From: <rc...@us...> - 2014-08-16 05:13:44
|
Revision: 6824 http://sourceforge.net/p/web-erp/reponame/6824 Author: rchacon Date: 2014-08-16 05:13:40 +0000 (Sat, 16 Aug 2014) Log Message: ----------- Changes to uniform code between PDFQuotation.php and PDFQuotationPortrait.php. Modified Paths: -------------- trunk/includes/PDFQuotationPageHeader.inc trunk/includes/PDFQuotationPortraitPageHeader.inc Modified: trunk/includes/PDFQuotationPageHeader.inc =================================================================== --- trunk/includes/PDFQuotationPageHeader.inc 2014-08-16 02:26:37 UTC (rev 6823) +++ trunk/includes/PDFQuotationPageHeader.inc 2014-08-16 05:13:40 UTC (rev 6824) @@ -11,31 +11,36 @@ $pdf->newPage(); } -// Print 'Quotation' title -$pdf->addText(361, 500, 18, _('Quotation')); +// Prints company logo: +$pdf->addJpegFromFile($_SESSION['LogoFile'], 301, 520, 0, 60); -// Print 'Quotation' info +// Prints 'Quotation' title: +$pdf->addTextWrap(0, $Page_Height-$Top_Margin-18, $Page_Width, 18, _('Quotation'), 'center'); + +// Prints quotation info: $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*1, 200, $FontSize, _('Number'). ': '.$_GET['QuotationNo'], 'right'); $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*2, 200, $FontSize, _('Your Ref'). ': '.$myrow['customerref'], 'right'); $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*3, 200, $FontSize, _('Date'). ': '.ConvertSQLDate($myrow['quotedate']), 'right'); $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*4, 200, $FontSize, _('Page').': '.$PageNumber, 'right'); -// Print company logo -$pdf->addJpegFromFile($_SESSION['LogoFile'], 301, 520, 0, 60); - -// Print company info -$XPos = 361; -$YPos = 482; -$FontSize=14; +// Prints company info: +$XPos = $Page_Width/2+$Left_Margin; +$YPos = 512; +$FontSize = 14; $pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['coyname']); -$FontSize =10; -$pdf->addText($XPos, $YPos-12, $FontSize, $_SESSION['CompanyRecord']['regoffice1']); -$pdf->addText($XPos, $YPos-21, $FontSize, $_SESSION['CompanyRecord']['regoffice2']); -$pdf->addText($XPos, $YPos-30, $FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); -$pdf->addText($XPos, $YPos-39, $FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); -$pdf->addText($XPos, $YPos-48, $FontSize, $_SESSION['CompanyRecord']['email']); +$YPos -= $FontSize; +$FontSize = 10; +$pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['regoffice1']); +$pdf->addText($XPos, $YPos-$FontSize*1, $FontSize, $_SESSION['CompanyRecord']['regoffice2']); +$pdf->addText($XPos, $YPos-$FontSize*2, $FontSize, $_SESSION['CompanyRecord']['regoffice3']); +$pdf->addText($XPos, $YPos-$FontSize*3, $FontSize, $_SESSION['CompanyRecord']['regoffice4']); +$pdf->addText($XPos, $YPos-$FontSize*4, $FontSize, $_SESSION['CompanyRecord']['regoffice5'] . + ' ' . $_SESSION['CompanyRecord']['regoffice6']); +$pdf->addText($XPos, $YPos-$FontSize*5, $FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . + ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); +$pdf->addText($XPos, $YPos-$FontSize*6, $FontSize, $_SESSION['CompanyRecord']['email']); -// Print 'Delivery To' info +// Prints 'Delivery To' info: $XPos = 46; $YPos = 566; $FontSize=14; @@ -46,7 +51,7 @@ $pdf->addText($XPos, $YPos-45, $FontSize, $myrow['deladd2']); $pdf->addText($XPos, $YPos-60, $FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5']); -// Print 'Quotation For' info +// Prints 'Quotation For' info: $YPos -= 80; $pdf->addText($XPos, $YPos, $FontSize, _('Quotation For').':'); $pdf->addText($XPos, $YPos-15, $FontSize, $myrow['name']); @@ -54,30 +59,42 @@ $pdf->addText($XPos, $YPos-45, $FontSize, $myrow['address2']); $pdf->addText($XPos, $YPos-60, $FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']); -// Draw a rectangle with rounded corners around 'Delivery To' info +// Draws a box with round corners around 'Delivery To' info: $XPos= 50; $YPos += 12; -$pdf->RoundRectangle($XPos-10, $YPos+60+10, 225+10+10, 60+10+10, 10, 10);// Function RoundRectangle from includes/class.pdf.php +$pdf->RoundRectangle( + $XPos-10,// RoundRectangle $XPos. + $YPos+70,// RoundRectangle $YPos. + 245,// RoundRectangle $Width.225+10+10 + 80,// RoundRectangle $Height.60+10+10 + 10,// RoundRectangle $RadiusX. + 10);// RoundRectangle $RadiusY. -// Draw a rectangle with rounded corners around 'Quotation For' info +// Draws a box with round corners around around 'Quotation For' info: $YPos -= 82; -$pdf->RoundRectangle($XPos-10, $YPos+60+10, 225+10+10, 60+10+10, 10, 10);// Function RoundRectangle from includes/class.pdf.php +$pdf->RoundRectangle( + $XPos-10,// RoundRectangle $XPos. + $YPos+70,// RoundRectangle $YPos. + 245,// RoundRectangle $Width.225+10+10 + 80,// RoundRectangle $Height.60+10+10 + 10,// RoundRectangle $RadiusX. + 10);// RoundRectangle $RadiusY. $FontSize=10; // Prints the currency name: require_once('includes/CurrenciesArray.php');// To get the currency name from the currency code. -$pdf->addText($Page_Width/2-60, $YPos-5, $FontSize, +$pdf->addText($Page_Width/2+$Left_Margin, $YPos-5, $FontSize, _('All amounts stated in') . ' ' . $myrow['currcode'] . ' - ' . $CurrencyName[$myrow['currcode']]); // Prints table header: $XPos = 40; $YPos -= 37; -$LeftOvers = $pdf->addTextWrap( 42, $YPos,103, $FontSize, _('Item Code'),'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos,103, $FontSize, _('Item Code')); if (strlen($LeftOvers) > 0) { // If translated text is greater than 103, prints remainder - $LeftOvers = $pdf->addTextWrap(585,$YPos-$FontSize,65, $FontSize, $LeftOvers,'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos-$FontSize, 65, $FontSize, $LeftOvers); } -$LeftOvers = $pdf->addTextWrap(145, $YPos,250, $FontSize, _('Item Description'),'left'); +$LeftOvers = $pdf->addTextWrap(145, $YPos,250, $FontSize, _('Item Description')); $LeftOvers = $pdf->addTextWrap(420, $YPos, 85, $FontSize, _('Quantity'),'right'); $LeftOvers = $pdf->addTextWrap(485, $YPos, 85, $FontSize, _('Price'),'right'); $LeftOvers = $pdf->addTextWrap(535, $YPos, 85, $FontSize, _('Discount'),'right'); Modified: trunk/includes/PDFQuotationPortraitPageHeader.inc =================================================================== --- trunk/includes/PDFQuotationPortraitPageHeader.inc 2014-08-16 02:26:37 UTC (rev 6823) +++ trunk/includes/PDFQuotationPortraitPageHeader.inc 2014-08-16 05:13:40 UTC (rev 6824) @@ -1,5 +1,5 @@ <?php -/* $Id: PDFQuotationPortraitPageHeader.inc 4491 2011-02-15 06:31:08Z daintree $ */ +/* $Id: PDFQuotationPortraitPageHeader.inc 6822 2014-08-15 20:24:57Z rchacon $*/ /* Please note that addTextWrap prints a font-size-height further down than addText and other functions.*/ @@ -10,27 +10,33 @@ $pdf->newPage(); } +// Prints company logo: $XPos = $Page_Width/2 - 140; $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+90,720,0,60); -$XPos = $XPos + 130; +// Prints 'Quotation' title: +$pdf->addTextWrap(0, $Page_Height-$Top_Margin-18, $Page_Width, 18, _('Quotation'), 'center'); -$FontSize=18; -$pdf->addText($XPos,820,$FontSize, _('Quotation')); -$FontSize=12; +// Prints company info: +$XPos = $Page_Width/2+$Left_Margin; $YPos = 720; -$pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']); -$FontSize =10; -$pdf->addText($XPos, $YPos-12,$FontSize, $_SESSION['CompanyRecord']['regoffice1']); -$pdf->addText($XPos, $YPos-21,$FontSize, $_SESSION['CompanyRecord']['regoffice2']); -$pdf->addText($XPos, $YPos-30,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); -$pdf->addText($XPos, $YPos-39,$FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); -$pdf->addText($XPos, $YPos-48,$FontSize, $_SESSION['CompanyRecord']['email']); +$FontSize = 12; +$pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['coyname']); +$YPos -= $FontSize; +$FontSize = 10; +$pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['regoffice1']); +$pdf->addText($XPos, $YPos-$FontSize*1, $FontSize, $_SESSION['CompanyRecord']['regoffice2']); +$pdf->addText($XPos, $YPos-$FontSize*2, $FontSize, $_SESSION['CompanyRecord']['regoffice3']); +$pdf->addText($XPos, $YPos-$FontSize*3, $FontSize, $_SESSION['CompanyRecord']['regoffice4']); +$pdf->addText($XPos, $YPos-$FontSize*4, $FontSize, $_SESSION['CompanyRecord']['regoffice5'] . + ' ' . $_SESSION['CompanyRecord']['regoffice6']); +$pdf->addText($XPos, $YPos-$FontSize*5, $FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . + ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); +$pdf->addText($XPos, $YPos-$FontSize*6, $FontSize, $_SESSION['CompanyRecord']['email']); - +// Prints 'Delivery To' info: $XPos = 46; $YPos = 770; - $FontSize=12; $myrow = array_map(html_entity_decode, $myrow); $pdf->addText($XPos, $YPos+10,$FontSize, _('Delivery To').':' ); @@ -39,55 +45,36 @@ $pdf->addText($XPos, $YPos-30,$FontSize, $myrow['deladd2']); $pdf->addText($XPos, $YPos-45,$FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5']); +// Prints 'Quotation For' info: $YPos -= 80; - $pdf->addText($XPos, $YPos,$FontSize, _('Quotation For').':'); $pdf->addText($XPos, $YPos-15,$FontSize, $myrow['name']); $pdf->addText($XPos, $YPos-30,$FontSize, $myrow['address1']); $pdf->addText($XPos, $YPos-45,$FontSize, $myrow['address2']); $pdf->addText($XPos, $YPos-60,$FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']); - -$XPos= 50; +// Draws a box with round corners around 'Delivery To' info: +$XPos = 50; $YPos += 25; -/*draw a nice curved corner box around the delivery details */ -/*from the top right */ -$pdf->partEllipse($XPos+200,$YPos+60,0,90,10,10); -/*line to the top left */ -$pdf->line($XPos+200, $YPos+70,$XPos, $YPos+70); -/*Dow top left corner */ -$pdf->partEllipse($XPos, $YPos+60,90,180,10,10); -/*Do a line to the bottom left corner */ -$pdf->line($XPos-10, $YPos+60,$XPos-10, $YPos); -/*Now do the bottom left corner 180 - 270 coming back west*/ -$pdf->partEllipse($XPos, $YPos,180,270,10,10); -/*Now a line to the bottom right */ -$pdf->line($XPos, $YPos-10,$XPos+200, $YPos-10); -/*Now do the bottom right corner */ -$pdf->partEllipse($XPos+200, $YPos,270,360,10,10); -/*Finally join up to the top right corner where started */ -$pdf->line($XPos+210, $YPos,$XPos+210, $YPos+60); +$pdf->RoundRectangle( + $XPos-10,// RoundRectangle $XPos. + $YPos+60+10,// RoundRectangle $YPos. + 200+10+10,// RoundRectangle $Width. + 60+10+10,// RoundRectangle $Height. + 10,// RoundRectangle $RadiusX. + 10);// RoundRectangle $RadiusY. - +// Draws a box with round corners around around 'Quotation For' info: $YPos -= 90; -/*draw a nice curved corner box around the billing details */ -/*from the top right */ -$pdf->partEllipse($XPos+200,$YPos+60,0,90,10,10); -/*line to the top left */ -$pdf->line($XPos+200, $YPos+70,$XPos, $YPos+70); -/*Dow top left corner */ -$pdf->partEllipse($XPos, $YPos+60,90,180,10,10); -/*Do a line to the bottom left corner */ -$pdf->line($XPos-10, $YPos+60,$XPos-10, $YPos); -/*Now do the bottom left corner 180 - 270 coming back west*/ -$pdf->partEllipse($XPos, $YPos,180,270,10,10); -/*Now a line to the bottom right */ -$pdf->line($XPos, $YPos-10,$XPos+200, $YPos-10); -/*Now do the bottom right corner */ -$pdf->partEllipse($XPos+200, $YPos,270,360,10,10); -/*Finally join up to the top right corner where started */ -$pdf->line($XPos+210, $YPos,$XPos+210, $YPos+60); +$pdf->RoundRectangle( + $XPos-10,// RoundRectangle $XPos. + $YPos+60+10,// RoundRectangle $YPos. + 200+10+10,// RoundRectangle $Width. + 60+10+10,// RoundRectangle $Height. + 10,// RoundRectangle $RadiusX. + 10);// RoundRectangle $RadiusY. +// Prints quotation info: $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*1, 200, $FontSize, _('Number'). ': '.$_GET['QuotationNo'], 'right'); $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*2, 200, $FontSize, _('Your Ref'). ': '.$myrow['customerref'], 'right'); $pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*3, 200, $FontSize, _('Date'). ': '.ConvertSQLDate($myrow['quotedate']), 'right'); @@ -97,14 +84,14 @@ // Prints the currency name: require_once('includes/CurrenciesArray.php');// To get the currency name from the currency code. -$pdf->addText($Page_Width/2-10, $YPos+5, $FontSize, +$pdf->addText($Page_Width/2+$Left_Margin, $YPos+5, $FontSize, _('All amounts stated in') . ' ' . $myrow['currcode'] . ' - ' . $CurrencyName[$myrow['currcode']]); // Prints table header: $YPos -= 45; $XPos = 40; -$LeftOvers = $pdf->addTextWrap($XPos+2,$YPos,100,$FontSize, _('Item Code'),'left'); -$LeftOvers = $pdf->addTextWrap(120,$YPos,235,$FontSize, _('Item Description'),'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize, _('Item Code')); +$LeftOvers = $pdf->addTextWrap(120,$YPos,235,$FontSize, _('Item Description')); $LeftOvers = $pdf->addTextWrap(180,$YPos,85,$FontSize, _('Quantity'),'right'); $LeftOvers = $pdf->addTextWrap(230,$YPos,85,$FontSize,_('Price'),'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,85,$FontSize, _('Discount'),'right'); |