From: <tim...@us...> - 2009-12-24 11:07:48
|
Revision: 3257 http://web-erp.svn.sourceforge.net/web-erp/?rev=3257&view=rev Author: tim_schofield Date: 2009-12-24 11:07:36 +0000 (Thu, 24 Dec 2009) Log Message: ----------- Move the purchase ordering printing parameters to a separate file for the form designer. Modified Paths: -------------- trunk/PO_PDFPurchOrder.php trunk/SelectOrderItems.php trunk/api/api_stock.php trunk/doc/Change.log.html trunk/includes/PO_PDFOrderPageHeader.inc trunk/includes/class.pdf.php Added Paths: ----------- trunk/companies/weberpdemo/FormDesigns/ trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/utf-8_xfer:3160-3162 + /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/PO_PDFPurchOrder.php 2009-12-24 11:07:36 UTC (rev 3257) @@ -142,17 +142,18 @@ }//if there is a valid order number if (isset($MakePDFThenDisplayIt) or isset($MakePDFThenEmailIt)) { + $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/PurchaseOrder.xml'); - $PaperSize = 'A4_Landscape'; + $PaperSize = $FormDesign->PaperSize; - include('includes/PDFStarter.php'); - $pdf->addInfo('Title', _('Purchase Order') ); - $pdf->addInfo('Subject', _('Purchase Order Number' ) . ' ' . $OrderNo); - $line_height = 16; - $PageNumber = 1; + include('includes/PDFStarter.php'); + $pdf->addInfo('Title', _('Purchase Order') ); + $pdf->addInfo('Subject', _('Purchase Order Number' ) . ' ' . $OrderNo); + $line_height = $FormDesign->LineHeight; + $PageNumber = 1; - /* Then there's an order to print and its not been printed already (or its been flagged for reprinting) - Now ... Has it got any line items */ + /* Then there's an order to print and its not been printed already (or its been flagged for reprinting) + Now ... Has it got any line items */ $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $OrderNo . ' ' . _('from the database'); @@ -175,32 +176,12 @@ include('includes/PO_PDFOrderPageHeader.inc'); - $YPos-=$line_height; + $YPos=$Page_Height - $FormDesign->Data->y; $OrderTotal = 0; while ($POLine=DB_fetch_array($result)){ - /*$sql = "SELECT supplierdescription - FROM purchdata - WHERE stockid='" . $POLine['itemcode'] . "' - AND supplierno ='" . $POHeader['supplierno'] . "'"; - $SuppDescRslt = DB_query($sql,$db); - - $ItemDescription=''; - - if (DB_error_no($db)==0){ - if (DB_num_rows($SuppDescRslt)==1){ - $SuppDescRow = DB_fetch_row($SuppDescRslt); - if (strlen($SuppDescRow[0])>2){ - $ItemDescription = $SuppDescRow[0]; - } - } - } - if (strlen($ItemDescription)<2){ - $ItemDescription = $POLine['itemdescription']; - }*/ - $DisplayQty = number_format($POLine['quantityord'],$POLine['decimalplaces']); if ($_POST['ShowAmounts']=='Yes'){ $DisplayPrice = number_format($POLine['unitprice'],2); @@ -230,13 +211,13 @@ } $OrderTotal += ($POLine['unitprice']*$POLine['quantityord']); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1,$YPos,94,$FontSize,$POLine['itemcode'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94,$YPos,270,$FontSize,$Desc, 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+260,$YPos,85,$FontSize,$DisplayQty, 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+270+85+3,$YPos,37,$FontSize,$POLine['units'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+270+85+3+37,$YPos,60,$FontSize,$DisplayDelDate, 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+270+85+40+60,$YPos,85,$FontSize,$DisplayPrice, 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+270+85+40+60+85,$YPos,85,$FontSize,$DisplayLineTotal, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$YPos,$FormDesign->Data->Column1->length,$FormDesign->Data->Column1->FontSize,$POLine['itemcode'], 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$YPos,$FormDesign->Data->Column2->length,$FormDesign->Data->Column2->FontSize,$Desc, 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$YPos,$FormDesign->Data->Column3->length,$FormDesign->Data->Column3->FontSize,$DisplayQty, 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$YPos,$FormDesign->Data->Column4->length,$FormDesign->Data->Column4->FontSize,$POLine['units'], 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$YPos,$FormDesign->Data->Column5->length,$FormDesign->Data->Column5->FontSize,$DisplayDelDate, 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$YPos,$FormDesign->Data->Column6->length,$FormDesign->Data->Column6->FontSize,$DisplayPrice, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x,$YPos,$FormDesign->Data->Column7->length,$FormDesign->Data->Column7->FontSize,$DisplayLineTotal, 'right'); if (strlen($LeftOvers)>1){ $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94,$YPos-$line_height,270,$FontSize,$LeftOvers, 'left'); @@ -266,8 +247,8 @@ $DisplayOrderTotal = "----"; } $YPos = $Bottom_Margin + $line_height; - $pdf->addText(450,$YPos, 14, _('Order Total - excl tax'). ' ' . $POHeader['currcode']); - $LeftOvers = $pdf->addTextWrap($Left_Margin+1+94+270+85+40+60+75,$YPos,95,14,$DisplayOrderTotal, 'right'); + $pdf->addText($FormDesign->OrderTotalCaption->x,$Page_Height - $FormDesign->OrderTotalCaption->y, $FormDesign->OrderTotalCaption->FontSize, _('Order Total - excl tax'). ' ' . $POHeader['currcode']); + $LeftOvers = $pdf->addTextWrap($FormDesign->OrderTotal->x,$Page_Height - $FormDesign->OrderTotal->y,$Page_Height - $FormDesign->OrderTotal->length,$FormDesign->OrderTotal->FontSize,$DisplayOrderTotal, 'right'); } /*end if there are order details to show on the order*/ //} /* end of check to see that there was an order selected to print */ @@ -275,18 +256,7 @@ //failed var to allow us to print if the email fails. $failed = false; if ($MakePDFThenDisplayIt){ - /* UldisN - $buf = $pdf->output(); - $len = strlen($buf); - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=PurchaseOrder.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Output('PurchOrder.pdf','I'); - */ + $pdf->OutputD($_SESSION['DatabaseName'] . '_PurchaseOrder_' . date('Y-m-d') . '.pdf');//UldisN $pdf->__destruct(); //UldisN Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/SelectOrderItems.php 2009-12-24 11:07:36 UTC (rev 3257) @@ -1526,7 +1526,7 @@ } if (isset($SearchResult)) { - + $j = 1; echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . ' method=post name="orderform">'; echo '<table class="table1">'; echo '<tr><td colspan=><input type="hidden" name="previous" value='.number_format($Offset-1).'><input tabindex='.number_format($j+7).' type="submit" name="Prev" value="'._('Prev').'"></td>'; @@ -1541,7 +1541,7 @@ <th>' . _('Available') . '</th> <th>' . _('Quantity') . '</th></tr>'; echo $TableHeader; - $j = 1; + $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { Modified: trunk/api/api_stock.php =================================================================== --- trunk/api/api_stock.php 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/api/api_stock.php 2009-12-24 11:07:36 UTC (rev 3257) @@ -782,16 +782,16 @@ ',"api adjustment",'.$Quantity.','.$newqoh.')'; $locstocksql='UPDATE locstock SET quantity = quantity + '.$Quantity.' WHERE loccode="'. $Location.'" AND stockid="'.$StockID.'"'; - $glupdatesql1='INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative) - VALUES (17,'.GetNextTransactionNo(17, $db).',"'.$TranDate. - '",'.GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db). - ','.$adjglact.','.$itemdetails['materialcost']*-$Quantity. - ',"'.$StockID.' x '.$Quantity.' @ '.$itemdetails['materialcost'].'")'; - $glupdatesql2='INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative) - VALUES (17,'.GetNextTransactionNo(17, $db).',"'.$TranDate. - '",'.GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db). - ','.$stockact.','.$itemdetails['materialcost']*$Quantity. - ',"'.$StockID.' x '.$Quantity.' @ '.$itemdetails['materialcost'].'")'; + $glupdatesql1="INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative) + VALUES (17,".GetNextTransactionNo(17, $db).",'".$TranDate. + "','"GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db). + ",".$adjglact.",".$itemdetails['materialcost']*-$Quantity. + ",'".$StockID." x ".$Quantity." @ ".$itemdetails['materialcost']."')"; + $glupdatesql2="INSERT INTO gltrans (type, typeno, trandate, periodno, account, amount, narrative) + VALUES (17,".GetNextTransactionNo(17, $db).",'".$TranDate. + "',".GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors, $db). + ",".$stockact.",".$itemdetails['materialcost']*$Quantity. + ",'".$StockID." x ".$Quantity." @ ".$itemdetails['materialcost']."')"; $systypessql = 'UPDATE systypes set typeno='.GetNextTransactionNo(17, $db).' where typeid=17'; DB_Txn_Begin($db); Added: trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml (rev 0) +++ trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml 2009-12-24 11:07:36 UTC (rev 3257) @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<form name="Purchase Order"> + <PaperSize name="Paper size">A4_Landscape</PaperSize> + <LineHeight name "Line height">16</LineHeight> + <logo type="logo" name="Logo"> + <x>0</x> + <y>62</y> + <width>0</width> + <height>60</height> + </logo> + <OrderNumber type="SimpleText" name="Order Number"> + <FontSize>15</FontSize> + <x>391</x> + <y>46</y> + </OrderNumber> + <ViewingOnly type="SimpleText" name="Viewing only text"> + <FontSize>16</FontSize> + <x>391</x> + <y>62</y> + </ViewingOnly> + <PageNumber type="SimpleText" name="Page number"> + <FontSize>10</FontSize> + <x>762</x> + <y>70</y> + </PageNumber> + <TaxAuthority type="SimpleText" name="Tax Authority"> + <FontSize>10</FontSize> + <x>40</x> + <y>106</y> + </TaxAuthority> + <CompanyName type="SimpleText" name="Company name"> + <FontSize>10</FontSize> + <x>40</x> + <y>122</y> + </CompanyName> + <CompanyAddress type="ElementArray" name="Company address"> + <Line1 type="SimpleText" name="Company address line 1"> + <FontSize>10</FontSize> + <x>40</x> + <y>132</y> + </Line1> + <Line2 type="SimpleText" name="Company address line 2"> + <FontSize>10</FontSize> + <x>40</x> + <y>142</y> + </Line2> + <Line3 type="SimpleText" name="Company address line 3"> + <FontSize>10</FontSize> + <x>40</x> + <y>152</y> + </Line3> + <Line4 type="SimpleText" name="Company address line 4"> + <FontSize>10</FontSize> + <x>40</x> + <y>162</y> + </Line4> + <Line5 type="SimpleText" name="Company address line 5"> + <FontSize>10</FontSize> + <x>40</x> + <y>172</y> + </Line5> + </CompanyAddress> + <CompanyPhone type="SimpleText" name="Company phone number"> + <FontSize>10</FontSize> + <x>40</x> + <y>182</y> + </CompanyPhone> + <CompanyFax type="SimpleText" name="Company fax number"> + <FontSize>10</FontSize> + <x>40</x> + <y>192</y> + </CompanyFax> + <CompanyEmail type="SimpleText" name="Company email address"> + <FontSize>10</FontSize> + <x>40</x> + <y>202</y> + </CompanyEmail> + <DeliveryAddress type="ElementArray" name="Delivery address"> + <Caption type="SimpleText" name="Delivery address caption"> + <FontSize>12</FontSize> + <x>448</x> + <y>154</y> + </Caption> + <Line1 type="SimpleText" name="Delivery address line 1"> + <FontSize>12</FontSize> + <x>448</x> + <y>166</y> + </Line1> + <Line2 type="SimpleText" name="Delivery address line 2"> + <FontSize>12</FontSize> + <x>448</x> + <y>178</y> + </Line2> + <Line3 type="SimpleText" name="Delivery address line 3"> + <FontSize>12</FontSize> + <x>448</x> + <y>190</y> + </Line3> + <Line4 type="SimpleText" name="Delivery address line 4"> + <FontSize>12</FontSize> + <x>448</x> + <y>202</y> + </Line4> + <Line5 type="SimpleText" name="Delivery address line 5"> + <FontSize>12</FontSize> + <x>448</x> + <y>214</y> + </Line5> + <Line6 type="SimpleText" name="Delivery address line 6"> + <FontSize>12</FontSize> + <x>448</x> + <y>226</y> + </Line6> + </DeliveryAddress> + <DeliveryAddressBox type="CurvedRectangle" name="Delivery address box"> + <x>446</x> + <y>145</y> + <width>240</width> + <height>80</height> + <radius>10</radius> + </DeliveryAddressBox> + <SupplierName type="SimpleText" name="Supplier name"> + <FontSize>12</FontSize> + <x>41</x> + <y>246</y> + </SupplierName> + <SupplierAddress type="ElementArray" name="Supplier address"> + <Line1 type="SimpleText" name="Supplier address line 1"> + <FontSize>12</FontSize> + <x>71</x> + <y>262</y> + </Line1> + <Line2 type="SimpleText" name="Supplier address line 2"> + <FontSize>12</FontSize> + <x>71</x> + <y>274</y> + </Line2> + <Line3 type="SimpleText" name="Supplier address line 3"> + <FontSize>12</FontSize> + <x>71</x> + <y>286</y> + </Line3> + <Line4 type="SimpleText" name="Supplier address line 4"> + <FontSize>12</FontSize> + <x>71</x> + <y>298</y> + </Line4> + </SupplierAddress> + <OrderDate type="SimpleText" name="Order date"> + <FontSize>12</FontSize> + <x>446</x> + <y>262</y> + </OrderDate> + <Initiator type="SimpleText" name="Order initiator"> + <FontSize>12</FontSize> + <x>446</x> + <y>278</y> + </Initiator> + <PaymentTerms type="SimpleText" name="Payment terms"> + <FontSize>12</FontSize> + <x>446</x> + <y>290</y> + </PaymentTerms> + <Comments type="MultiLineText" name="Comments"> + <FontSize>12</FontSize> + <Length>250</Length> + <x>446</x> + <y>302</y> + </Comments> + <Currency type="SimpleText" name="Currency text"> + <FontSize>12</FontSize> + <x>40</x> + <y>312</y> + </Currency> + <HeaderRectangle type="Rectangle" name="Header rectangle"> + <x>40</x> + <y>320</y> + <width>772</width> + <height>32</height> + </HeaderRectangle> + <Headings type="ElementArray" name="Column headings"> + <Column1 type="SimpleText" name="Column heading 1"> + <FontSize>10</FontSize> + <x>41</x> + <y>330</y> + </Column1> + <Column2 type="SimpleText" name="Column heading 2"> + <FontSize>10</FontSize> + <x>136</x> + <y>330</y> + </Column2> + <Column3 type="SimpleText" name="Column heading 3"> + <FontSize>10</FontSize> + <x>441</x> + <y>330</y> + </Column3> + <Column4 type="SimpleText" name="Column heading 4"> + <FontSize>10</FontSize> + <x>491</x> + <y>330</y> + </Column4> + <Column5 type="SimpleText" name="Column heading 5"> + <FontSize>10</FontSize> + <x>526</x> + <y>330</y> + </Column5> + <Column6 type="SimpleText" name="Column heading 6"> + <FontSize>10</FontSize> + <x>641</x> + <y>330</y> + </Column6> + <Column7 type="SimpleText" name="Column heading 7"> + <FontSize>10</FontSize> + <x>761</x> + <y>330</y> + </Column7> + </Headings> + <DataRectangle type="Rectangle" name="Header rectangle"> + <x>40</x> + <y>352</y> + <width>772</width> + <height>213</height> + </DataRectangle> + <Data type="ElementArray" name="Column Data"> + <y>362</y> + <Column1 type="DataText" name="Data column 1"> + <FontSize>10</FontSize> + <x>41</x> + <length>94</length> + </Column1> + <Column2 type="DataText" name="Data column 2"> + <FontSize>10</FontSize> + <x>136</x> + <length>270</length> + </Column2> + <Column3 type="DataText" name="Data column 3"> + <FontSize>10</FontSize> + <x>441</x> + <length>85</length> + </Column3> + <Column4 type="DataText" name="Data column 4"> + <FontSize>10</FontSize> + <x>491</x> + <length>37</length> + </Column4> + <Column5 type="DataText" name="Data column 5"> + <FontSize>10</FontSize> + <x>526</x> + <length>60</length> + </Column5> + <Column6 type="DataText" name="Data column 6"> + <FontSize>10</FontSize> + <x>591</x> + <length>85</length> + </Column6> + <Column7 type="DataText" name="Data column 7"> + <FontSize>10</FontSize> + <x>721</x> + <length>85</length> + </Column7> + </Data> + <OrderTotalCaption type="SimpleText" name="Order total caption"> + <FontSize>14</FontSize> + <x>450</x> + <y>549</y> + </OrderTotalCaption> + <OrderTotal type="MultiLineText" name="Order total"> + <FontSize>14</FontSize> + <x>665</x> + <y>549</y> + <length>135</length> + </OrderTotal> +</form> \ No newline at end of file Property changes on: trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/doc/Change.log.html 2009-12-24 11:07:36 UTC (rev 3257) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>24/12/09 Tim: Move the purchase ordering printing parameters to a separate file for the form designer. <p>23/12/09 Tim: Rename rtl theme to remove the space. <p>19/12/09 Pak Ricard: TopItems.php - Improvements to the top sales items report. <p>18/12/09 Tim: UserSettings.php - added new pdflanguage field to allow user pdf language support to be specified Modified: trunk/includes/PO_PDFOrderPageHeader.inc =================================================================== --- trunk/includes/PO_PDFOrderPageHeader.inc 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/includes/PO_PDFOrderPageHeader.inc 2009-12-24 11:07:36 UTC (rev 3257) @@ -10,150 +10,87 @@ $pdf->newPage(); } -$YPos = $Page_Height - $Top_Margin - ($line_height*2); +$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin+$FormDesign->logo->x,$Page_Height- $FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); +$pdf->addText($FormDesign->OrderNumber->x,$Page_Height- $FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, _('Purchase Order Number'). ' ' . $OrderNo); -$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin,$YPos,0,60); - -$FontSize=15; - -$XPos = $Page_Width/2 - 30; - -$pdf->addText($XPos,$YPos+$line_height,$FontSize, _('Purchase Order Number'). ' ' . $OrderNo); - if ($ViewingOnly!=0) { - $FontSize=16; - $pdf->addText($XPos,$YPos,$FontSize, _('FOR VIEWING ONLY') . ', ' . _('DO NOT SEND TO SUPPLIER') ); - $pdf->addText($XPos,$YPos-$line_height,$FontSize, _('SUPPLIERS') . ' - ' . _('THIS IS NOT AN ORDER') ); + $pdf->addText($FormDesign->ViewingOnly->x,$Page_Height - $FormDesign->ViewingOnly->y,$FormDesign->ViewingOnly->FontSize, _('FOR VIEWING ONLY') . ', ' . _('DO NOT SEND TO SUPPLIER') ); + $pdf->addText($FormDesign->ViewingOnly->x,$Page_Height - $FormDesign->ViewingOnly->y-$line_height,$FormDesign->ViewingOnly->FontSize, _('SUPPLIERS') . ' - ' . _('THIS IS NOT AN ORDER') ); } -$YPos -= ($line_height*3); -$FontSize=10; -$XPos = $Page_Width-$Right_Margin-50; -$pdf->addText($XPos,$YPos +40, $FontSize, _('Page') . ': ' .$PageNumber); +$pdf->addText($FormDesign->PageNumber->x,$Page_Height - $FormDesign->PageNumber->y, $FormDesign->PageNumber->FontSize, _('Page') . ': ' .$PageNumber); +/*Now print out the company Tax authority reference */ +$pdf->addText($FormDesign->TaxAuthority->x,$Page_Height - $FormDesign->TaxAuthority->y, $FormDesign->TaxAuthority->FontSize, $_SESSION['TaxAuthorityReferenceName'] . ' ' . $_SESSION['CompanyRecord']['gstno']); /*Now print out the company name and address */ -$XPos = $Left_Margin; -$YPos -= 1*$line_height; -$pdf->addText($Left_Margin,$YPos, $FontSize, $_SESSION['TaxAuthorityReferenceName'] . ' ' . $_SESSION['CompanyRecord']['gstno']); -$pdf->addText($Left_Margin,$YPos-(0.8*$line_height), $FontSize, $_SESSION['CompanyRecord']['coyname']); -$pdf->addText($Left_Margin,$YPos-(1.6*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice1']); -$pdf->addText($Left_Margin,$YPos-(2.4*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice2']); -$pdf->addText($Left_Margin,$YPos-(3.2*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); -$pdf->addText($Left_Margin,$YPos-(4*$line_height), $FontSize, _('Ph'). ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' ._('Fax').': ' . $_SESSION['CompanyRecord']['fax'] ); -$pdf->addText($Left_Margin,$YPos-(4.8*$line_height), $FontSize, _('Email'). ': ' . $_SESSION['CompanyRecord']['email']); +$pdf->addText($FormDesign->CompanyName->x,$Page_Height - $FormDesign->CompanyName->y, $FormDesign->CompanyName->FontSize, $_SESSION['CompanyRecord']['coyname']); +$pdf->addText($FormDesign->CompanyAddress->Line1->x,$Page_Height - $FormDesign->CompanyAddress->Line1->y, $FormDesign->CompanyAddress->Line1->FontSize, $_SESSION['CompanyRecord']['regoffice1']); +$pdf->addText($FormDesign->CompanyAddress->Line2->x,$Page_Height - $FormDesign->CompanyAddress->Line2->y, $FormDesign->CompanyAddress->Line2->FontSize, $_SESSION['CompanyRecord']['regoffice2']); +$pdf->addText($FormDesign->CompanyAddress->Line3->x,$Page_Height - $FormDesign->CompanyAddress->Line3->y, $FormDesign->CompanyAddress->Line3->FontSize, $_SESSION['CompanyRecord']['regoffice3']); +$pdf->addText($FormDesign->CompanyAddress->Line4->x,$Page_Height - $FormDesign->CompanyAddress->Line4->y, $FormDesign->CompanyAddress->Line4->FontSize, $_SESSION['CompanyRecord']['regoffice4']); +$pdf->addText($FormDesign->CompanyAddress->Line5->x,$Page_Height - $FormDesign->CompanyAddress->Line5->y, $FormDesign->CompanyAddress->Line5->FontSize, $_SESSION['CompanyRecord']['regoffice5']); +$pdf->addText($FormDesign->CompanyPhone->x,$Page_Height - $FormDesign->CompanyPhone->y, $FormDesign->CompanyPhone->FontSize, _('Tel'). ': ' . $_SESSION['CompanyRecord']['telephone']); +$pdf->addText($FormDesign->CompanyFax->x,$Page_Height - $FormDesign->CompanyFax->y, $FormDesign->CompanyFax->FontSize, _('Fax').': ' . $_SESSION['CompanyRecord']['fax']); +$pdf->addText($FormDesign->CompanyEmail->x,$Page_Height - $FormDesign->CompanyEmail->y, $FormDesign->CompanyEmail->FontSize, _('Email'). ': ' .$_SESSION['CompanyRecord']['email']); -$YPos -=2*$line_height; - /*Now the delivery details */ -$YPos -= 8; -$XPos = $Page_Width/2 + 25; -$FontSize=12; -$pdf->addText($XPos+2,$YPos, $FontSize, _('Deliver To') . ':' ); -$pdf->addText($XPos+2,$YPos-$line_height, $FontSize, $POHeader['deladd1']); -$pdf->addText($XPos+2,$YPos-(2*$line_height), $FontSize, $POHeader['deladd2']); -$pdf->addText($XPos+2,$YPos-(3*$line_height), $FontSize, $POHeader['deladd3'] . ' ' . $POHeader['deladd4'] . ' ' . $POHeader['deladd5']); -$pdf->addText($XPos+2,$YPos-(4*$line_height), $FontSize, $POHeader['deladd6']); +$pdf->addText($FormDesign->DeliveryAddress->Caption->x,$Page_Height - $FormDesign->DeliveryAddress->Caption->y, $FormDesign->DeliveryAddress->Caption->FontSize, _('Deliver To') . ':' ); +$pdf->addText($FormDesign->DeliveryAddress->Line1->x,$Page_Height - $FormDesign->DeliveryAddress->Line1->y, $FormDesign->DeliveryAddress->Line1->FontSize, $POHeader['deladd1']); +$pdf->addText($FormDesign->DeliveryAddress->Line2->x,$Page_Height - $FormDesign->DeliveryAddress->Line2->y, $FormDesign->DeliveryAddress->Line2->FontSize, $POHeader['deladd2']); +$pdf->addText($FormDesign->DeliveryAddress->Line3->x,$Page_Height - $FormDesign->DeliveryAddress->Line3->y, $FormDesign->DeliveryAddress->Line3->FontSize, $POHeader['deladd3']); +$pdf->addText($FormDesign->DeliveryAddress->Line4->x,$Page_Height - $FormDesign->DeliveryAddress->Line4->y, $FormDesign->DeliveryAddress->Line4->FontSize, $POHeader['deladd4']); +$pdf->addText($FormDesign->DeliveryAddress->Line5->x,$Page_Height - $FormDesign->DeliveryAddress->Line5->y, $FormDesign->DeliveryAddress->Line5->FontSize, $POHeader['deladd5']); +$pdf->addText($FormDesign->DeliveryAddress->Line6->x,$Page_Height - $FormDesign->DeliveryAddress->Line6->y, $FormDesign->DeliveryAddress->Line6->FontSize, $POHeader['deladd6']); /*draw a nice curved corner box around the delivery to address */ -/*from the top right */ -$pdf->partEllipse($XPos+250-10,$YPos+10,0,90,10,10); -/*line to the top left */ -$pdf->line($XPos+250-10, $YPos+20,$XPos+10, $YPos+20); -/*Do top left corner */ -$pdf->partEllipse($XPos+10, $YPos+10,90,180,10,10); -/*Do a line to the bottom left corner */ -$pdf->line($XPos+10, $YPos-70-10,$XPos+250-10, $YPos-70-10); -/*Now do the bottom left corner 180 - 270 coming back west*/ -$pdf->partEllipse($XPos+10, $YPos-70,180,270,10,10); -/*Now a line to the bottom right */ -$pdf->line($XPos, $YPos-70,$XPos, $YPos+10); -/*Now do the bottom right corner */ -$pdf->partEllipse($XPos+250-10, $YPos-70,270,360,10,10); -/*Finally join up to the top right corner where started */ -$pdf->line($XPos+250, $YPos-70,$XPos+250, $YPos+10); +$pdf->RoundRectangle($FormDesign->DeliveryAddressBox->x, $Page_Height - $FormDesign->DeliveryAddressBox->y,$FormDesign->DeliveryAddressBox->width, $FormDesign->DeliveryAddressBox->height, $FormDesign->DeliveryAddressBox->radius); +/*Now the Supplier details */ +$pdf->addText($FormDesign->SupplierName->x,$Page_Height - $FormDesign->SupplierName->y, $FormDesign->SupplierName->FontSize, _('To').': '); +$pdf->addText($FormDesign->SupplierName->x+30,$Page_Height - $FormDesign->SupplierName->y, $FormDesign->SupplierName->FontSize, $POHeader['suppname']); +$pdf->addText($FormDesign->SupplierAddress->Line1->x,$Page_Height - $FormDesign->SupplierAddress->Line1->y, $FormDesign->SupplierAddress->Line1->FontSize, $POHeader['address1']); +$pdf->addText($FormDesign->SupplierAddress->Line2->x,$Page_Height - $FormDesign->SupplierAddress->Line2->y, $FormDesign->SupplierAddress->Line2->FontSize, $POHeader['address2']); +$pdf->addText($FormDesign->SupplierAddress->Line3->x,$Page_Height - $FormDesign->SupplierAddress->Line3->y, $FormDesign->SupplierAddress->Line3->FontSize, $POHeader['address3']); +$pdf->addText($FormDesign->SupplierAddress->Line4->x,$Page_Height - $FormDesign->SupplierAddress->Line4->y, $FormDesign->SupplierAddress->Line4->FontSize, $POHeader['address4']); +/*Now the Order date */ +$pdf->addText($FormDesign->OrderDate->x,$Page_Height - $FormDesign->OrderDate->y, $FormDesign->OrderDate->FontSize, _('Order Date') . ':' ); +$pdf->addText($FormDesign->OrderDate->x+70,$Page_Height - $FormDesign->OrderDate->y, $FormDesign->OrderDate->FontSize, ConvertSQLDate($POHeader['orddate'])); -/*end of the small table showing the coy name and delivery address details */ +/*Now the Initiator */ +$pdf->addText($FormDesign->Initiator->x,$Page_Height - $FormDesign->Initiator->y, $FormDesign->Initiator->FontSize, _('Initiator').': '); +$pdf->addText($FormDesign->Initiator->x+70,$Page_Height - $FormDesign->Initiator->y, $FormDesign->Initiator->FontSize, $POHeader['initiator']); -$XPos = $Left_Margin; -$YPos -= ($line_height*4.5); /* 4 lines down */ - -/* -PDF_moveto($p, $XPos+230, $YPos-100); -PDF_arc($p, $XPos+220, $YPos, 10, 0, 90); -PDF_arc($p, $XPos+5, $YPos, 10, 90, 180); -PDF_arc($p, $XPos+5, $YPos-100, 10, 180, 270); -PDF_arc($p, $XPos+220, $YPos-100, 10, 270, 360); -PDF_stroke($p); - - - -$font=PDF_findfont($p,"Helvetica-Bold","host",0); -PDF_setfont($p, $font, 12.0); - -*/ -$YPos -= 20; -$pdf->addText($XPos+1,$YPos, $FontSize, _('To').': '); - -$YPos-=$line_height; -$pdf->addText($XPos+1,$YPos, $FontSize, $POHeader['suppname']); -$pdf->addText($XPos+1,$YPos-$line_height, $FontSize, $POHeader['address1']); -$pdf->addText($XPos+1,$YPos-(2*$line_height), $FontSize, $POHeader['address2']); -$pdf->addText($XPos+1,$YPos-(3*$line_height), $FontSize, $POHeader['address3']); -$pdf->addText($XPos+1,$YPos-(4*$line_height), $FontSize, $POHeader['address4']); - - -$XPos = $Page_Width/2 + 25; -$pdf->addText($XPos,$YPos, $FontSize, _('Order Date') . ':' ); -$pdf->addText($XPos+70,$YPos, $FontSize, ConvertSQLDate($POHeader['orddate'])); - - -$YPos -= $line_height; -$pdf->addText($XPos,$YPos, $FontSize, _('Initiator').': '); -$pdf->addText($XPos+70,$YPos, $FontSize, $POHeader['initiator']); - -$YPos -= $line_height; -$pdf->addText($XPos,$YPos, $FontSize, _('Comments') . ':' ); -$YPos -= $line_height; -$LeftOvers = $pdf->addTextWrap($XPos, $YPos,250,$FontSize,$POHeader['comments'], 'left'); -if (strlen($LeftOvers)>0){ - $LeftOvers = $pdf->addTextWrap($XPos, $YPos-$line_height,250,$FontSize,$LeftOvers, 'left'); -} - +/*Find the description of the payment terms and display */ $sql='SELECT terms FROM paymentterms where termsindicator="'.$POHeader['paymentterms'].'"'; $termsresult=DB_query($sql, $db); $myrow=DB_fetch_array($termsresult); -$pdf->addText($XPos+2,$YPos-($line_height), $FontSize, _('Payment Terms').' : '.$myrow['terms']); +$pdf->addText($FormDesign->PaymentTerms->x,$Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->FontSize, _('Payment Terms').' : '.$myrow['terms']); -$XPos = $Left_Margin; -$YPos -= ($line_height*2); -$pdf->addText($Left_Margin,$YPos, $FontSize, _('All amounts stated in').' - ' . $POHeader['currcode']); +/*Now the Comments split over two lines if necessary */ +$LeftOvers = $pdf->addTextWrap($FormDesign->Comments->x, $Page_Height - $FormDesign->Comments->y,$FormDesign->Comments->Length,$FormDesign->Comments->FontSize,_('Comments') . ':' .$POHeader['comments'], 'left'); +if (strlen($LeftOvers)>0){ + $LeftOvers = $pdf->addTextWrap($FormDesign->Comments->x, $Page_Height - $FormDesign->Comments->y-$line_height,$FormDesign->Comments->Length,$FormDesign->Comments->FontSize,$LeftOvers, 'left'); +} +/*Now the currency the order is in */ +$pdf->addText($FormDesign->Currency->x,$Page_Height - $FormDesign->Currency->y,$FormDesign->Currency->FontSize, _('All amounts stated in').' - ' . $POHeader['currcode']); -$YPos -= ($line_height*.5); -/*draw a square grid for entering line items */ -$pdf->line($Left_Margin, $YPos, $Page_Width-$Right_Margin, $YPos); -$pdf->line($Page_Width-$Right_Margin, $YPos, $Page_Width-$Right_Margin, $Bottom_Margin); -$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin, $Left_Margin, $Bottom_Margin); -$pdf->line($Left_Margin, $Bottom_Margin, $Left_Margin, $YPos); +/*draw a square grid for entering line headings */ +$pdf->Rectangle($FormDesign->HeaderRectangle->x, $Page_Height - $FormDesign->HeaderRectangle->y, $FormDesign->HeaderRectangle->width,$FormDesign->HeaderRectangle->height); -$YPos -= $line_height; /*Set up headings */ -$FontSize=10; -$pdf->addText($Left_Margin+1,$YPos, $FontSize, _('Code') ); -$pdf->addText($Left_Margin+95,$YPos, $FontSize, _('Item Description') ); -$pdf->addText($Left_Margin+400,$YPos, $FontSize, _('Quantity') ); -$pdf->addText($Left_Margin+450,$YPos, $FontSize, _('Unit') ); -$pdf->addText($Left_Margin+485,$YPos, $FontSize, _('Date Reqd')); -$pdf->addText($Left_Margin+600,$YPos, $FontSize, _('Price') ); -$pdf->addText($Left_Margin+680,$YPos, $FontSize, _('Total') ); +$pdf->addText($FormDesign->Headings->Column1->x,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, _('Code') ); +$pdf->addText($FormDesign->Headings->Column2->x,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, _('Item Description') ); +$pdf->addText($FormDesign->Headings->Column3->x,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, _('Quantity') ); +$pdf->addText($FormDesign->Headings->Column4->x,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->FontSize, _('Unit') ); +$pdf->addText($FormDesign->Headings->Column5->x,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->FontSize, _('Date Reqd')); +$pdf->addText($FormDesign->Headings->Column6->x,$Page_Height - $FormDesign->Headings->Column6->y, $FormDesign->Headings->Column6->FontSize, _('Price') ); +$pdf->addText($FormDesign->Headings->Column7->x,$Page_Height - $FormDesign->Headings->Column7->y, $FormDesign->Headings->Column7->FontSize, _('Total') ); -$YPos-=$line_height; +/*draw a rectangle to hold the data lines */ +$pdf->Rectangle($FormDesign->DataRectangle->x, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); -/*draw a line */ -$pdf->line($Left_Margin, $YPos, $Page_Width-$Right_Margin, $YPos); - ?> \ No newline at end of file Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2009-12-23 12:26:18 UTC (rev 3256) +++ trunk/includes/class.pdf.php 2009-12-24 11:07:36 UTC (rev 3257) @@ -215,7 +215,32 @@ $this->Output($DocumentFilename,'D'); } + function RoundRectangle($XPos, $YPos, $Width, $Height, $Radius) { + /*from the top right */ + $this->partEllipse($XPos+$Width,$YPos,0,90,$Radius,$Radius); + /*line to the top left */ + $this->line($XPos+$Width, $YPos+$Radius,$XPos+$Radius, $YPos+$Radius); + /*Do top left corner */ + $this->partEllipse($XPos+$Radius, $YPos,90,180,$Radius,$Radius); + /*Do a line to the bottom left corner */ + $this->line($XPos+$Radius, $YPos-$Height-$Radius,$XPos+$Width, $YPos-$Height-$Radius); + /*Now do the bottom left corner 180 - 270 coming back west*/ + $this->partEllipse($XPos+$Radius, $YPos-$Height,180,270,$Radius,$Radius); + /*Now a line to the bottom right */ + $this->line($XPos, $YPos-$Height,$XPos, $YPos); + /*Now do the bottom right corner */ + $this->partEllipse($XPos+$Width, $YPos-$Height,270,360,$Radius,$Radius); + /*Finally join up to the top right corner where started */ + $this->line($XPos+$Width+$Radius, $YPos-$Height,$XPos+$Width+$Radius, $YPos); + } + function Rectangle($XPos, $YPos, $Width, $Height) { + $this->line($XPos, $YPos, $XPos+$Width, $YPos); + $this->line($XPos+$Width, $YPos, $XPos+$Width, $YPos-$Height); + $this->line($XPos+$Width, $YPos-$Height, $XPos, $YPos-$Height); + $this->line($XPos, $YPos-$Height, $XPos, $YPos); + } + function addTextWrap($xb, $yb, $w, $h, $txt, $align='J', $border=0, $fill=0) { // $txt = html_entity_decode($txt); $this->x = $xb; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |