From: Phil D. <we...@pa...> - 2004-09-12 06:38:56
|
It is a little more tricky with pdf report. A $title will not normally be required unless the input form is shown - PDFStarter_ros.inc has the authentication stuff in it and session initialisation and includes the LanguageSetup.php $title really only needs to be defined before a header.inc so the $title in reports should be moved to before the include('includes/header.inc'); Phil On Sun, 2004-09-12 at 11:33, Hani Naguib wrote: > Hi Phil, I have attached the DebtorsAtPeriodEnd.php with my modifications= . > I am not familiar with your code so I would appreciate if you could have=20 > a look at this and > make sure I have not done anything stupid or missed things that should=20 > have been translated. >=20 > I did notice a few things. > 'includes/session.inc' includes 'includes/LanguageSetup.php' at=20 > the end of the file. This means > that the language stuff breaks initially on a system that does not have=20 > gettext installed, since the _() function > is not defined until the LanguageSetup is called but session.inc uses it=20 > before including LanguageSetup. >=20 > In DebtorsAtPeriodEnd.php I moved the include session.php to the start=20 > of the script so I could set the title. > I don't know what the implications of doing that are in your code. But I=20 > suspect I should not have done that! > Could you let me know what the policy is for what includes I should use=20 > prior to setting the title? >=20 > Hani >=20 > Phil Daintree wrote: >=20 > >*This message was transferred with a trial version of CommuniGate(tm) Pr= o* > > =20 > > > >>Once you guys settle on the approach I can give you a hand with some sc= ripts > >>although you would have to let me know which ones :) > >> > >> =20 > >> > > > >Hani, > > > >I noticed you kind offer and have pulled a couple off the list in > >alpabetical order ... > > > >DebtorsAtPeriodEnd.php Hani > >DeliveryDetails.php Hani > >DiscountCategories.php Hani > >DiscountMatrix.php Hani > > > > > >Many thanks > > > >Phil > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >Project Admins to receive an Apple iPod Mini FREE for your judgement on > >who ports your project to Linux PPC the best. Sponsored by IBM.=20 > >Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > >_______________________________________________ > >Web-erp-developers mailing list > >Web...@li... > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > =20 > > >=20 >=20 > ______________________________________________________________________ > =3D1 AND isset($_POST['ToCriteria']) AND > strlen($_POST['ToCriteria'])>=3D1){ include("config.php"); > include("includes/ConnectDB.inc"); > include("includes/PDFStarter_ros.inc"); $FontSize=3D12; > $pdf->addinfo('Title',"Customer Balance Listing"); > $pdf->addinfo('Subject','Customer Balances'); $PageNumber=3D0; > $line_height=3D12; /*Get the date of the last day in the period selected > */ $SQL =3D "SELECT LastDate_In_Period FROM Periods WHERE PeriodNo =3D " = . > $_POST['PeriodEnd']; $PeriodEndResult =3D DB_query($SQL,$db,"Could not > get the date of the last day in the period selected"); $PeriodRow =3D > DB_fetch_row($PeriodEndResult); $PeriodEndDate =3D > ConvertSQLDate($PeriodRow[0]); /*Now figure out the aged analysis for > the customer range under review */ $SQL =3D "SELECT > DebtorsMaster.DebtorNo, DebtorsMaster.Name, Currencies.Currency, > Sum((DebtorTrans.OvAmount + DebtorTrans.OvGST + DebtorTrans.OvFreight > + DebtorTrans.OvDiscount - DebtorTrans.Alloc)/DebtorTrans.Rate) AS > Balance, Sum(DebtorTrans.OvAmount + DebtorTrans.OvGST + > DebtorTrans.OvFreight + DebtorTrans.OvDiscount - DebtorTrans.Alloc) AS > FXBalance, Sum(CASE WHEN DebtorTrans.Prd > " . $_POST['PeriodEnd'] . " > THEN (DebtorTrans.OvAmount + DebtorTrans.OvGST + DebtorTrans.OvFreight > + DebtorTrans.OvDiscount)/DebtorTrans.Rate ELSE 0 END) AS > AfterDateTrans, Sum(CASE WHEN DebtorTrans.Prd > " . > $_POST['PeriodEnd'] . " THEN DebtorTrans.OvAmount + DebtorTrans.OvGST > + DebtorTrans.OvFreight + DebtorTrans.OvDiscount ELSE 0 END ) AS > FXAfterDateTrans FROM DebtorsMaster, Currencies, DebtorTrans WHERE > DebtorsMaster.CurrCode =3D Currencies.CurrAbrev AND > DebtorsMaster.DebtorNo =3D DebtorTrans.DebtorNo AND > DebtorsMaster.DebtorNo >=3D '" . $_POST['FromCriteria'] . "' AND > DebtorsMaster.DebtorNo <=3D '" . $_POST['ToCriteria'] . "' GROUP BY > DebtorsMaster.DebtorNo, DebtorsMaster.Name, Currencies.Currency"; > $CustomerResult =3D DB_query($SQL,$db); if (DB_error_no($db) !=3D0) { > $title =3D _("Customer Balances - Problem Report.... "); > include("includes/header.inc"); echo _("The customer details could not > be retrieved by the SQL because - ") . DB_error_msg($db); echo " > " . _("Back to the menu") . ""; if ($debug=3D=3D1){ echo " > $SQL"; } include("includes/footer.inc"); exit; } include > ("includes/PDFDebtorBalsPageHeader.inc"); $TotBal=3D0; While > ($DebtorBalances =3D DB_fetch_array($CustomerResult,$db)){ $Balance =3D > $DebtorBalances["Balance"] - $DebtorBalances['AfterDateTrans']; > $FXBalance =3D $DebtorBalances["FXBalance"] - > $DebtorBalances['FXAfterDateTrans']; if (ABS($Balance)>0.009 OR > ABS($FXBalance)>0.009) { $DisplayBalance =3D > number_format($DebtorBalances["Balance"] - > $DebtorBalances['AfterDateTrans'],2); $DisplayFXBalance =3D > number_format($DebtorBalances["FXBalance"] - > $DebtorBalances['FXAfterDateTrans'],2); $TotBal +=3D $Balance; > $LeftOvers =3D > $pdf->addTextWrap($Left_Margin,$YPos,220-$Left_Margin,$FontSize,$DebtorBa= lances["DebtorNo"] . " - " . $DebtorBalances["Name"],'left'); $LeftOvers = =3D $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $Lef= tOvers =3D $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayFXBalance,'righ= t'); $LeftOvers =3D $pdf->addTextWrap(350,$YPos,100,$FontSize,$DebtorBalanc= es['Currency'],'left'); $YPos -=3D$line_height; if ($YPos < $Bottom_Margin = + $line_height){ include("includes/PDFDebtorBalsPageHeader.inc"); } } } /*e= nd customer aged analysis while loop */ $YPos -=3D$line_height; if ($YPos <= $Bottom_Margin + (2*$line_height)){ $PageNumber++; include("includes/PDFDe= btorBalsPageHeader.inc"); } $DisplayTotBalance =3D number_format($TotBal,2)= ; $LeftOvers =3D $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalanc= e,'right'); $buf =3D $pdf->output(); $len =3D strlen($buf); header("Content= -type: application/pdf"); header("Content-Length: $len"); header("Content-D= isposition: inline; filename=3DDebtorBals.pdf"); header("Expires: 0"); head= er("Cache-Control: must-revalidate, post-check=3D0, pre-check=3D0"); header= ("Pragma: public"); $pdf->stream(); } else { /*The option to print PDF was = not hit */ include("includes/header.inc"); include("includes/SQL_CommonFunc= tions.inc"); $CompanyRecord =3D ReadInCompanyRecord($db); if (strlen($_POST= ['FromCriteria'])<1 || strlen($_POST['ToCriteria'])<1) { /*if $FromCriteria= is not set then show a form to allow input */ echo " > " . _("From Customer Code") .": > =20 > " . _("To Customer Code") . ": > =20 > " . _("Balances As At") . ": > "; $sql =3D "SELECT PeriodNo, > LastDate_In_Period FROM Periods"; > $Periods =3D > DB_query($sql,$db,_("Could not > retrieve period data > because"),_("The SQL that failed to > get the period data was:")); while > ($myrow =3D > DB_fetch_array($Periods,$db)){ echo > " >=20 > "; include("includes/footer.inc"); } /*end of else not PrintPDF */ ?> |