From: <tim...@us...> - 2010-01-16 09:52:46
|
Revision: 3301 http://web-erp.svn.sourceforge.net/web-erp/?rev=3301&view=rev Author: tim_schofield Date: 2010-01-16 09:52:39 +0000 (Sat, 16 Jan 2010) Log Message: ----------- Add the Goods Received Note to the Form Designer Modified Paths: -------------- trunk/FormDesigner.php trunk/PDFGrn.php trunk/doc/Change.log.html trunk/includes/PDFGrnHeader.inc Added Paths: ----------- trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2010-01-15 21:59:19 UTC (rev 3300) +++ trunk/FormDesigner.php 2010-01-16 09:52:39 UTC (rev 3301) @@ -78,6 +78,9 @@ /*First create a simple xml object from the main file */ $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/'.$_POST['FormName']); $FormDesign['name']=$_POST['formname']; + if (substr($_POST['PaperSize'],-8)=='Portrait') { + $_POST['PaperSize']=substr($_POST['PaperSize'],0,strlen($_POST['PaperSize'])-9); + } $FormDesign->PaperSize=$_POST['PaperSize']; $FormDesign->LineHeight=$_POST['LineHeight']; /*Iterate through the object filling in the values from @@ -98,7 +101,14 @@ * PDF creating script */ if (isset($_POST['preview'])) { $FormDesign->asXML(sys_get_temp_dir().'/'.$_POST['FormName']); - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PO_PDFPurchOrder.php?' . SID .'OrderNo=Preview">'; + switch ($_POST['FormName']) { + case 'PurchaseOrder.xml': + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PO_PDFPurchOrder.php?' . SID .'OrderNo=Preview">'; + break; + case 'GoodsReceived.xml': + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; + break; + } } else { /* otherwise check that the web server has write premissions on the companies * directory and save the xml file to the correct directory */ @@ -141,7 +151,7 @@ } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Form Design') . '" alt="">' . ' ' . _('Form Design').'<br />'. $FormDesign['name'] . ''; echo '<div class="page_help_text">' . _('Enter the changes that you want in the form layout below.') .'<br /> '. _('All measurements are in millimetres') . '.</div><br>'; -$Papers=array('A4_Landscape', 'A4_Portrait', 'A3_Lanscape', 'A3_Portrait'); // Possible paper sizes/orientations +$Papers=array('A4_Landscape', 'A4_Portrait', 'A3_Landscape', 'A3_Portrait'); // Possible paper sizes/orientations echo '<form method="post" id="Form" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; echo '<input name=FormName type=hidden value="'.$_POST['FormName'].'">'; echo '<table width=85% border=1>'; //Start of outer table Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2010-01-15 21:59:19 UTC (rev 3300) +++ trunk/PDFGrn.php 2010-01-16 09:52:39 UTC (rev 3301) @@ -7,77 +7,79 @@ $PageSecurity = 2; include('includes/session.inc'); +$FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/GoodsReceived.xml'); +// Set the paper size/orintation +$PaperSize = $FormDesign->PaperSize; +$PageNumber=1; +$line_height=$FormDesign->LineHeight; + include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Goods Received Note') ); -$FontSize=10; -$PageNumber=1; -$line_height=12; +if (isset($_POST['GRNNo'])) { + $GRNNo=$_POST['GRNNo']; +} else if (isset($_GET['GRNNo'])) { + $GRNNo=$_GET['GRNNo']; +} else { + $GRNNo=''; +} include('includes/PDFGrnHeader.inc'); -$FontSize =10; -/*Print out the category totals */ - -$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 - +if ($GRNNo=='Preview') { + $ListCount = 1; // UldisN +} else { + $sql='SELECT itemcode, grnno, deliverydate, itemdescription, qtyrecd, supplierid from grns where grnbatch='.$GRNNo; + $result=DB_query($sql, $db); + $ListCount = DB_num_rows($result); // UldisN +} $counter=1; -while ($myrow=DB_fetch_array($result)) { - $StockID=$myrow[0]; - $GRNNo=$myrow[1]; - $Date=$myrow[2]; - $Description=$myrow[3]; - $Quantity=$myrow[4]; - $SupplierID=$myrow[5]; +$YPos=$FormDesign->Data->y; +while ($counter<=$ListCount) { + if ($GRNNo=='Preview') { + $StockID=str_pad('',10,'x'); + $Date='1/1/1900'; + $Description=str_pad('',30,'x'); + $Quantity='XXXXX.XX'; + $Supplier=str_pad('',25,'x'); + } else { + $myrow=DB_fetch_array($result); + $StockID=$myrow[0]; + $GRNNo=$myrow[1]; + $Date=ConvertSQLDate($myrow[2]); + $Description=$myrow[3]; + $Quantity=$myrow[4]; + $SupplierID=$myrow[5]; - $sql='select suppname from suppliers where supplierid="'.$SupplierID.'"'; - $supplierresult=DB_query($sql, $db); - $suppliermyrow=DB_fetch_array($supplierresult); - $Supplier=$suppliermyrow[0]; + $sql='select suppname from suppliers where supplierid="'.$SupplierID.'"'; + $supplierresult=DB_query($sql, $db); + $suppliermyrow=DB_fetch_array($supplierresult); + $Supplier=$suppliermyrow[0]; + } - $LeftOvers = $pdf->addTextWrap($Left_Margin+1,$YPos-(10*$counter),70,$FontSize, $StockID); - $LeftOvers = $pdf->addTextWrap($Left_Margin+75,$YPos-(10*$counter),175,$FontSize, $Description); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos-(10*$counter),300-$Left_Margin,$FontSize, $Date); - $LeftOvers = $pdf->addTextWrap($Left_Margin+315,$YPos-(10*$counter),150,$FontSize, $Supplier); - $LeftOvers = $pdf->addTextWrap($Left_Margin+475,$YPos-(10*$counter),300-$Left_Margin,$FontSize, $Quantity); - $counter = $counter + 1; + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $StockID); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $Description); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Date); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, $Supplier); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $Quantity); + $YPos += $line_height; + $counter++; } -$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos-(10*$counter+80),300-$Left_Margin,$FontSize, _('Date of Receipt: ').$Date); +$LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ').$Date); -$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos-(10*$counter+130),300-$Left_Margin,$FontSize, _('Signed for ').'______________________'); +$LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________'); -//$pdfcode = $pdf->output(); -//$len = strlen($pdfcode); - -//if ($len<=20){ if ($ListCount == 0) { //UldisN - $title = _('Print Price List Error'); + $title = _('GRN Error'); include('includes/header.inc'); - prnMsg(_('There were no stock transfer details to print'),'warn'); + prnMsg(_('There were no GRN to print'),'warn'); echo '<br><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>'; include('includes/footer.inc'); exit; } else { -/* UldisN - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=GRN.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Output('GRN.pdf', 'I'); -*/ $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN $pdf->__destruct(); //UldisN } - - - /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Added: trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml (rev 0) +++ trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml 2010-01-16 09:52:39 UTC (rev 3301) @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<form name="Goods Received Note"> + <PaperSize name="Paper size">A4</PaperSize> + <LineHeight name="Line height">12</LineHeight> + <logo type="image" name="Logo" id="Logo"> + <x>20</x> + <y>80</y> + <width>0</width> + <height>60</height> + </logo> + <CompanyName type="SimpleText" name="Company name" id="CompanyName"> + <FontSize>10</FontSize> + <x>425</x> + <y>30</y> + </CompanyName> + <GRNNumber type="SimpleText" name="GRN Number" id="GRNNumber"> + <FontSize>10</FontSize> + <x>425</x> + <y>48</y> + </GRNNumber> + <OrderNumber type="SimpleText" name="Order Number" id="OrderNumber"> + <FontSize>10</FontSize> + <x>425</x> + <y>66</y> + </OrderNumber> + <PrintDate type="SimpleText" name="Date Printed" id="PrintDate"> + <FontSize>10</FontSize> + <x>425</x> + <y>84</y> + </PrintDate> + <HeaderRectangle type="Rectangle" name="Header rectangle" id="HeaderRectangle"> + <x>40</x> + <y>114</y> + <width>525</width> + <height>24</height> + </HeaderRectangle> + <Headings type="ElementArray" name="Column headings"> + <Column1 type="SimpleText" name="Heading 1" id="Heading1"> + <FontSize>10</FontSize> + <x>41</x> + <y>126</y> + </Column1> + <Column2 type="SimpleText" name="Heading 2" id="Heading2"> + <FontSize>10</FontSize> + <x>116</x> + <y>126</y> + </Column2> + <Column3 type="SimpleText" name="Heading 3" id="Heading3"> + <FontSize>10</FontSize> + <x>291</x> + <y>126</y> + </Column3> + <Column4 type="SimpleText" name="Heading 4" id="Heading4"> + <FontSize>10</FontSize> + <x>391</x> + <y>126</y> + </Column4> + <Column5 type="SimpleText" name="Heading 5" id="Heading5"> + <FontSize>10</FontSize> + <x>491</x> + <y>126</y> + </Column5> + </Headings> + <DataRectangle type="Rectangle" name="Data rectangle" id="DataRectangle"> + <x>40</x> + <y>138</y> + <width>525</width> + <height>674</height> + </DataRectangle> + <Data type="ElementArray" name="Column Data"> + <y type="StartLine" name="Y co-ordinate of first data line" id="DataStartLine">156</y> + <Column1 type="DataText" name="Column 1" id="Data1"> + <FontSize>10</FontSize> + <x>41</x> + <Length>94</Length> + </Column1> + <Column2 type="DataText" name="Column 2" id="Data2"> + <FontSize>10</FontSize> + <x>116</x> + <Length>270</Length> + </Column2> + <Column3 type="DataText" name="Column 3" id="Data3"> + <FontSize>10</FontSize> + <x>291</x> + <Length>85</Length> + </Column3> + <Column4 type="DataText" name="Column 4" id="Data4"> + <FontSize>10</FontSize> + <x>356</x> + <Length>150</Length> + </Column4> + <Column5 type="DataText" name="Column 5" id="Data5"> + <FontSize>10</FontSize> + <x>506</x> + <Length>60</Length> + </Column5> + </Data> + <ReceiptDate type="SimpleText" name="Date Received" id="ReceiptDate"> + <FontSize>10</FontSize> + <x>40</x> + <y>722</y> + </ReceiptDate> + <SignedFor type="SimpleText" name="Signed Fror" id="SignedFor"> + <FontSize>10</FontSize> + <x>40</x> + <y>760</y> + </SignedFor> +</form> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-01-15 21:59:19 UTC (rev 3300) +++ trunk/doc/Change.log.html 2010-01-16 09:52:39 UTC (rev 3301) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>16/01/10 Tim: Add the Goods Received Note to the Form Designer</p> <p>15/01/10 Tim: UserLogin.php: The userid session variable was not being correctly set.</p> <p>13/01/10 Tim: api_xml-rpc.php: Use output buffering to hide html error messages so that the api can handle errors in a graceful way</p> <p>13/01/10 Tim: PO_Header.php: Show the mailto links correctly by decoding the hml entities</p> Modified: trunk/includes/PDFGrnHeader.inc =================================================================== --- trunk/includes/PDFGrnHeader.inc 2010-01-15 21:59:19 UTC (rev 3300) +++ trunk/includes/PDFGrnHeader.inc 2010-01-16 09:52:39 UTC (rev 3301) @@ -5,44 +5,25 @@ $pdf->newPage(); } -$FontSize=10; -$YPos= $Page_Height-$Top_Margin; -$XPos=0; -$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$XPos+20,$YPos-50,0,60); +$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); +$LeftOvers = $pdf->addText($FormDesign->CompanyName->x,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber->x,$Page_Height-$FormDesign->GRNNumber->y,$FormDesign->GRNNumber->FontSize, _('GRN number ').' ' . $GRNNo ); +$LeftOvers = $pdf->addText($FormDesign->OrderNumber->x,$Page_Height-$FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, _('PO number ').' ' . $_GET['PONo'] ); +$LeftOvers = $pdf->addText($FormDesign->PrintDate->x,$Page_Height-$FormDesign->PrintDate->y,$FormDesign->PrintDate->FontSize, _('Printed').': ' . Date($_SESSION['DefaultDateFormat']) . ' '. _('Page'). ' ' . $PageNumber); -$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos,300,$FontSize,$_SESSION['CompanyRecord']['coyname']); -$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos-($line_height*1.5),550,$FontSize, _('GRN number ').' ' . $_GET['GRNNo'] ); -$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos-($line_height*3),550,$FontSize, _('PO number ').' ' . $_GET['PONo'] ); -$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos-($line_height*4.5),140,$FontSize, _('Printed').': ' . Date($_SESSION['DefaultDateFormat']) . ' '. _('Page'). ' ' . $PageNumber); - -$YPos -= 60; - -$YPos -=$line_height; -//Note, this is ok for multilang as this is the value of a Select, text in option is different - -$YPos -=(2*$line_height); - /*Draw a rectangle to put the headings in */ +$pdf->Rectangle($FormDesign->HeaderRectangle->x, $Page_Height - $FormDesign->HeaderRectangle->y, $FormDesign->HeaderRectangle->width,$FormDesign->HeaderRectangle->height); -$pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height); -$pdf->line($Left_Margin, $YPos+$line_height,$Left_Margin, $YPos- $line_height); -$pdf->line($Left_Margin, $YPos- $line_height,$Page_Width-$Right_Margin, $YPos- $line_height); -$pdf->line($Page_Width-$Right_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos- $line_height); - /*set up the headings */ -$Xpos = $Left_Margin+1; +$LeftOvers = $pdf->addText($FormDesign->Headings->Column1->x,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, _('Item Number')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column2->x,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, _('Description')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column3->x,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, _('Date Recd')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column4->x,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->FontSize, _('Supplier')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column5->x,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->FontSize, _('Quantity')); -$LeftOvers = $pdf->addTextWrap($Xpos,$YPos,300-$Left_Margin,$FontSize, _('Item Number'), 'centre'); -$LeftOvers = $pdf->addTextWrap($Xpos+75,$YPos,300-$Left_Margin,$FontSize, _('Description'), 'centre'); -$LeftOvers = $pdf->addTextWrap($Xpos+250,$YPos,300-$Left_Margin,$FontSize, _('Date Recd'), 'centre'); -$LeftOvers = $pdf->addTextWrap($Xpos+350,$YPos,300-$Left_Margin,$FontSize, _('Supplier'), 'centre'); -$LeftOvers = $pdf->addTextWrap($Xpos+450,$YPos,300-$Left_Margin,$FontSize, _('Quantity'), 'centre'); +/*Draw a rectangle to put the data in */ +$pdf->Rectangle($FormDesign->DataRectangle->x, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); - -$FontSize=8; -$YPos -= (1.5 * $line_height); - $PageNumber++; - ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |