From: <tim...@us...> - 2009-12-14 20:07:30
|
Revision: 3227 http://web-erp.svn.sourceforge.net/web-erp/?rev=3227&view=rev Author: tim_schofield Date: 2009-12-14 20:07:21 +0000 (Mon, 14 Dec 2009) Log Message: ----------- Merge utf-8 branch into the main line Modified Paths: -------------- trunk/AgedDebtors.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/EmailConfirmation.php trunk/GLTrialBalance.php trunk/InventoryPlanning.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReschedules.php trunk/OutstandingGRNs.php trunk/PDFBankingSummary.php trunk/PDFCustomerList.php trunk/PDFGrn.php trunk/PDFLowGP.php trunk/PDFPriceList.php trunk/PDFQuotation.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PrintCustOrder.php trunk/PrintCustTransPortrait.php trunk/ReorderLevel.php trunk/SalesAnalysis_UserDefined.php trunk/StockCheck.php trunk/SuppInvGRNs.php trunk/SuppPaymentRun.php trunk/Tax.php trunk/config.distrib.php Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo + /branches/utf-8_xfer:3160-3162 Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/AgedDebtors.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,26 +1,25 @@ <?php + /* $Id: AgedDebtors.php 3152 2009-12-11 14:28:49Z tim_schofield $ */ + +/* $Revision: 1.20 $ */ + $PageSecurity = 2; include('includes/session.inc'); -/* $Revision: 1.19 $ */ +if (isset($_POST['PrintPDF']) + and isset($_POST['FromCriteria']) + and strlen($_POST['FromCriteria'])>=1 + and isset($_POST['ToCriteria']) + and strlen($_POST['ToCriteria'])>=1) { -If (isset($_POST['PrintPDF']) - AND isset($_POST['FromCriteria']) - AND strlen($_POST['FromCriteria'])>=1 - AND isset($_POST['ToCriteria']) - AND strlen($_POST['ToCriteria'])>=1){ - - include('includes/PDFStarter.php'); + $pdf->addInfo('Title',_('Aged Customer Balance Listing')); + $pdf->addInfo('Subject',_('Aged Customer Balances')); + $FontSize = 12; + $PageNumber = 0; + $line_height = 12; - $FontSize=12; - $pdf->addinfo('Title',_('Aged Customer Balance Listing')); - $pdf->addinfo('Subject',_('Aged Customer Balances')); - - $PageNumber=0; - $line_height=12; - /*Now figure out the aged analysis for the customer range under review */ if (trim($_POST['Salesman'])!=''){ $SalesLimit = " and debtorsmaster.debtorno in (SELECT DISTINCT debtorno FROM custbranch where salesman = '".$_POST['Salesman']."') "; @@ -262,6 +261,8 @@ } $CustomerResult = DB_query($SQL,$db,'','',False,False); /*dont trap errors handled below*/ + //$ListCount = count ($CustomerResult); // Javier + if (DB_error_no($db) !=0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '.... '; include('includes/header.inc'); @@ -282,8 +283,10 @@ $TotOD1=0; $TotOD2=0; - While ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ + $ListCount = DB_num_rows($CustomerResult); //UldisN + while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ + $DisplayDue = number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); $DisplayCurrent = number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); $DisplayBalance = number_format($AgedAnalysis['balance'],2); @@ -423,10 +426,13 @@ $LeftOvers = $pdf->addTextWrap(400,$YPos,60,$FontSize,$DisplayTotOverdue1,'right'); $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayTotOverdue2,'right'); +/* Javier: This actually would produce the output $buf = $pdf->output(); - $len = strlen($buf); + $len = strlen($buf); +*/ - if ($len < 1000) { +// if ($len < 1000) { + if ($ListCount == 0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg(_('There are no customers meeting the criteria specified to list'),'info'); @@ -438,14 +444,20 @@ exit; } +/* Javier: TCPDF sends its own http header, would be an error to send it twice. header('Content-type: application/pdf'); header("Content-Length: $len"); header('Content-Disposition: inline; filename=AgedDebtors.pdf'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); + $pdf->stream(); */ - $pdf->stream(); +// This else was missed + else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . 'AgedDebtors_' . date('Y-m-d') . '.pdf'); + $pdf-> __destruct(); + } } else { /*The option to print PDF was not hit */ @@ -509,4 +521,4 @@ } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/BOMExtendedQty.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,9 @@ <?php -/* $Revision: 1.7 $ */ + +/* $Id$ */ + +/* $Revision: 1.8 $ */ + // BOMExtendedQty.php - Quantiy Extended Bill of Materials $PageSecurity = 2; include('includes/session.inc'); @@ -7,13 +11,12 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - + $pdf->addInfo('Title',_('Quantity Extended BOM Listing')); + $pdf->addInfo('Subject',_('Quantity Extended BOM Listing')); $FontSize=9; - $pdf->addinfo('Title',_('Quantity Extended BOM Listing')); - $pdf->addinfo('Subject',_('Quantity Extended BOM Listing')); - $PageNumber=1; $line_height=12; + if (!$_POST['Quantity'] || !is_numeric($_POST['Quantity'])) { $_POST['Quantity'] = 1; } @@ -203,6 +206,7 @@ stockmaster.decimalplaces, stockmaster.mbflag'; $result = DB_query($sql,$db); + $ListCount = DB_num_rows($result); // UldisN While ($myrow = DB_fetch_array($result,$db)){ @@ -247,11 +251,12 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin); } - +/* Uldisn:This actually would produce the output $pdfcode = $pdf->output(); $len = strlen($pdfcode); - - if ($len<=20){ +*/ +// if ($len<=20){ + if ($ListCount == 0) { //UldisN $title = _('Print Indented BOM Listing Error'); include('includes/header.inc'); prnMsg(_('There were no items for the selected assembly'),'error'); @@ -259,16 +264,20 @@ include('includes/footer.inc'); exit; } else { +/* UldisN header('Content-type: application/pdf'); header("Content-Length: " . $len); header('Content-Disposition: inline; filename=Customer_trans.pdf'); header('Expires: 0'); header('Cache-Control: private, post-check=0, pre-check=0'); header('Pragma: public'); - + $pdf->Output('BOMExtendedQty', 'I'); - } - +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf-> __destruct(); + } + } else { /*The option to print PDF was not hit so display form */ $title=_('Quantity Extended BOM Listing'); Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/BOMIndented.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,9 @@ <?php -/* $Revision: 1.4 $ */ + +/* $Id: */ + +/* $Revision: 1.5 $ */ + // BOMIndented.php - Indented Bill of Materials $PageSecurity = 2; include('includes/session.inc'); @@ -7,11 +11,9 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - - $FontSize=9; - $pdf->addinfo('Title',_('Indented BOM Listing')); - $pdf->addinfo('Subject',_('Indented BOM Listing')); - + $pdf->addInfo('Title',_('Indented BOM Listing')); + $pdf->addInfo('Subject',_('Indented BOM Listing')); + $FontSize=9; $PageNumber=1; $line_height=12; @@ -22,13 +24,13 @@ $sql = 'DROP TABLE IF EXISTS passbom2'; $result = DB_query($sql,$db); $sql = 'CREATE TEMPORARY TABLE passbom ( - part char(20), + part char(20), sortpart text)'; $ErrMsg = _('The SQL to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); $sql = 'CREATE TEMPORARY TABLE tempbom ( - parent char(20), + parent char(20), component char(20), sortpart text, level int, @@ -176,11 +178,13 @@ WHERE tempbom.component = stockmaster.stockid ORDER BY sortpart'; $result = DB_query($sql,$db); - + // $fill is used to alternate between lines with transparent and painted background $fill = false; $pdf->SetFillColor(224,235,255); - + + $ListCount = DB_num_rows($result); // UldisN + While ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; @@ -221,11 +225,13 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$assemblydesc); } - + /* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); if ($len<=20){ + */ + if ($ListCount == 0) { $title = _('Print Indented BOM Listing Error'); include('includes/header.inc'); prnMsg(_('There were no items for the selected assembly'),'error'); @@ -233,16 +239,21 @@ include('includes/footer.inc'); exit; } else { + /* UldisN header('Content-type: application/pdf'); header("Content-Length: " . $len); header('Content-Disposition: inline; filename=Customer_trans.pdf'); header('Expires: 0'); header('Cache-Control: private, post-check=0, pre-check=0'); header('Pragma: public'); - + $pdf->Output('BOMIndented.pdf', 'I'); + */ + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf-> __destruct(); + } - + } else { /*The option to print PDF was not hit so display form */ $title=_('Indented BOM Listing'); @@ -320,4 +331,4 @@ } // End of PrintHeader function -?> \ No newline at end of file +?> Modified: trunk/EmailConfirmation.php =================================================================== --- trunk/EmailConfirmation.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/EmailConfirmation.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -19,9 +19,8 @@ } $MailTo = $_GET['EMail']; -$headers = 'From: Bethany Manufacturing <sa...@be...>' . "\n"; -$headers .= "MIME-Version: 1.0\n" - ."Content-Type: text/html; charset=\"iso-8859-1\"\n"; +$headers = 'From: Bethany Manufacturing <sa...@be...>' . '\n'; +$headers .= 'MIME-Version: 1.0\n' . 'Content-Type: text/html; charset="' . _('ISO-8859-1') . '"\n'; /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); @@ -294,4 +293,4 @@ ?> </table> </body> -</html> \ No newline at end of file +</html> Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/GLTrialBalance.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,6 +1,7 @@ <?php /* $Revision: 1.21 $ */ +/* $Id$ */ /*Through deviousness and cunning, this system allows trial balances for any date range that recalcuates the p & l balances and shows the balance sheets as at the end of the period selected - so first off need to show the input of criteria screen @@ -94,10 +95,11 @@ } else if (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); + + $pdf->addInfo('Title', _('Trial Balance') ); + $pdf->addInfo('Subject', _('Trial Balance') ); $PageNumber = 0; $FontSize = 10; - $pdf->addinfo('Title', _('Trial Balance') ); - $pdf->addinfo('Subject', _('Trial Balance') ); $line_height = 12; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -145,6 +147,15 @@ include('includes/footer.inc'); exit; } + if (DB_num_rows($AccountsResult)==0){ + $title = _('Print Trial Balance Error'); + include('includes/header.inc'); + echo '<p>'; + prnMsg( _('There were no entries to print out for the selections specified') ); + echo '<br><a href="'. $rootpath.'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + include('includes/footer.inc'); + exit; + } include('includes/PDFTrialBalancePageHeader.inc'); @@ -174,7 +185,7 @@ }elseif ($myrow['parentgroupname']==$ParentGroups[$Level]){ $YPos -= (.5 * $line_height); $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,70,$FontSize,number_format($GrpActual[$Level],2),'right'); @@ -183,7 +194,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($GrpPrdBudget[$Level],2),'right'); $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); /*Draw the bottom line */ $YPos -= (2 * $line_height); - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $ParentGroups[$Level]=$myrow['groupname']; $GrpActual[$Level] =0; $GrpBudget[$Level] =0; @@ -191,10 +202,10 @@ $GrpPrdBduget[$Level] =0; } else { - do{ + do { $YPos -= $line_height; $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,70,$FontSize,number_format($GrpActual[$Level],2),'right'); @@ -203,19 +214,19 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($GrpPrdBudget[$Level],2),'right'); $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); /*Draw the bottom line */ $YPos -= (2 * $line_height); - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $ParentGroups[$Level]=''; $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; $GrpPrdBduget[$Level] =0; $Level--; - }while ($myrow['parentgroupname']!=$ParentGroups[$Level] AND $Level>0); + } while ($myrow['parentgroupname']!=$ParentGroups[$Level] AND $Level>0); if ($Level>0){ $YPos -= $line_height; $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60, $YPos, 190, $FontSize, $ParentGroups[$Level]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,70,$FontSize,number_format($GrpActual[$Level],2),'right'); @@ -224,7 +235,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($GrpPrdBudget[$Level],2),'right'); $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); /*Draw the bottom line */ $YPos -= (2 * $line_height); - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; @@ -236,13 +247,13 @@ } $YPos -= (2 * $line_height); // Print account group name - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $ActGrp = $myrow['groupname']; $ParentGroups[$Level]=$myrow['groupname']; $FontSize = 10; $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,$myrow['groupname']); $FontSize = 8; - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $YPos -= (2 * $line_height); } @@ -299,7 +310,7 @@ $YPos -= (.5 * $line_height); $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,70,$FontSize,number_format($GrpActual[$Level],2),'right'); @@ -325,29 +336,17 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+370,$YPos,70,$FontSize,number_format($CheckPeriodActual,2),'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($CheckPeriodBudget,2),'right'); $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); - - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ - $title = _('Print Trial Balance Error'); - include('includes/header.inc'); - echo '<p>'; - prnMsg( _('There were no entries to print out for the selections specified') ); - echo '<br><a href="'. $rootpath.'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; - include('includes/footer.inc'); - exit; - } else { + + /* header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=CustomerList.pdf'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); - - $pdf->Output('GLTrialBalance.pdf','I'); - - } +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Trial_Balance_' . Date('Y-m-d') . '.pdf'); + $pdf->__destruct(); exit; } else { @@ -679,4 +678,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/InventoryPlanning.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,19 +1,18 @@ <?php -/* $Revision: 1.19 $ */ +/* $Id: InventoryPlanning.php 3152 2009-12-11 14:28:49Z tim_schofield $ */ $PageSecurity = 2; include('includes/session.inc'); +if (isset($_POST['PrintPDF']) + and isset($_POST['FromCriteria']) + and strlen($_POST['FromCriteria'])>=1 + and isset($_POST['ToCriteria']) + and strlen($_POST['ToCriteria'])>=1) { -If (isset($_POST['PrintPDF']) - AND isset($_POST['FromCriteria']) - AND strlen($_POST['FromCriteria'])>=1 - AND isset($_POST['ToCriteria']) - AND strlen($_POST['ToCriteria'])>=1){ + include ('includes/class.pdf.php'); - include ('includes/class.pdf.php'); - /* A4_Landscape */ $Page_Width=842; @@ -23,26 +22,33 @@ $Left_Margin=25; $Right_Margin=22; - $PageSize = array(0,0,$Page_Width,$Page_Height); - $pdf = & new Cpdf($PageSize); +// Javier: now I use the native constructor +// $PageSize = array(0,0,$Page_Width,$Page_Height); - $PageNumber = 0; - - $pdf->selectFont('./fonts/Helvetica.afm'); - /* Standard PDF file creation header stuff */ - $pdf->addinfo('Author','webERP ' . $Version); - $pdf->addinfo('Creator','webERP http://www.weberp.org'); - $pdf->addinfo('Title',_('Inventory Planning Report') . ' ' . Date($_SESSION['DefaultDateFormat'])); +// Javier: better to not use references +// $pdf = & new Cpdf($PageSize); + $pdf = new Cpdf('L', 'pt', 'A4'); + $pdf->addInfo('Creator','webERP http://www.weberp.org'); + $pdf->addInfo('Author','webERP ' . $Version); + $pdf->addInfo('Title',_('Inventory Planning Report') . ' ' . Date($_SESSION['DefaultDateFormat'])); + $pdf->addInfo('Subject',_('Inventory Planning')); - $line_height=12; +/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user, + I corrected it to match TCPDF, but it still needs some check, after which, + I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */ + $pdf->setAutoPageBreak(0); // Javier: needs check. + $pdf->setPrintHeader(false); // Javier: I added this must be called before Add Page + $pdf->AddPage(); +// $this->SetLineWidth(1); Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok. + $pdf->cMargin = 0; // Javier: needs check. +/* END Brought from class.pdf.php constructor */ - $pdf->addinfo('Subject',_('Inventory Planning')); +// Javier: + $PageNumber = 1; + $line_height = 12; - $PageNumber=1; - $line_height=12; - /*Now figure out the inventory data to report for the category range under review need QOH, QOO, QDem, Sales Mth -1, Sales Mth -2, Sales Mth -3, Sales Mth -4*/ if ($_POST['Location']=='All'){ @@ -85,7 +91,7 @@ stockmaster.stockid"; } - $InventoryResult = DB_query($SQL,$db,'','',false,false); + $InventoryResult = DB_query($SQL, $db, '', '', false, false); if (DB_error_no($db) !=0) { $title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....'; @@ -116,7 +122,7 @@ $Period_4 = $CurrentPeriod -4; $Period_5 = $CurrentPeriod -5; - While ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){ + while ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){ if ($Category!=$InventoryPlan['categoryid']){ $FontSize=10; @@ -160,7 +166,7 @@ AND stockmoves.hidemovt=0"; } - $SalesResult=DB_query($SQL,$db,'','',FALSE,FALSE); + $SalesResult = DB_query($SQL,$db,'','', false, false); if (DB_error_no($db) !=0) { $title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....'; @@ -194,7 +200,8 @@ AND salesorderdetails.completed = 0"; } - $DemandResult = DB_query($SQL,$db,'','',FALSE,FALSE); + $DemandResult = DB_query($SQL, $db, '', '', false , false); + $ListCount = DB_num_rows($DemandResult); if (DB_error_no($db) !=0) { $title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....'; @@ -208,7 +215,7 @@ exit; } -//Also need to add in the demand as a component of an assembly items if this items has any assembly parents. +// Also need to add in the demand as a component of an assembly items if this items has any assembly parents. if ($_POST['Location']=='All'){ $SQL = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem @@ -336,26 +343,16 @@ $pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height); - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ + if ($ListCount == 0){ $title = _('Print Inventory Planning Report Empty'); include('includes/header.inc'); - prnMsg( _('There were no items in the range and location specified'),'error'); + prnMsg( _('There were no items in the range and location specified'), 'error'); echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } else { - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=InventoryPlanning.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Output('InventoryPlanning', 'I'); - + $pdf->OutputD($_SESSION['DatabaseName'] . '_Inventory_Planning_' . Date('Y-m-d') . '.pdf'); + $pdf-> __destruct(); } } else { /*The option to print PDF was not hit */ Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/MRPPlannedPurchaseOrders.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,6 @@ <?php /* $Revision: 1.5 $ */ +/* $Id$ */ // MRPPlannedPurchaseOrders.php - Report of purchase parts that MRP has determined should have // purchase orders created for them $PageSecurity = 2; @@ -7,13 +8,12 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - + $pdf->addInfo('Title',_('MRP Planned Purchase Orders Report')); + $pdf->addInfo('Subject',_('MRP Planned Purchase Orders')); $FontSize=9; - $pdf->addinfo('Title',_('MRP Planned Purchase Orders Report')); - $pdf->addinfo('Subject',_('MRP Planned Purchase Orders')); - $PageNumber=1; $line_height=12; + $Xpos = $Left_Margin+1; $wheredate = " "; $reportdate = " "; @@ -107,8 +107,15 @@ include('includes/footer.inc'); exit; } - - //include ('includes/MRPPlannedPurchaseOrdersPageHeader.inc'); + if (DB_num_rows($result)==0){ //then there is nothing to print + $title = _('Print MRP Planned Purchase Orders Error'); + include('includes/header.inc'); + prnMsg(_('There were no items with planned purchase orders'),'info'); + echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); + exit; + } + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$_POST['Consolidation'],$reportdate); @@ -194,7 +201,6 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$_POST['Consolidation'],$reportdate); - // include('includes/MRPPlannedPurchaseOrdersPageHeader.inc'); } } /*end while loop */ @@ -235,27 +241,9 @@ $DisplayTotalVal = number_format($Total_Extcost,2); $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ - $title = _('Print MRP Planned Purchase Orders Error'); - include('includes/header.inc'); - prnMsg(_('There were no items with planned purchase orders'),'error'); - echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); - exit; - } else { - header('Content-type: application/pdf'); - header("Content-Length: " . $len); - header('Content-Disposition: inline; filename=MRPPlannedOrders.pdf'); - header('Expires: 0'); - header('Cache-Control: private, post-check=0, pre-check=0'); - header('Pragma: public'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf'); + $pdf->__destruct(); - $pdf->Output('MRPPlannedPurchaseOrders.pdf', 'I'); - } - } else { /*The option to print PDF was not hit so display form */ $title=_('MRP Planned Purchase Orders Reporting'); Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/MRPPlannedWorkOrders.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,6 @@ <?php /* $Revision: 1.6 $ */ +/* $Id$ */ // MRPPlannedWorkOrders.php - Report of manufactured parts that MRP has determined should have // work orders created for them $PageSecurity = 2; @@ -8,10 +9,10 @@ include('includes/PDFStarter.php'); + $pdf->addInfo('Title',_('MRP Planned Work Orders Report')); + $pdf->addInfo('Subject',_('MRP Planned Work Orders')); + $FontSize=9; - $pdf->addinfo('Title',_('MRP Planned Work Orders Report')); - $pdf->addinfo('Subject',_('MRP Planned Work Orders')); - $PageNumber=1; $line_height=12; $Xpos = $Left_Margin+1; @@ -109,8 +110,15 @@ include('includes/footer.inc'); exit; } + if (DB_num_rows($result)==0){ //then there's nothing to print + $title = _('Print MRP Planned Work Orders'); + include('includes/header.inc'); + prnMsg(_('There were no items with demand greater than supply'),'info'); + echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); + exit; + } - //include ('includes/MRPPlannedWorkOrdersPageHeader.inc'); PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$_POST['Consolidation'],$reportdate); @@ -211,27 +219,9 @@ $DisplayTotalVal = number_format($Total_Extcost,2); $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ - $title = _('Print MRP Planned Work Orders'); - include('includes/header.inc'); - prnMsg(_('There were no items with demand greater than supply'),'error'); - echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); - exit; - } else { - header('Content-type: application/pdf'); - header("Content-Length: " . $len); - header('Content-Disposition: inline; filename=MRPPlannedWorkOrders.pdf'); - header('Expires: 0'); - header('Cache-Control: private, post-check=0, pre-check=0'); - header('Pragma: public'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Work_Orders_' . Date('Y-m-d') . '.pdf'); + $pdf->__destruct(); - $pdf->Output('MRPPlannedWorkOrders.pdf', 'I'); - } - } else { /*The option to print PDF was not hit so display form */ $title=_('MRP Planned Work Orders Reporting'); Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/MRPReschedules.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,8 @@ <?php -/* $Revision: 1.3 $ */ + +/*$Id$*/ + +/* $Revision: 1.4 $ */ // MRPReschedules.php - Report of purchase orders and work orders that MRP determines should be // rescheduled. $PageSecurity = 2; @@ -8,11 +11,9 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - + $pdf->addInfo('Title',_('MRP Reschedule Report')); + $pdf->addInfo('Subject',_('MRP Reschedules')); $FontSize=9; - $pdf->addinfo('Title',_('MRP Reschedule Report')); - $pdf->addinfo('Subject',_('MRP Reschedules')); - $PageNumber=1; $line_height=12; @@ -42,6 +43,18 @@ exit; } + if (DB_num_rows($result) == 0) { + $title = _('MRP Reschedules') . ' - ' . _('Problem Report'); + include('includes/header.inc'); + prnMsg( _('No MRP reschedule retrieved'), 'warn'); + echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$sql"; + } + include('includes/footer.inc'); + exit; + } + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin); $Tot_Val=0; @@ -94,7 +107,7 @@ //$pdf->addTextWrap(80,$YPos,260-$Left_Margin,$FontSize,_('Grand Total Value'), 'right'); //$DisplayTotalVal = number_format($Tot_Val,2); //$pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); - +/* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); @@ -115,6 +128,9 @@ $pdf->Output('MRPRescedules.pdf', 'I'); } +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPReschedules_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit so display form */ @@ -178,4 +194,4 @@ $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader function -?> \ No newline at end of file +?> Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/OutstandingGRNs.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,5 +1,9 @@ <?php + +/*$Id$*/ + /* $Revision: 1.11 $ */ + $PageSecurity = 2; include('includes/session.inc'); @@ -10,12 +14,9 @@ AND strlen($_POST['ToCriteria'])>=1){ include('includes/PDFStarter.php'); - - - $FontSize=10; - $pdf->addinfo('Title',_('Outstanding GRNs Report')); - $pdf->addinfo('Subject',_('Outstanding GRNs Valuation')); - + $pdf->addInfo('Title',_('Outstanding GRNs Report')); + $pdf->addInfo('Subject',_('Outstanding GRNs Valuation')); + $FontSize=10; $PageNumber=1; $line_height=12; $Left_Margin=30; @@ -58,6 +59,18 @@ exit; } + if (DB_num_rows($GRNsResult) == 0) { + $title = _('Outstanding GRN Valuation') . ' - ' . _('Problem Report'); + include('includes/header.inc'); + prnMsg(_('No outstanding GRNs valuation details retrieved'), 'warn'); + echo "<br><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$SQL"; + } + include('includes/footer.inc'); + exit; + } + include ('includes/PDFOstdgGRNsPageHeader.inc'); $Tot_Val=0; @@ -129,7 +142,7 @@ $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); $pdf->line($Left_Margin, $YPos+$line_height-2,$Page_Width-$Right_Margin, $YPos+$line_height-2); $YPos -=(2*$line_height); - +/* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); @@ -149,7 +162,10 @@ header('Pragma: public'); $pdf->Output('OutstandingGRNs.pdf','I'); - } + } +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_OSGRNsValuation_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit */ $title=_('Outstanding GRNs Report'); @@ -168,4 +184,4 @@ } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFBankingSummary.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,7 +1,9 @@ <?php -/* $Revision: 1.11 $ */ +/*$Id$*/ +/* $Revision: 1.14 $ */ + $PageSecurity = 3; include ('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -58,10 +60,10 @@ $DbgMsg = _('The SQL used to get the receipt header information that failed was'); $Result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - if (DB_num_rows($Result)==0){ + if (DB_num_rows($Result) == 0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); include ('includes/header.inc'); - prnMsg(_('The receipt batch number') . ' ' . $_POST['BatchNo'] . ' ' . _('was not found in the database') . '. ' . _('Please try again selecting a different batch number'),'error'); + prnMsg(_('The receipt batch number') . ' ' . $_POST['BatchNo'] . ' ' . _('was not found in the database') . '. ' . _('Please try again selecting a different batch number'), 'warn'); include('includes/footer.inc'); exit; } @@ -118,17 +120,25 @@ exit; } +if (DB_num_rows($GLRecs) == 0){ + $title = _('Create PDF Print-out For A Batch Of Receipts'); + include ('includes/header.inc'); + prnMsg(_('No GL receipts retrieved for batch number') . ' ' . $_POST['BatchNo'], 'warn'); + if ($debug==1){ + prnMsg(_('The SQL used to get the GL receipt information that no any record retrieved') . ':<br>' . $SQL,'error'); + } + include('includes/footer.inc'); + exit; +} + include('includes/PDFStarter.php'); /*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ - -$pdf->addinfo('Title',_('Banking Summary')); -$pdf->addinfo('Subject',_('Banking Summary Number') . ' ' . $_POST['BatchNo']); - +$pdf->addInfo('Title',_('Banking Summary')); +$pdf->addInfo('Subject',_('Banking Summary Number') . ' ' . $_POST['BatchNo']); $line_height=12; $PageNumber = 0; - $TotalBanked = 0; include ('includes/PDFBankingSummaryPageHeader.inc'); @@ -166,7 +176,7 @@ $YPos-=$line_height; $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format($TotalBanked,2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,300,$FontSize,_('TOTAL') . ' ' . $Currency . ' ' . _('BANKED'), 'left'); - +/* UldisN $buf = $pdf->output(); $len = strlen($buf); header('Content-type: application/pdf'); @@ -177,6 +187,11 @@ header('Pragma: public'); $pdf->stream(); +*/ +$pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf');//UldisN +$pdf->__destruct(); //UldisN +} +/* } else { $title = _('Create PDF Print Out For A Batch Of Receipts'); include ('includes/header.inc'); @@ -185,5 +200,6 @@ echo '<br><div class="centre"><a href="'.$_SERVER['PHP_SELF'].'">'._('Return to Entry screen').'</a>'; include ('includes/footer.inc'); } +*/ -?> \ No newline at end of file +?> Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFCustomerList.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,12 +1,19 @@ <?php /* $Revision: 1.13 $ */ +/* $Id$ */ + $PageSecurity = 2; include('includes/session.inc'); if (isset($_POST['PrintPDF'])){ include('includes/PDFStarter.php'); + $pdf->addInfo('Title', _('Customer Listing') ); + $pdf->addInfo('Subject', _('Customer Listing') ); + $line_height=12; + $PageNumber = 0; + $FontSize=10; if ($_POST['Activity']!='All'){ if (!is_numeric($_POST['ActivityAmount'])){ @@ -19,14 +26,6 @@ } } - $PageNumber = 0; - - $FontSize=10; - $pdf->addinfo('Title', _('Customer Listing') ); - $pdf->addinfo('Subject', _('Customer Listing') ); - - $line_height=12; - /* Now figure out the customer data to report for the selections made */ if (in_array('All', $_POST['Areas'])){ @@ -241,6 +240,16 @@ exit; } + if (DB_num_rows($CustomersResult) == 0) { + $title = _('Customer List') . ' - ' . _('Problem Report') . '....'; + include('includes/header.inc'); + prnMsg( _('This report has no output because there were no customers retrieved'), 'error' ); + echo '<br><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + include('includes/footer.inc'); + exit; + } + + include('includes/PDFCustomerListPageHeader.inc'); $Area =''; @@ -288,10 +297,10 @@ if ($YPos < ($Bottom_Margin + 80)){ include('includes/PDFCustomerListPageHeader.inc'); } - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,_('Customers in') . ' ' . $Customers['areadescription']); $Area = $Customers['area']; - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $FontSize=8; $YPos -=$line_height; } @@ -302,9 +311,9 @@ if ($YPos < ($Bottom_Margin + 80)){ include('includes/PDFCustomerListPageHeader.inc'); } - $pdf->selectFont('./fonts/Helvetica-Bold.afm'); + $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,300-$Left_Margin,$FontSize,$Customers['salesmanname']); - $pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->setFont('',''); $SalesPerson = $Customers['salesman']; $FontSize=8; $YPos -=$line_height; @@ -312,7 +321,6 @@ $YPos -=$line_height; - $LeftOvers = $pdf->addTextWrap(20,$YPos,60,$FontSize,$Customers['debtorno']); $LeftOvers = $pdf->addTextWrap(80,$YPos,150,$FontSize,$Customers['name']); $LeftOvers = $pdf->addTextWrap(80,$YPos-10,150,$FontSize,$Customers['address1']); @@ -351,29 +359,8 @@ } /*end if $PrintThisCustomer == true */ } /*end while loop */ - - $pdfcode = $pdf->output('PDFCustomerList.pdf', 'I'); - $len = strlen($pdfcode); - - if ($len<=20){ - $title = _('Print Customer List Error'); - include('includes/header.inc'); - echo '<p>'; - prnMsg( _('There were no customers to print out for the selections specified') ); - echo '<br><a href="'. $rootpath.' /index.php?' . SID . '">'. _('Back to the menu'). '</a>'; - include('includes/footer.inc'); - exit; - } else { - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=CustomerList.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Output('PDFCustomerList.pdf', 'I'); - - } + $pdf->OutputD($_SESSION['DatabaseName'] . '_CustomerList_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN exit; } else { @@ -424,4 +411,4 @@ include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFGrn.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,4 +1,7 @@ <?php + +/*$Id$*/ + /* $Revision: 1.5 $ */ $PageSecurity = 2; @@ -6,10 +9,8 @@ include('includes/PDFStarter.php'); - +$pdf->addInfo('Title', _('Goods Received Note') ); $FontSize=10; -$pdf->addinfo('Title', _('Goods Received Note') ); - $PageNumber=1; $line_height=12; @@ -22,6 +23,9 @@ $sql='SELECT itemcode, grnno, deliverydate, itemdescription, qtyrecd, supplierid from grns where grnbatch='. $_GET['GRNNo']; $result=DB_query($sql, $db); + +$ListCount = DB_num_rows($result); // UldisN + $counter=1; while ($myrow=DB_fetch_array($result)) { $StockID=$myrow[0]; @@ -48,10 +52,11 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos-(10*$counter+130),300-$Left_Margin,$FontSize, _('Signed for ').'______________________'); -$pdfcode = $pdf->output(); -$len = strlen($pdfcode); +//$pdfcode = $pdf->output(); +//$len = strlen($pdfcode); -if ($len<=20){ +//if ($len<=20){ +if ($ListCount == 0) { //UldisN $title = _('Print Price List Error'); include('includes/header.inc'); prnMsg(_('There were no stock transfer details to print'),'warn'); @@ -59,6 +64,7 @@ include('includes/footer.inc'); exit; } else { +/* UldisN header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=GRN.pdf'); @@ -67,6 +73,9 @@ header('Pragma: public'); $pdf->Output('GRN.pdf', 'I'); +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFLowGP.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,7 +1,9 @@ <?php -/* $Revision: 1.14 $ */ +/*$Id$*/ +/* $Revision: 1.15 $ */ + $PageSecurity = 2; include('includes/session.inc'); @@ -12,8 +14,12 @@ if (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); + $pdf->addInfo('Title', _('Low Gross Profit Sales')); + $pdf->addInfo('Subject', _('Low Gross Profit Sales')); + $FontSize=10; + $PageNumber=1; + $line_height=12; - $title = _('Low GP sales') . ' - ' . _('Problem Report'); if (! Is_Date($_POST['FromDate']) OR ! Is_Date($_POST['ToDate'])){ @@ -23,12 +29,7 @@ exit; } - $FontSize=10; - $pdf->addinfo('Title',_('Low Gross Profit Sales')); - $pdf->addinfo('Subject',_('Low Gross Profit Sales')); - $PageNumber=1; - $line_height=12; /*Now figure out the data to report for the category range under review */ $SQL = "SELECT stockmaster.categoryid, @@ -66,6 +67,18 @@ exit; } + if (DB_num_rows($LowGPSalesResult) == 0) { + + include('includes/header.inc'); + prnMsg(_('No low GP items retrieved'), 'warn'); + echo "<br><a href='" . $rootpath . "/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$SQL"; + } + include('includes/footer.inc'); + exit; + } + include ('includes/PDFLowGPPageHeader.inc'); $Tot_Val=0; $Category = ''; @@ -99,7 +112,7 @@ $FontSize =10; $YPos -= (2*$line_height); - +/* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); @@ -119,8 +132,11 @@ header('Pragma: public'); $pdf->Output('PDFLowGP.pdf', 'I'); + } +*/ + $pdf->OutputD($_SESSION['DatabaseName'] . '_LowGPSales_' . date('Y-m-d') . '.pdf');//UldisN + $pdf->__destruct(); //UldisN - } } else { /*The option to print PDF was not hit */ include('includes/header.inc'); @@ -151,4 +167,4 @@ } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFPriceList.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -1,21 +1,21 @@ <?php -/* $Revision: 1.14 $ */ +/* $Id$ */ +/* $Revision: 1.15 $ */ + $PageSecurity = 2; include('includes/session.inc'); -If (isset($_POST['PrintPDF']) - AND isset($_POST['FromCriteria']) - AND strlen($_POST['FromCriteria'])>=1 - AND isset($_POST['ToCriteria']) - AND strlen($_POST['ToCriteria'])>=1){ +if (isset($_POST['PrintPDF']) + and isset($_POST['FromCriteria']) + and strlen($_POST['FromCriteria'])>=1 + and isset($_POST['ToCriteria']) + and strlen($_POST['ToCriteria'])>=1){ include('includes/PDFStarter.php'); - + $pdf->addInfo('Title', _('Price Listing Report') ); + $pdf->addInfo('Subject', _('Price List') ); $FontSize=10; - $pdf->addinfo('Title', _('Price Listing Report') ); - $pdf->addinfo('Subject', _('Price List') ); - $PageNumber=1; $line_height=12; @@ -97,6 +97,8 @@ } $PricesResult = DB_query($SQL,$db,'','',false,false); + $ListSize = count ($PricesResult); //Javier + if (DB_error_no($db) !=0) { $title = _('Price List') . ' - ' . _('Problem Report....'); include('includes/header.inc'); @@ -113,7 +115,7 @@ $CurrCode =''; $Category = ''; $CatTot_Val=0; - While ($PriceList = DB_fetch_array($PricesResult,$db)){ + while ($PriceList = DB_fetch_array($PricesResult,$db)){ if ($CurrCode != $PriceList['currabrev']){ $FontSize=10; @@ -124,7 +126,7 @@ $YPos -= $line_height; } - if ($Category!=$PriceList['categoryid']){ + if ($Category!= $PriceList['categoryid']){ $FontSize=10; $YPos -=(2*$line_height); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,300-$Left_Margin,$FontSize,$PriceList['categoryid'] . ' - ' . $PriceList['categorydescription']); @@ -137,7 +139,8 @@ $YPos -=$line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,$PriceList['stockid']); $LeftOvers = $pdf->addTextWrap(120,$YPos,260,$FontSize,$PriceList['description']); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,$PriceList['stockid']); + $LeftOvers = $pdf->addTextWrap(120,$YPos,260,$FontSize,$PriceList['description']); if ($_POST['CustomerSpecials']=='Customer Special Prices Only'){ /*Need to show to which branch the price relates */ @@ -170,28 +173,37 @@ } /*end inventory valn while loop */ - $FontSize =10; /*Print out the category totals */ - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ +// Javier: this was actually the Price List that was PDF-Created but it seems it was intended to be only the check that I named ListSize. +/* $FontSize =10; + $FileName= $_SESSION['DatabaseName'] . '_' .'PriceList_' . date('Y-m-d').'.pdf'; +// $pdfcode = $pdf->output(); + $pdfcode = $pdf->OutputD($Filename); + $len = strlen($pdfcode); */ +// if ($len<=20){ + if ($ListSize == 0) { $title = _('Print Price List Error'); include('includes/header.inc'); prnMsg(_('There were no price details to print out for the customer or category specified'),'warn'); echo '<br><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>'; include('includes/footer.inc'); exit; - } else { - header('Content-type: application/pdf'); + } else { + +// Javier: TCPDF sends its own http header, it's an error to send it twice. + /* header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=PriceList.pdf'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - $FileName=$_SESSION['DatabaseName'].'_'.date('Y-m-d').'.pdf'; - $pdf->Output($FileName,'I'); + header('Pragma: public'); */ +// $FontSize =10; + $FileName= $_SESSION['DatabaseName'] . '_' .'PriceList_' . date('Y-m-d').'.pdf'; +// $pdf->Output($FileName,'I'); +// Javier: This is a recursive script, so it needs to be downloaded. + $pdf->OutputD($FileName); + $pdf-> __destruct(); } } else { /*The option to print PDF was not hit */ @@ -208,7 +220,7 @@ $sql='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid'; $CatResult= DB_query($sql,$db); - While ($myrow = DB_fetch_array($CatResult)){ + while ($myrow = DB_fetch_array($CatResult)){ echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; } echo '</select></td></tr>'; @@ -218,7 +230,7 @@ /*Set the index for the categories result set back to 0 */ DB_data_seek($CatResult,0); - While ($myrow = DB_fetch_array($CatResult)){ + while ($myrow = DB_fetch_array($CatResult)){ echo '<option VALUE="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; } echo '</select></td></tr>'; @@ -242,9 +254,10 @@ echo '<option selected Value="Sales Type Prices">'. _('Default Sales Type Prices'); echo '</select></td></tr>'; - echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>'; + /*echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>';*/ + echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div></form>'; } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PDFQuotation.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -81,18 +81,15 @@ LETS GO */ $PaperSize = 'A4_Landscape'; include('includes/PDFStarter.php'); - +$pdf->addInfo('Title', _('Customer Quotation') ); +$pdf->addInfo('Subject', _('Quotation') . ' ' . $_GET['QuotationNo']); $FontSize=12; +$PageNumber = 1; +$line_height=24; $pdf->selectFont('./fonts/Helvetica.afm'); -$pdf->addinfo('Title', _('Customer Quotation') ); -$pdf->addinfo('Subject', _('Quotation') . ' ' . $_GET['QuotationNo']); -$line_height=24; - /* Now ... Has the order got any line items still outstanding to be invoiced */ -$PageNumber = 1; - $ErrMsg = _('There was a problem retrieving the quotation line details for quotation Number') . ' ' . $_GET['QuotationNo'] . ' ' . _('from the database'); @@ -110,14 +107,18 @@ $result=DB_query($sql,$db, $ErrMsg); +$ListCount = 0; // UldisN + if (DB_num_rows($result)>0){ /*Yes there are line items to start the ball rolling with a page header */ include('includes/PDFQuotationPageHeader.inc'); - + $QuotationTotal =0; - + while ($myrow2=DB_fetch_array($result)){ + $ListCount ++; + if ((strlen($myrow2['narrative']) >200 AND $YPos-$line_height <= 75) OR (strlen($myrow2['narrative']) >1 AND $YPos-$line_height <= 62) OR $YPos-$line_height <= 50){ @@ -223,9 +224,9 @@ } /*end if there are line details to show on the quotation*/ -$pdfcode = $pdf->output('PDFQuotation.pdf', 'I'); -$len = strlen($pdfcode); -if ($len<=20){ +//$pdfcode = $pdf->output('PDFQuotation.pdf', 'I'); +//$len = strlen($pdfcode); +if ($ListCount == 0){ $title = _('Print Quotation Error'); include('includes/header.inc'); echo '<p>'. _('There were no items on the quotation') . '. ' . _('The quotation cannot be printed'). @@ -234,6 +235,7 @@ include('includes/footer.inc'); exit; } else { +/* header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=Quotation.pdf'); @@ -242,5 +244,8 @@ header('Pragma: public'); //echo 'here'; $pdf->Output('PDFQuotation.pdf', 'I'); +*/ + $pdf->OutputI($_SESSION['DatabaseName'] . '_Quotation_' . date('Y-m-d') . '.pdf');//UldisN + $pdf->__destruct(); //UldisN } -?> \ No newline at end of file +?> Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-12-14 19:52:35 UTC (rev 3226) +++ trunk/PO_Header.php 2009-12-14 20:07:21 UTC (rev 3227) @@ -111,7 +111,7 @@ $_POST['StatComments']=' - '.$_POST['StatComments']; } - if ($NewStatus==_('Authorised')) { + if ($NewStatus == PurchOrder::STATUS_AUTHORISED) { if ($AuthorityLevel>$OrderTotal) { $StatusComment=$date.' - Authorised by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. '</a>'.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; @@ -126,7 +126,7 @@ } } - if ($NewStatus==_('Cancelled') and $OK_to_updstat==1) { + if ($NewStatus == PurchOrder::STATUS_CANCELLED and $OK_to_updstat==1) { if ($AuthorityLevel>$OrderTotal or $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator ) { $StatusComment=$date.' - Cancelled by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. '</a>'.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; @@ -141,7 +141,7 @@ } } - if ($NewStatus==_('Rejected') and $OK_to_updstat==1) { + if ($NewStatus == PurchOrder::STATUS_REJECTED and $OK_to_updstat==1) { if ($AuthorityLevel>$OrderTotal) { $StatusComment=$date.' - Rejected by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. '</a>'.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; @@ -156,7 +156,7 @@ } } - if ($NewStatus==_('Pending') and $OK_to_updstat==1) { + if ($NewStatus == PurchOrder::STATUS_PENDING and $OK_to_updstat==1) { if ($AuthorityLevel>$OrderTotal or $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator ) { $StatusComment=$date.' - Returned to Pending status by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. '</a>'.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; @@ -170,7 +170,7 @@ _('If you think this is a mistake please contact the systems administrator') , 'warn'); } } - + if ($OK_to_updstat==1){ // unset($_SESSION['PO'.$identifier]->LineItems); // unset($_SESSION['PO'.$identifier]); @@ -180,7 +180,7 @@ if($_SESSION['ExistingOrder']!=0){ - $SQL = "UPDATE purchorders SET + $SQL = "UPDATE purchorders SET status='" . $_POST['Stat']. "', stat_comment='" . $StatusComment ."' WHERE purchorders.orderno =" . $_SESSION['ExistingOrder']; @@ -281,8 +281,8 @@ echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?' . SID . 'identifier='.$identifier. "'>"; echo '<p>'; - prnMsg(_('You should automatically be forwarded to the entry of the purchase order line items page') . '. ' . - _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . + prnMsg(_('You should automatically be forwarded to the entry of the purchase order line items page') . '. ' . + _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . "<a href='$rootpath/PO_Items.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); include('includes/footer.inc'); exit; @@ -308,9 +308,9 @@ if($_SESSION['PO'.$identifier]->Any_Already_Received()==1){ $OK_to_delete =0; - prnMsg( _('This order cannot be cancelled because some of it has already been received') . '. ' . - _('The line item quantities may be modified to quantities more than already received') . '. ' . - _('Prices cannot be altered for lines that have already been received') .' '. + prnMsg( _('This order cannot be cancelled because some of it has already been received') . '. ' . + _('The line item quantities may be modified to quantities more than already received') . '. ' . + _('Prices cannot be altered for lines that have already been received') .' '. _('and quantities cannot be reduced below the quantity already received'),'warn'); } @@ -336,7 +336,7 @@ $DelResult=DB_query($sql,$db,$ErrMsg); $sql="UPDATE purchorders - SET status='Cancelled', + SET status='".PurchOrder::STATUS_CANCELLED."', stat_comment='".$StatusComment."' WHERE orderno=".$_SESSION['ExistingOrder']; @@ -384,14 +384,14 @@ /* change supplier only allowed with appropriate permissions - * button only displayed to modify is AccessLevel >10 * (see below)*/ - if ($_SESSION['PO'.$identifier]->Stat==_('Pending') and $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator) { + if ($_SESSION['PO'.$identifier]->Stat == PurchOrder::STATUS_PENDING and $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator) { if ($_SESSION['PO'.$identifier]->Any_Already_Received()==0){ $emailsql='SELECT email FROM www_users WHERE userid="'.$_SESSION['PO'.$identifier]->Initiator.'"'; $emailresult=DB_query($emailsql, $db); $emailrow=DB_fetch_array($emailresult); $date = date($_SESSION['DefaultDateFormat']); $_SESSION['RequireSupplierSelection']=1; - $_SESSION['PO'.$identifier]->Stat=_('Pending'); + $_SESSION['PO'.$identifier]->Stat = PurchOrder::STATUS_PENDING; $StatusComment=$date.' - Supplier changed by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; $_SESSION['PO'.$identifier]->StatComments=$StatusComment; @@ -457,7 +457,7 @@ $myrow=DB_fetch_array($result_SuppSelect); $_POST['Select'] = $myrow['supplierid']; } elseif (DB_num_rows($result_SuppSelect)==0){ - prnMsg( _('No supplier records contain the selected text') . ' - ' . + prnMsg( _('No supplier records contain the selected text') . ' - ' . _('please alter your search criteria and try again'),'info'); } } /*one of keywords or SuppCode was more than a zero length string */ @@ -523,7 +523,7 @@ ON suppliers.currcode=currencies.currabrev WHERE supplierid='" . $_POST['Select'] . "'"; - $ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' . + $ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -586,7 +586,7 @@ ON suppliers.currcode=currencies.currabrev WHERE supplierid='" . $_POST['Select'] . "'"; - $ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' . + $ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -633,7 +633,7 @@ if ($_SESSION['RequireSupplierSelection'] ==1 OR !isset($_SESSION['PO'.$identifier]->SupplierID) OR $_SESSION['PO'.$identifier]->SupplierID=='' ) { //if (true) { - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt="">' . ' ' . _('Purchase Order: Select Supplier') . ''; echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "identifier=".$identifier."' method=post name='choosesupplier'>"; if (strlen($msg)>1){ @@ -710,12 +710,15 @@ // Be careful not made confused by orderno and realorderno // $orderno = previous_id("purchorders","orderno"); // $_SESSION['PO'.$identifier]->OrderNo2 = $orderno; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Purchase Order') . '" alt="">'; - echo ' '.$_SESSION['PO'.$identifier]->SupplierName . '</u> </b> - ' . _('All amounts stated in') . ' ' . - $_SESSION['PO'.$identifier]->CurrCode . '<br>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt=""> + ' . $_... [truncated message content] |