diff --git a/report_supply_status.php b/report_supply_status.php index adcb23cb8..195283a4c 100644 --- a/report_supply_status.php +++ b/report_supply_status.php @@ -5,118 +5,91 @@ require_once( "db.inc.php" ); require_once( "facilities.inc.php" ); - + if(!$person->ReadAccess){ // No soup for you. header('Location: '.redirect()); exit; } - /* Version 1.0 of this report has no selectable parameters - you just get a complete dump */ - - $mpdf=new \Mpdf\Mpdf(['tempDir'=>sys_get_temp_dir(),'mode'=>'s']); - $mpdf->SetAuthor($config->ParameterArray["OrgName"]); - $mpdf->SetDisplayMode('fullpage'); - $mpdf->useActiveForms = true; - $mpdf->SetTitle($config->ParameterArray["OrgName"] . " " . __("Supply Status Report")); + /* Version 2.0 of this report uses PhpSpreadsheet instead of mPDF */ + + $xl = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); + + $xl->getProperties()->setCreator($config->ParameterArray["OrgName"]); + $xl->getProperties()->setLastModifiedBy("openDCIM"); + $xl->getProperties()->setTitle($config->ParameterArray["OrgName"] . " " . __("Supply Status Report")); + $xl->getProperties()->setSubject(__("Supply Status Report")); + + $xl->setActiveSheetIndex(0); + $currSheet = $xl->getActiveSheet(); + $currSheet->setTitle(__("Supply Status")); + + // Header row + $currSheet->setCellValue('A1', __("Part Number")); + $currSheet->setCellValue('B1', __("Part Name")); + $currSheet->setCellValue('C1', __("Min Qty")); + $currSheet->setCellValue('D1', __("Max Qty")); + $currSheet->setCellValue('E1', __("On Hand")); + $currSheet->setCellValue('F1', __("Location")); + $currSheet->setCellValue('G1', __("Location Count")); + + // Bold header row + $currSheet->getStyle('A1:G1')->getFont()->setBold(true); + $currSheet->getStyle('A1:G1')->getFill() + ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) + ->getStartColor()->setRGB('EEEEEE'); $sup = new Supplies(); $bin = new SupplyBin(); $bc = new BinContents(); - + $SupplyList = $sup->GetSuppliesList(); - - $html = ' - -
- - - - - - -| '.__("Part Number").' | -'.__("Part Name").' | -'.__("Min Qty").' | -'.__("Max Qty").' | -'.__("On Hand").' | -
| %s | %s | %d | %d | %d |
| %s: %s | %d | |||
| - | ||||