diff --git a/MRPPlannedPurchaseOrders.php b/MRPPlannedPurchaseOrders.php
index f9bde5e1d..a4243f1ec 100644
--- a/MRPPlannedPurchaseOrders.php
+++ b/MRPPlannedPurchaseOrders.php
@@ -1,5 +1,5 @@
' . _('Back to the menu') . '';
- if ($debug==1){
- echo '
' . $sql;
- }
- include('includes/footer.php');
- exit;
+ $Title = _('MRP Planned Purchase Orders') . ' - ' . _('Problem Report');
+ include('includes/header.php');
+ prnMsg( _('The MRP planned purchase orders could not be retrieved by the SQL because') . ' ' . DB_error_msg(),'error');
+ echo '
' . _('Back to the menu') . '';
+ if ($debug==1){
+ echo '
' . $sql;
+ }
+ include('includes/footer.php');
+ exit;
}
if (DB_num_rows($result)==0){ //then there is nothing to print
@@ -132,37 +132,37 @@
$line_height=12;
$Xpos = $Left_Margin+1;
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,
- $Page_Width,$Right_Margin,$_POST['Consolidation'],$ReportDate);
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,
+ $Page_Width,$Right_Margin,$_POST['Consolidation'],$ReportDate);
+
+ $Partctr = 0;
+ $fill = false;
+ $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted
+ $FontSize=8;
+ $HoldPart = ' ';
+ $HoldDescription = ' ';
+ $HoldMBFlag = ' ';
+ $HoldCost = ' ';
+ $HoldDecimalPlaces = 0;
+ $TotalPartQty = 0;
+ $TotalPartCost = 0;
+ $Total_ExtCost = 0;
- $Partctr = 0;
- $fill = false;
- $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted
- $FontSize=8;
- $holdpart = ' ';
- $holddescription = ' ';
- $holdmbflag = ' ';
- $holdcost = ' ';
- $holddecimalplaces = 0;
- $totalpartqty = 0;
- $totalpartcost = 0;
- $Total_Extcost = 0;
-
- while ($myrow = DB_fetch_array($result)){
+ while ($myrow = DB_fetch_array($result)){
$YPos -=$line_height;
// Print information on part break
- if ($Partctr > 0 AND $holdpart != $myrow['part']) {
- $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill);
+ if ($Partctr > 0 AND $HoldPart != $myrow['part']) {
+ $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill);
$pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill);
- $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
- $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty, $holddecimalplaces),'right',0,$fill);
- $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
+ $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
+ $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty, $HoldDecimalPlaces),'right',0,$fill);
+ $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
$pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill);
- $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill);
+ $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill);
// Get and print supplier info for part
- list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart);
+ list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($HoldPart);
$displaydate = $lastdate;
if (!Is_Date($lastdate)) {
@@ -176,8 +176,8 @@
$pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill);
$pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill);
$pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill);
- $totalpartcost = 0;
- $totalpartqty = 0;
+ $TotalPartCost = 0;
+ $TotalPartQty = 0;
$YPos -= (2*$line_height);
// Use to alternate between lines with transparent and painted background
@@ -189,12 +189,12 @@
// Parameters for addTextWrap are defined in /includes/class.pdf.php
$FormatedSupDueDate = ConvertSQLDate($myrow['duedate']);
$FormatedSupMRPDate = ConvertSQLDate($myrow['mrpdate']);
- $extcost = $myrow['supplyquantity'] * $myrow['computedcost'];
+ $ExtCost = $myrow['supplyquantity'] * $myrow['computedcost'];
$pdf->addTextWrap($Left_Margin,$YPos,110,$FontSize,$myrow['part'],'',0,$fill);
$pdf->addTextWrap(150,$YPos,50,$FontSize,$FormatedSupDueDate,'right',0,$fill);
$pdf->addTextWrap(200,$YPos,60,$FontSize,$FormatedSupMRPDate,'right',0,$fill);
$pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($myrow['supplyquantity'], $myrow['decimalplaces']),'right',0,$fill);
- $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($extcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
+ $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($ExtCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
if ($_POST['Consolidation'] == 'None'){
$pdf->addTextWrap(370,$YPos,80,$FontSize,$myrow['ordertype'],'right',0,$fill);
@@ -203,65 +203,65 @@
$pdf->addTextWrap(370,$YPos,100,$FontSize,$myrow['consolidatedcount'],'right',0,$fill);
}
- $holddescription = $myrow['description'];
- $holdpart = $myrow['part'];
- $holdmbflag = $myrow['mbflag'];
- $holdcost = $myrow['computedcost'];
- $holddecimalplaces = $myrow['decimalplaces'];
- $totalpartcost += $extcost;
- $totalpartqty += $myrow['supplyquantity'];
+ $HoldDescription = $myrow['description'];
+ $HoldPart = $myrow['part'];
+ $HoldMBFlag = $myrow['mbflag'];
+ $HoldCost = $myrow['computedcost'];
+ $HoldDecimalPlaces = $myrow['decimalplaces'];
+ $TotalPartCost += $ExtCost;
+ $TotalPartQty += $myrow['supplyquantity'];
- $Total_Extcost += $extcost;
+ $Total_ExtCost += $ExtCost;
$Partctr++;
if ($YPos < $Bottom_Margin + $line_height){
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
- $Right_Margin,$_POST['Consolidation'],$ReportDate);
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
+ $Right_Margin,$_POST['Consolidation'],$ReportDate);
}
- } /*end while loop */
-
- // Print summary information for last part
- $YPos -=$line_height;
- $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill);
- $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill);
- $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
- $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty,$holddecimalplaces),'right',0,$fill);
- $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
- $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill);
- $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill);
-
- // Get and print supplier info for part
- list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart);
- $displaydate = $lastdate;
-
- if (!Is_Date($lastdate)) {
- $displaydate = ' ';
- }
-
- $YPos -= $line_height;
- $pdf->addTextWrap(50,$YPos,80,$FontSize,_('Last Purchase Date: '),'left',0,$fill);
- $pdf->addTextWrap(130,$YPos,60,$FontSize,$displaydate,'left',0,$fill);
- $pdf->addTextWrap(190,$YPos,60,$FontSize,_('Supplier: '),'left',0,$fill);
- $pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill);
- $pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill);
- $pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill);
- $FontSize =8;
- $YPos -= (2*$line_height);
-
- if ($YPos < $Bottom_Margin + $line_height){
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
- $Right_Margin,$_POST['Consolidation'],$ReportDate);
- }
-
- /*Print out the grand totals */
- $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left');
- $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left');
- $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right');
- $DisplayTotalVal = locale_number_format($Total_Extcost,$_SESSION['CompanyRecord']['decimalplaces']);
- $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right');
-
- $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf');
- $pdf->__destruct();
+ } /*end while loop */
+
+ // Print summary information for last part
+ $YPos -=$line_height;
+ $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill);
+ $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill);
+ $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
+ $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty,$HoldDecimalPlaces),'right',0,$fill);
+ $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill);
+ $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill);
+ $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill);
+
+ // Get and print supplier info for part
+ list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($HoldPart);
+ $displaydate = $lastdate;
+
+ if (!Is_Date($lastdate)) {
+ $displaydate = ' ';
+ }
+
+ $YPos -= $line_height;
+ $pdf->addTextWrap(50,$YPos,80,$FontSize,_('Last Purchase Date: '),'left',0,$fill);
+ $pdf->addTextWrap(130,$YPos,60,$FontSize,$displaydate,'left',0,$fill);
+ $pdf->addTextWrap(190,$YPos,60,$FontSize,_('Supplier: '),'left',0,$fill);
+ $pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill);
+ $pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill);
+ $pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill);
+ $FontSize =8;
+ $YPos -= (2*$line_height);
+
+ if ($YPos < $Bottom_Margin + $line_height){
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
+ $Right_Margin,$_POST['Consolidation'],$ReportDate);
+ }
+
+ /*Print out the grand totals */
+ $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left');
+ $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left');
+ $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right');
+ $DisplayTotalVal = locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']);
+ $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right');
+
+ $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf');
+ $pdf->__destruct();
} else { // Review planned purchase orders
@@ -349,36 +349,36 @@
' . _('Consolidation') . ': | +' . _('Consolidation') . ': | - |
' . _('Print Option') . ': | +||
' . _('Print Option') . ': | - | |
' . _('Cut Off Date') . ': | +||
' . _('Cut Off Date') . ': | - |