From: <dai...@us...> - 2012-12-24 01:21:29
|
Revision: 5772 http://sourceforge.net/p/web-erp/reponame/5772 Author: daintree Date: 2012-12-24 01:21:26 +0000 (Mon, 24 Dec 2012) Log Message: ----------- OutstandingGRNs.php now has show on screen option Modified Paths: -------------- trunk/GoodsReceivedNotInvoiced.php trunk/OutstandingGRNs.php trunk/Z_ImportStocks.php trunk/doc/Change.log Modified: trunk/GoodsReceivedNotInvoiced.php =================================================================== --- trunk/GoodsReceivedNotInvoiced.php 2012-12-23 05:10:12 UTC (rev 5771) +++ trunk/GoodsReceivedNotInvoiced.php 2012-12-24 01:21:26 UTC (rev 5772) @@ -90,36 +90,23 @@ locale_number_format(($QtyPending * $myrow['unitprice']),$myrow['decimalplaces']), $myrow['currcode'], locale_number_format(($QtyPending * $myrow['unitprice'] / $myrow['rate']),$_SESSION['CompanyRecord']['decimalplaces']), - $_SESSION['CountryOfOperation'] - ); - $i++; + $_SESSION['CompanyRecord']['currencydefault']); + + if ($i==15){ + $i=0; + echo $TableHeader; + } else { + $i++; + } } - printf('<td>%s</td> - <td class="number">%s</td> + printf('<td colspan="10">%s</td> <td>%s</td> <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> </tr>', - '', - '', - '', - '', - '', - '', - '', - '', - '', _('Total').':', locale_number_format($TotalHomeCurrency,$_SESSION['CompanyRecord']['decimalplaces']), - $_SESSION['CountryOfOperation'] - ); + $_SESSION['CompanyRecord']['currencydefault']); echo '</table> </div> Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2012-12-23 05:10:12 UTC (rev 5771) +++ trunk/OutstandingGRNs.php 2012-12-24 01:21:26 UTC (rev 5772) @@ -4,24 +4,15 @@ include('includes/session.inc'); -If (isset($_POST['PrintPDF']) - AND isset($_POST['FromCriteria']) +if (isset($_POST['FromCriteria']) AND mb_strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) AND mb_strlen($_POST['ToCriteria'])>=1){ - include('includes/PDFStarter.php'); - $pdf->addInfo('Title',_('Outstanding GRNs Report')); - $pdf->addInfo('Subject',_('Outstanding GRNs Valuation')); - $FontSize=10; - $PageNumber=1; - $line_height=12; - $Left_Margin=30; +/*Now figure out the data to report for the criteria under review */ - /*Now figure out the data to report for the criteria under review */ - $SQL = "SELECT grnno, - orderno, + purchorderdetails.orderno, grns.supplierid, suppliers.suppname, grns.itemcode, @@ -31,6 +22,8 @@ grns.stdcostunit, actprice, unitprice, + suppliers.currcode, + currencies.rate, currencies.decimalplaces as currdecimalplaces, stockmaster.decimalplaces as itemdecimalplaces FROM grns INNER JOIN purchorderdetails @@ -54,25 +47,40 @@ include('includes/header.inc'); prnMsg(_('The outstanding GRNs valuation details could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error'); echo '<br /><a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; + /* if ($debug==1){ echo '<br />' . $SQL; } + * */ include('includes/footer.inc'); exit; } - if (DB_num_rows($GRNsResult) == 0) { $title = _('Outstanding GRN Valuation') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('No outstanding GRNs valuation details retrieved'), 'warn'); echo '<br /><a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; + /* if ($debug==1){ echo '<br />' . $SQL; } + * */ include('includes/footer.inc'); exit; } +} + +If (isset($_POST['PrintPDF']) AND DB_num_rows($GRNsResult)>0){ + + include('includes/PDFStarter.php'); + $pdf->addInfo('Title',_('Outstanding GRNs Report')); + $pdf->addInfo('Subject',_('Outstanding GRNs Valuation')); + $FontSize=10; + $PageNumber=1; + $line_height=12; + $Left_Margin=30; + include ('includes/PDFOstdgGRNsPageHeader.inc'); $Tot_Val=0; @@ -155,14 +163,98 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_OSGRNsValuation_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); -} else { /*The option to print PDF was not hit */ +} elseif (isset($_POST['ShowOnScreen']) AND DB_num_rows($GRNsResult)>0) { + echo '<p class="page_title_text" align="center"><strong>' . _('Goods Received but not invoiced Yet') . '</strong></p>'; + + echo '<div class="page_help_text">' . _('Shows the list of goods received not yet invoiced, both in supplier currency and home currency. When run for all suppliers, the total in home curency should match the GL Account for Goods received not invoiced.') . '</div>'; + + echo '<div>'; + echo '<table class="selection">'; + $TableHeader = '<tr> + <th>' . _('Supplier') . '</th> + <th>' . _('PO#') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Qty Received') . '</th> + <th>' . _('Qty Invoiced') . '</th> + <th>' . _('Qty Pending') . '</th> + <th>' . _('Unit Price') . '</th> + <th>' .'' . '</th> + <th>' . _('Line Total') . '</th> + <th>' . '' . '</th> + <th>' . _('Line Total') . '</th> + <th>' . '' . '</th> + </tr>'; + echo $TableHeader; + $k = 0; //row colour counter + $i = 1; + $TotalHomeCurrency = 0; + while ($GRNs = DB_fetch_array($GRNsResult,$db) ){ + if ($k == 1) { + echo '<tr class="EvenTableRows">'; + $k = 0; + } else { + echo '<tr class="OddTableRows">'; + $k = 1; + } + $QtyPending = $GRNs['qtyrecd'] - $GRNs['quantityinv']; + $TotalHomeCurrency = $TotalHomeCurrency + ($QtyPending * $GRNs['unitprice'] / $GRNs['rate']); + printf('<td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $GRNs['supplierid'], + $GRNs['orderno'], + $GRNs['itemcode'], + $GRNs['qtyrecd'], + $GRNs['quantityinv'], + $QtyPending, + locale_number_format($GRNs['unitprice'],$GRNs['decimalplaces']), + $GRNs['currcode'], + locale_number_format(($QtyPending * $GRNs['unitprice']),$GRNs['decimalplaces']), + $GRNs['currcode'], + locale_number_format(($GRNs['qtyrecd'] - $GRNs['quantityinv'])*$GRNs['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']), + $_SESSION['CompanyRecord']['currencydefault']); + + if ($i==15){ + $i=0; + echo $TableHeader; + } else { + $i++; + } + } + printf('<td colspan="10">%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + _('Total').':', + locale_number_format($TotalHomeCurrency,$_SESSION['CompanyRecord']['decimalplaces']), + $_SESSION['CompanyRecord']['currencydefault']); + + echo '</table> + </div>'; + + include('includes/footer.inc'); + +} else { /*Neither the print PDF nor show on scrren option was hit */ + $title=_('Outstanding GRNs Report'); include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . - '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text" align="center"><strong>' . $title . '</strong></p>'; + echo '<div class="page_help_text">' . _('Shows the list of goods received not yet invoiced, both in supplier currency and home currency. When run for all suppliers the total in home curency should match the GL Account for Goods received not invoiced.') . '</div>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -180,6 +272,7 @@ <br /> <div class="centre"> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + <input type="submit" name="ShowOnScreen" value="' . _('Show On Screen') . '" /> </div> </div> </form>'; Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2012-12-23 05:10:12 UTC (rev 5771) +++ trunk/Z_ImportStocks.php 2012-12-24 01:21:26 UTC (rev 5772) @@ -9,7 +9,7 @@ // If this script is called with the gettemplate flag, then a template file is served // Otherwise, a file upload form is displayed -$headers = array( +$FieldHeadings = array( 'StockID', // 0 'STOCKID', 'Description', // 1 'DESCRIPTION', 'LongDescription', // 2 'LONGDESCRIPTION', @@ -33,31 +33,24 @@ if (isset($_FILES['userfile']) and $_FILES['userfile']['name']) { //start file processing //initialize - $AllowType='text/csv'; - $fieldTarget = 18; + $FieldTarget = 18; $InputError = 0; //check file info $FileName = $_FILES['userfile']['name']; - $tmpName = $_FILES['userfile']['tmp_name']; - $fileSize = $_FILES['userfile']['size']; - $fileType = $_FILES['userfile']['type']; - if ($fileType != $AllowType) { - prnMsg (_('File has type '. $fileType. ', but only '. $AllowType. ' is allowed.'),'error'); - include('includes/footer.inc'); - exit; - } - + $TempName = $_FILES['userfile']['tmp_name']; + $FileSize = $_FILES['userfile']['size']; + //get file handle - $handle = fopen($tmpName, 'r'); + $FileHandle = fopen($TempName, 'r'); //get the header row - $headRow = fgetcsv($handle, 10000, ","); + $headRow = fgetcsv($FileHandle, 10000, ","); //check for correct number of fields - if ( count($headRow) != count($headers) ) { - prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($headers). '. Try downloading a new template.'),'error'); - fclose($handle); + if ( count($headRow) != count($FieldHeadings) ) { + prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($FieldHeadings). '. Try downloading a new template.'),'error'); + fclose($FileHandle); include('includes/footer.inc'); exit; } @@ -65,9 +58,9 @@ //test header row field name and sequence $head = 0; foreach ($headRow as $headField) { - if ( mb_strtoupper($headField) != mb_strtoupper($headers[$head]) ) { + if ( mb_strtoupper($headField) != mb_strtoupper($FieldHeadings[$head]) ) { prnMsg (_('File contains incorrect headers ('. mb_strtoupper($headField). ' != '. mb_strtoupper($header[$head]). '. Try downloading a new template.'),'error'); - fclose($handle); + fclose($FileHandle); include('includes/footer.inc'); exit; } @@ -79,13 +72,13 @@ //loop through file rows $row = 1; - while ( ($myrow = fgetcsv($handle, 10000, ",")) !== FALSE ) { + while ( ($myrow = fgetcsv($FileHandle, 10000, ",")) !== FALSE ) { //check for correct number of fields $fieldCount = count($myrow); - if ($fieldCount != $fieldTarget){ - prnMsg (_($fieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); - fclose($handle); + if ($fieldCount != $FieldTarget){ + prnMsg (_($FieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); + fclose($FileHandle); include('includes/footer.inc'); exit; } @@ -276,11 +269,11 @@ prnMsg( _('Batch Import of') .' ' . $FileName . ' '. _('has been completed. All transactions committed to the database.'),'success'); } - fclose($handle); + fclose($FileHandle); } elseif ( isset($_POST['gettemplate']) || isset($_GET['gettemplate']) ) { //download an import template - echo '<br /><br /><br />"'. implode('","',$headers). '"<br /><br /><br />'; + echo '<br /><br /><br />"'. implode('","',$FieldHeadings). '"<br /><br /><br />'; } else { //show file upload form Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-12-23 05:10:12 UTC (rev 5771) +++ trunk/doc/Change.log 2012-12-24 01:21:26 UTC (rev 5772) @@ -1,5 +1,6 @@ webERP Change Log +24/12/12 Ricard: OutstandingGRNs.php now has show on screen option 15/12/12 Phil: Customer login selection of branch option removed unecessary fields from customer order placement 15/12/12 Bob Thomas: modified default.css for the default theme to use pt based default font and other font sizes based on this 12/12/12 Phil/RockStar: SelectOrderitems.php would not recognise Customer only logins correctly as there are two tokens in a Customer login role. and was testing to see if just one token! |