From: <tim...@us...> - 2010-09-05 10:36:26
|
Revision: 3704 http://web-erp.svn.sourceforge.net/web-erp/?rev=3704&view=rev Author: tim_schofield Date: 2010-09-05 10:36:19 +0000 (Sun, 05 Sep 2010) Log Message: ----------- List stock transactions by transaction type. Modified Paths: -------------- trunk/doc/Change.log.html trunk/index.php Added Paths: ----------- trunk/PDFStockTransListing.php trunk/includes/PDFStockTransListingPageHeader.inc Added: trunk/PDFStockTransListing.php =================================================================== --- trunk/PDFStockTransListing.php (rev 0) +++ trunk/PDFStockTransListing.php 2010-09-05 10:36:19 UTC (rev 3704) @@ -0,0 +1,144 @@ +<?php + +/* $Id$*/ + +/* $Revision: 1.13 $ */ + +$PageSecurity = 3; +include('includes/SQL_CommonFunctions.inc'); +include ('includes/session.inc'); + +$InputError=0; +if (isset($_POST['Date']) AND !Is_Date($_POST['Date'])){ + $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; + $InputError=1; + unset($_POST['Date']); +} + +if (!isset($_POST['Date'])){ + + $title = _('Stock Transaction Listing'); + include ('includes/header.inc'); + + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . _('Stock Transaction Listing').'</img></p></div>'; + + if ($InputError==1){ + prnMsg($msg,'error'); + } + + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; + echo '<table class=selection> + <tr> + <td>' . _('Enter the date for which the transactions are to be listed') . ":</td> + <td><input type=text name='Date' maxlength=10 size=10 class=date alt='" . $_SESSION['DefaultDateFormat'] . "' value='" . Date($_SESSION['DefaultDateFormat']) . "'></td> + </tr>"; + + echo '<tr><td>' . _('Transaction type') . '</td><td>'; + + echo "<select name='TransType'>"; + + echo '<option value=10>' . _('Sales Invoice').'</option>'; + echo '<option value=11>' . _('Sales Credit Note').'</option>'; + echo '<option value=16>' . _('Location Transfer').'</option>'; + echo '<option value=17>' . _('Stock Adjustment').'</option>'; + echo '<option value=25>' . _('Purchase Order Delivery').'</option>'; + echo '<option value=26>' . _('Work Order Receipt').'</option>'; + echo '<option value=28>' . _('Work Order Issue').'</option>'; + + echo '</select></td></tr>'; + + echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; + + + include('includes/footer.inc'); + exit; +} else { + + include('includes/ConnectDB.inc'); +} + +$sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; + +$result=DB_query($sql,$db,'','',false,false); + +if (DB_error_no($db)!=0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + prnMsg(_('An error occurred getting the transactions'),'error'); + include('includes/footer.inc'); + exit; +} elseif (DB_num_rows($result) == 0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + echo '<br>'; + prnMsg (_('There were no transactions found in the database for the date') . ' ' . $_POST['Date'] .'. '._('Please try again selecting a different date'), 'info'); + 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',_('Stock Transaction Listing')); +$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['Date'] ); +$line_height=12; +$PageNumber = 1; + +include ('includes/PDFStockTransListingPageHeader.inc'); + +while ($myrow=DB_fetch_array($result)){ + + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); + + $YPos -= ($line_height); + + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFStockTransListingPageHeader.inc'); + } /*end of new page header */ +} /* end of while there are customer receipts in the batch to print */ + + +$YPos-=$line_height; + +/* UldisN +$pdfcode = $pdf->output(); +$len = strlen($pdfcode); +header('Content-type: application/pdf'); +header('Content-Length: ' . $len); +header('Content-Disposition: inline; filename=ChequeListing.pdf'); +header('Expires: 0'); +header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); +header('Pragma: public'); + +$pdf->stream(); +*/ +$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; +$pdf->OutputD($ReportFileName);//UldisN +$pdf->__destruct(); //UldisN + +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-05 09:32:08 UTC (rev 3703) +++ trunk/doc/Change.log.html 2010-09-05 10:36:19 UTC (rev 3704) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>31/08/10 Ricard: upgrade3.11.1-3.12.sql - Database changes required for changes to report writer.</p> +<p>05/09/10 Tim: PDFStockTransListing.php - List stock transactions by transaction type.</p> +<p>05/09/10 Ricard: upgrade3.11.1-3.12.sql - Database changes required for changes to report writer.</p> <p>31/08/10 Tim: StockLocTransfer.php - Change quantity input field to have more than 5 digits</p> <p>28/08/10 Marcos Garcia Trejo: Fix ConfirmDispatchInvoice.php assembly components new qty on hand </p> <p>27/08/10 Tim: Add in rfequisition number into purchase order prints.</p> Added: trunk/includes/PDFStockTransListingPageHeader.inc =================================================================== --- trunk/includes/PDFStockTransListingPageHeader.inc (rev 0) +++ trunk/includes/PDFStockTransListingPageHeader.inc 2010-09-05 10:36:19 UTC (rev 3704) @@ -0,0 +1,79 @@ +<?php +/* $Id$*/ +if ($PageNumber>1){ + $pdf->newPage(); +} + +$YPos = $Page_Height - $Top_Margin - 50; + +$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin,$YPos,0,50); + +$FontSize=15; + +Switch ($_POST['TransType']) { + case 10: + $TransType=_('Customer Invoices'); + break; + case 11: + $TransType=_('Customer Credit Notes'); + break; + case 16: + $TransType=_('Location Transfers'); + break; + case 17: + $TransType=_('Stock Adjustments'); + break; + case 25: + $TransType=_('Purchase Order Deliveries'); + break; + case 26: + $TransType=_('Work Order Receipts'); + break; + case 28: + $TransType=_('Work Order Issues'); + break; +} + +$XPos = $Page_Width/2; +$YPos += 30; +$pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']); +$FontSize=12; +$pdf->addText($XPos, $YPos-20,$FontSize, $TransType . ' ' ._('dated') . ' ' . $_POST['Date']); + +$XPos = $Page_Width-$Right_Margin-50; +$YPos -=30; +$pdf->addText($XPos, $YPos+10,$FontSize, _('Page') . ': ' . $PageNumber); + +/*Now print out the company name and address */ +$XPos = $Left_Margin; +$YPos -= $line_height; + +/*draw a square grid for entering line items */ +$pdf->line($XPos, $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,$XPos, $Bottom_Margin); +$pdf->line($XPos, $Bottom_Margin,$XPos, $YPos); + +$pdf->line($Left_Margin+160, $YPos,$Left_Margin+160, $Bottom_Margin); +$pdf->line($Left_Margin+240, $YPos,$Left_Margin+240, $Bottom_Margin); +$pdf->line($Left_Margin+310, $YPos,$Left_Margin+310, $Bottom_Margin); +$pdf->line($Left_Margin+384, $YPos,$Left_Margin+384, $Bottom_Margin); +$pdf->line($Left_Margin+454, $YPos,$Left_Margin+454, $Bottom_Margin); + +$YPos -= $line_height; +/*Set up headings */ +$FontSize=8; + +$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,_('Stock Item'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,_('Reference'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,_('Trans Date'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,_('Quantity'), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,_('Location'), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,_('Reference'), 'right'); +$YPos-=$line_height; + +/*draw a line */ +$pdf->line($XPos, $YPos,$Page_Width-$Right_Margin, $YPos); + +$YPos -= ($line_height); +?> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2010-09-05 09:32:08 UTC (rev 3703) +++ trunk/index.php 2010-09-05 10:36:19 UTC (rev 3704) @@ -226,7 +226,7 @@ <td class="menu_group_items"> <!-- Orders Maintenance options --> <table width="100%"> <tr> - <td class="menu_group_items"> + <td class="menu_group_items"> <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> @@ -691,7 +691,13 @@ </td> </tr> <tr> + <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/PDFStockTransListing.php?' . SID . '">' . _('Daily Stock Transaction Listing') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> <?php echo GetRptLinks('inv'); ?> </td> </tr> @@ -1342,7 +1348,7 @@ </table> <?php break; - + Case 'PC': /* Petty Cash Module */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |