From: <dai...@us...> - 2011-10-05 07:26:15
|
Revision: 4712 http://web-erp.svn.sourceforge.net/web-erp/?rev=4712&view=rev Author: daintree Date: 2011-10-05 07:26:06 +0000 (Wed, 05 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFDeliveryDifferences.php trunk/PDFGrn.php trunk/PDFLowGP.php trunk/PDFOrderStatus.php trunk/PDFOrdersInvoiced.php trunk/PDFPeriodStockTransListing.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFQuotation.php trunk/PDFQuotationPortrait.php trunk/PDFReceipt.php trunk/PDFRemittanceAdvice.php trunk/PDFStockCheckComparison.php trunk/PDFStockLocTransfer.php trunk/PDFStockNegatives.php trunk/PDFStockTransfer.php trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/POReport.php trunk/PO_Header.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PageSecurity.php trunk/PaymentAllocations.php trunk/PaymentTerms.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/TopItems.php trunk/doc/INSTALL.txt trunk/doc/Manual/ManualCreatingNewSystem.html trunk/doc/Manual/ManualIntroduction.html trunk/includes/GetConfig.php Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFBankingSummary.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -32,8 +32,14 @@ while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['transno'].'">'._('Batch') .' '. $myrow['transno'].' - '.ConvertSqlDate($myrow['transdate']).'</option>'; } - echo '</select></td></tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="EnterBatchNo" value="' . _('Create PDF') . '"></div></form>'; + echo '</select></td> + </tr> + </table>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="EnterBatchNo" value="' . _('Create PDF') . '"> + </div> + </form>'; include ('includes/footer.inc'); exit; @@ -41,21 +47,21 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode, - currencies.decimalplaces AS currdecimalplaces - FROM bankaccounts INNER JOIN banktrans - ON bankaccounts.accountcode=banktrans.bankact - INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev - WHERE banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode, + currencies.decimalplaces AS currdecimalplaces + FROM bankaccounts INNER JOIN banktrans + ON bankaccounts.accountcode=banktrans.bankact + INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev + WHERE banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); Modified: trunk/PDFChequeListing.php =================================================================== --- trunk/PDFChequeListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFChequeListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -26,17 +26,17 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; - if ($InputError==1){ - prnMsg($msg,'error'); - } + if ($InputError==1){ + prnMsg($msg,'error'); + } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> - <tr> + echo '<table class="selection"> + <tr> <td>' . _('Enter the date from which cheques are to be listed') . ':</td> - <td><input type="text" name="FromDate" maxlength="10" size="10" class=date alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> + <td><input type="text" name="FromDate" maxlength="10" size="10" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td> </tr>'; echo '<tr><td>' . _('Enter the date to which cheques are to be listed') . ':</td> <td><input type="text" name="ToDate" maxlength="10" size="10" class=date alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> @@ -56,14 +56,18 @@ echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ':</td> - <td><select name="Email">'; - echo '<option selected value="No">' . _('No') . '</option>'; - echo '<option value="Yes">' . _('Yes') . '</option>'; - echo '</select></td> + echo '<tr> + <td>' . _('Email the report off') . ':</td> + <td><select name="Email"> + <option selected value="No">' . _('No') . '</option> + <option value="Yes">' . _('Yes') . '</option> + </select></td> </tr> </table> - <br /><div class="centre"><input type=submit name="Go" value="' . _('Create PDF') . '"></div>'; + <br /> + <div class="centre"> + <input type=submit name="Go" value="' . _('Create PDF') . '"> + </div>'; include('includes/footer.inc'); exit; Modified: trunk/PDFCustTransListing.php =================================================================== --- trunk/PDFCustTransListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFCustTransListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -17,8 +17,10 @@ $title = _('Customer 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="">' . ' ' - . _('Customer Transaction Listing').'</p>'; + echo '<div class="centre"> + <p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' . _('Customer Transaction Listing'). + '</p>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -27,24 +29,25 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"> - <tr> + <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 '<tr><td>' . _('Transaction type') . '</td> + <td><select name="TransType"> + <option value=10>' . _('Invoices') . '</option> + <option value=11>' . _('Credit Notes') . '</option> + <option value=12>' . _('Receipts') . '</option> + </select></td> + </tr>'; - echo '<select name="TransType">'; - - echo '<option value=10>' . _('Invoices') . '</option>'; - echo '<option value=11>' . _('Credit Notes') . '</option>'; - echo '<option value=12>' . _('Receipts') . '</option>'; - - echo '</select></td></tr>'; - echo '</select></td></tr> </table> - <br /><div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; + <br /> + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '"> + </div>'; include('includes/footer.inc'); exit; Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFCustomerList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -28,141 +28,141 @@ if (in_array('All', $_POST['Areas'])){ if (in_array('All', $_POST['SalesPeople'])){ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - ORDER BY area, - salesman, - debtorsmaster.debtorno, - custbranch.branchcode'; + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + ORDER BY area, + salesman, + debtorsmaster.debtorno, + custbranch.branchcode"; } else { /* there are a range of salesfolk selected need to build the where clause */ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - WHERE ('; + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + WHERE ("; $i=0; foreach ($_POST['SalesPeople'] as $Salesperson){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.salesman='" . $Salesperson ."'"; } - $SQL .=') ORDER BY area, + $SQL .=") ORDER BY area, salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } /*end if SalesPeople =='All' */ } else { /* not all sales areas has been selected so need to build the where clause */ if (in_array('All', $_POST['SalesPeople'])){ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - WHERE ('; - + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + WHERE ("; + $i=0; foreach ($_POST['Areas'] as $Area){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.area='" . $Area ."'"; } - $SQL .= ') ORDER BY custbranch.area, + $SQL .= ") ORDER BY custbranch.area, custbranch.salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } else { /* there are a range of salesfolk selected need to build the where clause */ - $SQL = 'SELECT debtorsmaster.debtorno, + $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, debtorsmaster.address1, debtorsmaster.address2, @@ -193,32 +193,32 @@ ON custbranch.area = areas.areacode INNER JOIN salesman ON custbranch.salesman=salesman.salesmancode - WHERE ('; + WHERE ("; $i=0; foreach ($_POST['Areas'] as $Area){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.area='" . $Area ."'"; } - $SQL .= ') AND ('; + $SQL .= ") AND ("; $i=0; foreach ($_POST['SalesPeople'] as $Salesperson){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.salesman='" . $Salesperson ."'"; } - $SQL .=') ORDER BY custbranch.area, + $SQL .=") ORDER BY custbranch.area, custbranch.salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } /*end if Salesfolk =='All' */ } /* end if not all sales areas was selected */ @@ -261,11 +261,11 @@ since the date entered */ $SQL = "SELECT SUM((ovamount+ovfreight+ovdiscount)/rate) AS turnover - FROM debtortrans - WHERE debtorno='" . $Customers['debtorno'] . "' - AND branchcode='" . $Customers['branchcode'] . "' - AND (type=10 or type=11) - AND trandate >='" . FormatDateForSQL($_POST['ActivitySince']). "'"; + FROM debtortrans + WHERE debtorno='" . $Customers['debtorno'] . "' + AND branchcode='" . $Customers['branchcode'] . "' + AND (type=10 or type=11) + AND trandate >='" . FormatDateForSQL($_POST['ActivitySince']). "'"; $ActivityResult = DB_query($SQL, $db, _('Could not retrieve the activity of the branch because'), _('The failed SQL was')); $ActivityRow = DB_fetch_row($ActivityResult); @@ -382,10 +382,10 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('For Sales folk'). ':</td><td><select name=SalesPeople[] multiple>'; + echo '<tr><td>' . _('For Sales folk'). ':</td> + <td><select name=SalesPeople[] multiple> + <option selected value="All">'. _('All sales folk') . '</option>'; - echo '<option selected value="All">'. _('All sales folk'); - $sql = "SELECT salesmancode, salesmanname FROM salesman"; $SalesFolkResult = DB_query($sql,$db); @@ -394,20 +394,28 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Level Of Activity'). ':</td><td><select name="Activity">'; + echo '<tr><td>' . _('Level Of Activity'). ':</td> + <td><select name="Activity"> + <option selected value="All">'. _('All customers') . '</option> + <option value="GreaterThan">'. _('Sales Greater Than') . '</option> + <option value="LessThan">'. _('Sales Less Than') . '</option> + </select></td> + <td>'; - echo '<option selected value="All">'. _('All customers') . '</option>'; - echo '<option value="GreaterThan">'. _('Sales Greater Than') . '</option>'; - echo '<option value="LessThan">'. _('Sales Less Than') . '</option>'; - echo '</select></td><td>'; + echo '<input type="text" class="number" name="ActivityAmount" size="8" maxlength="8" value=0></td> + </tr>'; - echo '<input type="text" class=number name="ActivityAmount" size=8 maxlength=8 value=0></td></tr>'; - $DefaultActivitySince = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-6,0,Date('y'))); - echo '<tr><td>' . _('Activity Since'). ':</td> - <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="ActivitySince" size=10 maxlength=10 value="' . $DefaultActivitySince . '"></td></tr>'; + echo '<tr> + <td>' . _('Activity Since'). ':</td> + <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="ActivitySince" size="10" maxlength="10" value="' . $DefaultActivitySince . '"></td> + </tr>'; - echo '</table><br /><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=Submit Name="PrintPDF" value="'. _('Print PDF'). '"> + </div>'; include('includes/footer.inc'); Modified: trunk/PDFDeliveryDifferences.php =================================================================== --- trunk/PDFDeliveryDifferences.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFDeliveryDifferences.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -26,30 +26,39 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '" /></td> </tr>'; - echo '<tr> - <td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> + echo '<tr> + <td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td> </tr>'; - echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + echo '<tr> + <td>' . _('Inventory Category') . '</td> + <td>'; - $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; - $result = DB_query($sql,$db); + $sql = "SELECT categorydescription, + categoryid + FROM stockcategory + WHERE stocktype<>'D' + AND stocktype<>'L'"; + + $result = DB_query($sql,$db); - echo '<select name="CategoryID">'; - echo '<option selected value="All">' . _('Over All Categories') . '</option>'; + echo '<select name="CategoryID"> + <option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Inventory Location') . ':</td> + echo '<tr> + <td>' . _('Inventory Location') . ':</td> <td><select name="Location"> <option selected value="All">' . _('All Locations') . '</option>'; @@ -59,16 +68,18 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ':</td> + echo '<tr> + <td>' . _('Email the report off') . ':</td> <td><select name="Email"> <option selected value="No">' . _('No') . '</option> <option value="Yes">' . _('Yes') . '</option> - </select> - </td> + </select></td> </tr> </table> <br /> - <div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '"> + </div>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -84,6 +95,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -100,6 +112,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -117,6 +130,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -138,6 +152,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -162,7 +177,7 @@ include('includes/header.inc'); prnMsg( _('An error occurred getting the variances between deliveries and orders'),'error'); if ($debug==1){ - prnMsg( _('The SQL used to get the variances between deliveries and orders that failed was') . "<br />$SQL",'error'); + prnMsg( _('The SQL used to get the variances between deliveries and orders that failed was') . '<br />' . $SQL,'error'); } include ('includes/footer.inc'); exit; @@ -195,7 +210,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,40,$FontSize,$myrow['orderno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos,200,$FontSize,$myrow['stockid'] . ' - ' . $myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,locale_number_format($myrow['quantitydiff']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,locale_number_format($myrow['quantitydiff'],$myrow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+335,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+385,$YPos,50,$FontSize,$myrow['branch'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+435,$YPos,50,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFGrn.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -54,7 +54,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem LEFT JOIN stockmaster ON grns.itemcode=stockmaster.stockid - WHERE grnbatch='".filter_number_format($GRNNo)."'"; + WHERE grnbatch='". $GRNNo ."'"; $GRNResult=DB_query($sql, $db); $NoOfGRNs = DB_num_rows($GRNResult); @@ -69,7 +69,7 @@ suppliers.address6 FROM grns INNER JOIN suppliers ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".filter_number_format($GRNNo)."'"; + WHERE grnbatch='". $GRNNo ."'"; $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); $SuppRow = DB_fetch_array($SuppResult); } @@ -88,7 +88,7 @@ $DecimalPlaces=2; } if (is_numeric($myrow['conversionfactor']) AND $myrow['conversionfactor'] !=0){ - $SuppliersQuantity=locale_number_format(filter_number_format($myrow['qtyrecd']/$myrow['conversionfactor']),$DecimalPlaces); + $SuppliersQuantity=locale_number_format($myrow['qtyrecd']/$myrow['conversionfactor'],$DecimalPlaces); } else { $SuppliersQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); } Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFLowGP.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -47,7 +47,7 @@ ON stockmoves.debtorno=debtorsmaster.debtorno WHERE stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' AND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "' - AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . filter_number_format(filter_number_format($_POST['GPMin'])/100) . " + AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . $_POST['GPMin']/100 . " ORDER BY stockmaster.stockid"; $LowGPSalesResult = DB_query($SQL,$db,'','',false,false); @@ -129,21 +129,21 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Sales Made From') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" size=10 maxlength="10" value="' . $_POST['FromDate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" size=10 maxlength="10" value="' . $_POST['FromDate'] . '" /></td> </tr>'; echo '<tr><td>' . _('Sales Made To') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '" /></td> </tr>'; echo '<tr><td>' . _('Show sales with GP') . '%' . _('below') . ':</td> - <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '"></td> + <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '" /></td> </tr>'; echo '</table> <br /> <div class="centre"> - <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; } include('includes/footer.inc'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFOrderStatus.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -34,7 +34,7 @@ echo '<table class="selection"> <tr> <td>' . _('Enter the date from which orders are to be listed') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '" /></td> </tr>'; echo '<tr><td>' . _('Enter the date to which orders are to be listed') . ':</td><td>'; echo '<input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat']) . '"></td></tr>'; Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFOrdersInvoiced.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -290,7 +290,7 @@ if($OrderNo != $myrow['orderno']){ if ($AccumOrderTotal !=0){ $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,120,$FontSize,_('Total Invoiced for order') . ' ' . $OrderNo , 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($AccumOrderTotal,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -395,7 +395,7 @@ while ($InvRow=DB_fetch_array($InvoicesResult)){ - $ValueInvoiced = filter_number_format($InvRow['price']*$InvRow['quantity']); + $ValueInvoiced = $InvRow['price']*$InvRow['quantity']; $LeftOvers = $pdf->addTextWrap($Left_Margin+150,$YPos,90,$FontSize,$InvRow['typename'] . ' ' . $InvRow['transno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,60,$FontSize,locale_number_format($InvRow['quantity'],$myrow['decimalplaces']), 'right'); @@ -424,7 +424,7 @@ $YPos -= ($line_height); $LeftOvers = $pdf->addTextWrap($Left_Margin+260,$YPos,100,$FontSize,_('GRAND TOTAL INVOICED'), 'right'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($AccumTotalInv,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $pdf->OutputD($_SESSION['DatabaseName'] . '_OrdersInvoiced_' . date('Y-m-d') . '.pdf'); Modified: trunk/PDFPeriodStockTransListing.php =================================================================== --- trunk/PDFPeriodStockTransListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPeriodStockTransListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -46,16 +46,18 @@ <option value=17>' . _('Stock Adjustment').'</option> <option value=25>' . _('Purchase Order Delivery').'</option> <option value=26>' . _('Work Order Receipt').'</option> - <option value=28>' . _('Work Order Issue').'</option>'; + <option value=28>' . _('Work Order Issue').'</option> + </select></td> + </tr>'; - echo '</select></td></tr>'; - $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql, $db); - echo '<tr><td>' . _('For Stock Location') . ':</td> - <td><select name="StockLocation">'; - echo '<option value="All">' . _('All') . '</option>'; + echo '<tr> + <td>' . _('For Stock Location') . ':</td> + <td><select name="StockLocation"> + <option value="All">' . _('All') . '</option>'; + while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ Modified: trunk/PDFPickingList.php =================================================================== --- trunk/PDFPickingList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPickingList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -12,13 +12,13 @@ $title = _('Picking Lists Not Enabled'); include('includes/header.inc'); echo '<br />'; - prnMsg( _('The system is not configured for picking lists. Please consult your system administrator.'), 'info'); + prnMsg( _('The system is not configured for picking lists. A configuration parameter is required where picking slips are required. Please consult your system administrator.'), 'info'); include('includes/footer.inc'); exit; } /* Show selection screen if we have no orders to work with */ -if ((!isset($_GET['TransNo']) or $_GET['TransNo']=="") and !isset($_POST['TransDate'])){ +if ((!isset($_GET['TransNo']) or $_GET['TransNo']=='') and !isset($_POST['TransDate'])){ $title = _('Select Picking Lists'); include('includes/header.inc'); $sql="SELECT loccode, @@ -28,17 +28,24 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection"><tr>'; - echo '<td>'._('Create picking lists for all deliveries to be made on').' : '.'</td>'; - echo '<td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="TransDate" maxlength=10 size=11 value='.date($_SESSION['DefaultDateFormat'], mktime(date('m'),date('Y'),date('d')+1)).'></td></tr>'; + echo '<table class="selection"> + <tr> + <td>'._('Create picking lists for all deliveries to be made on').' : '.'</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="TransDate" maxlength="10" size="11" value="'.date($_SESSION['DefaultDateFormat'], mktime(date('m'),date('Y'),date('d')+1)).'" /></td> + </tr>'; echo '<tr><td>'._('From Warehouse').' : '.'</td> <td><select name="loccode">'; while ($myrow=DB_fetch_array($result)) { echo '<option value='.$myrow['loccode'].'>'.$myrow['locationname'].'</option>'; } - echo '</select></td></tr>'; - echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="Process" value="' . _('Print Picking Lists') . '"></div></form>'; + echo '</select></td> + </tr> + </table>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="Process" value="' . _('Print Picking Lists') . '"> + </div> + </form>'; include('includes/footer.inc'); exit(); } @@ -46,7 +53,7 @@ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details from the database'); -if (!isset($_POST['TransDate']) and $_GET['TransNo'] != 'Preview') { +if (!isset($_POST['TransDate']) AND $_GET['TransNo'] != 'Preview') { /* If there is no transaction date set, then it must be for a single order */ $sql = "SELECT salesorders.debtorno, salesorders.orderno, @@ -80,7 +87,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . filter_number_format($_GET['TransNo'])."'"; + AND salesorders.orderno='" . $_GET['TransNo']."'"; } else if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { /* We are printing picking lists for all orders on a day */ @@ -117,22 +124,26 @@ AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode AND salesorders.fromstkloc='".$_POST['loccode']."' - AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; + AND salesorders.deliverydate<='" . FormatDateForSQL($_POST['TransDate'])."'"; } if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { $result=DB_query($sql,$db, $ErrMsg); - + /*if there are no rows, there's a problem. */ if (DB_num_rows($result)==0){ $title = _('Print Picking List Error'); include('includes/header.inc'); echo '<br />'; prnMsg( _('Unable to Locate any orders for this criteria '), 'info'); - echo '<br /><table class="selection"><tr><td> - <a href="'. $rootpath . '/PDFPickingList.php">' . _('Enter Another Date') . '</a> - </td></tr></table><br />'; + echo '<br /> + <table class="selection"> + <tr> + <td><a href="'. $rootpath . '/PDFPickingList.php">' . _('Enter Another Date') . '</a></td> + </tr> + </table> + <br />'; include('includes/footer.inc'); exit(); } @@ -207,10 +218,10 @@ /* Are there any picking lists for this order already */ $sql="SELECT COUNT(orderno) FROM pickinglists - WHERE orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) . "'"; - $countresult=DB_query($sql, $db); - $count=DB_fetch_row($countresult); - if ($count[0]==0) { + WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "'"; + $CountResult=DB_query($sql, $db); + $Count=DB_fetch_row($CountResult); + if ($Count[0]==0) { /* There are no previous picking lists for this order */ $sql = "SELECT salesorderdetails.stkcode, stockmaster.description, @@ -223,7 +234,7 @@ FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filer_locale_number_format($OrdersToPick[$i]['orderno']) ."'"; + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."'"; } else { /* There are previous picking lists for this order so * need to take those quantities into account @@ -245,22 +256,25 @@ ON salesorderdetails.orderno=pickinglists.orderno LEFT JOIN pickinglistdetails ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno - WHERE salesorderdetails.orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) ."' + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."' AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; } - $lineresult=DB_query($sql,$db, $ErrMsg); + $LineResult=DB_query($sql,$db, $ErrMsg); } - if ((isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') or (isset($lineresult) and DB_num_rows($lineresult)>0)){ + if ((isset($_GET['TransNo']) + AND $_GET['TransNo'] == 'Preview') + OR (isset($LineResult) + AND DB_num_rows($LineResult)>0)){ /*Yes there are line items to start the ball rolling with a page header */ include('includes/PDFPickingListHeader.inc'); if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { - $LinesToShow=DB_num_rows($lineresult); + $LinesToShow=DB_num_rows($LineResult); $PickingListNo = GetNextTransNo(19, $db); $sql="INSERT INTO pickinglists VALUES ( '" . $PickingListNo ."', - '" . filter_number_format($OrdersToPick[$i]['orderno'])."', + '" . $OrdersToPick[$i]['orderno']."', '" . FormatDateForSQL($_POST['TransDate'])."', '" . date('Y-m-d')."', '0000-00-00')"; @@ -274,6 +288,7 @@ while ($Lines<$LinesToShow){ if (isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') { $myrow2['stkcode']=str_pad('',10,'x'); + $myrow2['decimalplaces']=2; $DisplayQty='XXXX.XX'; $DisplayPrevDel='XXXX.XX'; $DisplayQtySupplied='XXXX.XX'; @@ -281,23 +296,23 @@ $myrow2['narrative']=str_pad('',18,'x'); $itemdesc = $myrow2['description'] . ' - ' . $myrow2['narrative']; } else { - $myrow2=DB_fetch_array($lineresult); - if ($count[0]==0) { + $myrow2=DB_fetch_array($LineResult); + if ($Count[0]==0) { $myrow2['qtyexpected']=0; $myrow2['qtypicked']=0; } $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $DisplayQtySupplied = locale_number_format(filer_locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked']),$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked'],$myrow2['decimalplaces']); $itemdesc = $myrow2['description'] . ' - ' . $myrow2['narrative']; $sql="INSERT INTO pickinglistdetails VALUES( '" . $PickingListNo ."', '" . $Lines."', '" . $myrow2['orderlineno']."', - '" . filter_number_format($DisplayQtySupplied) ."', + '" . $DisplayQtySupplied ."', 0)"; - $lineresult=DB_query($sql, $db); + $LineResult=DB_query($sql, $db); } $ListCount ++; Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPriceList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -181,7 +181,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47+130,$YPos,150,$FontSize,$DisplayUnitPrice, 'right'); if ($PriceList['price']!=0){ - $DisplayGPPercent = (int)filter_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price'])) . '%'; + $DisplayGPPercent = locale_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price']),1) . '%'; } else { $DisplayGPPercent = 0; } Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPrintLabel.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -10,12 +10,13 @@ $MsgErr=null; $DecimalPlaces=2; $pdf= null; +/* The variable $AllLabels is the global variable that contains the list */ +$AllLabels = getXMLFile(LABELS_FILE); +/* of all the label objects defined until now. In case of a fresh +installation or an empty XML labels file it holds a NULL value. - $AllLabels = //!< The variable $AllLabels is the global variable that contains the list - getXMLFile(LABELS_FILE); //!< of all the label objects defined until now. In case of a fresh - //!< installation or an empty XML labels file it holds a NULL value. - -// If there is no label templates, the user could select to set up a new one +If there is no label templates, the user could select to set up a new one +*/ if ($AllLabels==null) { abortMsg( _('There isn\'t any label template to select for printing. Click') . @@ -345,11 +346,12 @@ $obj = $label->dimensions; $unit = (string)$obj->Unit; - if ( array_key_exists($unit , $scales) ) + if ( array_key_exists($unit , $scales) ) { $factor = $scales[$unit]; - else + } else { abortMsg( _('Unit not defined in scale operation! Correct the template') ); - + } + $dims = array(); foreach ($DimensionTags as $iTag=>$tag) { if ($tag['type']=='n') // it is a data numeric Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFQuotation.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -7,19 +7,32 @@ //Get Out if we have no order number to work with If (!isset($_GET['QuotationNo']) || $_GET['QuotationNo']==""){ - $title = _('Select Quotation To Print'); - include('includes/header.inc'); - echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Select a Quotation to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'&Quotations=Quotes_Only">' . _('Quotations') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Select Quotation To Print'); + include('includes/header.inc'); + echo '<div class="centre"> + <br /> + <br /> + <br />'; + prnMsg( _('Select a Quotation to Print before calling this page') , 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Quotations') . '</a></td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + include('includes/footer.inc'); + exit(); } /*retrieve the order details from the database to print */ -$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . filter_number_format($_GET['QuotationNo']) . ' ' . _('from the database'); +$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . $_GET['QuotationNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, salesorders.comments, @@ -55,7 +68,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; + AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -63,15 +76,18 @@ if (DB_num_rows($result)==0){ $title = _('Print Quotation Error'); include('includes/header.inc'); - echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); + echo '<div class="centre"> + <br /> + <br /> + <br />'; + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); echo '<br /> <br /> <br /> <table class="table_index"> <tr> <td class="menu_group_item"> - <ul><li><a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a></li></ul> + <a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a> </td> </tr> </table> @@ -116,7 +132,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['QuotationNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['QuotationNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -147,7 +163,7 @@ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $DisplayPrice = locale_number_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent'])); + $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); $TaxProv = $myrow['taxprovinceid']; $TaxCat = $myrow2['taxcatid']; $Branch = $myrow['branchcode']; @@ -169,11 +185,11 @@ $TaxClass = 100 * $myrow4['taxrate']; } - $DisplayTaxClass = $TaxClass . "%"; - $TaxAmount = filter_number_format((($SubTot/100)*(100+$TaxClass))-$SubTot); + $DisplayTaxClass = $TaxClass . '%'; + $TaxAmount = (($SubTot/100)*(100+$TaxClass))-$SubTot; $DisplayTaxAmount = locale_number_format($TaxAmount,$myrow['currdecimalplaces']); - $LineTotal = filter_number_format($SubTot + $TaxAmount); + $LineTotal = $SubTot + $TaxAmount; $DisplayTotal = locale_number_format($LineTotal,$myrow['currdecimalplaces']); $FontSize=10; Modified: trunk/PDFQuotationPortrait.php =================================================================== --- trunk/PDFQuotationPortrait.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFQuotationPortrait.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -70,7 +70,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; + AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -82,7 +82,7 @@ <br /> <br /> <br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); echo '<br /> <br /> <br /> @@ -111,7 +111,7 @@ $PaperSize = 'A4'; include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Customer Quotation') ); -$pdf->addInfo('Subject', _('Quotation') . ' ' . filter_number_format($_GET['QuotationNo'])); +$pdf->addInfo('Subject', _('Quotation') . ' ' . $_GET['QuotationNo']); $FontSize=12; $PageNumber = 1; $line_height=24; @@ -163,7 +163,7 @@ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $DisplayPrice = locale_number_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent'])); + $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); $TaxProv = $myrow['taxprovinceid']; $TaxCat = $myrow2['taxcatid']; $Branch = $myrow['branchcode']; @@ -186,7 +186,7 @@ } $DisplayTaxClass = $TaxClass . "%"; - $TaxAmount = filter_number_fomat((($SubTot/100)*(100+$TaxClass))-$SubTot); + $TaxAmount = (($SubTot/100)*(100+$TaxClass))-$SubTot; $DisplayTaxAmount = locale_number_format($TaxAmount,$myrow['currdecimalplaces']); $LineTotal = $SubTot + $TaxAmount; Modified: trunk/PDFReceipt.php =================================================================== --- trunk/PDFReceipt.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFReceipt.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -57,7 +57,7 @@ FROM debtortrans WHERE type=12 AND transno='".$_GET['BatchNumber']."' - AND id='". filter_number_format($StartReceiptNumber-1+$_GET['ReceiptNumber']) ."'"; + AND id='". $StartReceiptNumber-1+$_GET['ReceiptNumber'] ."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $DebtorNo=$myrow['debtorno']; @@ -70,7 +70,7 @@ WHERE currabrev=(SELECT currcode FROM banktrans WHERE type=12 - AND transno='" . filter_number_format($_GET['BatchNumber'])."')"; + AND transno='" . $_GET['BatchNumber']."')"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $Currency=$myrow['currency']; @@ -116,5 +116,5 @@ $LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,'______________________________________________________________________________'); -$pdf->Output('Receipt-'.filter_number_format($_GET['ReceiptNumber']), 'I'); +$pdf->Output('Receipt-'.$_GET['ReceiptNumber'], 'I'); ?> \ No newline at end of file Modified: trunk/PDFRemittanceAdvice.php =================================================================== --- trunk/PDFRemittanceAdvice.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFRemittanceAdvice.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -145,10 +145,14 @@ } else { $DefaultToCriteria = $_POST['ToCriteria']; } - echo '<tr><td>' . _('From Supplier Code') . ':</font></td> - <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="' . $DefaultFromCriteria . '"></td></tr>'; - echo '<tr><td>' . _('To Supplier Code') . ':</td> - <td><input type="text" maxlength="6" size="7" name="ToCriteria" value="' . $DefaultToCriteria . '"></td></tr>'; + echo '<tr> + <td>' . _('From Supplier Code') . ':</font></td> + <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="' . $DefaultFromCriteria . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('To Supplier Code') . ':</td> + <td><input type="text" maxlength="6" size="7" name="ToCriteria" value="' . $DefaultToCriteria . '" /></td> + </tr>'; if (!isset($_POST['PaymentDate'])){ $DefaultDate = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')+1,0 ,Date('y'))); @@ -156,19 +160,19 @@ $DefaultDate = $_POST['PaymentDate']; } - echo '<tr><td>' . _('Date Of Payment') . ':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="PaymentDate" maxlength="11" size="12" value="' . $DefaultDate . '" /></td> - </tr>'; + echo '<tr> + <td>' . _('Date Of Payment') . ':</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="PaymentDate" maxlength="11" size="12" value="' . $DefaultDate . '" /></td> + </tr>'; - echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="' . _('Print PDF') . '"></div>'; + echo '</table> + <div class="centre"> + <input type=Submit Name="PrintPDF" Value="' . _('Print PDF') . '"> + </div>'; include ('includes/footer.inc'); } /*end of else not PrintPDF */ - - - - function PageHeader(){ global $pdf; global $PageNumber; Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFStockCheckComparison.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -20,12 +20,13 @@ if ($_POST['ReportOrClose']=='ReportAndClose'){ $sql = "SELECT stockcheckfreeze.stockid, - stockcheckfreeze.loccode, - qoh, - materialcost+labourcost+overheadcost AS standardcost - FROM stockmaster INNER JOIN stockcheckfreeze + stockcheckfreeze.loccode, + qoh, + materialcost+labourcost+overheadcost AS standardcost + FROM stockmaster INNER JOIN stockcheckfreeze ON stockcheckfreeze.stockid=stockmaster.stockid - ORDER BY stockcheckfreeze.loccode, stockcheckfreeze.stockid"; + ORDER BY stockcheckfreeze.loccode, + stockcheckfreeze.stockid"; $StockChecks = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -49,9 +50,9 @@ $sql = "SELECT SUM(stockcounts.qtycounted) AS totcounted, COUNT(stockcounts.stockid) AS noofcounts - FROM stockcounts - WHERE stockcounts.stockid='" . $myrow['stockid'] . "' - AND stockcounts.loccode='" . $myrow['loccode'] . "'"; + FROM stockcounts + WHERE stockcounts.stockid='" . $myrow['stockid'] . "' + AND stockcounts.loccode='" . $myrow['loccode'] . "'"; $StockCounts = DB_query($sql, $db); if (DB_error_no($db) !=0) { @@ -70,7 +71,7 @@ $StkCountResult = DB_query($sql,$db); $StkCountRow = DB_fetch_array($StkCountResult); - $StockQtyDifference = filter_number_format($StkCountRow['totcounted'] - $myrow['qoh']); + $StockQtyDifference = $StkCountRow['totcounted'] - $myrow['qoh']; if ($_POST['ZeroCounts']=='Leave' AND $StkCountRow['noofcounts']==0){ $StockQtyDifference =0; @@ -112,7 +113,7 @@ '" . $PeriodNo . "', '" . _('Inventory Check') . "', '" . $StockQtyDifference . "', - '" . filter_number_format($QtyOnHandPrior + $StockQtyDifference) . "' + '" . $QtyOnHandPrior + $StockQtyDifference . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -145,7 +146,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . filter_number_format($myrow['standardcost'] * -($StockQtyDifference)) . "', + '" . $myrow['standardcost'] * -($StockQtyDifference) . "', '" . $myrow['stockid'] . " x " . $StockQtyDifference . " @ " . $myrow['standardcost'] . " - " . _('Inventory Check') . "')"; $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg, true); @@ -164,14 +165,13 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . filter_number_format($myrow['standardcost'] * $StockQtyDifference) . "', + '" . $myrow['standardcost'] * $StockQtyDifference . "', '" . $myrow['stockid'] . " x " . $StockQtyDifference . " @ " . $myrow['standardcost'] . " - " . _('Inventory Check') . "')"; $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg, true); } //END INSERT GL TRANS $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Unable to COMMIT transaction while adjusting stock in StockCheckAdjustmet report'); - $SQL = "COMMIT"; - $Result = DB_query($SQL,$db, $ErrMsg,'',true); + DB_Txn_Commit($db); } // end if $StockQtyDifference !=0 Modified: trunk/PDFStockLocTransfer.php =================================================================== --- trunk/PDFStockLocTransfer.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFStockLocTransfer.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -8,7 +8,7 @@ include('includes/PDFStarter.php'); if (isset($_POST['TransferNo'])) { - $_GET['TransferNo']=filter_number_format($_POST['TransferNo']); + $_GET['TransferNo']=$_POST['TransferNo']; } if (!isset($_GET['TransferNo'])){ @@ -16,16 +16,19 @@ include ('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Reprint transfer docket').'</p><br />'; - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table><tr><td>'._('Transfer docket to reprint').'</td>'; - echo '<td><input type="text" class="number" size="10" name="TransferNo"></td></tr></table>'; - echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') .'">'; + echo '<table> + <tr> + <td>'._('Transfer docket to reprint').'</td> + <td><input type="text" class="number" size="10" name="TransferNo" /></td> + </tr> + </table>'; + echo '<div class="centre"> + <input type="submit" name="Print" value="' . _('Print') .'">'; include ('includes/footer.inc'); exit; -} else { - $_GET['TransferNo'] = filter_number_format($_GET['TransferNo']); -} +} $pdf->addInfo('Title', _('Inventory Location Transfer BOL') ); $pdf->addInfo('Subject', _('Inventory Location Transfer BOL') . ' # ' . $_GET['TransferNo']); @@ -43,12 +46,13 @@ loctransfers.shiploc, locations.locationname as shiplocname, ... [truncated message content] |
From: <dai...@us...> - 2011-10-06 07:52:45
|
Revision: 4713 http://web-erp.svn.sourceforge.net/web-erp/?rev=4713&view=rev Author: daintree Date: 2011-10-06 07:52:38 +0000 (Thu, 06 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PricesByCost.php trunk/PrintCheque.php trunk/PrintCustOrder.php trunk/PrintCustOrder_generic.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PricesByCost.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -163,7 +163,7 @@ echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo'<input type="hidden" value=' . $_POST['StockCat'] . ' name="StockCat"> - <input type="hidden" value=' . filter_number_format($_POST['Margin']) . ' name="Margin"> + <input type="hidden" value=' . $_POST['Margin'] . ' name="Margin"> <input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode"> <input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator"> <input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">'; @@ -213,7 +213,7 @@ <td class="number">' . locale_number_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CurrentGP, 1) . '%</td> <td class="number">' . locale_number_format($ProposedPrice, $myrow['decimalplaces']) . '</td> - <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '"></td> + <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength="14" size="10" value="' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '"></td> </tr> '; $PriceCounter++; } //end of looping @@ -227,7 +227,10 @@ } } else { /*The option to submit was not hit so display form */ echo '<div class="page_help_text">' . _('Use this report to display price list with the cost.') . '</div><br />'; - echo '<br /><br /><form action="' . $_SERVER['PHP_SELF'] . '" method="post"><table class=selection>'; + echo '<br /> + <br /> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL = "SELECT categoryid, categorydescription @@ -243,9 +246,9 @@ } echo '</select></td></tr>'; echo '<tr><td>' . _('Price') . ' - <select name="Comparator">'; - echo '<option value="1">' . _('Less than or equal to') . '</option>'; - echo '<option value="2">' . _('Greater than or equal to') . '</option>'; + <select name="Comparator"> + <option value="1">' . _('Less than or equal to') . '</option> + <option value="2">' . _('Greater than or equal to') . '</option>'; if ($_SESSION['WeightedAverageCosting']==1) { echo '</select>'.' '. _('Average Cost') . ' x </td>'; } else { Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCheque.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -13,7 +13,10 @@ $PageNumber=1; $line_height=12; -$result = db_query("SELECT hundredsname, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); +$result = db_query("SELECT hundredsname, + decimalplaces + FROM currencies + WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustOrder.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -7,15 +7,28 @@ include('includes/SQL_CommonFunctions.inc'); //Get Out if we have no order number to work with -If (!isset($_GET['TransNo']) || $_GET['TransNo']==""){ +If (!isset($_GET['TransNo']) OR $_GET['TransNo']==''){ $title = _('Select Order To Print'); include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; + echo '<div class="centre"> + <br /> + <br /> + <br />'; prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr><td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; } @@ -52,7 +65,7 @@ ON salesorders.shipvia=shippers.shipper_id INNER JOIN locations ON salesorders.fromstkloc=locations.loccode - WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']). "'"; + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -122,7 +135,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql, $db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -195,9 +208,9 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') .'.pdf'); $pdf-> __destruct(); - $sql = "UPDATE salesorders SET printedpackingslip=1, - datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" .filter_number_format($_GET['TransNo']) . "'"; + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } else { $title = _('Print Packing Slip Error'); Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustOrder_generic.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -65,7 +65,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -166,7 +166,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -248,7 +248,7 @@ $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustStatements.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -79,7 +79,7 @@ if (DB_Num_Rows($StatementResults) == 0){ $title = _('Print Statements') . ' - ' . _('No Customers Found'); - require('includes/header.inc'); + require('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Customer Account Statements') . '</p>'; prnMsg( _('There were no Customers matching your selection of '). $_POST['FromCust']. ' - '. $_POST['ToCust'].'.' , 'error'); Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustTrans.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -7,7 +7,7 @@ if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { - $FromTransNo = trim($_POST['FromTransNo']); + $FromTransNo = filter_number_format($_POST['FromTransNo']); } else { $FromTransNo = ''; } @@ -25,8 +25,8 @@ } if (!isset($_POST['ToTransNo']) - or trim($_POST['ToTransNo'])=='' - or $_POST['ToTransNo'] < $FromTransNo) { + OR trim($_POST['ToTransNo'])=='' + OR filter_number_format($_POST['ToTransNo']) < $FromTransNo) { $_POST['ToTransNo'] = $FromTransNo; } @@ -72,7 +72,7 @@ $FirstPage = true; $line_height=16; - while ($FromTransNo <= $_POST['ToTransNo']){ + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])){ /* retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -127,22 +127,22 @@ debtortrans.debtorno, debtortrans.branchcode, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesorders + INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno - INNER JOIN shippers - ON debtortrans.shipvia=shippers.shipper_id - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - INNER JOIN paymentterms + INNER JOIN shippers + ON debtortrans.shipvia=shippers.shipper_id + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -186,16 +186,16 @@ debtortrans.branchcode, paymentterms.terms, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -460,10 +460,10 @@ if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { - $FromTransNo = trim($_POST['FromTransNo']); + $FromTransNo = filter_number_format($_POST['FromTransNo']); } - - + + if (isset($_GET['Email'])){ //email the invoice to address supplied include('includes/header.inc'); @@ -471,7 +471,7 @@ $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; $pdf->Output($FileName,'F'); $mail = new htmlMimeMail(); - + $Attachment = $mail->getFile($FileName); $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo'] ); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); @@ -489,7 +489,7 @@ } else { //its not an email just print the invoice to PDF $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); - + } $pdf->__destruct(); @@ -503,7 +503,7 @@ /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; echo '<table class="table1"> <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; @@ -532,12 +532,12 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; + <td><input type="text" class="number" maxlength="6" size="7" name="FromTransNo" /></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input Type=text class=number max=6 size=7 name="ToTransNo"></td></tr> + <td><input type="text" class="number" maxlength="6" size="7" name="ToTransNo" /></td></tr> </table>'; - echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p>'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '" /><p>'; + echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /></div>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -551,11 +551,13 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV'; + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b> + <br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . + '</div>'; } else { - while ($FromTransNo <= $_POST['ToTransNo']) { + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])) { /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -600,22 +602,22 @@ salesman.salesmanname, debtortrans.debtorno, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesorders + INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno - INNER JOIN shippers - ON debtortrans.shipvia=shippers.shipper_id - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - INNER JOIN paymentterms + INNER JOIN shippers + ON debtortrans.shipvia=shippers.shipper_id + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -646,16 +648,16 @@ salesman.salesmanname, debtortrans.debtorno, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -674,8 +676,11 @@ $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + if (count($_SESSION['AllowedPageSecurityTokens'])==1 + AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) + AND $myrow['debtorno'] != $_SESSION['CustomerID']){ + + echo '<p><font color="red" size="4">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-06 07:52:45
|
Revision: 4713 http://web-erp.svn.sourceforge.net/web-erp/?rev=4713&view=rev Author: daintree Date: 2011-10-06 07:52:38 +0000 (Thu, 06 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PricesByCost.php trunk/PrintCheque.php trunk/PrintCustOrder.php trunk/PrintCustOrder_generic.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PricesByCost.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -163,7 +163,7 @@ echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo'<input type="hidden" value=' . $_POST['StockCat'] . ' name="StockCat"> - <input type="hidden" value=' . filter_number_format($_POST['Margin']) . ' name="Margin"> + <input type="hidden" value=' . $_POST['Margin'] . ' name="Margin"> <input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode"> <input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator"> <input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">'; @@ -213,7 +213,7 @@ <td class="number">' . locale_number_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CurrentGP, 1) . '%</td> <td class="number">' . locale_number_format($ProposedPrice, $myrow['decimalplaces']) . '</td> - <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '"></td> + <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength="14" size="10" value="' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '"></td> </tr> '; $PriceCounter++; } //end of looping @@ -227,7 +227,10 @@ } } else { /*The option to submit was not hit so display form */ echo '<div class="page_help_text">' . _('Use this report to display price list with the cost.') . '</div><br />'; - echo '<br /><br /><form action="' . $_SERVER['PHP_SELF'] . '" method="post"><table class=selection>'; + echo '<br /> + <br /> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL = "SELECT categoryid, categorydescription @@ -243,9 +246,9 @@ } echo '</select></td></tr>'; echo '<tr><td>' . _('Price') . ' - <select name="Comparator">'; - echo '<option value="1">' . _('Less than or equal to') . '</option>'; - echo '<option value="2">' . _('Greater than or equal to') . '</option>'; + <select name="Comparator"> + <option value="1">' . _('Less than or equal to') . '</option> + <option value="2">' . _('Greater than or equal to') . '</option>'; if ($_SESSION['WeightedAverageCosting']==1) { echo '</select>'.' '. _('Average Cost') . ' x </td>'; } else { Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCheque.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -13,7 +13,10 @@ $PageNumber=1; $line_height=12; -$result = db_query("SELECT hundredsname, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); +$result = db_query("SELECT hundredsname, + decimalplaces + FROM currencies + WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustOrder.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -7,15 +7,28 @@ include('includes/SQL_CommonFunctions.inc'); //Get Out if we have no order number to work with -If (!isset($_GET['TransNo']) || $_GET['TransNo']==""){ +If (!isset($_GET['TransNo']) OR $_GET['TransNo']==''){ $title = _('Select Order To Print'); include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; + echo '<div class="centre"> + <br /> + <br /> + <br />'; prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr><td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; } @@ -52,7 +65,7 @@ ON salesorders.shipvia=shippers.shipper_id INNER JOIN locations ON salesorders.fromstkloc=locations.loccode - WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']). "'"; + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -122,7 +135,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql, $db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -195,9 +208,9 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') .'.pdf'); $pdf-> __destruct(); - $sql = "UPDATE salesorders SET printedpackingslip=1, - datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" .filter_number_format($_GET['TransNo']) . "'"; + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } else { $title = _('Print Packing Slip Error'); Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustOrder_generic.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -65,7 +65,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -166,7 +166,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -248,7 +248,7 @@ $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; + WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustStatements.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -79,7 +79,7 @@ if (DB_Num_Rows($StatementResults) == 0){ $title = _('Print Statements') . ' - ' . _('No Customers Found'); - require('includes/header.inc'); + require('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Customer Account Statements') . '</p>'; prnMsg( _('There were no Customers matching your selection of '). $_POST['FromCust']. ' - '. $_POST['ToCust'].'.' , 'error'); Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-05 07:26:06 UTC (rev 4712) +++ trunk/PrintCustTrans.php 2011-10-06 07:52:38 UTC (rev 4713) @@ -7,7 +7,7 @@ if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { - $FromTransNo = trim($_POST['FromTransNo']); + $FromTransNo = filter_number_format($_POST['FromTransNo']); } else { $FromTransNo = ''; } @@ -25,8 +25,8 @@ } if (!isset($_POST['ToTransNo']) - or trim($_POST['ToTransNo'])=='' - or $_POST['ToTransNo'] < $FromTransNo) { + OR trim($_POST['ToTransNo'])=='' + OR filter_number_format($_POST['ToTransNo']) < $FromTransNo) { $_POST['ToTransNo'] = $FromTransNo; } @@ -72,7 +72,7 @@ $FirstPage = true; $line_height=16; - while ($FromTransNo <= $_POST['ToTransNo']){ + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])){ /* retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -127,22 +127,22 @@ debtortrans.debtorno, debtortrans.branchcode, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesorders + INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno - INNER JOIN shippers - ON debtortrans.shipvia=shippers.shipper_id - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - INNER JOIN paymentterms + INNER JOIN shippers + ON debtortrans.shipvia=shippers.shipper_id + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -186,16 +186,16 @@ debtortrans.branchcode, paymentterms.terms, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -460,10 +460,10 @@ if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { - $FromTransNo = trim($_POST['FromTransNo']); + $FromTransNo = filter_number_format($_POST['FromTransNo']); } - - + + if (isset($_GET['Email'])){ //email the invoice to address supplied include('includes/header.inc'); @@ -471,7 +471,7 @@ $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; $pdf->Output($FileName,'F'); $mail = new htmlMimeMail(); - + $Attachment = $mail->getFile($FileName); $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo'] ); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); @@ -489,7 +489,7 @@ } else { //its not an email just print the invoice to PDF $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); - + } $pdf->__destruct(); @@ -503,7 +503,7 @@ /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; echo '<table class="table1"> <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; @@ -532,12 +532,12 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; + <td><input type="text" class="number" maxlength="6" size="7" name="FromTransNo" /></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input Type=text class=number max=6 size=7 name="ToTransNo"></td></tr> + <td><input type="text" class="number" maxlength="6" size="7" name="ToTransNo" /></td></tr> </table>'; - echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p>'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '" /><p>'; + echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /></div>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -551,11 +551,13 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV'; + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b> + <br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . + '</div>'; } else { - while ($FromTransNo <= $_POST['ToTransNo']) { + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])) { /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -600,22 +602,22 @@ salesman.salesmanname, debtortrans.debtorno, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesorders + INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno - INNER JOIN shippers - ON debtortrans.shipvia=shippers.shipper_id - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - INNER JOIN paymentterms + INNER JOIN shippers + ON debtortrans.shipvia=shippers.shipper_id + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -646,16 +648,16 @@ salesman.salesmanname, debtortrans.debtorno, currencies.decimalplaces - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN custbranch - ON debtortrans.debtorno=custbranch.debtorno + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN custbranch + ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator - INNER JOIN currencies + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; @@ -674,8 +676,11 @@ $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + if (count($_SESSION['AllowedPageSecurityTokens'])==1 + AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) + AND $myrow['debtorno'] != $_SESSION['CustomerID']){ + + echo '<p><font color="red" size="4">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-06 09:16:53
|
Revision: 4714 http://web-erp.svn.sourceforge.net/web-erp/?rev=4714&view=rev Author: daintree Date: 2011-10-06 09:16:44 +0000 (Thu, 06 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Prices.php trunk/Prices_Customer.php trunk/PrintCustOrder.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/SecurityTokens.php trunk/SelectSalesOrder.php trunk/includes/MiscFunctions.php Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -193,7 +193,7 @@ prices.currabrev, prices.startdate, prices.enddate, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM prices INNER JOIN salestypes ON prices.typeabbrev = salestypes.typeabbrev @@ -211,7 +211,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> <table class=selection> <tr> - <th colspan=7> + <th colspan="7"> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />' . _('Pricing for part') . ': <input type="text" name="Item" size="22" value="' . $Item . '" maxlength="20"> @@ -245,7 +245,7 @@ if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Item=' . $myrow['stockid'] . '&TypeAbbrev=' .$myrow['typeabbrev'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . $myrow['price'] . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'] . '&Edit=1">' . _('Edit') . '</td> @@ -254,7 +254,7 @@ } else { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td></tr>'; } @@ -269,10 +269,10 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['Edit'])){ - echo '<input type=hidden name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; - echo '<input type=hidden name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] . '">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; + echo '<input type="hidden" name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; + echo '<input type="hidden" name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] . '">'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '">'; $_POST['CurrAbrev'] = $_GET['CurrAbrev']; $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; /*the price sent with the get is sql format price so no need to filter */ @@ -291,7 +291,7 @@ $result = DB_query($SQL,$db); echo '<br /><table class="selection">'; - echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; + echo '<tr><th colspan="5"><font color="blue" size="3"><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; echo '<tr><td>' . _('Currency') . ':</td> <td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices_Customer.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -5,12 +5,13 @@ $result = DB_query("SELECT debtorsmaster.name, debtorsmaster.currcode, - debtorsmaster.salestype + debtorsmaster.salestype, + currencies.decimalplaces AS currdecimalplaces FROM debtorsmaster WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$title = _('Special Prices for') . ' '. $myrow[0]; +$title = _('Special Prices for') . ' '. $myrow['name']; include('includes/header.inc'); @@ -20,7 +21,7 @@ $Item = $_POST['Item']; } -if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ +if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==''){ prnMsg( _('A customer must be selected from the customer selection screen') . ', ' . _('then an item must be selected before this page is called') . '. ' @@ -30,18 +31,13 @@ exit; } -$result = DB_query("SELECT debtorsmaster.name, - debtorsmaster.currcode, - debtorsmaster.salestype - FROM debtorsmaster - WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . _('Special Customer Prices').'</p><br />'; -echo '<font color=BLUE><b>' . $myrow[0] . ' ' . _('in') . ' ' . $myrow[1] . '<br />' . ' ' . _('for') . ' '; +echo '<font color=BLUE><b>' . $myrow['name'] . ' ' . _('in') . ' ' . $myrow['currcode'] . '<br />' . ' ' . _('for') . ' '; -$CurrCode = $myrow[1]; -$SalesType = $myrow[2]; +$CurrCode = $myrow['currcode']; +$SalesType = $myrow['salestype']; +$CurrDecimalPlaces = $myrow['currdecimalplaces']; $result = DB_query("SELECT stockmaster.description, stockmaster.mbflag @@ -216,16 +212,16 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } printf('<tr class="EvenTableRows"> - <td class=number>%0.2f</td> - <td class=date>%s</td> - <td class=date>%s</td></tr>', - $myrow['price'], + <td class="number">%s</td> + <td class="date">%s</td> + <td class="date">%s</td></tr>', + locale_number_format($myrow['price'],$CurrDecimalPlaces), ConvertSQLDate($myrow['startdate']), $EndDateDisplay); } } -echo '</table></td><td valign=top>'; +echo '</table></td><td valign="top">'; //now get the prices for the customer selected @@ -234,7 +230,8 @@ custbranch.brname, prices.startdate, prices.enddate - FROM prices LEFT JOIN custbranch ON prices.branchcode= custbranch.branchcode + FROM prices LEFT JOIN custbranch + ON prices.branchcode= custbranch.branchcode WHERE prices.typeabbrev = '".$SalesType."' AND prices.stockid='".$Item."' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' @@ -242,13 +239,13 @@ AND (custbranch.debtorno='" . $_SESSION['CustomerID'] . "' OR custbranch.debtorno IS NULL) ORDER BY prices.branchcode, - prices.startdate"; + prices.startdate"; $ErrMsg = _('Could not retrieve the special prices set up because'); $DbgMsg = _('The SQL used to retrieve these records was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); -echo '<table class=selection>'; +echo '<table class="selection">'; if (DB_num_rows($result) == 0) { echo '<tr><td>' . _('There are no special prices set up for this part') . '</td></tr>'; @@ -270,10 +267,10 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } echo '<tr bgcolor="#CCCCCC"> - <td class=number>'.locale_number_format($myrow['price'],2).'</td> - <td>'.$Branch.'</td> + <td class="number">'.locale_number_format($myrow['price'],$CurrDecimalPlaces).'</td> + <td>' . $Branch.'</td> <td>'.$myrow['units'].'</td> - <td class=number>'.$myrow['conversionfactor'].'</td> + <td class="number">'.$myrow['conversionfactor'].'</td> <td>'.ConvertSQLDate($myrow['startdate']).'</td> <td>'.$EndDateDisplay.'</td> <td><a href="'.$_SERVER['PHP_SELF'].'?Item='.$Item.'&Price='.$myrow['price'].'&Branch='.$myrow['branchcode']. @@ -288,13 +285,13 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type=hidden name="Item" value="' . $Item . '">'; +echo '<input type="hidden" name="Item" value="' . $Item . '" />'; if (isset($_GET['Edit']) and $_GET['Edit']==1){ - echo '<input type=hidden name="Editing" value="Yes">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] .'">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; - $_POST['Price']=filter_number_format($_GET['Price']); + echo '<input type="hidden" name="Editing" value="Yes" />'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] .'" />'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '" />'; + $_POST['Price']=$_GET['Price']; $_POST['Branch']=$_GET['Branch']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if (Is_Date($_GET['EndDate'])){ @@ -322,11 +319,14 @@ branchcode, brname FROM custbranch - WHERE debtorno='".$_SESSION['CustomerID'] ."'"; + WHERE debtorno='" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql, $db); -echo '<table class=selection>'; -echo '<tr><td>' . _('Branch') . ':</td>'; -echo '<td><select name="Branch">'; + +echo '<table class="selection"> + <tr> + <td>' . _('Branch') . ':</td> + <td><select name="Branch">'; + while ($myrow=DB_fetch_array($result)) { if ($myrow['branchcode']==$_POST['branch']) { echo '<option selected value='.$myrow['branchcode'].'>'.$myrow['brname'].'</option>'; @@ -335,22 +335,28 @@ } } echo '</select></td></tr>'; -echo '<tr><td>' . _('Start Date') . ':</td> - <td><input type="Text" name="StartDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; -echo '<tr><td>' . _('End Date') . ':</td> - <td><input type="Text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['EndDate'] . '"></td></tr>'; +echo '<tr> + <td>' . _('Start Date') . ':</td> + <td><input type="text" name="StartDate" class="date" alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['StartDate'] . '"></td> + </tr>'; +echo '<tr> + <td>' . _('End Date') . ':</td> + <td><input type="text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['EndDate'] . '" /></td></tr>'; echo '<tr><td>' . _('Price') . ':</td> - <td><input type="Text" class=number name="Price" size=11 maxlength=10 value=' . $_POST['Price'] . '></td> - </tr></table>'; + <td><input type="text" class="number" name="Price" size="11" maxlength="10" value="' . locale_number_format($_POST['Price'],2) . '"></td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - -echo '</form>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; + include('includes/footer.inc'); +exit; function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $CustomerID, $db) { Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -20,15 +20,15 @@ <br /> <table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td> - </tr> - </table> - </div> - <br /> - <br /> - <br />'; + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; } Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTrans.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -692,11 +692,13 @@ <td bgcolor="#BBBBBB"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /* Now print out the logo and company name and address */ echo '<table class="table1"> @@ -711,13 +713,16 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td WIDTH=50% class=number>'; + echo '</td><td width="50%" class="number">'; /* Now the customer charged to details in a sub table within a cell of the main table*/ echo '<table class="table1"> - <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> - </tr><tr><td bgcolor="#EEEEEE">'; + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#EEEEEE">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -725,10 +730,14 @@ '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -755,7 +764,8 @@ '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td> </tr> - </table><hr>'; + </table> + <hr>'; echo '<table class="table1"> <tr> @@ -880,22 +890,22 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; } - printf ('<td>%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 class=number>%s</td> - </tr>', - $myrow2['stockid'], - $myrow2['description'], - $DisplayQty, - $myrow2['units'], - $DisplayPrice, - $DisplayDiscount, - $DisplayNet); - + printf ('<td>%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 class="number">%s</td> + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + if (mb_strlen($myrow2['narrative'])>1){ echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; @@ -981,7 +991,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class="number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -1023,18 +1033,22 @@ /*Print out the invoice text entered */ echo '<table class=table1><tr> - <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; - echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; - echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + <td class="number">' . _('Sub Total') . '</td> + <td class="number" bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; + echo '<tr><td class="number">' . _('Freight') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; + echo '<tr><td class="number">' . _('Tax') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; if ($InvOrCredit=='Invoice'){ - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; + echo '<tr> + <td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> + <td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td> + </tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; + echo '<tr> + <td class="number"><font color=RED><b>' . _('TOTAL CREDIT') .'</b></font></td> + <td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td> + </tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTransPortrait.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -334,8 +334,8 @@ $GetControlMovts = DB_query("SELECT moveqty, serialno - FROM stockserialmoves - WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); + FROM stockserialmoves + WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); if ($myrow2['serialised']==1){ while ($ControlledMovtRow = DB_fetch_array($GetControlMovts)){ @@ -358,7 +358,6 @@ PrintLinesToBottom (); include ('includes/PDFTransPageHeaderPortrait.inc'); } //end if need a new page headed up - } } } @@ -487,7 +486,6 @@ $FromTransNo++; } /* end loop to print invoices */ - if (isset($_GET['Email'])){ //email the invoice to address supplied include('includes/header.inc'); @@ -523,14 +521,18 @@ if (!isset($FromTransNo) OR $FromTransNo=='') { - /*if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Portrait Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td> - <td><select name="InvOrCredit">'; + + echo '<table class="selection"> + <tr> + <td>' . _('Print Invoices or Credit Notes') . '</td> + <td><select name="InvOrCredit">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; @@ -539,9 +541,13 @@ echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name="PrintEDI">'; + echo '<tr> + <td>' . _('Print EDI Transactions') . '</td> + <td><select name="PrintEDI">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; @@ -554,14 +560,23 @@ } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td></tr>'; - echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td></tr> + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Start invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td> + </tr>'; + echo '<tr> + <td>' . _('End invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td> + </tr> </table>'; - echo '<div class="centre"><br /><input type="submit" name="Print" value="' . _('Print Preview') . '"><p>'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<div class="centre"> + <br /> + <input type="submit" name="Print" value="' . _('Print Preview') . '" /> + <br /> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -700,7 +715,7 @@ $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + echo '<p><font color="red" size="4">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } @@ -708,17 +723,25 @@ $PageNumber = 1; echo '<table class="table1"> - <tr><td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + <tr> + <td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /><font size="1">' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out the logo and company name and address */ - echo '<table class"table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class"table1"> + <tr> + <td><font size="4" color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font> + <br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -729,11 +752,17 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td width=50% class+"number">'; + echo '</td> + <td width="50%" class="number">'; /*Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#eee">'; + echo '<table class="table1"> + <tr> + <td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#eee">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -742,10 +771,14 @@ '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -814,11 +847,12 @@ } else { /* then its a credit note */ - echo '<table WIDTH=50%><tr> - <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> + echo '<table width="50%"> + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' .$myrow['brname'] . + <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . @@ -827,14 +861,17 @@ '<br />' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> - <td align=left bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> - <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> - </tr>'; + echo '<hr> + <table class="table1"> + <tr> + <td align="left" bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> + <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> + </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> - <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> - </tr></table>'; + <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> + <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> + </tr> + </table>'; $sql ="SELECT stockmoves.stockid, @@ -903,11 +940,11 @@ printf ('<td>%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 class+"number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow2['stockid'], $myrow2['description'], @@ -918,7 +955,10 @@ $DisplayNet); if (mb_strlen($myrow2['narrative'])>1){ - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + echo $RowStarter . + '<td></td> + <td colspan=6>' . $myrow2['narrative'] . '</td> + </tr>'; $LineCounter++; } @@ -929,17 +969,25 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOP><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '</table> + <table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; + if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class="table1"> + <tr> + <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -949,7 +997,9 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td> + </tr> + </table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -976,13 +1026,20 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN="TOP"><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '<table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') .' '; + echo '<font size="4">' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /> + <font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Print out the logo and company name and address */ echo '<table class="table1"> Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PurchData.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -207,12 +207,12 @@ $myrow['suppname'], locale_number_format($myrow['price'], $myrow['currdecimalplaces']), $myrow['suppliersuom'], - $myrow['conversionfactor'], + locale_number_format($myrow['conversionfactor'],'Variable'), locale_number_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']), $myrow['currcode'], ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], + locale_number_format($myrow['minorderqty'],'Variable'), + locale_number_format($myrow['leadtime'],'Variable'), $DisplayPreferred, $_SERVER['PHP_SELF'], $StockID, @@ -262,14 +262,17 @@ <table cellpadding="3" colspan="4" class="selection"> <tr>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; + echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td>'; echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; echo '<td><input type="text" name="SupplierCode" size=15 maxlength=18></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; + echo '<div class="centre"> + <input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /> + </div> + </form>'; include ('includes/footer.inc'); exit; }; @@ -292,21 +295,24 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers - WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + } //one of keywords or SupplierCode was more than a zero length string $ErrMsg = _('The suppliers matching the criteria entered could not be retrieved because'); $DbgMsg = _('The SQL to retrieve supplier details that failed was'); @@ -337,10 +343,11 @@ $StockID = ''; $StockUOM = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table cellpadding="2" colspan="7" class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr><th>' . _('Code') . '</th> + $TableHeader = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Address 1') . '</th> @@ -406,22 +413,24 @@ WHERE purchdata.supplierno='".$SupplierID."' AND purchdata.stockid='".$StockID."' AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'"; + $ErrMsg = _('The supplier purchasing details for the selected supplier and item could not be retrieved because'); $EditResult = DB_query($sql, $db, $ErrMsg); $myrow = DB_fetch_array($EditResult); $SuppName = $myrow['suppname']; - $_POST['Price'] = $myrow['price']; + $_POST['Price'] = locale_number_format(round($myrow['price'],$myrow['currdecimalplaces']),$myrow['currdecimalplaces']); $_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']); $CurrCode = $myrow['currcode']; $CurrDecimalPlaces = $myrow['currdecimalplaces']; $_POST['SuppliersUOM'] = $myrow['suppliersuom']; $_POST['SupplierDescription'] = $myrow['supplierdescription']; - $_POST['LeadTime'] = $myrow['leadtime']; - $_POST['ConversionFactor'] = $myrow['conversionfactor']; + $_POST['LeadTime'] = locale_number_format($myrow['leadtime'],'Variable'); + + $_POST['ConversionFactor'] = locale_number_format($myrow['conversionfactor'],'Variable'); $_POST['Preferred'] = $myrow['preferred']; - $_POST['MinOrderQty'] = $myrow['minorderqty']; + $_POST['MinOrderQty'] = locale_number_format($myrow['minorderqty'],'Variable'); $_POST['SupplierCode'] = $myrow['suppliers_partno']; - $StockUOM=$myrow['units']; + $StockUOM=$myrow['units']; } echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; @@ -431,10 +440,12 @@ } if (isset($_GET['Edit'])) { echo '<tr><td>' . _('Supplier Name') . ':</td> - <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td></tr>'; + <td><input type="hidden" name="SupplierID" value="' . $SupplierID . '" />' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td> + </tr>'; } else { - echo '<tr><td>' . _('Supplier Name') . ':</td> - <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; + echo '<tr> + <td>' . _('Supplier Name') . ':</td> + <input type="hidden" name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; if ($SupplierID!='') { echo '<td>'.$SuppName; } @@ -445,7 +456,7 @@ } echo '</td></tr>'; } - echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; + echo '<td><input type="hidden" name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; if (!isset($CurrCode)) { $CurrCode = ''; } @@ -468,11 +479,11 @@ $_POST['MinOrderQty'] = '1'; } echo '<tr><td>' . _('Currency') . ':</td> - <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; + <td><input type="hidden" name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_number_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength="12" size="12" value=' . $_POST['Price'] . ' /></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength="10" size="11" value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; if (isset($SupplierID)) { echo '<td>' . $StockUOM . '</td></tr>'; @@ -480,7 +491,8 @@ echo '<tr><td>' . _('Suppliers Unit of Measure') . ':</td>'; echo '<td><input type="text" name="SuppliersUOM" size="20" maxlength="20" value ="' . $_POST['SuppliersUOM'] . '"/>'; echo '</td></tr>'; - if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == '') { + if (!isset($_POST['ConversionFactor']) + OR $_POST['ConversionFactor'] == '') { $_POST['ConversionFactor'] = 1; } echo '<tr><td>' . _('Conversion Factor (to our UOM)') . ':</td> @@ -507,9 +519,9 @@ } echo '</select></td></tr></table><br /><div class="centre">'; if (isset($_GET['Edit'])) { - echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '">'; + echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '" />'; } else { - echo '<input type=submit name="AddRecord" value="' . _('Add') . '">'; + echo '<input type=submit name="AddRecord" value="' . _('Add') . '" />'; } echo '</div>'; echo '<div class="centre">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SecurityTokens.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -92,15 +92,16 @@ if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> - <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'"><input type="submit" name="Update" value="' . _('Update') . '" />'; + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> + <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'" /> + <input type="submit" name="Update" value="' . _('Update') . '" />'; } else { echo '<td>'._('Token ID') . '</td> <td><input type="text" name="TokenID" value="'.$_POST['TokenID'].'" /></td> </tr> <tr> <td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> <td><input type="submit" name="Submit" value="' . _('Insert') . '" />'; } @@ -125,7 +126,7 @@ <td>'.$myrow['tokenid'].'</td> <td>'.$myrow['tokenname'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this security token?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SelectSalesOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -25,39 +25,40 @@ } else { /* Now build SQL of items to purchase with purchasing data and preferred suppliers - sorted by preferred supplier */ $sql = "SELECT purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact, - SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty - FROM purchdata INNER JOIN salesorderdetails ON - purchdata.stockid = salesorderdetails.stkcode - INNER JOIN stockmaster ON - purchdata.stockid = stockmaster.stockid - INNER JOIN stockcategory ON - stockmaster.categoryid = stockcategory.categoryid - WHERE purchdata.preferred=1 - AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND (" . $OrdersToPlacePOFor . ") - GROUP BY purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact - ORDER BY purchdata.supplierno, - purchdata.stockid"; + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact, + SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty + FROM purchdata INNER JOIN salesorderdetails ON + purchdata.stockid = salesorderdetails.stkcode + INNER JOIN stockmaster ON + purchdata.stockid = stockmaster.stockid + INNER JOIN stockcategory ON + stockmaster.categoryid = stockcategory.categoryid + WHERE purchdata.preferred=1 + AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' + AND (" . $OrdersToPlacePOFor . ") + GROUP BY purchdata.supplierno, + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact + ORDER BY purchdata.supplierno, + purchdata.stockid"; + $ErrMsg = _('Unable to retrieve the items on the selected orders for creating purchase orders for'); $ItemResult = DB_query($sql,$db,$ErrMsg); @@ -66,16 +67,16 @@ } else { /*Now get the default delivery address details from the users default stock location */ $sql = "SELECT locationname, - deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; $ErrMsg = _('The delivery address for the order could not be obtained from the user default stock location'); $DelAddResult = DB_query($sql, $db,$ErrMsg); $DelAddRow = DB_fetch_array($DelAddResult); @@ -97,9 +98,9 @@ /* if an order is/has been created already and the supplier of this item has changed - so need to finish off the order */ //if the user has authority to authorise the PO then it should be created as authorised $AuthSQL ="SELECT authlevel - FROM purchorderauth - WHERE userid='".$_SESSION['UserID']."' - AND currabrev='".$SuppRow['currcode']."'"; + FROM purchorderauth + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$SuppRow['currcode']."'"; $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); @@ -120,7 +121,7 @@ if (DB_num_rows($AuthResult) ==0){ $AuthMessage = _('Your authority to approve purchase orders in') . ' ' .$SuppRow['currcode'] . ' ' . _('has not yet been set up') . '<br />'; } else { - $AuthMessage = _('You can only authorise up to').' '.$SuppRow['currcode'].' '.$AuthRow['authlevel'].'.<br />'; + $AuthMessage = _('You can only authorise up to') . ' ' . $SuppRow['currcode'] . ' ' . $AuthRow['authlevel'] . '.<br />'; } prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. @@ -136,7 +137,7 @@ DB_Txn_Commit($db); } - /*Starting a new purchase order with a different supplier */ + /*Starting a new purchase order with a different supplier */ $result = DB_Txn_Begin($db); $PO_OrderNo = GetNextTransNo(18, $db); //get the next PO number @@ -331,10 +332,10 @@ } else { if (isset($_REQUEST['SelectedCustomer'])) { echo _('For customer') . ': ' . $_REQUEST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo "<input type=hidden name='SelectedCustomer' value=" . $_REQUEST['SelectedCustomer'] . '>'; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_REQUEST['SelectedCustomer'] . '" />'; } if (isset($_REQUEST['SelectedStockItem'])) { - echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . " <input type=hidden name='SelectedStockItem' value='" . $_REQUEST['SelectedStockItem'] . "'>"; + echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . ' <input type="hidden" name="SelectedStockItem" value="' . $_REQUEST['SelectedStockItem'] . '" />'; } } @@ -349,46 +350,49 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, SUM(locstock.quantity) AS qoh, stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.description " . LIKE . " '" . $SearchString . "' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' AND stockmaster.categoryid='" . $_POST['StockCat']. "' GROUP BY stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, stockmaster.units ORDER BY stockmaster.stockid"; } elseif (isset($_POST['StockCode'])){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.categoryid='" . $_POST['StockCat'] ."' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } $ErrMsg = _('No stock items were returned by the SQL because'); @@ -412,10 +416,12 @@ if (!isset($_REQUEST['OrderNumber']) or $_REQUEST['OrderNumber']==''){ - echo '<table class=selection>'; - echo '<tr><td>' . _('Order number') . ': </td> - <td><input type="text" name="OrderNumber" maxlength="8" size="9"></td> - <td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Order number') . ': </td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" /></td> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; @@ -424,36 +430,37 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } - echo '</select></td><td>'; - echo '<select name="Quotations">'; + echo '</select></td> + <td><select name="Quotations">'; if ($_GET['Quotations']=='Quotes_Only'){ $_POST['Quotations']='Quotes_Only'; } if ($_POST['Quotations']=='Quotes_Only'){ - echo '<option selected value="Quotes_Only">' . _('Quotations Only'); - echo '<option value="Orders_Only">' . _('Orders Only'); + echo '<option selected value="Quotes_Only">' . _('Quotations Only') . '</option>'; + echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; } else { - echo '<option selected value="Orders_Only">' . _('Orders Only'); - echo '<option value="Quotes_Only">' . _('Quotations Only'); + echo '<option selected value="Orders_Only">' . _('Orders Only') . '</option>'; + echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; } - echo '</select> </td><td>'; - echo '<input type=submit name="SearchOrders" value="' . _('Search') . '"></td>'; - echo ' <td><a href="' . $rootpath . '/SelectOrderItems.php?' . SID . '&NewOrder=Yes">' . - _('Add Sales Order') . '</a></td></tr></table>'; + echo '</select> </td> + <td><input type=submit name="SearchOrders" value="' . _('Search') . '"></td> + <td><a href="' . $rootpath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Add Sales Order') . '</a></td> + </tr> + </table>'; } $SQL="SELECT categoryid, @@ -463,10 +470,12 @@ $result1 = DB_query($SQL,$db); - echo '<br /><table class="selection">'; - echo '<tr><th colspan=6><font size=3 color=navy>' . _('To search for sales orders for a specific part use the part selection facilities below'); - echo '</th></tr>'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> + <th colspan="6"><font size="3" color="navy">' . _('To search for sales orders for a specific part use the part selection facilities below') . '</th> + </tr> + <tr> <td><font size="1">' . _('Select a stock category') . ':</font> <select name="StockCat">'; @@ -474,27 +483,32 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } - echo '</select> - <td><font size=1>' . _('Enter text extract(s) in the description') . ":</font></td> - <td><input type='Text' name='Keywords' size=20 maxlength=25></td> - </tr> - <tr><td></td> - <td><font size 3><b>" . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . "</b>:</font></td> - <td><input type='Text' name='StockCode' size=15 maxlength=18></td> + echo '</select></td> + <td><font size=1>' . _('Enter text extract(s) in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1">' . _('Enter extract of the Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> </tr> - </table>"; - echo "<br /><input type=submit name='SearchParts' value='" . _('Search Parts Now') . - "'><input type=submit name='ResetPart' value='" . _('Show All') . "'></div><br />"; + </table>'; + echo '<br /> + <input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" /> + <input type="submit" name="ResetPart" value="' . _('Show All') . '" /> + </div> + <br />'; -if (isset($StockItemsResult) and DB_num_rows($StockItemsResult)>0) { +if (isset($StockItemsResult) + AND DB_num_rows($StockItemsResult)>0) { - echo '<table cellpadding=2 colspan=7 class=selection>'; + echo '<table cellpadding="2" colspan="7" class="selection">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -510,15 +524,15 @@ $k++; } - printf("<td><input type=submit name='SelectedStockItem' value='%s'</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - </tr>", - $myrow['stockid'], - $myrow['description'], - $myrow['qoh'], - $myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + $myrow['units']); $j++; if ($j == 12){ @@ -544,7 +558,8 @@ if(!isset($_POST['StockLocation'])) { $_POST['StockLocation'] = ''; } - if (isset($_REQUEST['OrderNumber']) && $_REQUEST['OrderNumber'] !='') { + if (isset($_REQUEST['OrderNumber']) + AND $_REQUEST['OrderNumber'] !='') { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, custbranch.brname, @@ -734,20 +749,21 @@ $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); - echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; + echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ $tableheader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Invoice') . '</th> - <th>' . _('Dispatch Note') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Cust Order') . ' #</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Req Del Date') . '</th> - <th>' . _('Delivery To') . '</th> - <th>' . _('Order Total') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th>'; + <th>' . _('Modify') . '</th> + <th>' . _('... [truncated message content] |
From: <dai...@us...> - 2011-10-06 09:16:53
|
Revision: 4714 http://web-erp.svn.sourceforge.net/web-erp/?rev=4714&view=rev Author: daintree Date: 2011-10-06 09:16:44 +0000 (Thu, 06 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Prices.php trunk/Prices_Customer.php trunk/PrintCustOrder.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/SecurityTokens.php trunk/SelectSalesOrder.php trunk/includes/MiscFunctions.php Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -193,7 +193,7 @@ prices.currabrev, prices.startdate, prices.enddate, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM prices INNER JOIN salestypes ON prices.typeabbrev = salestypes.typeabbrev @@ -211,7 +211,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> <table class=selection> <tr> - <th colspan=7> + <th colspan="7"> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />' . _('Pricing for part') . ': <input type="text" name="Item" size="22" value="' . $Item . '" maxlength="20"> @@ -245,7 +245,7 @@ if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Item=' . $myrow['stockid'] . '&TypeAbbrev=' .$myrow['typeabbrev'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . $myrow['price'] . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'] . '&Edit=1">' . _('Edit') . '</td> @@ -254,7 +254,7 @@ } else { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['currdecimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td></tr>'; } @@ -269,10 +269,10 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['Edit'])){ - echo '<input type=hidden name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; - echo '<input type=hidden name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] . '">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; + echo '<input type="hidden" name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] .'">'; + echo '<input type="hidden" name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '">'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] . '">'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '">'; $_POST['CurrAbrev'] = $_GET['CurrAbrev']; $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; /*the price sent with the get is sql format price so no need to filter */ @@ -291,7 +291,7 @@ $result = DB_query($SQL,$db); echo '<br /><table class="selection">'; - echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; + echo '<tr><th colspan="5"><font color="blue" size="3"><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; echo '<tr><td>' . _('Currency') . ':</td> <td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/Prices_Customer.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -5,12 +5,13 @@ $result = DB_query("SELECT debtorsmaster.name, debtorsmaster.currcode, - debtorsmaster.salestype + debtorsmaster.salestype, + currencies.decimalplaces AS currdecimalplaces FROM debtorsmaster WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$title = _('Special Prices for') . ' '. $myrow[0]; +$title = _('Special Prices for') . ' '. $myrow['name']; include('includes/header.inc'); @@ -20,7 +21,7 @@ $Item = $_POST['Item']; } -if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ +if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==''){ prnMsg( _('A customer must be selected from the customer selection screen') . ', ' . _('then an item must be selected before this page is called') . '. ' @@ -30,18 +31,13 @@ exit; } -$result = DB_query("SELECT debtorsmaster.name, - debtorsmaster.currcode, - debtorsmaster.salestype - FROM debtorsmaster - WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); -$myrow = DB_fetch_row($result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . _('Special Customer Prices').'</p><br />'; -echo '<font color=BLUE><b>' . $myrow[0] . ' ' . _('in') . ' ' . $myrow[1] . '<br />' . ' ' . _('for') . ' '; +echo '<font color=BLUE><b>' . $myrow['name'] . ' ' . _('in') . ' ' . $myrow['currcode'] . '<br />' . ' ' . _('for') . ' '; -$CurrCode = $myrow[1]; -$SalesType = $myrow[2]; +$CurrCode = $myrow['currcode']; +$SalesType = $myrow['salestype']; +$CurrDecimalPlaces = $myrow['currdecimalplaces']; $result = DB_query("SELECT stockmaster.description, stockmaster.mbflag @@ -216,16 +212,16 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } printf('<tr class="EvenTableRows"> - <td class=number>%0.2f</td> - <td class=date>%s</td> - <td class=date>%s</td></tr>', - $myrow['price'], + <td class="number">%s</td> + <td class="date">%s</td> + <td class="date">%s</td></tr>', + locale_number_format($myrow['price'],$CurrDecimalPlaces), ConvertSQLDate($myrow['startdate']), $EndDateDisplay); } } -echo '</table></td><td valign=top>'; +echo '</table></td><td valign="top">'; //now get the prices for the customer selected @@ -234,7 +230,8 @@ custbranch.brname, prices.startdate, prices.enddate - FROM prices LEFT JOIN custbranch ON prices.branchcode= custbranch.branchcode + FROM prices LEFT JOIN custbranch + ON prices.branchcode= custbranch.branchcode WHERE prices.typeabbrev = '".$SalesType."' AND prices.stockid='".$Item."' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' @@ -242,13 +239,13 @@ AND (custbranch.debtorno='" . $_SESSION['CustomerID'] . "' OR custbranch.debtorno IS NULL) ORDER BY prices.branchcode, - prices.startdate"; + prices.startdate"; $ErrMsg = _('Could not retrieve the special prices set up because'); $DbgMsg = _('The SQL used to retrieve these records was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); -echo '<table class=selection>'; +echo '<table class="selection">'; if (DB_num_rows($result) == 0) { echo '<tr><td>' . _('There are no special prices set up for this part') . '</td></tr>'; @@ -270,10 +267,10 @@ $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } echo '<tr bgcolor="#CCCCCC"> - <td class=number>'.locale_number_format($myrow['price'],2).'</td> - <td>'.$Branch.'</td> + <td class="number">'.locale_number_format($myrow['price'],$CurrDecimalPlaces).'</td> + <td>' . $Branch.'</td> <td>'.$myrow['units'].'</td> - <td class=number>'.$myrow['conversionfactor'].'</td> + <td class="number">'.$myrow['conversionfactor'].'</td> <td>'.ConvertSQLDate($myrow['startdate']).'</td> <td>'.$EndDateDisplay.'</td> <td><a href="'.$_SERVER['PHP_SELF'].'?Item='.$Item.'&Price='.$myrow['price'].'&Branch='.$myrow['branchcode']. @@ -288,13 +285,13 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type=hidden name="Item" value="' . $Item . '">'; +echo '<input type="hidden" name="Item" value="' . $Item . '" />'; if (isset($_GET['Edit']) and $_GET['Edit']==1){ - echo '<input type=hidden name="Editing" value="Yes">'; - echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] .'">'; - echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; - $_POST['Price']=filter_number_format($_GET['Price']); + echo '<input type="hidden" name="Editing" value="Yes" />'; + echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] .'" />'; + echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '" />'; + $_POST['Price']=$_GET['Price']; $_POST['Branch']=$_GET['Branch']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if (Is_Date($_GET['EndDate'])){ @@ -322,11 +319,14 @@ branchcode, brname FROM custbranch - WHERE debtorno='".$_SESSION['CustomerID'] ."'"; + WHERE debtorno='" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql, $db); -echo '<table class=selection>'; -echo '<tr><td>' . _('Branch') . ':</td>'; -echo '<td><select name="Branch">'; + +echo '<table class="selection"> + <tr> + <td>' . _('Branch') . ':</td> + <td><select name="Branch">'; + while ($myrow=DB_fetch_array($result)) { if ($myrow['branchcode']==$_POST['branch']) { echo '<option selected value='.$myrow['branchcode'].'>'.$myrow['brname'].'</option>'; @@ -335,22 +335,28 @@ } } echo '</select></td></tr>'; -echo '<tr><td>' . _('Start Date') . ':</td> - <td><input type="Text" name="StartDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; -echo '<tr><td>' . _('End Date') . ':</td> - <td><input type="Text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. - ' size=11 maxlength=10 value="' . $_POST['EndDate'] . '"></td></tr>'; +echo '<tr> + <td>' . _('Start Date') . ':</td> + <td><input type="text" name="StartDate" class="date" alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['StartDate'] . '"></td> + </tr>'; +echo '<tr> + <td>' . _('End Date') . ':</td> + <td><input type="text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. ' size="11" maxlength="10" value="' . $_POST['EndDate'] . '" /></td></tr>'; echo '<tr><td>' . _('Price') . ':</td> - <td><input type="Text" class=number name="Price" size=11 maxlength=10 value=' . $_POST['Price'] . '></td> - </tr></table>'; + <td><input type="text" class="number" name="Price" size="11" maxlength="10" value="' . locale_number_format($_POST['Price'],2) . '"></td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - -echo '</form>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; + include('includes/footer.inc'); +exit; function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $CustomerID, $db) { Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -20,15 +20,15 @@ <br /> <table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td> - </tr> - </table> - </div> - <br /> - <br /> - <br />'; + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; } Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTrans.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -692,11 +692,13 @@ <td bgcolor="#BBBBBB"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /* Now print out the logo and company name and address */ echo '<table class="table1"> @@ -711,13 +713,16 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td WIDTH=50% class=number>'; + echo '</td><td width="50%" class="number">'; /* Now the customer charged to details in a sub table within a cell of the main table*/ echo '<table class="table1"> - <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> - </tr><tr><td bgcolor="#EEEEEE">'; + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#EEEEEE">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -725,10 +730,14 @@ '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -755,7 +764,8 @@ '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td> </tr> - </table><hr>'; + </table> + <hr>'; echo '<table class="table1"> <tr> @@ -880,22 +890,22 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; } - printf ('<td>%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 class=number>%s</td> - </tr>', - $myrow2['stockid'], - $myrow2['description'], - $DisplayQty, - $myrow2['units'], - $DisplayPrice, - $DisplayDiscount, - $DisplayNet); - + printf ('<td>%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 class="number">%s</td> + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + if (mb_strlen($myrow2['narrative'])>1){ echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; @@ -981,7 +991,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class="number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -1023,18 +1033,22 @@ /*Print out the invoice text entered */ echo '<table class=table1><tr> - <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; - echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; - echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + <td class="number">' . _('Sub Total') . '</td> + <td class="number" bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; + echo '<tr><td class="number">' . _('Freight') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; + echo '<tr><td class="number">' . _('Tax') . '</td> + <td class="number" bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; if ($InvOrCredit=='Invoice'){ - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; + echo '<tr> + <td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> + <td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td> + </tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; + echo '<tr> + <td class="number"><font color=RED><b>' . _('TOTAL CREDIT') .'</b></font></td> + <td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td> + </tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PrintCustTransPortrait.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -334,8 +334,8 @@ $GetControlMovts = DB_query("SELECT moveqty, serialno - FROM stockserialmoves - WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); + FROM stockserialmoves + WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'",$db); if ($myrow2['serialised']==1){ while ($ControlledMovtRow = DB_fetch_array($GetControlMovts)){ @@ -358,7 +358,6 @@ PrintLinesToBottom (); include ('includes/PDFTransPageHeaderPortrait.inc'); } //end if need a new page headed up - } } } @@ -487,7 +486,6 @@ $FromTransNo++; } /* end loop to print invoices */ - if (isset($_GET['Email'])){ //email the invoice to address supplied include('includes/header.inc'); @@ -523,14 +521,18 @@ if (!isset($FromTransNo) OR $FromTransNo=='') { - /*if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Portrait Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td> - <td><select name="InvOrCredit">'; + + echo '<table class="selection"> + <tr> + <td>' . _('Print Invoices or Credit Notes') . '</td> + <td><select name="InvOrCredit">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; @@ -539,9 +541,13 @@ echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name="PrintEDI">'; + echo '<tr> + <td>' . _('Print EDI Transactions') . '</td> + <td><select name="PrintEDI">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; @@ -554,14 +560,23 @@ } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td></tr>'; - echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td></tr> + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Start invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td> + </tr>'; + echo '<tr> + <td>' . _('End invoice/credit note number to print') . '</td> + <td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td> + </tr> </table>'; - echo '<div class="centre"><br /><input type="submit" name="Print" value="' . _('Print Preview') . '"><p>'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<div class="centre"> + <br /> + <input type="submit" name="Print" value="' . _('Print Preview') . '" /> + <br /> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -700,7 +715,7 @@ $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + echo '<p><font color="red" size="4">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } @@ -708,17 +723,25 @@ $PageNumber = 1; echo '<table class="table1"> - <tr><td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + <tr> + <td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /><font size="1">' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out the logo and company name and address */ - echo '<table class"table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class"table1"> + <tr> + <td><font size="4" color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font> + <br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -729,11 +752,17 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td width=50% class+"number">'; + echo '</td> + <td width="50%" class="number">'; /*Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#eee">'; + echo '<table class="table1"> + <tr> + <td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td> + </tr> + <tr> + <td bgcolor="#eee">'; echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . @@ -742,10 +771,14 @@ '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; /*end of the main table showing the company name and charge to details */ if ($InvOrCredit=='Invoice') { @@ -814,11 +847,12 @@ } else { /* then its a credit note */ - echo '<table WIDTH=50%><tr> - <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> + echo '<table width="50%"> + <tr> + <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' .$myrow['brname'] . + <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . @@ -827,14 +861,17 @@ '<br />' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> - <td align=left bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> - <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> - </tr>'; + echo '<hr> + <table class="table1"> + <tr> + <td align="left" bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td> + <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> + </tr>'; echo '<tr> - <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> - <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> - </tr></table>'; + <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> + <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> + </tr> + </table>'; $sql ="SELECT stockmoves.stockid, @@ -903,11 +940,11 @@ printf ('<td>%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 class+"number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow2['stockid'], $myrow2['description'], @@ -918,7 +955,10 @@ $DisplayNet); if (mb_strlen($myrow2['narrative'])>1){ - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + echo $RowStarter . + '<td></td> + <td colspan=6>' . $myrow2['narrative'] . '</td> + </tr>'; $LineCounter++; } @@ -929,17 +969,25 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOP><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '</table> + <table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; + if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<font size="4">' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; + echo '<table class="table1"> + <tr> + <td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; @@ -949,7 +997,9 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td> + </tr> + </table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -976,13 +1026,20 @@ /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN="TOP"><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>'; + echo '<table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#bbb"><b>'; if ($InvOrCredit=='Invoice') { - echo '<font size=4>' . _('TAX INVOICE') .' '; + echo '<font size="4">' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color="red" size="4">' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font> + <br /> + <font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; /*Print out the logo and company name and address */ echo '<table class="table1"> Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/PurchData.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -207,12 +207,12 @@ $myrow['suppname'], locale_number_format($myrow['price'], $myrow['currdecimalplaces']), $myrow['suppliersuom'], - $myrow['conversionfactor'], + locale_number_format($myrow['conversionfactor'],'Variable'), locale_number_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']), $myrow['currcode'], ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], + locale_number_format($myrow['minorderqty'],'Variable'), + locale_number_format($myrow['leadtime'],'Variable'), $DisplayPreferred, $_SERVER['PHP_SELF'], $StockID, @@ -262,14 +262,17 @@ <table cellpadding="3" colspan="4" class="selection"> <tr>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; + echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td>'; echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; echo '<td><input type="text" name="SupplierCode" size=15 maxlength=18></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; + echo '<div class="centre"> + <input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /> + </div> + </form>'; include ('includes/footer.inc'); exit; }; @@ -292,21 +295,24 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.suppname " . LIKE . " '".$SearchString."'"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { $SQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.currcode, - suppliers.address1, - suppliers.address2, - suppliers.address3 - FROM suppliers - WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + suppliers.suppname, + suppliers.currcode, + suppliers.address1, + suppliers.address2, + suppliers.address3 + FROM suppliers + WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + } //one of keywords or SupplierCode was more than a zero length string $ErrMsg = _('The suppliers matching the criteria entered could not be retrieved because'); $DbgMsg = _('The SQL to retrieve supplier details that failed was'); @@ -337,10 +343,11 @@ $StockID = ''; $StockUOM = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table cellpadding="2" colspan="7" class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr><th>' . _('Code') . '</th> + $TableHeader = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Address 1') . '</th> @@ -406,22 +413,24 @@ WHERE purchdata.supplierno='".$SupplierID."' AND purchdata.stockid='".$StockID."' AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'"; + $ErrMsg = _('The supplier purchasing details for the selected supplier and item could not be retrieved because'); $EditResult = DB_query($sql, $db, $ErrMsg); $myrow = DB_fetch_array($EditResult); $SuppName = $myrow['suppname']; - $_POST['Price'] = $myrow['price']; + $_POST['Price'] = locale_number_format(round($myrow['price'],$myrow['currdecimalplaces']),$myrow['currdecimalplaces']); $_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']); $CurrCode = $myrow['currcode']; $CurrDecimalPlaces = $myrow['currdecimalplaces']; $_POST['SuppliersUOM'] = $myrow['suppliersuom']; $_POST['SupplierDescription'] = $myrow['supplierdescription']; - $_POST['LeadTime'] = $myrow['leadtime']; - $_POST['ConversionFactor'] = $myrow['conversionfactor']; + $_POST['LeadTime'] = locale_number_format($myrow['leadtime'],'Variable'); + + $_POST['ConversionFactor'] = locale_number_format($myrow['conversionfactor'],'Variable'); $_POST['Preferred'] = $myrow['preferred']; - $_POST['MinOrderQty'] = $myrow['minorderqty']; + $_POST['MinOrderQty'] = locale_number_format($myrow['minorderqty'],'Variable'); $_POST['SupplierCode'] = $myrow['suppliers_partno']; - $StockUOM=$myrow['units']; + $StockUOM=$myrow['units']; } echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; @@ -431,10 +440,12 @@ } if (isset($_GET['Edit'])) { echo '<tr><td>' . _('Supplier Name') . ':</td> - <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td></tr>'; + <td><input type="hidden" name="SupplierID" value="' . $SupplierID . '" />' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td> + </tr>'; } else { - echo '<tr><td>' . _('Supplier Name') . ':</td> - <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; + echo '<tr> + <td>' . _('Supplier Name') . ':</td> + <input type="hidden" name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; if ($SupplierID!='') { echo '<td>'.$SuppName; } @@ -445,7 +456,7 @@ } echo '</td></tr>'; } - echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; + echo '<td><input type="hidden" name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; if (!isset($CurrCode)) { $CurrCode = ''; } @@ -468,11 +479,11 @@ $_POST['MinOrderQty'] = '1'; } echo '<tr><td>' . _('Currency') . ':</td> - <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; + <td><input type="hidden" name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_number_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength="12" size="12" value=' . $_POST['Price'] . ' /></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength="10" size="11" value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; if (isset($SupplierID)) { echo '<td>' . $StockUOM . '</td></tr>'; @@ -480,7 +491,8 @@ echo '<tr><td>' . _('Suppliers Unit of Measure') . ':</td>'; echo '<td><input type="text" name="SuppliersUOM" size="20" maxlength="20" value ="' . $_POST['SuppliersUOM'] . '"/>'; echo '</td></tr>'; - if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == '') { + if (!isset($_POST['ConversionFactor']) + OR $_POST['ConversionFactor'] == '') { $_POST['ConversionFactor'] = 1; } echo '<tr><td>' . _('Conversion Factor (to our UOM)') . ':</td> @@ -507,9 +519,9 @@ } echo '</select></td></tr></table><br /><div class="centre">'; if (isset($_GET['Edit'])) { - echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '">'; + echo '<input type=submit name="UpdateRecord" value="' . _('Update') . '" />'; } else { - echo '<input type=submit name="AddRecord" value="' . _('Add') . '">'; + echo '<input type=submit name="AddRecord" value="' . _('Add') . '" />'; } echo '</div>'; echo '<div class="centre">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SecurityTokens.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -92,15 +92,16 @@ if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> - <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'"><input type="submit" name="Update" value="' . _('Update') . '" />'; + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'"></td> + <td><input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'" /> + <input type="submit" name="Update" value="' . _('Update') . '" />'; } else { echo '<td>'._('Token ID') . '</td> <td><input type="text" name="TokenID" value="'.$_POST['TokenID'].'" /></td> </tr> <tr> <td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> + <td><input type="text" size="50" maxlength="50" name="TokenDescription" value="'.$_POST['TokenDescription'] .'" /></td> <td><input type="submit" name="Submit" value="' . _('Insert') . '" />'; } @@ -125,7 +126,7 @@ <td>'.$myrow['tokenid'].'</td> <td>'.$myrow['tokenname'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow['tokenid'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this security token?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-06 07:52:38 UTC (rev 4713) +++ trunk/SelectSalesOrder.php 2011-10-06 09:16:44 UTC (rev 4714) @@ -25,39 +25,40 @@ } else { /* Now build SQL of items to purchase with purchasing data and preferred suppliers - sorted by preferred supplier */ $sql = "SELECT purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact, - SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty - FROM purchdata INNER JOIN salesorderdetails ON - purchdata.stockid = salesorderdetails.stkcode - INNER JOIN stockmaster ON - purchdata.stockid = stockmaster.stockid - INNER JOIN stockcategory ON - stockmaster.categoryid = stockcategory.categoryid - WHERE purchdata.preferred=1 - AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND (" . $OrdersToPlacePOFor . ") - GROUP BY purchdata.supplierno, - purchdata.stockid, - purchdata.price, - purchdata.suppliers_partno, - purchdata.supplierdescription, - purchdata.conversionfactor, - purchdata.leadtime, - purchdata.suppliersuom, - stockmaster.kgs, - stockmaster.volume, - stockcategory.stockact - ORDER BY purchdata.supplierno, - purchdata.stockid"; + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact, + SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS orderqty + FROM purchdata INNER JOIN salesorderdetails ON + purchdata.stockid = salesorderdetails.stkcode + INNER JOIN stockmaster ON + purchdata.stockid = stockmaster.stockid + INNER JOIN stockcategory ON + stockmaster.categoryid = stockcategory.categoryid + WHERE purchdata.preferred=1 + AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' + AND (" . $OrdersToPlacePOFor . ") + GROUP BY purchdata.supplierno, + purchdata.stockid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.supplierdescription, + purchdata.conversionfactor, + purchdata.leadtime, + purchdata.suppliersuom, + stockmaster.kgs, + stockmaster.volume, + stockcategory.stockact + ORDER BY purchdata.supplierno, + purchdata.stockid"; + $ErrMsg = _('Unable to retrieve the items on the selected orders for creating purchase orders for'); $ItemResult = DB_query($sql,$db,$ErrMsg); @@ -66,16 +67,16 @@ } else { /*Now get the default delivery address details from the users default stock location */ $sql = "SELECT locationname, - deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; $ErrMsg = _('The delivery address for the order could not be obtained from the user default stock location'); $DelAddResult = DB_query($sql, $db,$ErrMsg); $DelAddRow = DB_fetch_array($DelAddResult); @@ -97,9 +98,9 @@ /* if an order is/has been created already and the supplier of this item has changed - so need to finish off the order */ //if the user has authority to authorise the PO then it should be created as authorised $AuthSQL ="SELECT authlevel - FROM purchorderauth - WHERE userid='".$_SESSION['UserID']."' - AND currabrev='".$SuppRow['currcode']."'"; + FROM purchorderauth + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$SuppRow['currcode']."'"; $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); @@ -120,7 +121,7 @@ if (DB_num_rows($AuthResult) ==0){ $AuthMessage = _('Your authority to approve purchase orders in') . ' ' .$SuppRow['currcode'] . ' ' . _('has not yet been set up') . '<br />'; } else { - $AuthMessage = _('You can only authorise up to').' '.$SuppRow['currcode'].' '.$AuthRow['authlevel'].'.<br />'; + $AuthMessage = _('You can only authorise up to') . ' ' . $SuppRow['currcode'] . ' ' . $AuthRow['authlevel'] . '.<br />'; } prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. @@ -136,7 +137,7 @@ DB_Txn_Commit($db); } - /*Starting a new purchase order with a different supplier */ + /*Starting a new purchase order with a different supplier */ $result = DB_Txn_Begin($db); $PO_OrderNo = GetNextTransNo(18, $db); //get the next PO number @@ -331,10 +332,10 @@ } else { if (isset($_REQUEST['SelectedCustomer'])) { echo _('For customer') . ': ' . $_REQUEST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo "<input type=hidden name='SelectedCustomer' value=" . $_REQUEST['SelectedCustomer'] . '>'; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_REQUEST['SelectedCustomer'] . '" />'; } if (isset($_REQUEST['SelectedStockItem'])) { - echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . " <input type=hidden name='SelectedStockItem' value='" . $_REQUEST['SelectedStockItem'] . "'>"; + echo _('for the part') . ': ' . $_REQUEST['SelectedStockItem'] . ' ' . _('and') . ' <input type="hidden" name="SelectedStockItem" value="' . $_REQUEST['SelectedStockItem'] . '" />'; } } @@ -349,46 +350,49 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, SUM(locstock.quantity) AS qoh, stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.description " . LIKE . " '" . $SearchString . "' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' AND stockmaster.categoryid='" . $_POST['StockCat']. "' GROUP BY stockmaster.stockid, stockmaster.description, + stockmaster.decimalplaces, stockmaster.units ORDER BY stockmaster.stockid"; } elseif (isset($_POST['StockCode'])){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - sum(locstock.quantity) as qoh, - stockmaster.units - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.categoryid='" . $_POST['StockCat'] ."' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + stockmaster.units + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } $ErrMsg = _('No stock items were returned by the SQL because'); @@ -412,10 +416,12 @@ if (!isset($_REQUEST['OrderNumber']) or $_REQUEST['OrderNumber']==''){ - echo '<table class=selection>'; - echo '<tr><td>' . _('Order number') . ': </td> - <td><input type="text" name="OrderNumber" maxlength="8" size="9"></td> - <td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Order number') . ': </td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" /></td> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; @@ -424,36 +430,37 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']. '</option>'; } } - echo '</select></td><td>'; - echo '<select name="Quotations">'; + echo '</select></td> + <td><select name="Quotations">'; if ($_GET['Quotations']=='Quotes_Only'){ $_POST['Quotations']='Quotes_Only'; } if ($_POST['Quotations']=='Quotes_Only'){ - echo '<option selected value="Quotes_Only">' . _('Quotations Only'); - echo '<option value="Orders_Only">' . _('Orders Only'); + echo '<option selected value="Quotes_Only">' . _('Quotations Only') . '</option>'; + echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; } else { - echo '<option selected value="Orders_Only">' . _('Orders Only'); - echo '<option value="Quotes_Only">' . _('Quotations Only'); + echo '<option selected value="Orders_Only">' . _('Orders Only') . '</option>'; + echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; } - echo '</select> </td><td>'; - echo '<input type=submit name="SearchOrders" value="' . _('Search') . '"></td>'; - echo ' <td><a href="' . $rootpath . '/SelectOrderItems.php?' . SID . '&NewOrder=Yes">' . - _('Add Sales Order') . '</a></td></tr></table>'; + echo '</select> </td> + <td><input type=submit name="SearchOrders" value="' . _('Search') . '"></td> + <td><a href="' . $rootpath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Add Sales Order') . '</a></td> + </tr> + </table>'; } $SQL="SELECT categoryid, @@ -463,10 +470,12 @@ $result1 = DB_query($SQL,$db); - echo '<br /><table class="selection">'; - echo '<tr><th colspan=6><font size=3 color=navy>' . _('To search for sales orders for a specific part use the part selection facilities below'); - echo '</th></tr>'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> + <th colspan="6"><font size="3" color="navy">' . _('To search for sales orders for a specific part use the part selection facilities below') . '</th> + </tr> + <tr> <td><font size="1">' . _('Select a stock category') . ':</font> <select name="StockCat">'; @@ -474,27 +483,32 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } - echo '</select> - <td><font size=1>' . _('Enter text extract(s) in the description') . ":</font></td> - <td><input type='Text' name='Keywords' size=20 maxlength=25></td> - </tr> - <tr><td></td> - <td><font size 3><b>" . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . "</b>:</font></td> - <td><input type='Text' name='StockCode' size=15 maxlength=18></td> + echo '</select></td> + <td><font size=1>' . _('Enter text extract(s) in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1">' . _('Enter extract of the Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> </tr> - </table>"; - echo "<br /><input type=submit name='SearchParts' value='" . _('Search Parts Now') . - "'><input type=submit name='ResetPart' value='" . _('Show All') . "'></div><br />"; + </table>'; + echo '<br /> + <input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" /> + <input type="submit" name="ResetPart" value="' . _('Show All') . '" /> + </div> + <br />'; -if (isset($StockItemsResult) and DB_num_rows($StockItemsResult)>0) { +if (isset($StockItemsResult) + AND DB_num_rows($StockItemsResult)>0) { - echo '<table cellpadding=2 colspan=7 class=selection>'; + echo '<table cellpadding="2" colspan="7" class="selection">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -510,15 +524,15 @@ $k++; } - printf("<td><input type=submit name='SelectedStockItem' value='%s'</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - </tr>", - $myrow['stockid'], - $myrow['description'], - $myrow['qoh'], - $myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + $myrow['units']); $j++; if ($j == 12){ @@ -544,7 +558,8 @@ if(!isset($_POST['StockLocation'])) { $_POST['StockLocation'] = ''; } - if (isset($_REQUEST['OrderNumber']) && $_REQUEST['OrderNumber'] !='') { + if (isset($_REQUEST['OrderNumber']) + AND $_REQUEST['OrderNumber'] !='') { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, custbranch.brname, @@ -734,20 +749,21 @@ $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); - echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; + echo '<table cellpadding="2" colspan="7" width="95%" class="selection">'; if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ $tableheader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Invoice') . '</th> - <th>' . _('Dispatch Note') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Cust Order') . ' #</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Req Del Date') . '</th> - <th>' . _('Delivery To') . '</th> - <th>' . _('Order Total') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th>'; + <th>' . _('Modify') . '</th> + <th>' . _('... [truncated message content] |
From: <dai...@us...> - 2011-10-08 09:45:06
|
Revision: 4715 http://web-erp.svn.sourceforge.net/web-erp/?rev=4715&view=rev Author: daintree Date: 2011-10-08 09:44:56 +0000 (Sat, 08 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PcAuthorizeExpenses.php trunk/PcExpenses.php trunk/RecurringSalesOrders.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SalesAnalReptCols.php trunk/SalesAnalRepts.php trunk/SalesAnalysis_UserDefined.php trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/includes/ConnectDB.inc trunk/includes/ConstructSQLForUserDefinedSalesReport.inc trunk/includes/PDFSalesAnalysis.inc trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcAuthorizeExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -57,7 +57,7 @@ echo '<br /><table class=selection>'; echo '<tr><th colspan=7>' . _('Detail Of Movement For Last ') .': '; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" />' . _('Days'); - echo '<input type=submit name="Go" value="' . _('Go') . '"></tr></th>'; + echo '<input type="submit" name="Go" value="' . _('Go') . '"></tr></th>'; echo '</form>'; $sql = "SELECT pcashdetails.counterindex, @@ -101,7 +101,9 @@ while ($myrow=DB_fetch_array($result)) { $CurrDecimalPlaces = $myrow['decimalplaces']; //update database if update pressed - if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) + AND $_POST['Submit']=='Update') + AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -119,12 +121,14 @@ $type = 1; $Amount = -$Amount; $AccountFrom = $myrow['glaccountpcash']; - $SQLAccExp = "SELECT glaccount + $SQLAccExp = "SELECT glaccount, + tag FROM pcexpenses WHERE codeexpense = '".$myrow['codeexpense']."'"; $ResultAccExp = DB_query($SQLAccExp,$db); $myrowAccExp = DB_fetch_array($ResultAccExp); $AccountTo = $myrowAccExp['glaccount']; + $TagTo = $myrowAccExp['tag']; } //get typeno @@ -158,7 +162,7 @@ '".-$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultFrom = DB_Query($sqlFrom, $db, '', '', true); @@ -185,7 +189,7 @@ '".$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultTo = DB_Query($sqlTo, $db, '', '', true); @@ -253,13 +257,13 @@ if(($Authoriser!='00/00/0000')){ echo'<td>'.ConvertSQLDate($myrow['authorized']).'</td>'; }else{ - echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'">'; + echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'" /></td>'; } } - echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '">'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; - echo '<input type="hidden" name="Days" value="' .$Days. '">'; + echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '" />'; + echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />'; + echo '<input type="hidden" name="Days" value="' .$Days. '" />'; echo'</tr>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -20,6 +20,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } @@ -85,10 +86,11 @@ if (isset($SelectedExpense) AND $InputError !=1) { - $sql = "UPDATE pcexpenses - SET description = '" . DB_escape_string($_POST['Description']) . "', - glaccount = '" . $_POST['GLAccount'] . "' - WHERE codeexpense = '" . $SelectedExpense . "'"; + $sql = "UPDATE pcexpenses + SET description = '" . DB_escape_string($_POST['Description']) . "', + glaccount = '" . $_POST['GLAccount'] . "', + tag = '" . $_POST['Tag'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -111,11 +113,14 @@ $sql = "INSERT INTO pcexpenses (codeexpense, - description,glaccount) + description, + glaccount, + tag) VALUES ('" . $_POST['CodeExpense'] . "', '" . DB_escape_string($_POST['Description']) . "', - '" . $_POST['GLAccount'] . "')"; - + '" . $_POST['GLAccount'] . "', + '" . $_POST['Tag'] . "')"; + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; @@ -134,6 +139,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } } elseif ( isset($_GET['delete']) ) { @@ -181,6 +187,7 @@ <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> + <th>' . _('Tag') . '</th> </tr>'; $k=0; //row colour counter @@ -200,20 +207,29 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); + + $SqlDescTag="SELECT tagdescription + FROM tags + WHERE tagref='". $myrow[3] . "'"; + $ResultDesTag = DB_query($SqlDescTag,$db); + $DescriptionTag=DB_fetch_array($ResultDesTag); + printf('<td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $Description[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[2], + $Description['accountname'], + $DescriptionTag['tagdesciption'], + $_SERVER['PHP_SELF'] . '?', $myrow[0], + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -228,14 +244,15 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table // The user wish to EDIT an existing type if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, - glaccount + glaccount, + tag FROM pcexpenses WHERE codeexpense='" . $SelectedExpense . "'"; @@ -245,6 +262,7 @@ $_POST['CodeExpense'] = $myrow['codeexpense']; $_POST['Description'] = $myrow['description']; $_POST['GLAccount'] = $myrow['glaccount']; + $_POST['Tag'] = $myrow['tag']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; @@ -274,7 +292,9 @@ <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; + echo '<tr> + <td>' . _('Account Code') . ':</td> + <td><select name="GLAccount">'; DB_free_result($result); $SQL = "SELECT accountcode, @@ -294,11 +314,34 @@ } //end while loop echo '</select></td></tr>'; + + //Select the tag + DB_free_result($result); + echo '<tr> + <td>' . _('Tag') . ':</td> + <td><select name="Tag">'; + $SQL = "SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + + $result=DB_query($SQL,$db); + echo '<option value="0">0 - ' . _('None') . '</option>'; + while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['Tag']) and $_POST['Tag']==$myrow['tagref']){ + echo '<option selected value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'].'</option>'; + } else { + echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; + } + } + echo '</select></td>'; + // End select tag + echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"> - <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '" /> + <input type="submit" name="Cancel" value="' . _('Cancel') . '" /></div>'; echo '</form>'; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/RecurringSalesOrders.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -160,11 +160,11 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); @@ -287,7 +287,7 @@ stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', frequency = '" . $_POST['Frequency'] . "', autoinvoice = '" . $_POST['AutoInvoice'] . "' - WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -420,7 +420,7 @@ echo '<tr> <td>'. _('Last Recurrence') . ':</td> <td>' . $_POST['StartDate'] . '</td></tr>'; - echo '<input type=hidden name="StartDate" value="' . $_POST['StartDate'] . '">'; + echo '<input type="hidden" name="StartDate" value="' . $_POST['StartDate'] . '">'; } if (!isset($_POST['StopDate'])){ @@ -486,7 +486,7 @@ } echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoInvoice" value=0>'; + echo '<input type="hidden" name="AutoInvoice" value=0>'; } echo '</table>'; @@ -496,8 +496,8 @@ echo '<input type="hidden" name="NewRecurringOrder" value="Yes" />'; echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '" />'; } else { - echo '<input type=hidden name="NewRecurringOrder" value="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; + echo '<input type="hidden" name="NewRecurringOrder" value="No">'; + echo '<input type="hidden" name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />'; echo '<hr>'; Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevel.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -170,7 +170,10 @@ locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); - echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; if (!isset($_POST['StockLocation'])){ $_POST['StockLocation']='All'; } @@ -200,7 +203,9 @@ exit; } - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -217,7 +222,11 @@ } } echo '</select></td></tr>'; - echo '</table><br /><div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; include('includes/footer.inc'); Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevelLocation.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -60,19 +60,20 @@ $Location=DB_fetch_array($ResultLocation); echo'<p class="page_title_text" align="center"><strong>' . _('Location : ') . '' . $Location['locationname'] . ' </strong></p>'; - echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . $_POST['NumberOfDays'] . '' . _(' Days ') . ' </strong></p>'; + echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . locale_number_format($_POST['NumberOfDays'],0) . '' . _(' Days ') . ' </strong></p>'; echo '<table>'; - echo '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> - <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> - <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> - <th>' . _('Reorder Level') . '</th> - <tr>'; + echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> + <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> + <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> + <th>' . _('Reorder Level') . '</th> + <tr>'; $k=0; //row colour counter - echo'<form action="ReorderLevelLocation.php" method="POST" name="update">'; + echo'<form action="ReorderLevelLocation.php" method="post" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $i=1; while ($myrow=DB_fetch_array($result)) { @@ -88,9 +89,9 @@ //variable for update data echo'<input type="hidden" value=' . $_POST['order'] . ' name='. _('order').' /> - <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> - <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> - <input type="hidden" value="' . $_POST['NumberOfDays'] . '" name="NumberOfDays" />'; + <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> + <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> + <input type="hidden" value="' . locale_number_format($_POST['NumberOfDays'],0) . '" name="NumberOfDays" />'; //get qtyinvoice all $sqlinv="SELECT sum(salesorderdetails.qtyinvoiced)as qtyinvoice @@ -138,13 +139,13 @@ <td class="number">'.$QtyInvoice.'</td> <td class="number">'.$ohRow['0'].'</td> <td class="number">'.$ohinRow['0'].'</td> - <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. $myrow['reorderlevel'] .'" /> + <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /></td> </tr> '; $i++; } //end of looping echo'<tr> - <td style="text-align:center" colspan=7><input type="submit" name="submit" value=' . _('Update') . ' /></td> + <td style="text-align:center" colspan="7"><input type="submit" name="submit" value=' . _('Update') . ' /></td> </tr> </form>'; @@ -191,14 +192,21 @@ echo'<tr> <td>' . _('Number Of Days Sales') . ':</td> <td><input type="text" class="number" name="NumberOfDays" maxlength="3" size="4" value="0" /></td>'; - echo '<tr><td>' . _('Order By') . ':</td> - <td><select name="order">'; - echo '<option value="1">'. _('Total Invoiced') . '</option>'; - echo '<option value="2">'. _('Item Code') . '</option>'; + echo '<tr> + <td>' . _('Order By') . ':</td> + <td><select name="order"> + <option value="1">'. _('Total Invoiced') . '</option> + <option value="2">'. _('Item Code') . '</option> + </select></td> + </tr>'; + echo '</table> + <br /> + <p> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Submit') . '"> + </div> + </p>'; - echo '</select></td></tr>'; - echo '</table><br /><p><div class="centre"><input type="submit" name="submit" value="' . _('Submit') . '"></div></p>'; - } /*end of else not submit */ include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ReprintGRN.php =================================================================== --- trunk/ReprintGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReprintGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -13,15 +13,20 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection">'; -echo '<tr><th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th></tr>'; -echo '<tr><td>' . _('Enter a Purchase Order Number') . '</td>'; -echo '<td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td></tr>'; -echo '<tr><td colspan=2 style="text-align: center"><input type="submit" name="Show" value="Show GRNs" /></td></tr>'; +echo '<table class="selection"> + <tr> + <th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th> + </tr> + <tr> + <td>' . _('Enter a Purchase Order Number') . '</td> + <td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td> + </tr> + <tr> + <td colspan="2" style="text-align: center"><input type="submit" name="Show" value="' . _('Show GRNs') . '" /></td> + </tr> + </table> + </form>'; -echo '</table>'; -echo '</form>'; - if (isset($_POST['Show'])) { if ($_POST['PONumber']=='') { echo '<br />'; @@ -64,15 +69,21 @@ exit; } $k=0; - echo '<br /><table class="selection">'; - echo '<tr><th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th></tr>'; - echo '<tr><th>' . _('Supplier') . '</th>'; - echo '<th>' . _('PO Order line') . '</th>'; - echo '<th>' . _('GRN Number') . '</th>'; - echo '<th>' . _('Item Code') . '</th>'; - echo '<th>' . _('Item Description') . '</th>'; - echo '<th>' . _('Delivery Date') . '</th>'; - echo '<th>' . _('Quantity Received') . '</th></tr>'; + echo '<br /> + <table class="selection"> + <tr> + <th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th> + </tr> + <tr> + <th>' . _('Supplier') . '</th> + <th>' . _('PO Order line') . '</th> + <th>' . _('GRN Number') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Delivery Date') . '</th> + <th>' . _('Quantity Received') . '</th> + </tr>'; + while ($myrow=DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -81,15 +92,15 @@ echo '<tr class="OddTableRows">'; $k=1; } - echo '<td>' . $myrow['suppname'] . '</td>'; - echo '<td class="number">' . $myrow['podetailitem'] . '</td>'; - echo '<td class="number">' . $myrow['grnbatch'] . '</td>'; - echo '<td>' . $myrow['itemcode'] . '</td>'; - echo '<td>' . $myrow['itemdescription'] . '</td>'; - echo '<td>' . $myrow['deliverydate'] . '</td>'; - echo '<td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td>'; - echo '<td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow['suppname'] . '</td> + <td class="number">' . $myrow['podetailitem'] . '</td> + <td class="number">' . $myrow['grnbatch'] . '</td> + <td>' . $myrow['itemcode'] . '</td> + <td>' . $myrow['itemdescription'] . '</td> + <td>' . $myrow['deliverydate'] . '</td> + <td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td> + <td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td> + </tr>'; } echo '</table>'; } Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReverseGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -12,8 +12,11 @@ if ((isset($_SESSION['SupplierID']) AND $_SESSION['SupplierID']!='') OR (!isset($_POST['SupplierID']) OR $_POST['SupplierID'])==''){ + $_POST['SupplierID']=$_SESSION['SupplierID']; + } + if (!isset($_POST['SupplierID']) OR $_POST['SupplierID']==""){ echo '<br />' . _('This page is expected to be called after a supplier has been selected'); echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SelectSupplier.php">'; @@ -25,8 +28,7 @@ $_POST['SuppName'] = $SuppRow[0]; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . - '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; if (isset($_GET['GRNNo']) AND isset($_POST['SupplierID'])){ /* SQL to process the postings for the GRN reversal.. */ @@ -48,7 +50,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem INNER JOIN purchorders ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; + WHERE AND grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; @@ -59,7 +61,8 @@ $QtyToReverse = $GRN['qtyrecd'] - $GRN['quantityinv']; if ($QtyToReverse ==0){ - echo '<br /><br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); + echo '<br /> + <br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); include ('includes/footer.inc'); exit; } @@ -118,7 +121,7 @@ /*Now the SQL to do the update to the PurchOrderDetails */ $SQL = "UPDATE purchorderdetails - SET quantityrecd = quantityrecd - '" . filter_number_format($QtyToReverse) . "', + SET quantityrecd = quantityrecd - '" . $QtyToReverse . "', completed=0 WHERE purchorderdetails.podetailitem = '" . $GRN['podetailitem'] . "'"; @@ -144,9 +147,9 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be deleted because'); $DbgMsg = _('The following SQL to delete the GRN record was used'); - $result = DB_query("DELETE FROM grns WHERE grnno='" . filter_number_format($_GET['GRNNo']) . "'",$db,$ErrMsg,$DbgMsg,true); + $result = DB_query("DELETE FROM grns WHERE grnno='" . $_GET['GRNNo'] . "'",$db,$ErrMsg,$DbgMsg,true); } else { - $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . filter_number_format($QtyToReverse) . " + $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . $QtyToReverse . " WHERE grns.grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be updated') . '. ' . _('This reversal of goods received has not been processed because'); @@ -163,18 +166,18 @@ inputdate, cost) VALUES ('" . $GRN['assetid'] . "', - 25, - '" . $_GET['GRNNo'] . "', - '" . $GRN['deliverydate'] . "', - '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', - '" . filter_number_format((-$GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '25', + '" . $_GET['GRNNo'] . "', + '" . $GRN['deliverydate'] . "', + '" . $PeriodNo . "', + '" . Date('Y-m-d') . "', + '" . (-$GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE The fixed asset transaction could not be inserted because'); $DbgMsg = _('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); /*now reverse the cost put to fixedassets */ - $SQL = "UPDATE fixedassets SET cost = cost - " . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . " + $SQL = "UPDATE fixedassets SET cost = cost - " . $GRN['stdcostunit'] * $QtyToReverse . " WHERE assetid = '" . $GRN['assetid'] . "'"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost addition could not be reversed:'); $DbgMsg = _('The following SQL was used to attempt the reduce the cost of the asset was:'); @@ -237,9 +240,9 @@ '" . $GRN['deliverydate'] . "', '" . $PeriodNo . "', '" . _('Reversal') . ' - ' . $_POST['SupplierID'] . ' - ' . $GRN['orderno'] . "', - '" . filter_number_format(-$QtyToReverse) . "', + '" . -$QtyToReverse . "', '" . $GRN['stdcostunit'] . "', - '" . filter_number_format($QtyOnHandPrior - $QtyToReverse) . "' + '" . $QtyOnHandPrior - $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); @@ -260,6 +263,7 @@ '" . $GRN['itemcode'] . "', '" . $SerialStockMoves['serialno'] . "', '" . -$SerialStockMoves['moveqty'] . "')"; + $result = DB_query($SQL,$db,_('Could not insert the reversing stock movements for the batch/serial numbers'),_('The SQL used but failed was') . ':',true); $SQL = "UPDATE stockserialitems @@ -274,9 +278,14 @@ /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $GRN['glcode'] !=0 AND $GRN['stdcostunit']!=0){ /*GLCode is set to 0 when the GLLink is not activated - this covers a situation where the GLLink is now active but it wasn't when this PO was entered */ - /*first the credit using the GLCode in the PO detail record entry*/ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 + AND $GRN['glcode'] !=0 + AND $GRN['stdcostunit']!=0){ + + /*GLCode is set to 0 when the GLLink is not activated + this covers a situation where the GLLink is now active but it wasn't when this PO was entered + + First the credit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, typeno, @@ -292,7 +301,7 @@ '" . $PeriodNo . "', '" . $GRN['glcode'] . "', '" . _('GRN Reversal for PO') .": " . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format(-($GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '" . -($GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted for the reversal of the received item because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -313,7 +322,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', '" . _('GRN Reversal PO') . ': ' . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . "' + '" . $GRN['stdcostunit'] * $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); @@ -326,7 +335,7 @@ echo '<br />' . _('GRN number') . ' ' . $_GET['GRNNo'] . ' ' . _('for') . ' ' . $QtyToReverse . ' x ' . $GRN['itemcode'] . ' - ' . $GRN['itemdescription'] . ' ' . _('has been reversed') . '<br />'; unset($_GET['GRNNo']); // to ensure it cant be done again!! - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Select another GRN to Reverse') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another GRN to Reverse') . '</a>'; /*end of Process Goods Received Reversal entry */ } else { @@ -337,14 +346,17 @@ $_POST['RecdAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date("m")-3,Date("d"),Date("Y"))); } echo '<table class="selection"><tr>'; - echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '">'; - echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '">'; + echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '" />'; + echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '" />'; echo '<td>'._('Show all goods received after') . ': </td> - <td><input type="text" class="date" alt="'. - $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . - '" MAXLENGTH =10 size=10></td></tr>';; - echo '</table>'; - echo '<br /><div class=centre><input type=submit name="ShowGRNS" value=' . _('Show Outstanding Goods Received') . '></div>'; + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . '" maxlength="10" size="10" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowGRNS" value="' . _('Show Outstanding Goods Received') . '" /> + </div>'; + if (isset($_POST['ShowGRNS'])){ $sql = "SELECT grnno, @@ -368,15 +380,15 @@ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; $TableHeader = '<tr> - <th>' . _('GRN') . ' #</th> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Date') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> - <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> - </tr>'; - + <th>' . _('GRN') . ' #</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Date') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> + <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> + </tr>'; + echo $TableHeader; /* show the GRNs outstanding to be invoiced that could be reversed */ @@ -391,29 +403,29 @@ $k=1; } - $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],2); - $DisplayQtyInv = locale_number_format($myrow['quantityinv'],2); - $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],2); + $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],'Variable'); + $DisplayQtyInv = locale_number_format($myrow['quantityinv'],'Variable'); + $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],'Variable'); $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - </tr>', - $myrow['grnno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $DisplayDateDel, - $DisplayQtyRecd, - $DisplayQtyInv, - $DisplayQtyRev, - $LinkToRevGRN); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['grnno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $DisplayDateDel, + $DisplayQtyRecd, + $DisplayQtyInv, + $DisplayQtyRev, + $LinkToRevGRN); $RowCounter++; if ($RowCounter >20){ Modified: trunk/SalesAnalReptCols.php =================================================================== --- trunk/SalesAnalReptCols.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalReptCols.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Sales Analysis Report Columns'); @@ -15,39 +13,41 @@ /*Sales analysis headers group by data options */ if ($DataX == 'Quantity'){ - echo '<option selected Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option selected value="Quantity">' . _('Quantity') . '</option>'; } else { - echo '<option Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option value="Quantity">' . _('Quantity') . '</option>'; } if ($DataX == 'Gross Value'){ - echo '<option selected Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option selected value="Gross Value">' . _('Gross Value') . '</option>'; } else { - echo '<option Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option value="Gross Value">' . _('Gross Value') . '</option>'; } if ($DataX == 'Net Value'){ - echo '<option selected Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option selected value="Net Value">' . _('Net Value') . '</option>'; } else { - echo '<option Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option value="Net Value">' . _('Net Value') . '</option>'; } if ($DataX == 'Gross Profit'){ - echo '<option selected Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option selected value="Gross Profit">' . _('Gross Profit') . '</option>'; } else { - echo '<option Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option value="Gross Profit">' . _('Gross Profit') . '</option>'; } if ($DataX == 'Cost'){ - echo '<option selected Value="Cost">' . _('Cost') . '</option>'; + echo '<option selected value="Cost">' . _('Cost') . '</option>'; } else { - echo '<option Value="Cost">' . _('Cost') . '</option>'; + echo '<option value="Cost">' . _('Cost') . '</option>'; } if ($DataX == 'Discount'){ - echo '<option selected Value="Discount">' . _('Discount') . '</option>'; + echo '<option selected value="Discount">' . _('Discount') . '</option>'; } else { - echo '<option Value="Discount">' . _('Discount') . '</option>'; + echo '<option value="Discount">' . _('Discount') . '</option>'; } } /* end of functions -Right ... now to the meat */ + +Right ... now to the meat */ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; if (isset($_GET['SelectedCol'])){ @@ -246,18 +246,23 @@ if (DB_num_rows($result)!=0){ $myrow = DB_fetch_array($result); - echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b><br /></div><table class=selection>'; - echo '<tr><th>' . _('Col') . ' #</th> + echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b> + <br /> + </div> + <table class="selection"> + <tr> + <th>' . _('Col') . ' #</th> <th>' . _('Heading 1') . '</th> - <th>' . _('Heading 2') . '</th>'; - echo '<th>' . _('Calc') . '</th> - <th>' . _('Prd From') . '</th> - <th>' . _('Prd To') . '</th>'; - echo '<th>' . _('Data') . '</th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th>'; - echo '<th>' . _('Operator') . '</th> - <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th></tr>'; + <th>' . _('Heading 2') . '</th> + <th>' . _('Calc') . '</th> + <th>' . _('Prd From') . '</th> + <th>' . _('Prd To') . '</th> + <th>' . _('Data') . '</th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th> + <th>' . _('Operator') . '</th> + <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th> + </tr>'; $k=0; //row colour counter do { @@ -292,7 +297,7 @@ <td>%s</td> <td>%s</td> <td><a href="%sReportID=%s&SelectedCol=%s&delete=1">' . _('Delete') . '</td></tr>', - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1], $myrow[1], @@ -306,7 +311,7 @@ $myrow[9], $myrow[10], $BudOrAct, - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1]); @@ -314,7 +319,11 @@ //END WHILE LIST LOOP } -echo '</table><br /><div class="centre"><a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a></div><p>'; +echo '</table> + <br /> + <div class="centre"> + <a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a> + </div>'; if (DB_num_rows($result)>10){ prnMsg(_('WARNING') . ': ' . _('User defined reports can have up to 10 columns defined') . '. ' . _('The report will not be able to be run until some columns are deleted'),'warn'); } @@ -327,8 +336,8 @@ $ReportHeading=$myrow['reportheading']; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="ReportHeading" value='.$ReportHeading.'>'; - echo '<input type=hidden name="ReportID" VALUE=' . $ReportID . '>'; + echo '<input type="hidden" name="ReportHeading" value="'.$ReportHeading.'" />'; + echo '<input type=hidden name="ReportID" value="' . $ReportID . '" />'; if (isset($SelectedCol)) { //editing an existing Column @@ -373,44 +382,55 @@ $_POST['BudgetOrActual']=$myrow['budgetoractual']; $_POST['ValFormat']=$myrow['valformat']; - echo '<input type=hidden name="SelectedCol" VALUE=' . $SelectedCol . '>'; - echo '<table class=selection>'; + echo '<input type=hidden name="SelectedCol" value="' . $SelectedCol . '" />'; + echo '<table class="selection">'; } else { - echo '<table class=selection>'; + echo '<table class="selection">'; if (!isset($_POST['ColID'])) { $_POST['ColID']=1; } - echo '<tr><td>' . _('Column Number') . ':</td> - <td><input type="text" class=number name=ColID size=3 maxlength=3 Value=' . $_POST['ColID'] . '> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</td>'; + echo '<tr> + <td>' . _('Column Number') . ':</td> + <td><input type="text" class="number" name=ColID size=3 maxlength=3 value="' . $_POST['ColID'] . '"> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</font></td> + </tr>'; } if (!isset($_POST['Heading1'])) { $_POST['Heading1']=''; } - echo '<tr><td>' . _('Heading line 1') . ':</td> - <td><input type="TEXT" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Heading line 1') . ':</td> + <td><input type="text" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td> + </tr>'; if (!isset($_POST['Heading2'])) { $_POST['Heading2']=''; } - echo '<tr><td>' . _('Heading line 2') . ':</td><td><input type="TEXT" size=16 maxlength=15 name="Heading2" value="' . $_POST['Heading2'] . '"></td></tr>'; - echo '<tr><td>' . _('Calculation') . ':</td><td><select name="Calculation">'; + echo '<tr> + <td>' . _('Heading line 2') . ':</td> + <td><input type="text" size="16" maxlength="15" name="Heading2" value="' . $_POST['Heading2'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation') . ':</td> + <td><select name="Calculation">'; if (!isset($_POST['Calculation'])) { $_POST['Calculation']=0; } if ($_POST['Calculation'] ==1){ - echo '<option selected Value=1>' . _('Yes'); - echo '<option Value=0>' . _('No'); + echo '<option selected value="1">' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; } else { - echo '<option Value=1>' . _('Yes'); - echo '<option selected Value=0>' . _('No'); + echo '<option value="1">' . _('Yes') . '</option>'; + echo '<option selected value="0">' . _('No') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if ($_POST['Calculation']==0){ /*Its not a calculated column */ - echo '<tr><td>' . _('From Period') . ':</td> - <td><select name="PeriodFrom"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('From Period') . ':</td> + <td><select name="PeriodFrom"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -420,11 +440,13 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('ToPeriod') . ':</td> - <td><select name="PeriodTo"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('ToPeriod') . ':</td> + <td><select name="PeriodTo"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -434,34 +456,46 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Data to show') . ':</td><td><select name="DataType">'; + echo '<tr> + <td>' . _('Data to show') . ':</td> + <td><select name="DataType">'; DataOptions($_POST['DataType']); - echo '</select></td></tr>'; - echo '<tr><td>' . _('Budget or Actual') . ':</td><td><select name=BudgetOrActual>'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Budget or Actual') . ':</td> + <td><select name="BudgetOrActual">'; if ($_POST['BudgetOrActual']==0){ - echo '<option selected Value=0>' . _('Budget') . '</option>'; - echo '<option Value=1>' . _('Actual') . '</option>'; + echo '<option selected value="0">' . _('Budget') . '</option>'; + echo '<option value="1">' . _('Actual') . '</option>'; } else { - echo '<option Value=0>' . _('Budget') . '</option>'; - echo '<option selected Value=1>' . _('Actual') . '</option>'; + echo '<option value="0">' . _('Budget') . '</option>'; + echo '<option selected value="1">' . _('Actual') . '</option>'; } - echo '</select></td></tr>'; - echo '<input type=hidden name="ValFormat" Value="N"> - <input type=hidden name="ColNumerator" Value=0> - <input type=hidden name="ColDenominator" Value=0> - <input type=hidden name="CalcOperator" Value=""> - <input type=hidden name="Constant" Value=0>'; + echo '</select></td> + </tr>'; + echo '<input type=hidden name="ValFormat" value="N" /> + <input type=hidden name="ColNumerator" value="0" /> + <input type=hidden name="ColDenominator" value="0" /> + <input type=hidden name="CalcOperator" value="" /> + <input type=hidden name="Constant" value="0" />'; } else { /*it IS a calculated column */ - echo '<tr><td>' . _('Numerator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColNumerator" value=' . $_POST['ColNumerator'] . '></td></tr>'; - echo '<tr><td>' . _('Denominator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColDenominator" value=' . $_POST['ColDenominator'] . '></td></tr>'; - echo '<tr><td>' . _('Calculation Operator') . ':</td> - <td><select name="CalcOperator">'; + echo '<tr> + <td>' . _('Numerator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColNumerator" value="' . $_POST['ColNumerator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Denominator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColDenominator" value="' . $_POST['ColDenominator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation Operator') . ':</td> + <td><select name="CalcOperator">'; if ($_POST['CalcOperator'] == '/'){ echo '<option selected value="/">' . _('Numerator Divided By Denominator') . '</option>'; } else { @@ -488,26 +522,36 @@ echo '<option value="-">' . _('Numerator Minus Denominator') . '</option>'; } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Constant') . ':</td><td><input type="TEXT" size=10 maxlength=10 name="Constant" value=' . $_POST['Constant'] . '></td></tr>'; - echo '<tr><td>' . _('Format Type') . ':</td><td><select name="ValFormat">'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Constant') . ':</td> + <td><input type="text" size="10" maxlength="10" name="Constant" value="' . $_POST['Constant'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Format Type') . ':</td> + <td><select name="ValFormat">'; if ($_POST['ValFormat']=='N'){ - echo '<option selected Value="N">' . _('Numeric'); - echo '<option Value="P">' . _('Percentage'); + echo '<option selected value="N">' . _('Numeric') . '</option>'; + echo '<option value="P">' . _('Percentage') . '</option>'; } else { - echo '<option Value="N">' . _('Numeric'); - echo '<option selected Value="P">' . _('Percentage'); + echo '<option value="N">' . _('Numeric') . '</option>'; + echo '<option selected value="P">' . _('Percentage') . '</option>'; } - echo '</select></td></tr><input type=hidden name="BudgetOrActual" Value=0> - <input type=hidden name="DataType" Value=""> - <input type=hidden name="PeriodFrom" Value=0> - <input type=hidden name="PeriodTo" Value=0>'; + echo '</select></td></tr> + <input type=hidden name="BudgetOrActual" value="0" /> + <input type=hidden name="DataType" value="" /> + <input type=hidden name="PeriodFrom" value="0" /> + <input type=hidden name="PeriodTo" value="0" />'; } - echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/SalesAnalRepts.php =================================================================== --- trunk/SalesAnalRepts.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalRepts.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -100,15 +100,15 @@ $InputError = 1; prnMsg (_('Group by Level 1 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower limits not set')); } - if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' || $_POST['Upper2']=='')) { + if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' OR $_POST['Upper2']=='')) { $InputError = 1; prnMsg( _('Group by Level 2 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' || $_POST['Upper3']=='')) { + if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' OR $_POST['Upper3']=='')) { $InputError = 1; prnMsg( _('Group by Level 3 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' || $_POST['Upper4']=='')) { + if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' OR $_POST['Upper4']=='')) { $InputError = 1; prnMsg( _('Group by Level 4 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } @@ -138,23 +138,23 @@ delete code below*/ $sql = "UPDATE reportheaders SET - reportheading='" . $_POST['ReportHeading'] . "', - groupbydata1='" . $_POST['GroupByData1'] . "', - groupbydata2='" . $_POST['GroupByData2'] . "', - groupbydata3='" . $_POST['GroupByData3'] . "', - groupbydata4='" . $_POST['GroupByData4'] . "', - newpageafter1='" . $_POST['NewPageAfter1'] . "', - newpageafter2='" . $_POST['NewPageAfter2'] . "', - newpageafter3='" . $_POST['NewPageAfter3'] . "', - lower1='" . $_POST['Lower1'] . "', - upper1='" . $_POST['Upper1'] . "', - lower2='" . $_POST['Lower2'] . "', - upper2='" . $_POST['Upper2'] . "', - lower3='" . $_POST['Lower3'] . "', - upper3='" . $_POST['Upper3'] . "', - lower4='" . $_POST['Lower4'] . "', - upper4='" . $_POST['Upper4'] . "' - WHERE reportid = " . $SelectedReport; + reportheading='" . $_POST['ReportHeading'] . "', + groupbydata1='" . $_POST['GroupByData1'] . "', + groupbydata2='" . $_POST['GroupByData2'] . "', + groupbydata3='" . $_POST['GroupByData3'] . "', + groupbydata4='" . $_POST['GroupByData4'] . "', + newpageafter1='" . $_POST['NewPageAfter1'] . "', + newpageafter2='" . $_POST['NewPageAfter2'] . "', + newpageafter3='" . $_POST['NewPageAfter3'] . "', + lower1='" . filter_number_format($_POST['Lower1']) . "', + upper1='" . filter_number_format($_POST['Upper1']) . "', + lower2='" . filter_number_format($_POST['Lower2']) . "', + upper2='" . filter_number_format($_POST['Upper2']) . "', + lower3='" . filter_number_format($_POST['Lower3']) . "', + upper3='" . filter_number_format($_POST['Upper3']) . "', + lower4='" . filter_number_format($_POST['Lower4']) . "', + upper4='" . filter_number_format($_POST['Upper4']) . "' + WHERE reportid = " . $SelectedReport; $ErrMsg = _('The report could not be updated because'); $DbgMsg = _('The SQL used to update the report headers was'); @@ -209,14 +209,14 @@ '" . $_POST['NewPageAfter1'] . "', '" . $_POST['NewPageAfter2'] . "', '" . $_POST['NewPageAfter3'] . "', - '" . $_POST['Lower1'] . "', - '" . $_POST['Upper1'] . "', - '" . $_POST['Lower2'] . "', - '" . $_POST['Upper2'] . "', - '" . $_POST['Lower3'] . "', - '" . $_POST['Upper3'] . "', - '" . $_POST['Lower4'] . "', - '" . $_POST['Upper4'] . "' + '" . filter_number_format($_POST['Lower1']) . "', + '" . filter_number_format($_POST['Upper1']) . "', + '" . filter_number_format($_POST['Lower2']) . "', + '" . filter_number_format($_POST['Upper2']) . "', + '" . filter_number_format($_POST['Lower3']) . "', + '" . filter_number_format($_POST['Upper3']) . "', + '" . filter_number_format($_POST['Lower4']) . "', + '" . filter_number_format($_POST['Upper4']) . "' )"; $ErrMsg = _('The report could not be added because'); @@ -277,9 +277,10 @@ $result = DB_query("SELECT reportid, reportheading FROM reportheaders ORDER BY reportid",$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Report No') . '</th> - <th>' . _('Report Title') . '</th>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Report No') . '</th> + <th>' . _('Report Title') . '</th>'; $k=0; //row colour counter @@ -293,27 +294,27 @@ } - printf("<td>%s</td> - <td>%s</td> - <td><a href=\"%s&SelectedReport=%s\">" . _('Design') . "</a></td> - <td><a href=\"%s/SalesAnalReptCols.php?ReportID=%s\">" . _('Define Columns') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True\">" . _('Make PDF Report') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True\">" . _('Make CSV File') . "</a></td> - <td><a href=\"%s&SelectedReport=%s&delete=1\" onclick=\"return confirm('" . _('Are you sure you wish to remove this report design?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td><a href="%s&SelectedReport=%s">' . _('Design') . '</a></td> + <td><a href="%s/SalesAnalReptCols.php?ReportID=%s">' . _('Define Columns') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True">' . _('Make PDF Report') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True">' . _('Make CSV File') . '</a></td> + <td><a href="%s&SelectedReport=%s&delete=1" onclick="return confirm(\"' . _('Are you sure you wish to remove this report design?') . '\");">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); + } //END WHILE LIST LOOP echo '</table><p>'; @@ -324,7 +325,7 @@ if (isset($SelectedReport)) { - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Show All Defined Reports') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Defined Reports') . '</a>'; } echo '<p />'; @@ -338,24 +339,24 @@ //editing an existing Report $sql = "SELECT reportid, - reportheading, - groupbydata1, - newpageafter1, - upper1, - lower1, - groupbydata2, - newpageafter2, - upper2, - lower2, - groupbydata3, - upper3, - lower3, - newpageafter3, - groupbydata4, - upper4, - lower4 - FROM reportheaders - WHERE reportid='".$SelectedReport."'"; + reportheading, + groupbydata1, + newpageafter1, + upper1, + lower1, + groupbydata2, + newpageafter2, + upper2, + lower2, + groupbydata3, + upper3, + lower3, + newpageafter3, + groupbydata4, + upper4, + lower4 + FROM reportheaders + WHERE reportid='".$SelectedReport."'"; $ErrMsg = _('The reports for display could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the report headers was'); @@ -380,31 +381,41 @@ $_POST['Upper4'] = $myrow['upper4']; $_POST['Lower4'] = $myrow['lower4']; - echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '">'; - echo '<input type="hidden" name="ReportID" value="' . $ReportID . '">'; - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Edit The Selected Report') . '</font></th></tr>'; + echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '" />'; + echo '<input type="hidden" name="ReportID" value="' . $ReportID . '" />'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size=3 color="blue">' . _('Edit The Selected Report') . '</font></th> + </tr>'; } else { - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Define A New Report') . '</font></th></tr>'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size="3" color="blue">' . _('Define A New Report') . '</font></th> + </tr>'; } if (!isset($_POST['ReportHeading'])) { $_POST['ReportHeading']=''; } - echo '<tr><td class=number>' . _('Report Heading') . ':</td> - <td colspan=2><input type="text" size=80 maxlength=80 name="ReportHeading" value="' . $_POST['ReportHeading'] . '"></td></tr>'; + echo '<tr> + <td class="number">' . _('Report Heading') . ':</td> + <td colspan="2"><input type="text" size="80" maxlength="80" name="ReportHeading" value="' . $_POST['ReportHeading'] . '" /></td> + </tr>'; - echo '<tr><td>' . _('Group By 1') . ': <select name=GroupByData1>'; + echo '<tr> + <td>' . _('Group By 1') . ': <select name="GroupByData1">'; GrpByDataOptions($_POST['GroupByData1']); - echo '</select></td><td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; + echo '</select></td> + <td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; if ($_POST['NewPageAfter1']==0){ echo '<option selected value="0">' . _('No') . '</option>'; echo '<option value="1">' . _('Yes') . '</option>'; } Else { - echo '<option value=0>' . _('No') . '</option>'; - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; + echo '<option selected value="1">' . _('Yes') . '</option>'; } echo '</select></td>'; @@ -416,21 +427,23 @@ if (!isset($_POST['Upper1'])) { $_POST['Upper1'] = ''; } - echo '<td>' . _('From') . ': <input type="text" name="Lower1" size=10 maxlength=10 value="' . $_POST['Lower1'] . '"></td>'; - echo '<td>' . _('To') . ': <input type="text" name="Upper1" size=10 maxlength=10 value="' . $_POST['Upper1'] . '"></td></tr>'; + echo '<td>' . _('From') . ': <input type="text" name="Lower1" size="10" maxlength="10" value="' . $_POST['Lower1'] . '" /></td> + <td>' . _('To') . ': <inp... [truncated message content] |
From: <dai...@us...> - 2011-10-08 09:45:07
|
Revision: 4715 http://web-erp.svn.sourceforge.net/web-erp/?rev=4715&view=rev Author: daintree Date: 2011-10-08 09:44:56 +0000 (Sat, 08 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PcAuthorizeExpenses.php trunk/PcExpenses.php trunk/RecurringSalesOrders.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SalesAnalReptCols.php trunk/SalesAnalRepts.php trunk/SalesAnalysis_UserDefined.php trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/includes/ConnectDB.inc trunk/includes/ConstructSQLForUserDefinedSalesReport.inc trunk/includes/PDFSalesAnalysis.inc trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcAuthorizeExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -57,7 +57,7 @@ echo '<br /><table class=selection>'; echo '<tr><th colspan=7>' . _('Detail Of Movement For Last ') .': '; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" />' . _('Days'); - echo '<input type=submit name="Go" value="' . _('Go') . '"></tr></th>'; + echo '<input type="submit" name="Go" value="' . _('Go') . '"></tr></th>'; echo '</form>'; $sql = "SELECT pcashdetails.counterindex, @@ -101,7 +101,9 @@ while ($myrow=DB_fetch_array($result)) { $CurrDecimalPlaces = $myrow['decimalplaces']; //update database if update pressed - if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) + AND $_POST['Submit']=='Update') + AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -119,12 +121,14 @@ $type = 1; $Amount = -$Amount; $AccountFrom = $myrow['glaccountpcash']; - $SQLAccExp = "SELECT glaccount + $SQLAccExp = "SELECT glaccount, + tag FROM pcexpenses WHERE codeexpense = '".$myrow['codeexpense']."'"; $ResultAccExp = DB_query($SQLAccExp,$db); $myrowAccExp = DB_fetch_array($ResultAccExp); $AccountTo = $myrowAccExp['glaccount']; + $TagTo = $myrowAccExp['tag']; } //get typeno @@ -158,7 +162,7 @@ '".-$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultFrom = DB_Query($sqlFrom, $db, '', '', true); @@ -185,7 +189,7 @@ '".$Amount."', 0, '', - 0)"; + '" . $TagTo ."')"; $ResultTo = DB_Query($sqlTo, $db, '', '', true); @@ -253,13 +257,13 @@ if(($Authoriser!='00/00/0000')){ echo'<td>'.ConvertSQLDate($myrow['authorized']).'</td>'; }else{ - echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'">'; + echo '<td align=right><input type="checkbox" name="'.$myrow['counterindex'].'" /></td>'; } } - echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '">'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; - echo '<input type="hidden" name="Days" value="' .$Days. '">'; + echo '<input type="hidden" name="SelectedIndex" value="' . $myrow['counterindex']. '" />'; + echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />'; + echo '<input type="hidden" name="Days" value="' .$Days. '" />'; echo'</tr>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/PcExpenses.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -20,6 +20,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } @@ -85,10 +86,11 @@ if (isset($SelectedExpense) AND $InputError !=1) { - $sql = "UPDATE pcexpenses - SET description = '" . DB_escape_string($_POST['Description']) . "', - glaccount = '" . $_POST['GLAccount'] . "' - WHERE codeexpense = '" . $SelectedExpense . "'"; + $sql = "UPDATE pcexpenses + SET description = '" . DB_escape_string($_POST['Description']) . "', + glaccount = '" . $_POST['GLAccount'] . "', + tag = '" . $_POST['Tag'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -111,11 +113,14 @@ $sql = "INSERT INTO pcexpenses (codeexpense, - description,glaccount) + description, + glaccount, + tag) VALUES ('" . $_POST['CodeExpense'] . "', '" . DB_escape_string($_POST['Description']) . "', - '" . $_POST['GLAccount'] . "')"; - + '" . $_POST['GLAccount'] . "', + '" . $_POST['Tag'] . "')"; + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; @@ -134,6 +139,7 @@ unset($_POST['CodeExpense']); unset($_POST['Description']); unset($_POST['GLAccount']); + unset($_POST['Tag']); } } elseif ( isset($_GET['delete']) ) { @@ -181,6 +187,7 @@ <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> + <th>' . _('Tag') . '</th> </tr>'; $k=0; //row colour counter @@ -200,20 +207,29 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); + + $SqlDescTag="SELECT tagdescription + FROM tags + WHERE tagref='". $myrow[3] . "'"; + $ResultDesTag = DB_query($SqlDescTag,$db); + $DescriptionTag=DB_fetch_array($ResultDesTag); + printf('<td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $Description[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[2], + $Description['accountname'], + $DescriptionTag['tagdesciption'], + $_SERVER['PHP_SELF'] . '?', $myrow[0], + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -228,14 +244,15 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table // The user wish to EDIT an existing type if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, - glaccount + glaccount, + tag FROM pcexpenses WHERE codeexpense='" . $SelectedExpense . "'"; @@ -245,6 +262,7 @@ $_POST['CodeExpense'] = $myrow['codeexpense']; $_POST['Description'] = $myrow['description']; $_POST['GLAccount'] = $myrow['glaccount']; + $_POST['Tag'] = $myrow['tag']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; @@ -274,7 +292,9 @@ <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; + echo '<tr> + <td>' . _('Account Code') . ':</td> + <td><select name="GLAccount">'; DB_free_result($result); $SQL = "SELECT accountcode, @@ -294,11 +314,34 @@ } //end while loop echo '</select></td></tr>'; + + //Select the tag + DB_free_result($result); + echo '<tr> + <td>' . _('Tag') . ':</td> + <td><select name="Tag">'; + $SQL = "SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + + $result=DB_query($SQL,$db); + echo '<option value="0">0 - ' . _('None') . '</option>'; + while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['Tag']) and $_POST['Tag']==$myrow['tagref']){ + echo '<option selected value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'].'</option>'; + } else { + echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; + } + } + echo '</select></td>'; + // End select tag + echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"> - <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '" /> + <input type="submit" name="Cancel" value="' . _('Cancel') . '" /></div>'; echo '</form>'; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/RecurringSalesOrders.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -160,11 +160,11 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); @@ -287,7 +287,7 @@ stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', frequency = '" . $_POST['Frequency'] . "', autoinvoice = '" . $_POST['AutoInvoice'] . "' - WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; + WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -420,7 +420,7 @@ echo '<tr> <td>'. _('Last Recurrence') . ':</td> <td>' . $_POST['StartDate'] . '</td></tr>'; - echo '<input type=hidden name="StartDate" value="' . $_POST['StartDate'] . '">'; + echo '<input type="hidden" name="StartDate" value="' . $_POST['StartDate'] . '">'; } if (!isset($_POST['StopDate'])){ @@ -486,7 +486,7 @@ } echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoInvoice" value=0>'; + echo '<input type="hidden" name="AutoInvoice" value=0>'; } echo '</table>'; @@ -496,8 +496,8 @@ echo '<input type="hidden" name="NewRecurringOrder" value="Yes" />'; echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '" />'; } else { - echo '<input type=hidden name="NewRecurringOrder" value="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; + echo '<input type="hidden" name="NewRecurringOrder" value="No">'; + echo '<input type="hidden" name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />'; echo '<hr>'; Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevel.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -170,7 +170,10 @@ locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); - echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; if (!isset($_POST['StockLocation'])){ $_POST['StockLocation']='All'; } @@ -200,7 +203,9 @@ exit; } - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -217,7 +222,11 @@ } } echo '</select></td></tr>'; - echo '</table><br /><div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; include('includes/footer.inc'); Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReorderLevelLocation.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -60,19 +60,20 @@ $Location=DB_fetch_array($ResultLocation); echo'<p class="page_title_text" align="center"><strong>' . _('Location : ') . '' . $Location['locationname'] . ' </strong></p>'; - echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . $_POST['NumberOfDays'] . '' . _(' Days ') . ' </strong></p>'; + echo'<p class="page_title_text" align="center"><strong>' . _('Number Of Days Sales : ') . '' . locale_number_format($_POST['NumberOfDays'],0) . '' . _(' Days ') . ' </strong></p>'; echo '<table>'; - echo '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> - <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> - <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> - <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> - <th>' . _('Reorder Level') . '</th> - <tr>'; + echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At All Locations') . '</th> + <th>' . _('Total Invoiced').'<br />'._('At Location') . '</th> + <th>' . _('On Hand') .'<br />'._('At All Locations') . '</th> + <th>' . _('On Hand') .'<br />' ._('At Location') . '</th> + <th>' . _('Reorder Level') . '</th> + <tr>'; $k=0; //row colour counter - echo'<form action="ReorderLevelLocation.php" method="POST" name="update">'; + echo'<form action="ReorderLevelLocation.php" method="post" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $i=1; while ($myrow=DB_fetch_array($result)) { @@ -88,9 +89,9 @@ //variable for update data echo'<input type="hidden" value=' . $_POST['order'] . ' name='. _('order').' /> - <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> - <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> - <input type="hidden" value="' . $_POST['NumberOfDays'] . '" name="NumberOfDays" />'; + <input type="hidden" value="' . $_POST['StockLocation'] . '" name="StockLocation" /> + <input type="hidden" value="' . $_POST['StockCat'] . '" name="StockCat" /> + <input type="hidden" value="' . locale_number_format($_POST['NumberOfDays'],0) . '" name="NumberOfDays" />'; //get qtyinvoice all $sqlinv="SELECT sum(salesorderdetails.qtyinvoiced)as qtyinvoice @@ -138,13 +139,13 @@ <td class="number">'.$QtyInvoice.'</td> <td class="number">'.$ohRow['0'].'</td> <td class="number">'.$ohinRow['0'].'</td> - <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. $myrow['reorderlevel'] .'" /> + <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /></td> </tr> '; $i++; } //end of looping echo'<tr> - <td style="text-align:center" colspan=7><input type="submit" name="submit" value=' . _('Update') . ' /></td> + <td style="text-align:center" colspan="7"><input type="submit" name="submit" value=' . _('Update') . ' /></td> </tr> </form>'; @@ -191,14 +192,21 @@ echo'<tr> <td>' . _('Number Of Days Sales') . ':</td> <td><input type="text" class="number" name="NumberOfDays" maxlength="3" size="4" value="0" /></td>'; - echo '<tr><td>' . _('Order By') . ':</td> - <td><select name="order">'; - echo '<option value="1">'. _('Total Invoiced') . '</option>'; - echo '<option value="2">'. _('Item Code') . '</option>'; + echo '<tr> + <td>' . _('Order By') . ':</td> + <td><select name="order"> + <option value="1">'. _('Total Invoiced') . '</option> + <option value="2">'. _('Item Code') . '</option> + </select></td> + </tr>'; + echo '</table> + <br /> + <p> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Submit') . '"> + </div> + </p>'; - echo '</select></td></tr>'; - echo '</table><br /><p><div class="centre"><input type="submit" name="submit" value="' . _('Submit') . '"></div></p>'; - } /*end of else not submit */ include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ReprintGRN.php =================================================================== --- trunk/ReprintGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReprintGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -13,15 +13,20 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection">'; -echo '<tr><th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th></tr>'; -echo '<tr><td>' . _('Enter a Purchase Order Number') . '</td>'; -echo '<td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td></tr>'; -echo '<tr><td colspan=2 style="text-align: center"><input type="submit" name="Show" value="Show GRNs" /></td></tr>'; +echo '<table class="selection"> + <tr> + <th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th> + </tr> + <tr> + <td>' . _('Enter a Purchase Order Number') . '</td> + <td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td> + </tr> + <tr> + <td colspan="2" style="text-align: center"><input type="submit" name="Show" value="' . _('Show GRNs') . '" /></td> + </tr> + </table> + </form>'; -echo '</table>'; -echo '</form>'; - if (isset($_POST['Show'])) { if ($_POST['PONumber']=='') { echo '<br />'; @@ -64,15 +69,21 @@ exit; } $k=0; - echo '<br /><table class="selection">'; - echo '<tr><th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th></tr>'; - echo '<tr><th>' . _('Supplier') . '</th>'; - echo '<th>' . _('PO Order line') . '</th>'; - echo '<th>' . _('GRN Number') . '</th>'; - echo '<th>' . _('Item Code') . '</th>'; - echo '<th>' . _('Item Description') . '</th>'; - echo '<th>' . _('Delivery Date') . '</th>'; - echo '<th>' . _('Quantity Received') . '</th></tr>'; + echo '<br /> + <table class="selection"> + <tr> + <th colspan="8"><font size="2" color="navy">' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</th> + </tr> + <tr> + <th>' . _('Supplier') . '</th> + <th>' . _('PO Order line') . '</th> + <th>' . _('GRN Number') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Delivery Date') . '</th> + <th>' . _('Quantity Received') . '</th> + </tr>'; + while ($myrow=DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -81,15 +92,15 @@ echo '<tr class="OddTableRows">'; $k=1; } - echo '<td>' . $myrow['suppname'] . '</td>'; - echo '<td class="number">' . $myrow['podetailitem'] . '</td>'; - echo '<td class="number">' . $myrow['grnbatch'] . '</td>'; - echo '<td>' . $myrow['itemcode'] . '</td>'; - echo '<td>' . $myrow['itemdescription'] . '</td>'; - echo '<td>' . $myrow['deliverydate'] . '</td>'; - echo '<td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td>'; - echo '<td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow['suppname'] . '</td> + <td class="number">' . $myrow['podetailitem'] . '</td> + <td class="number">' . $myrow['grnbatch'] . '</td> + <td>' . $myrow['itemcode'] . '</td> + <td>' . $myrow['itemdescription'] . '</td> + <td>' . $myrow['deliverydate'] . '</td> + <td class="number">' . locale_number_format($myrow['qtyrecd'], $myrow['decimalplaces']) . '</td> + <td><a href="PDFGrn.php?GRNNo=' . $myrow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint') . '</a></td> + </tr>'; } echo '</table>'; } Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/ReverseGRN.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -12,8 +12,11 @@ if ((isset($_SESSION['SupplierID']) AND $_SESSION['SupplierID']!='') OR (!isset($_POST['SupplierID']) OR $_POST['SupplierID'])==''){ + $_POST['SupplierID']=$_SESSION['SupplierID']; + } + if (!isset($_POST['SupplierID']) OR $_POST['SupplierID']==""){ echo '<br />' . _('This page is expected to be called after a supplier has been selected'); echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SelectSupplier.php">'; @@ -25,8 +28,7 @@ $_POST['SuppName'] = $SuppRow[0]; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . - '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Sales') . '" alt="" />' . ' ' . _('Reverse Goods Received from') . ' ' . $_POST['SuppName'] . '</p> '; if (isset($_GET['GRNNo']) AND isset($_POST['SupplierID'])){ /* SQL to process the postings for the GRN reversal.. */ @@ -48,7 +50,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem INNER JOIN purchorders ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; + WHERE AND grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; @@ -59,7 +61,8 @@ $QtyToReverse = $GRN['qtyrecd'] - $GRN['quantityinv']; if ($QtyToReverse ==0){ - echo '<br /><br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); + echo '<br /> + <br />' . _('The GRN') . ' ' . $_GET['GRNNo'] . ' ' . _('has already been reversed or fully invoiced by the supplier - it cannot be reversed - stock quantities must be corrected by stock adjustments - the stock is paid for'); include ('includes/footer.inc'); exit; } @@ -118,7 +121,7 @@ /*Now the SQL to do the update to the PurchOrderDetails */ $SQL = "UPDATE purchorderdetails - SET quantityrecd = quantityrecd - '" . filter_number_format($QtyToReverse) . "', + SET quantityrecd = quantityrecd - '" . $QtyToReverse . "', completed=0 WHERE purchorderdetails.podetailitem = '" . $GRN['podetailitem'] . "'"; @@ -144,9 +147,9 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be deleted because'); $DbgMsg = _('The following SQL to delete the GRN record was used'); - $result = DB_query("DELETE FROM grns WHERE grnno='" . filter_number_format($_GET['GRNNo']) . "'",$db,$ErrMsg,$DbgMsg,true); + $result = DB_query("DELETE FROM grns WHERE grnno='" . $_GET['GRNNo'] . "'",$db,$ErrMsg,$DbgMsg,true); } else { - $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . filter_number_format($QtyToReverse) . " + $SQL = "UPDATE grns SET qtyrecd = qtyrecd - " . $QtyToReverse . " WHERE grns.grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN record could not be updated') . '. ' . _('This reversal of goods received has not been processed because'); @@ -163,18 +166,18 @@ inputdate, cost) VALUES ('" . $GRN['assetid'] . "', - 25, - '" . $_GET['GRNNo'] . "', - '" . $GRN['deliverydate'] . "', - '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', - '" . filter_number_format((-$GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '25', + '" . $_GET['GRNNo'] . "', + '" . $GRN['deliverydate'] . "', + '" . $PeriodNo . "', + '" . Date('Y-m-d') . "', + '" . (-$GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE The fixed asset transaction could not be inserted because'); $DbgMsg = _('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); /*now reverse the cost put to fixedassets */ - $SQL = "UPDATE fixedassets SET cost = cost - " . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . " + $SQL = "UPDATE fixedassets SET cost = cost - " . $GRN['stdcostunit'] * $QtyToReverse . " WHERE assetid = '" . $GRN['assetid'] . "'"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost addition could not be reversed:'); $DbgMsg = _('The following SQL was used to attempt the reduce the cost of the asset was:'); @@ -237,9 +240,9 @@ '" . $GRN['deliverydate'] . "', '" . $PeriodNo . "', '" . _('Reversal') . ' - ' . $_POST['SupplierID'] . ' - ' . $GRN['orderno'] . "', - '" . filter_number_format(-$QtyToReverse) . "', + '" . -$QtyToReverse . "', '" . $GRN['stdcostunit'] . "', - '" . filter_number_format($QtyOnHandPrior - $QtyToReverse) . "' + '" . $QtyOnHandPrior - $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); @@ -260,6 +263,7 @@ '" . $GRN['itemcode'] . "', '" . $SerialStockMoves['serialno'] . "', '" . -$SerialStockMoves['moveqty'] . "')"; + $result = DB_query($SQL,$db,_('Could not insert the reversing stock movements for the batch/serial numbers'),_('The SQL used but failed was') . ':',true); $SQL = "UPDATE stockserialitems @@ -274,9 +278,14 @@ /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $GRN['glcode'] !=0 AND $GRN['stdcostunit']!=0){ /*GLCode is set to 0 when the GLLink is not activated - this covers a situation where the GLLink is now active but it wasn't when this PO was entered */ - /*first the credit using the GLCode in the PO detail record entry*/ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 + AND $GRN['glcode'] !=0 + AND $GRN['stdcostunit']!=0){ + + /*GLCode is set to 0 when the GLLink is not activated + this covers a situation where the GLLink is now active but it wasn't when this PO was entered + + First the credit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, typeno, @@ -292,7 +301,7 @@ '" . $PeriodNo . "', '" . $GRN['glcode'] . "', '" . _('GRN Reversal for PO') .": " . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format(-($GRN['stdcostunit'] * $QtyToReverse)) . "')"; + '" . -($GRN['stdcostunit'] * $QtyToReverse) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted for the reversal of the received item because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -313,7 +322,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', '" . _('GRN Reversal PO') . ': ' . $GRN['orderno'] . " " . $_POST['SupplierID'] . " - " . $GRN['itemcode'] . "-" . $GRN['itemdescription'] . " x " . $QtyToReverse . " @ " . locale_number_format($GRN['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . "' + '" . $GRN['stdcostunit'] * $QtyToReverse . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); @@ -326,7 +335,7 @@ echo '<br />' . _('GRN number') . ' ' . $_GET['GRNNo'] . ' ' . _('for') . ' ' . $QtyToReverse . ' x ' . $GRN['itemcode'] . ' - ' . $GRN['itemdescription'] . ' ' . _('has been reversed') . '<br />'; unset($_GET['GRNNo']); // to ensure it cant be done again!! - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Select another GRN to Reverse') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another GRN to Reverse') . '</a>'; /*end of Process Goods Received Reversal entry */ } else { @@ -337,14 +346,17 @@ $_POST['RecdAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date("m")-3,Date("d"),Date("Y"))); } echo '<table class="selection"><tr>'; - echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '">'; - echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '">'; + echo '<input type="hidden" name="SupplierID" valuE="' . $_POST['SupplierID'] . '" />'; + echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '" />'; echo '<td>'._('Show all goods received after') . ': </td> - <td><input type="text" class="date" alt="'. - $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . - '" MAXLENGTH =10 size=10></td></tr>';; - echo '</table>'; - echo '<br /><div class=centre><input type=submit name="ShowGRNS" value=' . _('Show Outstanding Goods Received') . '></div>'; + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'].'" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . '" maxlength="10" size="10" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowGRNS" value="' . _('Show Outstanding Goods Received') . '" /> + </div>'; + if (isset($_POST['ShowGRNS'])){ $sql = "SELECT grnno, @@ -368,15 +380,15 @@ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; $TableHeader = '<tr> - <th>' . _('GRN') . ' #</th> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Date') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Received') . '</th> - <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> - <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> - </tr>'; - + <th>' . _('GRN') . ' #</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Date') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Received') . '</th> + <th>' . _('Quantity') . '<br />' . _('Invoiced') . '</th> + <th>' . _('Quantity To') . '<br />' . _('Reverse') . '</th> + </tr>'; + echo $TableHeader; /* show the GRNs outstanding to be invoiced that could be reversed */ @@ -391,29 +403,29 @@ $k=1; } - $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],2); - $DisplayQtyInv = locale_number_format($myrow['quantityinv'],2); - $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],2); + $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],'Variable'); + $DisplayQtyInv = locale_number_format($myrow['quantityinv'],'Variable'); + $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],'Variable'); $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - </tr>', - $myrow['grnno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $DisplayDateDel, - $DisplayQtyRecd, - $DisplayQtyInv, - $DisplayQtyRev, - $LinkToRevGRN); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['grnno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $DisplayDateDel, + $DisplayQtyRecd, + $DisplayQtyInv, + $DisplayQtyRev, + $LinkToRevGRN); $RowCounter++; if ($RowCounter >20){ Modified: trunk/SalesAnalReptCols.php =================================================================== --- trunk/SalesAnalReptCols.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalReptCols.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Sales Analysis Report Columns'); @@ -15,39 +13,41 @@ /*Sales analysis headers group by data options */ if ($DataX == 'Quantity'){ - echo '<option selected Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option selected value="Quantity">' . _('Quantity') . '</option>'; } else { - echo '<option Value="Quantity">' . _('Quantity') . '</option>'; + echo '<option value="Quantity">' . _('Quantity') . '</option>'; } if ($DataX == 'Gross Value'){ - echo '<option selected Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option selected value="Gross Value">' . _('Gross Value') . '</option>'; } else { - echo '<option Value="Gross Value">' . _('Gross Value') . '</option>'; + echo '<option value="Gross Value">' . _('Gross Value') . '</option>'; } if ($DataX == 'Net Value'){ - echo '<option selected Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option selected value="Net Value">' . _('Net Value') . '</option>'; } else { - echo '<option Value="Net Value">' . _('Net Value') . '</option>'; + echo '<option value="Net Value">' . _('Net Value') . '</option>'; } if ($DataX == 'Gross Profit'){ - echo '<option selected Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option selected value="Gross Profit">' . _('Gross Profit') . '</option>'; } else { - echo '<option Value="Gross Profit">' . _('Gross Profit') . '</option>'; + echo '<option value="Gross Profit">' . _('Gross Profit') . '</option>'; } if ($DataX == 'Cost'){ - echo '<option selected Value="Cost">' . _('Cost') . '</option>'; + echo '<option selected value="Cost">' . _('Cost') . '</option>'; } else { - echo '<option Value="Cost">' . _('Cost') . '</option>'; + echo '<option value="Cost">' . _('Cost') . '</option>'; } if ($DataX == 'Discount'){ - echo '<option selected Value="Discount">' . _('Discount') . '</option>'; + echo '<option selected value="Discount">' . _('Discount') . '</option>'; } else { - echo '<option Value="Discount">' . _('Discount') . '</option>'; + echo '<option value="Discount">' . _('Discount') . '</option>'; } } /* end of functions -Right ... now to the meat */ + +Right ... now to the meat */ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; if (isset($_GET['SelectedCol'])){ @@ -246,18 +246,23 @@ if (DB_num_rows($result)!=0){ $myrow = DB_fetch_array($result); - echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b><br /></div><table class=selection>'; - echo '<tr><th>' . _('Col') . ' #</th> + echo '<div class="centre"><b>' . $myrow['reportheading'] . '</b> + <br /> + </div> + <table class="selection"> + <tr> + <th>' . _('Col') . ' #</th> <th>' . _('Heading 1') . '</th> - <th>' . _('Heading 2') . '</th>'; - echo '<th>' . _('Calc') . '</th> - <th>' . _('Prd From') . '</th> - <th>' . _('Prd To') . '</th>'; - echo '<th>' . _('Data') . '</th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> - <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th>'; - echo '<th>' . _('Operator') . '</th> - <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th></tr>'; + <th>' . _('Heading 2') . '</th> + <th>' . _('Calc') . '</th> + <th>' . _('Prd From') . '</th> + <th>' . _('Prd To') . '</th> + <th>' . _('Data') . '</th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Numerator') . '</font></th> + <th>' . _('Col') . ' #<br /><font size=1>' . _('Denominator') . '</font></th> + <th>' . _('Operator') . '</th> + <th>' . _('Budget') . '<br />' . _('Or Actual') . '</th> + </tr>'; $k=0; //row colour counter do { @@ -292,7 +297,7 @@ <td>%s</td> <td>%s</td> <td><a href="%sReportID=%s&SelectedCol=%s&delete=1">' . _('Delete') . '</td></tr>', - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1], $myrow[1], @@ -306,7 +311,7 @@ $myrow[9], $myrow[10], $BudOrAct, - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $ReportID, $myrow[1]); @@ -314,7 +319,11 @@ //END WHILE LIST LOOP } -echo '</table><br /><div class="centre"><a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a></div><p>'; +echo '</table> + <br /> + <div class="centre"> + <a href="' . $rootpath . '/SalesAnalRepts.php">' . _('Maintain Report Headers') . '</a> + </div>'; if (DB_num_rows($result)>10){ prnMsg(_('WARNING') . ': ' . _('User defined reports can have up to 10 columns defined') . '. ' . _('The report will not be able to be run until some columns are deleted'),'warn'); } @@ -327,8 +336,8 @@ $ReportHeading=$myrow['reportheading']; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="ReportHeading" value='.$ReportHeading.'>'; - echo '<input type=hidden name="ReportID" VALUE=' . $ReportID . '>'; + echo '<input type="hidden" name="ReportHeading" value="'.$ReportHeading.'" />'; + echo '<input type=hidden name="ReportID" value="' . $ReportID . '" />'; if (isset($SelectedCol)) { //editing an existing Column @@ -373,44 +382,55 @@ $_POST['BudgetOrActual']=$myrow['budgetoractual']; $_POST['ValFormat']=$myrow['valformat']; - echo '<input type=hidden name="SelectedCol" VALUE=' . $SelectedCol . '>'; - echo '<table class=selection>'; + echo '<input type=hidden name="SelectedCol" value="' . $SelectedCol . '" />'; + echo '<table class="selection">'; } else { - echo '<table class=selection>'; + echo '<table class="selection">'; if (!isset($_POST['ColID'])) { $_POST['ColID']=1; } - echo '<tr><td>' . _('Column Number') . ':</td> - <td><input type="text" class=number name=ColID size=3 maxlength=3 Value=' . $_POST['ColID'] . '> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</td>'; + echo '<tr> + <td>' . _('Column Number') . ':</td> + <td><input type="text" class="number" name=ColID size=3 maxlength=3 value="' . $_POST['ColID'] . '"> <font size=1>(' . _('A number between 1 and 10 is expected') . ')</font></td> + </tr>'; } if (!isset($_POST['Heading1'])) { $_POST['Heading1']=''; } - echo '<tr><td>' . _('Heading line 1') . ':</td> - <td><input type="TEXT" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Heading line 1') . ':</td> + <td><input type="text" size=16 maxlength=15 name="Heading1" value="' . $_POST['Heading1'] . '"></td> + </tr>'; if (!isset($_POST['Heading2'])) { $_POST['Heading2']=''; } - echo '<tr><td>' . _('Heading line 2') . ':</td><td><input type="TEXT" size=16 maxlength=15 name="Heading2" value="' . $_POST['Heading2'] . '"></td></tr>'; - echo '<tr><td>' . _('Calculation') . ':</td><td><select name="Calculation">'; + echo '<tr> + <td>' . _('Heading line 2') . ':</td> + <td><input type="text" size="16" maxlength="15" name="Heading2" value="' . $_POST['Heading2'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation') . ':</td> + <td><select name="Calculation">'; if (!isset($_POST['Calculation'])) { $_POST['Calculation']=0; } if ($_POST['Calculation'] ==1){ - echo '<option selected Value=1>' . _('Yes'); - echo '<option Value=0>' . _('No'); + echo '<option selected value="1">' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; } else { - echo '<option Value=1>' . _('Yes'); - echo '<option selected Value=0>' . _('No'); + echo '<option value="1">' . _('Yes') . '</option>'; + echo '<option selected value="0">' . _('No') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if ($_POST['Calculation']==0){ /*Its not a calculated column */ - echo '<tr><td>' . _('From Period') . ':</td> - <td><select name="PeriodFrom"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('From Period') . ':</td> + <td><select name="PeriodFrom"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -420,11 +440,13 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('ToPeriod') . ':</td> - <td><select name="PeriodTo"'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + echo '<tr> + <td>' . _('ToPeriod') . ':</td> + <td><select name="PeriodTo"'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); while ($PeriodRow = DB_fetch_row($result)){ @@ -434,34 +456,46 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[1]) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Data to show') . ':</td><td><select name="DataType">'; + echo '<tr> + <td>' . _('Data to show') . ':</td> + <td><select name="DataType">'; DataOptions($_POST['DataType']); - echo '</select></td></tr>'; - echo '<tr><td>' . _('Budget or Actual') . ':</td><td><select name=BudgetOrActual>'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Budget or Actual') . ':</td> + <td><select name="BudgetOrActual">'; if ($_POST['BudgetOrActual']==0){ - echo '<option selected Value=0>' . _('Budget') . '</option>'; - echo '<option Value=1>' . _('Actual') . '</option>'; + echo '<option selected value="0">' . _('Budget') . '</option>'; + echo '<option value="1">' . _('Actual') . '</option>'; } else { - echo '<option Value=0>' . _('Budget') . '</option>'; - echo '<option selected Value=1>' . _('Actual') . '</option>'; + echo '<option value="0">' . _('Budget') . '</option>'; + echo '<option selected value="1">' . _('Actual') . '</option>'; } - echo '</select></td></tr>'; - echo '<input type=hidden name="ValFormat" Value="N"> - <input type=hidden name="ColNumerator" Value=0> - <input type=hidden name="ColDenominator" Value=0> - <input type=hidden name="CalcOperator" Value=""> - <input type=hidden name="Constant" Value=0>'; + echo '</select></td> + </tr>'; + echo '<input type=hidden name="ValFormat" value="N" /> + <input type=hidden name="ColNumerator" value="0" /> + <input type=hidden name="ColDenominator" value="0" /> + <input type=hidden name="CalcOperator" value="" /> + <input type=hidden name="Constant" value="0" />'; } else { /*it IS a calculated column */ - echo '<tr><td>' . _('Numerator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColNumerator" value=' . $_POST['ColNumerator'] . '></td></tr>'; - echo '<tr><td>' . _('Denominator Column') . ' #:</td> - <td><input type="TEXT" size=4 maxlength=3 name="ColDenominator" value=' . $_POST['ColDenominator'] . '></td></tr>'; - echo '<tr><td>' . _('Calculation Operator') . ':</td> - <td><select name="CalcOperator">'; + echo '<tr> + <td>' . _('Numerator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColNumerator" value="' . $_POST['ColNumerator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Denominator Column') . ' #:</td> + <td><input type="text" size="4" maxlength="3" name="ColDenominator" value="' . $_POST['ColDenominator'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Calculation Operator') . ':</td> + <td><select name="CalcOperator">'; if ($_POST['CalcOperator'] == '/'){ echo '<option selected value="/">' . _('Numerator Divided By Denominator') . '</option>'; } else { @@ -488,26 +522,36 @@ echo '<option value="-">' . _('Numerator Minus Denominator') . '</option>'; } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Constant') . ':</td><td><input type="TEXT" size=10 maxlength=10 name="Constant" value=' . $_POST['Constant'] . '></td></tr>'; - echo '<tr><td>' . _('Format Type') . ':</td><td><select name="ValFormat">'; + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Constant') . ':</td> + <td><input type="text" size="10" maxlength="10" name="Constant" value="' . $_POST['Constant'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Format Type') . ':</td> + <td><select name="ValFormat">'; if ($_POST['ValFormat']=='N'){ - echo '<option selected Value="N">' . _('Numeric'); - echo '<option Value="P">' . _('Percentage'); + echo '<option selected value="N">' . _('Numeric') . '</option>'; + echo '<option value="P">' . _('Percentage') . '</option>'; } else { - echo '<option Value="N">' . _('Numeric'); - echo '<option selected Value="P">' . _('Percentage'); + echo '<option value="N">' . _('Numeric') . '</option>'; + echo '<option selected value="P">' . _('Percentage') . '</option>'; } - echo '</select></td></tr><input type=hidden name="BudgetOrActual" Value=0> - <input type=hidden name="DataType" Value=""> - <input type=hidden name="PeriodFrom" Value=0> - <input type=hidden name="PeriodTo" Value=0>'; + echo '</select></td></tr> + <input type=hidden name="BudgetOrActual" value="0" /> + <input type=hidden name="DataType" value="" /> + <input type=hidden name="PeriodFrom" value="0" /> + <input type=hidden name="PeriodTo" value="0" />'; } - echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/SalesAnalRepts.php =================================================================== --- trunk/SalesAnalRepts.php 2011-10-06 09:16:44 UTC (rev 4714) +++ trunk/SalesAnalRepts.php 2011-10-08 09:44:56 UTC (rev 4715) @@ -100,15 +100,15 @@ $InputError = 1; prnMsg (_('Group by Level 1 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower limits not set')); } - if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' || $_POST['Upper2']=='')) { + if (($_POST['GroupByData2']!='Not Used') AND ($_POST['Lower2']=='' OR $_POST['Upper2']=='')) { $InputError = 1; prnMsg( _('Group by Level 2 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' || $_POST['Upper3']=='')) { + if (($_POST['GroupByData3']!='Not Used') AND ($_POST['Lower3']=='' OR $_POST['Upper3']=='')) { $InputError = 1; prnMsg( _('Group by Level 3 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } - if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' || $_POST['Upper4']=='')) { + if (($_POST['GroupByData4']!='Not Used') AND ($_POST['Lower4']=='' OR $_POST['Upper4']=='')) { $InputError = 1; prnMsg( _('Group by Level 4 is set but the upper and lower limits are not set') . ' - ' . _('these must be specified for the report to have any output'),'error',_('Upper/Lower Limits not set')); } @@ -138,23 +138,23 @@ delete code below*/ $sql = "UPDATE reportheaders SET - reportheading='" . $_POST['ReportHeading'] . "', - groupbydata1='" . $_POST['GroupByData1'] . "', - groupbydata2='" . $_POST['GroupByData2'] . "', - groupbydata3='" . $_POST['GroupByData3'] . "', - groupbydata4='" . $_POST['GroupByData4'] . "', - newpageafter1='" . $_POST['NewPageAfter1'] . "', - newpageafter2='" . $_POST['NewPageAfter2'] . "', - newpageafter3='" . $_POST['NewPageAfter3'] . "', - lower1='" . $_POST['Lower1'] . "', - upper1='" . $_POST['Upper1'] . "', - lower2='" . $_POST['Lower2'] . "', - upper2='" . $_POST['Upper2'] . "', - lower3='" . $_POST['Lower3'] . "', - upper3='" . $_POST['Upper3'] . "', - lower4='" . $_POST['Lower4'] . "', - upper4='" . $_POST['Upper4'] . "' - WHERE reportid = " . $SelectedReport; + reportheading='" . $_POST['ReportHeading'] . "', + groupbydata1='" . $_POST['GroupByData1'] . "', + groupbydata2='" . $_POST['GroupByData2'] . "', + groupbydata3='" . $_POST['GroupByData3'] . "', + groupbydata4='" . $_POST['GroupByData4'] . "', + newpageafter1='" . $_POST['NewPageAfter1'] . "', + newpageafter2='" . $_POST['NewPageAfter2'] . "', + newpageafter3='" . $_POST['NewPageAfter3'] . "', + lower1='" . filter_number_format($_POST['Lower1']) . "', + upper1='" . filter_number_format($_POST['Upper1']) . "', + lower2='" . filter_number_format($_POST['Lower2']) . "', + upper2='" . filter_number_format($_POST['Upper2']) . "', + lower3='" . filter_number_format($_POST['Lower3']) . "', + upper3='" . filter_number_format($_POST['Upper3']) . "', + lower4='" . filter_number_format($_POST['Lower4']) . "', + upper4='" . filter_number_format($_POST['Upper4']) . "' + WHERE reportid = " . $SelectedReport; $ErrMsg = _('The report could not be updated because'); $DbgMsg = _('The SQL used to update the report headers was'); @@ -209,14 +209,14 @@ '" . $_POST['NewPageAfter1'] . "', '" . $_POST['NewPageAfter2'] . "', '" . $_POST['NewPageAfter3'] . "', - '" . $_POST['Lower1'] . "', - '" . $_POST['Upper1'] . "', - '" . $_POST['Lower2'] . "', - '" . $_POST['Upper2'] . "', - '" . $_POST['Lower3'] . "', - '" . $_POST['Upper3'] . "', - '" . $_POST['Lower4'] . "', - '" . $_POST['Upper4'] . "' + '" . filter_number_format($_POST['Lower1']) . "', + '" . filter_number_format($_POST['Upper1']) . "', + '" . filter_number_format($_POST['Lower2']) . "', + '" . filter_number_format($_POST['Upper2']) . "', + '" . filter_number_format($_POST['Lower3']) . "', + '" . filter_number_format($_POST['Upper3']) . "', + '" . filter_number_format($_POST['Lower4']) . "', + '" . filter_number_format($_POST['Upper4']) . "' )"; $ErrMsg = _('The report could not be added because'); @@ -277,9 +277,10 @@ $result = DB_query("SELECT reportid, reportheading FROM reportheaders ORDER BY reportid",$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Report No') . '</th> - <th>' . _('Report Title') . '</th>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Report No') . '</th> + <th>' . _('Report Title') . '</th>'; $k=0; //row colour counter @@ -293,27 +294,27 @@ } - printf("<td>%s</td> - <td>%s</td> - <td><a href=\"%s&SelectedReport=%s\">" . _('Design') . "</a></td> - <td><a href=\"%s/SalesAnalReptCols.php?ReportID=%s\">" . _('Define Columns') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True\">" . _('Make PDF Report') . "</a></td> - <td><a href=\"%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True\">" . _('Make CSV File') . "</a></td> - <td><a href=\"%s&SelectedReport=%s&delete=1\" onclick=\"return confirm('" . _('Are you sure you wish to remove this report design?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $rootpath, - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td><a href="%s&SelectedReport=%s">' . _('Design') . '</a></td> + <td><a href="%s/SalesAnalReptCols.php?ReportID=%s">' . _('Define Columns') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProducePDF=True">' . _('Make PDF Report') . '</a></td> + <td><a href="%s/SalesAnalysis_UserDefined.php?ReportID=%s&ProduceCVSFile=True">' . _('Make CSV File') . '</a></td> + <td><a href="%s&SelectedReport=%s&delete=1" onclick="return confirm(\"' . _('Are you sure you wish to remove this report design?') . '\");">' . _('Delete') . '</td> + </tr>', + $myrow[0], + $myrow[1], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $rootpath, + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); + } //END WHILE LIST LOOP echo '</table><p>'; @@ -324,7 +325,7 @@ if (isset($SelectedReport)) { - echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Show All Defined Reports') . '</a>'; + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Defined Reports') . '</a>'; } echo '<p />'; @@ -338,24 +339,24 @@ //editing an existing Report $sql = "SELECT reportid, - reportheading, - groupbydata1, - newpageafter1, - upper1, - lower1, - groupbydata2, - newpageafter2, - upper2, - lower2, - groupbydata3, - upper3, - lower3, - newpageafter3, - groupbydata4, - upper4, - lower4 - FROM reportheaders - WHERE reportid='".$SelectedReport."'"; + reportheading, + groupbydata1, + newpageafter1, + upper1, + lower1, + groupbydata2, + newpageafter2, + upper2, + lower2, + groupbydata3, + upper3, + lower3, + newpageafter3, + groupbydata4, + upper4, + lower4 + FROM reportheaders + WHERE reportid='".$SelectedReport."'"; $ErrMsg = _('The reports for display could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the report headers was'); @@ -380,31 +381,41 @@ $_POST['Upper4'] = $myrow['upper4']; $_POST['Lower4'] = $myrow['lower4']; - echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '">'; - echo '<input type="hidden" name="ReportID" value="' . $ReportID . '">'; - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Edit The Selected Report') . '</font></th></tr>'; + echo '<input type="hidden" name="SelectedReport" value="' . $SelectedReport . '" />'; + echo '<input type="hidden" name="ReportID" value="' . $ReportID . '" />'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size=3 color="blue">' . _('Edit The Selected Report') . '</font></th> + </tr>'; } else { - echo '<table width=98% colspan=4 class=selection><tr><th colspan=8><font size=3 color=BLUE>' . _('Define A New Report') . '</font></th></tr>'; + echo '<table width="98%" colspan="4" class="selection"> + <tr> + <th colspan="8"><font size="3" color="blue">' . _('Define A New Report') . '</font></th> + </tr>'; } if (!isset($_POST['ReportHeading'])) { $_POST['ReportHeading']=''; } - echo '<tr><td class=number>' . _('Report Heading') . ':</td> - <td colspan=2><input type="text" size=80 maxlength=80 name="ReportHeading" value="' . $_POST['ReportHeading'] . '"></td></tr>'; + echo '<tr> + <td class="number">' . _('Report Heading') . ':</td> + <td colspan="2"><input type="text" size="80" maxlength="80" name="ReportHeading" value="' . $_POST['ReportHeading'] . '" /></td> + </tr>'; - echo '<tr><td>' . _('Group By 1') . ': <select name=GroupByData1>'; + echo '<tr> + <td>' . _('Group By 1') . ': <select name="GroupByData1">'; GrpByDataOptions($_POST['GroupByData1']); - echo '</select></td><td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; + echo '</select></td> + <td>' . _('Page Break After') . ': <select name="NewPageAfter1">'; if ($_POST['NewPageAfter1']==0){ echo '<option selected value="0">' . _('No') . '</option>'; echo '<option value="1">' . _('Yes') . '</option>'; } Else { - echo '<option value=0>' . _('No') . '</option>'; - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; + echo '<option selected value="1">' . _('Yes') . '</option>'; } echo '</select></td>'; @@ -416,21 +427,23 @@ if (!isset($_POST['Upper1'])) { $_POST['Upper1'] = ''; } - echo '<td>' . _('From') . ': <input type="text" name="Lower1" size=10 maxlength=10 value="' . $_POST['Lower1'] . '"></td>'; - echo '<td>' . _('To') . ': <input type="text" name="Upper1" size=10 maxlength=10 value="' . $_POST['Upper1'] . '"></td></tr>'; + echo '<td>' . _('From') . ': <input type="text" name="Lower1" size="10" maxlength="10" value="' . $_POST['Lower1'] . '" /></td> + <td>' . _('To') . ': <inp... [truncated message content] |
From: <dai...@us...> - 2011-10-09 00:16:22
|
Revision: 4716 http://web-erp.svn.sourceforge.net/web-erp/?rev=4716&view=rev Author: daintree Date: 2011-10-09 00:16:14 +0000 (Sun, 09 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PrintCustTrans.php trunk/SalesByTypePeriodInquiry.php trunk/SalesGraph.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SelectCompletedOrder.php trunk/SelectContract.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/includes/MiscFunctions.php Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/PrintCustTrans.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -832,6 +832,7 @@ stockmoves.qty as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces FROM stockmoves, Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesByTypePeriodInquiry.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -19,7 +19,7 @@ $_POST['DateRange']='ThisMonth'; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form name="Form1" action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class="selection"> @@ -34,7 +34,7 @@ if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)"/></td> </tr> <tr> <td>' . _('This Week') . ':</td> @@ -42,7 +42,7 @@ if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Month') . ':</td> @@ -50,7 +50,7 @@ if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Quarter') . ':</td> @@ -58,9 +58,13 @@ if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ + if (!isset($_POST['ToDate'])){ + $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'],mktime(1,1,1,Date('m')-12,Date('d')+1,Date('Y'))); + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } echo '<tr> <td>' . _('Date From') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> @@ -82,7 +86,7 @@ if ($_POST['DisplayData']=='Daily'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Weekly') . ':</td> @@ -90,7 +94,7 @@ if ($_POST['DisplayData']=='Weekly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Monthly') . ':</td> @@ -98,24 +102,27 @@ if ($_POST['DisplayData']=='Monthly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Quarterly') . ':</td> <td><input type="radio" name="DisplayData" value="Quarterly" '; -if ($_POST['DisplayData']=='Monthly'){ +if ($_POST['DisplayData']=='Quarterly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr>'; echo '</table> </td></tr> </table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; -echo '</form></div>'; -echo '<br />'; +echo '<br /> + <div class="centre"> + <input tabindex="4" type="submit" name="ShowSales" value="' . _('Show Sales') . '" /> + </div> + </form> + <br />'; if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ //Don't run the report until custom dates entered Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesGraph.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -176,20 +176,20 @@ $_POST['ValueTo']=''; } echo '<tr><td>' . _('Graph On:') . '</td><td> - <input type="RADIO" name="GraphOn" value="All" CHECKED>' . _('All') . '<br /> - <input type="RADIO" name="GraphOn" value="Customer">' . _('Customer') . '<br /> - <input type="RADIO" name="GraphOn" value="StockID">' . _('Item Code') . '</td></tr>'; + <input type="radio"" name="GraphOn" value="All" CHECKED>' . _('All') . '<br /> + <input type="radio"" name="GraphOn" value="Customer">' . _('Customer') . '<br /> + <input type="radio"" name="GraphOn" value="StockID">' . _('Item Code') . '</td></tr>'; echo '<tr><td>' . _('From:') . ' <input type=TEXT name="ValueFrom" value=' . $_POST['ValueFrom'] . '></td> <td>' . _('To:') . ' <input type=TEXT name="ValueTo" value=' . $_POST['ValueTo'] . '></td></tr>'; echo '<tr><td>' . _('Graph Value:') . '</td><td> - <input type="RADIO" name="GraphValue" value="Net" CHECKED>' . _('Net Sales Value') . '<br /> - <input type="RADIO" name="GraphValue" value="GP">' . _('Gross Profit') . '<br /> - <input type="RADIO" name="GraphValue" value="Quantity">' . _('Quantity') . '</td></tr>'; + <input type="radio"" name="GraphValue" value="Net" CHECKED>' . _('Net Sales Value') . '<br /> + <input type="radio"" name="GraphValue" value="GP">' . _('Gross Profit') . '<br /> + <input type="radio"" name="GraphValue" value="Quantity">' . _('Quantity') . '</td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type="submit" Name="ShowGraph" Value="' . _('Show Sales Graph') .'"></div>'; + echo '<br /><div class="centre"><input type="submit" Name="ShowGraph" Value="' . _('Show Sales Graph') .'" /></div>'; include('includes/footer.inc'); } else { Modified: trunk/SalesPeople.php =================================================================== --- trunk/SalesPeople.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesPeople.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -57,9 +57,6 @@ OR !is_numeric(filter_number_format($_POST['CommissionRate2']))) { $InputError = 1; prnMsg(_('The commission rates must be a floating point number'),'error'); - echo '<br/>Commission Rate 1 = ' . filter_number_format($_POST['CommissionRate1']); - echo '<br/>Commission Rate 2 = ' . filter_number_format($_POST['CommissionRate2']); - echo '<br/>The locale decimal point is ' . $LocaleInfo['decimal_point']; } elseif (!is_numeric(filter_number_format($_POST['Breakpoint']))) { $InputError = 1; prnMsg(_('The breakpoint should be a floating point number'),'error'); @@ -88,10 +85,10 @@ /*SelectedSalesPerson could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE salesman SET salesmanname='" . $_POST['SalesmanName'] . "', + $sql = "UPDATE salesman SET salesmanname='" . DB_escape_string($_POST['SalesmanName']) . "', commissionrate1='" . filter_number_format($_POST['CommissionRate1']) . "', - smantel='" . $_POST['SManTel'] . "', - smanfax='" . $_POST['SManFax'] . "', + smantel='" . DB_escape_string($_POST['SManTel']) . "', + smanfax='" . DB_escape_string($_POST['SManFax']) . "', breakpoint='" . filter_number_format($_POST['Breakpoint']) . "', commissionrate2='" . filter_number_format($_POST['CommissionRate2']) . "', current='" . $_POST['Current'] . "' @@ -110,7 +107,7 @@ smantel, smanfax, current) - VALUES ('" . $_POST['SalesmanCode'] . "', + VALUES ('" . DB_escape_string($_POST['SalesmanCode']) . "', '" . DB_escape_string($_POST['SalesmanName']) . "', '" . filter_number_format($_POST['CommissionRate1']) . "', '" . filter_number_format($_POST['CommissionRate2']) . "', @@ -275,9 +272,9 @@ $_POST['SalesmanName'] = $myrow['salesmanname']; $_POST['SManTel'] = $myrow['smantel']; $_POST['SManFax'] = $myrow['smanfax']; - $_POST['CommissionRate1'] = $myrow['commissionrate1']; - $_POST['Breakpoint'] = $myrow['breakpoint']; - $_POST['CommissionRate2'] = $myrow['commissionrate2']; + $_POST['CommissionRate1'] = locale_number_format($myrow['commissionrate1'],'Variable'); + $_POST['Breakpoint'] = locale_number_format($myrow['breakpoint'],'Variable'); + $_POST['CommissionRate2'] = locale_number_format($myrow['commissionrate2'],'Variable'); $_POST['Current'] = $myrow['current']; @@ -347,24 +344,24 @@ <td>' . _('Current?') . ':</td> <td><select name="Current">'; if ($_POST['Current']==1){ - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option selected value="1">' . _('Yes') . '</option>'; } else { - echo '<option value=1>' . _('Yes') . '</option>'; + echo '<option value="1">' . _('Yes') . '</option>'; } if ($_POST['Current']==0){ - echo '<option selected value=0>' . _('No') . '</option>'; + echo '<option selected value="0">' . _('No') . '</option>'; } else { - echo '<option value=0>' . _('No') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; } echo '</select></td> - </tr>'; + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; - echo '</table>'; - - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesTopItemsInquiry.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -3,11 +3,11 @@ /* $Id: SalesTopItemsInquiry.php 4261 2010-12-22 15:56:50Z $*/ include('includes/session.inc'); -$title = _('Sales Category Report'); +$title = _('Top Sales Inquiry'); include('includes/header.inc'); include('includes/DefineCartClass.php'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Inquiry') . '" alt="" />' . ' ' . _('Top Sales Items Inquiry') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; if (!isset($_POST['DateRange'])){ @@ -244,7 +244,7 @@ <td class="number">' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($SalesRow['netsalesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . $SalesRow['salesquantity'] . '</td> + <td class="number">' . locale_number_format($SalesRow['salesquantity'],'Variable') . '</td> </tr>'; $i++; @@ -266,7 +266,7 @@ <td class="number">' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . $CumulativeTotalQuantity . '</td> + <td class="number">' . locale_number_format($CumulativeTotalQuantity,'Variable') . '</td> </tr>'; echo '</table>'; Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCompletedOrder.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -519,7 +519,7 @@ $_POST['OrderNumber']=''; } echo '<td>' . _('Order Number') . ':</td> - <td><input type="text" name="OrderNumber" maxlength =8 size=9 value ="' . $_POST['OrderNumber'] . '"></td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" value ="' . $_POST['OrderNumber'] . '" /></td> <td>' . _('for all orders placed after') . ': </td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength="10" size="11" value="' . $_POST['OrdersAfterDate'] . '" /></td> <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '" /></td> @@ -542,7 +542,7 @@ echo '<div class="page_help_text"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . ' </font></div>'; echo '<br /> <table class="selection">'; - echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; + echo '<tr><td><font size="1">' . _('Select a stock category') . ':</font>'; echo '<select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { @@ -553,19 +553,23 @@ } } - echo '</select>'; - echo '<td><font size=1>' . _('Enter text extracts in the description') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td></tr>'; - echo '<tr><td></td>'; - echo '<td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td>'; - echo '<td><input type="text" name="StockCode" size="15" maxlength="18"></td>'; - echo '</tr>'; - echo '<tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; + echo '</select> + <td><font size="1">' . _('Enter text extracts in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> + </tr> + <tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; if (count($_SESSION['AllowedPageSecurityTokens'])>1){ echo '<input type="submit" name="ResetPart" value="' . _('Show All') . '" /></div>'; } - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; } @@ -574,12 +578,14 @@ echo '<br /> <table cellpadding="2" colspan="7" class="selection">'; - $TableHeadings = '<tr><th>' . _('Code') . '</th> + $TableHeadings = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('On Hand') . '</th> <th>' . _('Purchase Orders') . '</th> <th>' . _('Sales Orders') . '</th> - <th>' . _('Units') . '</th></tr>'; + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeadings; @@ -597,17 +603,17 @@ } printf('<td><font size=1><input type="submit" name="SelectedStockItem" value="%s" /></font></td> - <td><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td><font size=1>%s</font></td></tr>', - $myrow['stockid'], - $myrow['description'], - locale_number_format($myrow['qoh'],$myrow['decimalplaces']), - locale_number_format($myrow['qoo'],$myrow['decimalplaces']), - locale_number_format($myrow['qdem'],$myrow['decimalplaces']), - $myrow['units']); + <td><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td><font size=1>%s</font></td></tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qoo'],$myrow['decimalplaces']), + locale_number_format($myrow['qdem'],$myrow['decimalplaces']), + $myrow['units']); //end of page full new headings if } @@ -631,7 +637,8 @@ <th>' . _('Order Date') . '</th> <th>' . _('Req Del Date') . '</th> <th>' . _('Delivery To') . '</th> - <th>' . _('Order Total') . '</th></tr>'; + <th>' . _('Order Total') . '</th> + </tr>'; echo $tableheader; @@ -654,23 +661,23 @@ $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - </tr>', - $ViewPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + </tr>', + $ViewPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue); //end of page full new headings if } Modified: trunk/SelectContract.php =================================================================== --- trunk/SelectContract.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectContract.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -27,7 +27,7 @@ } else { if (isset($_POST['SelectedCustomer'])) { echo _('For customer') . ': ' . $_POST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo '<input type="hidden" name="SelectedCustomer" value="' . $_POST['SelectedCustomer'] . '">'; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_POST['SelectedCustomer'] . '" />'; } } @@ -145,14 +145,14 @@ echo '<table cellpadding="2" colspan="7" width="98%" class="selection">'; $TableHeader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Issue To WO') . '</th> - <th>' . _('Costing') . '</th> - <th>' . _('Contract Ref') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Required Date') . '</th> + <th>' . _('Modify') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Issue To WO') . '</th> + <th>' . _('Costing') . '</th> + <th>' . _('Contract Ref') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Required Date') . '</th> </tr>'; echo $TableHeader; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCreditItems.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -541,7 +541,7 @@ $Narrative = $_POST['Narrative_' . $LineItem->LineNumber]; if (isset($_POST['Price_' . $LineItem->LineNumber])){ - if (isset($_POST['Gross']) AND $_POST['Gross']==True){ + if (isset($_POST['Gross']) AND $_POST['Gross']==true){ $TaxTotalPercent =0; foreach ($LineItem->Taxes AS $Tax) { if ($Tax->TaxOnTax ==1){ @@ -550,7 +550,7 @@ $TaxTotalPercent += $Tax->TaxRate; } } - $Price = round($_POST['Price_' . $LineItem->LineNumber]/($TaxTotalPercent + 1),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); + $Price = round(filter_number_format($_POST['Price_' . $LineItem->LineNumber])/($TaxTotalPercent + 1),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); } else { $Price = filter_number_format($_POST['Price_' . $LineItem->LineNumber]); } @@ -708,16 +708,16 @@ <td>' . $LineItem->ItemDescription . '</td>'; if ($LineItem->Controlled==0){ - echo '<td><input type="text" class="number" name="Quantity_' . $LineItem->LineNumber . '" maxlength="6" size="6" value=' . locale_number_format($LineItem->Quantity,$LineItem->DecimalPlaces) . '></td>'; + echo '<td><input type="text" class="number" name="Quantity_' . $LineItem->LineNumber . '" maxlength="6" size="6" value=' . locale_number_format(round($LineItem->Quantity,$LineItem->DecimalPlaces),$LineItem->DecimalPlaces) . '></td>'; } else { echo '<td class="number"><a href="' . $rootpath . '/CreditItemsControlled.php?LineNo=' . $LineItem->LineNumber . '">' . locale_number_format($LineItem->Quantity,$LineItem->DecimalPlaces) . '</a> - <input type=hidden name="Quantity_' . $LineItem->LineNumber . '" value=' . round($LineItem->Quantity,$LineItem->DecimalPlaces) . '></td>'; + <input type=hidden name="Quantity_' . $LineItem->LineNumber . '" value=' . locale_number_format(round($LineItem->Quantity,$LineItem->DecimalPlaces),$LineItem->DecimalPlaces) . '></td>'; } echo '<td>' . $LineItem->Units . '</td> <td><input type="text" class="number" name="Price_' . $LineItem->LineNumber . '" size=10 maxlength=12 value=' . locale_number_format($LineItem->Price,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '></td> <td><input type="CheckBox" name="Gross" value=False></td> - <td><input type="text" class="number" name="Discount_' . $LineItem->LineNumber . '" size=3 maxlength=3 value=' . ($LineItem->DiscountPercent * 100) . '>%</td> + <td><input type="text" class="number" name="Discount_' . $LineItem->LineNumber . '" size=3 maxlength=3 value=' . locale_number_format(($LineItem->DiscountPercent * 100),'Variable') . '>%</td> <td class="number">' . $DisplayLineTotal . '</td>'; @@ -741,7 +741,7 @@ if ($i>0){ echo '<br />'; } - echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size=4 value="' . locale_number_format($Tax->TaxRate*100,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '">'; + echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size="4" value="' . locale_number_format($Tax->TaxRate*100,'Variable') . '">'; $i++; if ($Tax->TaxOnTax ==1){ $TaxTotals[$Tax->TaxAuthID] += ($Tax->TaxRate * ($LineTotal + $TaxLineTotal)); @@ -765,7 +765,7 @@ </tr>'; echo $RowStarter; - echo '<td colspan=11><textarea name="Narrative_' . $LineItem->LineNumber . '" cols=100% rows=1>' . $LineItem->Narrative . '</textarea><br /></td></tr>'; + echo '<td colspan=11><textarea name="Narrative_' . $LineItem->LineNumber . '" cols="100%" rows="1">' . $LineItem->Narrative . '</textarea><br /></td></tr>'; $_SESSION['CreditItems'.$identifier]->total += $LineTotal; @@ -780,7 +780,6 @@ echo '<tr> <td colspan="5"></td>'; - echo '<td colspan="2" class="number">'. _('Credit Freight').'</td> <td><input type="text" class="number" size=6 maxlength=6 name="ChargeFreightCost" value="' . locale_number_format($_SESSION['CreditItems'.$identifier]->FreightCost,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '" /></td>'; @@ -805,7 +804,7 @@ echo '<br />'; } - echo '<input type="text" class="number" name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format(($FreightTaxLine->TaxRate * 100),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '" />'; + echo '<input type="text" class="number" name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format(($FreightTaxLine->TaxRate * 100),'Variable') . '" />'; if ($FreightTaxLine->TaxOnTax ==1){ $TaxTotals[$FreightTaxLine->TaxAuthID] += ($FreightTaxLine->TaxRate * ($_SESSION['CreditItems'.$identifier]->FreightCost + $FreightTaxTotal)); @@ -933,7 +932,7 @@ /* Now show the stock item selection search stuff below */ - if (isset($_POST['PartSearch']) AND $_POST['PartSearch']!="" AND !isset($_POST['ProcessCredit'])){ + if (isset($_POST['PartSearch']) AND $_POST['PartSearch']!='' AND !isset($_POST['ProcessCredit'])){ echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '" />'; @@ -950,7 +949,7 @@ <tr> <td>' . _('Select a stock category') . ': <select name="StockCat">'; - echo '<option selected value="All">' . _('All'); + echo '<option selected value="All">' . _('All') . '</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ echo '<option selected value=' . $myrow1['categoryid'] . '>' . $myrow1['categorydescription'] . '</option>'; @@ -970,7 +969,7 @@ echo '<td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr>'; echo '<tr><td></td>'; echo '<td><font size="3"><b>' ._('OR') . '</b></font> ' . _('Enter extract of the Stock Code') . ': </td>'; - echo '<td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '"></td>'; + echo '<td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td>'; echo '</tr>'; echo '</table> <br /> @@ -1121,7 +1120,7 @@ '" . -$TaxTotal . "', '" . -$_SESSION['CreditItems'.$identifier]->FreightCost . "', '" . $_SESSION['CurrencyRate'] . "', - '" . $_POST['CreditText'] . "' + '" . DB_escape_string($_POST['CreditText']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The customer credit note transaction could not be added to the database because'); @@ -1139,7 +1138,7 @@ taxamount) VALUES ('" . $CreditTransID . "', '" . $TaxAuthID . "', - '" . -($TaxAmount)/$_SESSION['CurrencyRate'] . "')"; + '" . -$TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -1316,10 +1315,10 @@ /*1st off check if StockSerialItems already exists */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE stockid='" . $CreditLine->StockID . "' - AND loccode='" . $_SESSION['CreditItems'.$identifier]->Location . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE stockid='" . $CreditLine->StockID . "' + AND loccode='" . $_SESSION['CreditItems'.$identifier]->Location . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The existence of the serial stock item record could not be determined because'); $DbgMsg = _('The following SQL to find out if the serial stock item record existed already was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -1362,8 +1361,7 @@ '" . $StkMoveNo . "', '" . $CreditLine->StockID . "', '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "' - )"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -1381,7 +1379,7 @@ if ($CreditLine->MBflag=='B' OR $CreditLine->MBflag=='M') { $SQL = "UPDATE locstock - SET locstock.quantity = locstock.quantity + " . filter_number_format($CreditLine->Quantity) . " + SET locstock.quantity = locstock.quantity + " . $CreditLine->Quantity . " WHERE locstock.stockid = '" . $CreditLine->StockID . "' AND locstock.loccode = '" . $_SESSION['CreditItems'.$identifier]->Location . "'"; @@ -1400,11 +1398,11 @@ $SQL = "SELECT bom.component, bom.quantity, stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard - FROM bom INNER JOIN stockmaster - ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $CreditLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $CreditLine->StockID . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve assembly components from the database for') . ' ' . $CreditLine->StockID . ' ' . _('because'); $DbgMsg = _('The SQL that failed was'); @@ -1453,10 +1451,10 @@ '" . $_SESSION['CreditItems'.$identifier]->Branch . "', '" . $PeriodNo . "', '" . _('Assembly') .': ' . $CreditLine->StockID . "', - '" . filter_number_format($AssParts['quantity'] * $CreditLine->Quantity) . "', + '" . $AssParts['quantity'] * $CreditLine->Quantity . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->Quantity)) . "' + '" . $QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of') . ' ' . $CreditLine->StockID . ' ' . _('could not be inserted because'); @@ -1510,11 +1508,11 @@ '" . $SQLCreditDate . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . filter_number_format($CreditLine->DiscountPercent) . "', - '" . filter_number_format($CreditLine->StandardCost) . "', + '" . -$CreditLine->Quantity . "', + '" . $CreditLine->DiscountPercent . "', + '" . $CreditLine->StandardCost . "', '" . DB_escape_string($_POST['CreditText']) . "', 0, '" . $QtyOnHandPrior . "', @@ -1545,11 +1543,11 @@ '" . $SQLCreditDate . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . filter_number_format($CreditLine->DiscountPercent) . "', - '" . filter_number_format($CreditLine->StandardCost) . "', + '" . -$CreditLine->Quantity . "', + '" . $CreditLine->DiscountPercent . "', + '" . $CreditLine->StandardCost . "', '" . DB_escape_string($_POST['CreditText']) . "', 0)"; @@ -1639,8 +1637,8 @@ /*No updates to qty or cost data */ - $SQL = "UPDATE salesanalysis SET amt=amt-" . filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . ", - disc=disc-" . filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET amt=amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", + disc=disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $myrow[3] . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1653,10 +1651,10 @@ } else { - $SQL = "UPDATE salesanalysis SET Amt=Amt-" . filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . ", - Cost=Cost-" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . ", - Qty=Qty-" . filter_number_format($CreditLine->Quantity) . ", - Disc=Disc-" . filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET Amt=Amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", + Cost=Cost-" . $CreditLine->StandardCost * $CreditLine->Quantity . ", + Qty=Qty-" . $CreditLine->Quantity . ", + Disc=Disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $myrow[3] . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1686,11 +1684,11 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', 0, - '" . -filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1718,12 +1716,12 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', - '" . -filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "', + '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->StandardCost * $CreditLine->Quantity . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . -filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->Quantity . "', + '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1769,7 +1767,7 @@ '" . $PeriodNo . "', '" . $COGSAccount . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * -$CreditLine->Quantity) . "')"; + '" . ($CreditLine->StandardCost * -$CreditLine->Quantity) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of the stock credited GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1794,7 +1792,7 @@ '" . $PeriodNo . "', '" . $_POST['WriteOffGLCode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "' + '" . ($CreditLine->StandardCost * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of the stock credited GL posting could not be inserted because'); @@ -1817,7 +1815,7 @@ '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "' + '" . ($CreditLine->StandardCost * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side (or write off) of the cost of sales GL posting could not be inserted because'); @@ -1848,7 +1846,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->Price . "', - '" . filter_number_format(($CreditLine->Price * $CreditLine->Quantity)/$_SESSION['CurrencyRate']) . "' + '" . (($CreditLine->Price * $CreditLine->Quantity)/$_SESSION['CurrencyRate']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit note GL posting could not be inserted because'); @@ -1870,7 +1868,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " @ " . ($CreditLine->DiscountPercent * 100) . "%', - '" . -filter_number_format(($CreditLine->Price * $CreditLine->Quantity * $CreditLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "' + '" . -(($CreditLine->Price * $CreditLine->Quantity * $CreditLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "' )"; @@ -1900,7 +1898,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . -filter_number_format(($_SESSION['CreditItems'.$identifier]->total + $_SESSION['CreditItems'.$identifier]->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; + '" . -(($_SESSION['CreditItems'.$identifier]->total + $_SESSION['CreditItems'.$identifier]->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting for the credit note could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1920,7 +1918,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['freightact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . filter_number_format($_SESSION['CreditItems'.$identifier]->FreightCost/$_SESSION['CurrencyRate']) . "')"; + '" . ($_SESSION['CreditItems'.$identifier]->FreightCost/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting for this credit note could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1941,7 +1939,7 @@ '" . $PeriodNo . "', '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . ($TaxAmount/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCustomer.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -23,7 +23,7 @@ } echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customers') . '</p>'; if (!isset($_SESSION['CustomerType'])) { //initialise if not already done - $_SESSION['CustomerType'] = ""; + $_SESSION['CustomerType'] = ''; } // only run geocode if integration is turned on and customer has been selected if ($_SESSION['geocode_integration'] == 1 AND $_SESSION['CustomerID'] != "") { @@ -38,7 +38,7 @@ custbranch.lat, custbranch.lng FROM debtorsmaster LEFT JOIN custbranch - ON debtorsmaster.debtorno = custbranch.debtorno + ON debtorsmaster.debtorno = custbranch.debtorno WHERE debtorsmaster.debtorno = '" . $_SESSION['CustomerID'] . "' ORDER BY debtorsmaster.debtorno"; $ErrMsg = _('An error occurred in retrieving the information'); @@ -85,13 +85,24 @@ $_POST['PageOffset'] = 1; } } -if (isset($_POST['Search']) OR isset($_POST['CSV']) OR isset($_POST['Go']) OR isset($_POST['Next']) OR isset($_POST['Previous'])) { +if (isset($_POST['Search']) + OR isset($_POST['CSV']) + OR isset($_POST['Go']) + OR isset($_POST['Next']) + OR isset($_POST['Previous'])) { + unset($_POST['JustSelectedACustomer']); if (isset($_POST['Search'])) { $_POST['PageOffset'] = 1; } - if (($_POST['Keywords'] == '') AND ($_POST['CustCode'] == '') AND ($_POST['CustPhone'] == '') AND ( $_POST['CustType'] == 'ALL') AND ($_POST['Area'] == 'ALL') AND ($_POST['CustAdd'] == '')) { + if (($_POST['Keywords'] == '') + AND ($_POST['CustCode'] == '') + AND ($_POST['CustPhone'] == '') + AND ($_POST['CustType'] == 'ALL') + AND ($_POST['Area'] == 'ALL') + AND ($_POST['CustAdd'] == '')) { + //no criteria set then default to all customers $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, @@ -200,7 +211,8 @@ echo '<div class="page_help_text">' . _('Select a menu option to operate using this customer') . '.</div><br />'; echo '<table cellpadding=4 width=90% class="selection"> - <tr><th width=33%>' . _('Customer Inquiries') . '</th> + <tr> + <th width=33%>' . _('Customer Inquiries') . '</th> <th width=33%>' . _('Customer Transactions') . '</th> <th width=33%>' . _('Customer Maintenance') . '</th> </tr>'; @@ -231,9 +243,10 @@ <th width=33%>' . _('Customer Transactions') . '</th> <th width=33%>' . _('Customer Maintenance') . '</th> </tr>'; - echo '<tr><td class="select">'; - echo '</td><td class="select">'; - echo '</td><td class="select">'; + echo '<tr> + <td class="select"></td> + <td class="select"></td> + <td class="select">'; if (!isset($_SESSION['SalesmanLogin']) or $_SESSION['SalesmanLogin'] == '') { echo '<a href="' . $rootpath . '/Customers.php?">' . _('Add a New Customer') . '</a><br />'; } @@ -248,18 +261,24 @@ echo '<table cellpadding="3" colspan="4" class="selection">'; echo '<tr><td colspan="2">' . _('Enter a partial Name') . ':</td><td>'; if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25">'; + echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25">'; + echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; } -echo '</td><td><font size=3><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</td><td>'; +echo '</td> + <td><font size=3><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</td> + <td>'; if (isset($_POST['CustCode'])) { echo '<input type="text" name="CustCode" value="' . $_POST['CustCode'] . '" size="15" maxlength="18" />'; } else { echo '<input type="text" name="CustCode" size="15" maxlength="18" />'; } -echo '</td></tr><tr><td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Enter a partial Phone Number') . ':</td><td>'; +echo '</td> + </tr> + <tr> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td>' . _('Enter a partial Phone Number') . ':</td> + <td>'; if (isset($_POST['CustPhone'])) { echo '<input type="text" name="CustPhone" value="' . $_POST['CustPhone'] . '" size="15" maxlength="18" />'; } else { @@ -267,15 +286,18 @@ } echo '</td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Enter part of the Address') . ':</td><td>'; + <td>' . _('Enter part of the Address') . ':</td> + <td>'; if (isset($_POST['CustAdd'])) { - echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25">'; + echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25" />'; } else { - echo '<input type="text" name="CustAdd" size="20" maxlength="25">'; + echo '<input type="text" name="CustAdd" size="20" maxlength="25" />'; } echo '</td></tr>'; -echo '<tr><td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Choose a Type') . ':</td><td>'; +echo '<tr> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td>' . _('Choose a Type') . ':</td> + <td>'; if (isset($_POST['CustType'])) { // Show Customer Type drop down list $result2 = DB_query("SELECT typeid, typename FROM debtortype", $db); @@ -286,8 +308,8 @@ echo '<tr><td colspan="2">' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>'; } else { // If OK show select box with option selected - echo '<select name="CustType">'; - echo '<option value="ALL">' . _('Any') . '</option>'; + echo '<select name="CustType"> + <option value="ALL">' . _('Any') . '</option>'; while ($myrow = DB_fetch_array($result2)) { if ($_POST['CustType'] == $myrow['typename']) { echo '<option selected value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>'; @@ -308,8 +330,8 @@ echo '<tr><td colspan=2>' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>'; } else { // if OK show select box with available options to choose - echo '<select name="CustType">'; - echo '<option value="ALL">' . _('Any'). '</option>'; + echo '<select name="CustType"> + <option value="ALL">' . _('Any'). '</option>'; while ($myrow = DB_fetch_array($result2)) { echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>'; } //end while loop @@ -344,8 +366,8 @@ echo '</td></tr></table><br />'; echo '<div class="centre"> - <input type=submit name="Search" value="' . _('Search Now') . '" /> - <input type=submit name="CSV" value="' . _('CSV Format') . '" /> + <input type="submit" name="Search" value="' . _('Search Now') . '" /> + <input type="submit" name="CSV" value="' . _('CSV Format') . '" /> </div>'; if (isset($_SESSION['SalesmanLogin']) and $_SESSION['SalesmanLogin'] != '') { prnMsg(_('Your account enables you to see only customers allocated to you'), 'warn', _('Note: Sales-person Login')); @@ -379,9 +401,9 @@ $ListPage++; } echo '</select> - <input type=submit name="Go1" value="' . _('Go') . '" /> - <input type=submit name="Previous" value="' . _('Previous') . '" /> - <input type=submit name="Next" value="' . _('Next') . '" />'; + <input type="submit" name="Go1" value="' . _('Go') . '" /> + <input type="submit" name="Previous" value="' . _('Previous') . '" /> + <input type="submit" name="Next" value="' . _('Next') . '" />'; echo '</div>'; } echo '<br /> @@ -460,9 +482,9 @@ $ListPage++; } echo '</select> - <input type=submit name="Go2" value="' . _('Go') . '" /> - <input type=submit name="Previous" value="' . _('Previous') . '" /> - <input type=submit name="Next" value="' . _('Next') . '" />'; + <input type="submit" name="Go2" value="' . _('Go') . '" /> + <input type="submit" name="Previous" value="' . _('Previous') . '" /> + <input type="submit" name="Next" value="' . _('Next') . '" />'; } //end if results to show echo '</div></form>'; @@ -474,13 +496,22 @@ if ($lat == 0) { echo '<div class="centre">' . _('Mapping is enabled, but no Mapping data to display for this Customer.') . '</div>'; } else { - echo '<tr><td colspan=2>'; - echo '<table width=45% colspan=2 cellpadding=4>'; - echo '<tr><th width=33%>' . _('Customer Mapping') . '</th></tr>'; - echo '</td><td valign="top">'; /* Mapping */ - echo '<div class="centre">' . _('Mapping is enabled, Map will display below.') . '</div>'; - echo '<div align="center" id="map" style="width: ' . $map_width . 'px; height: ' . $map_height . 'px"></div><br />'; - echo '</th></tr></table>'; + echo '<tr> + <td colspan=2> + <table width="45%" colspan="2" cellpadding="4"> + <tr> + <th width=33%>' . _('Customer Mapping') . '</th> + </tr> + </td> + <th valign="top"> + <div class="centre">' . _('Mapping is enabled, Map will display below.') . ' + </div> + <div align="center" id="map" style="width: ' . $map_width . 'px; height: ' . $map_height . 'px"> + </div> + <br /> + </th> + </tr> + </table>'; } } // Extended Customer Info only if selected in Configuration Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/includes/MiscFunctions.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -317,7 +317,8 @@ function locale_number_format($Number, $DecimalPlaces=0) { global $DecimalPoint; global $ThousandsSeparator; - if ($DecimalPlaces=='Variable'){ + + if (!is_numeric($DecimalPlaces) AND $DecimalPlaces == 'Variable'){ $DecimalPlaces = mb_strlen($Number) - mb_strlen(intval($Number)); if ($DecimalPlaces > 0){ $DecimalPlaces--; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-09 00:16:22
|
Revision: 4716 http://web-erp.svn.sourceforge.net/web-erp/?rev=4716&view=rev Author: daintree Date: 2011-10-09 00:16:14 +0000 (Sun, 09 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PrintCustTrans.php trunk/SalesByTypePeriodInquiry.php trunk/SalesGraph.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SelectCompletedOrder.php trunk/SelectContract.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/includes/MiscFunctions.php Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/PrintCustTrans.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -832,6 +832,7 @@ stockmoves.qty as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces FROM stockmoves, Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesByTypePeriodInquiry.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -19,7 +19,7 @@ $_POST['DateRange']='ThisMonth'; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form name="Form1" action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class="selection"> @@ -34,7 +34,7 @@ if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)"/></td> </tr> <tr> <td>' . _('This Week') . ':</td> @@ -42,7 +42,7 @@ if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Month') . ':</td> @@ -50,7 +50,7 @@ if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Quarter') . ':</td> @@ -58,9 +58,13 @@ if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ + if (!isset($_POST['ToDate'])){ + $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'],mktime(1,1,1,Date('m')-12,Date('d')+1,Date('Y'))); + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } echo '<tr> <td>' . _('Date From') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> @@ -82,7 +86,7 @@ if ($_POST['DisplayData']=='Daily'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Weekly') . ':</td> @@ -90,7 +94,7 @@ if ($_POST['DisplayData']=='Weekly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Monthly') . ':</td> @@ -98,24 +102,27 @@ if ($_POST['DisplayData']=='Monthly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr> <tr> <td>' . _('Quarterly') . ':</td> <td><input type="radio" name="DisplayData" value="Quarterly" '; -if ($_POST['DisplayData']=='Monthly'){ +if ($_POST['DisplayData']=='Quarterly'){ echo 'checked'; } -echo '></td> +echo ' onChange="ReloadForm(Form1.ShowSales)" /></td> </tr>'; echo '</table> </td></tr> </table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; -echo '</form></div>'; -echo '<br />'; +echo '<br /> + <div class="centre"> + <input tabindex="4" type="submit" name="ShowSales" value="' . _('Show Sales') . '" /> + </div> + </form> + <br />'; if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ //Don't run the report until custom dates entered Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesGraph.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -176,20 +176,20 @@ $_POST['ValueTo']=''; } echo '<tr><td>' . _('Graph On:') . '</td><td> - <input type="RADIO" name="GraphOn" value="All" CHECKED>' . _('All') . '<br /> - <input type="RADIO" name="GraphOn" value="Customer">' . _('Customer') . '<br /> - <input type="RADIO" name="GraphOn" value="StockID">' . _('Item Code') . '</td></tr>'; + <input type="radio"" name="GraphOn" value="All" CHECKED>' . _('All') . '<br /> + <input type="radio"" name="GraphOn" value="Customer">' . _('Customer') . '<br /> + <input type="radio"" name="GraphOn" value="StockID">' . _('Item Code') . '</td></tr>'; echo '<tr><td>' . _('From:') . ' <input type=TEXT name="ValueFrom" value=' . $_POST['ValueFrom'] . '></td> <td>' . _('To:') . ' <input type=TEXT name="ValueTo" value=' . $_POST['ValueTo'] . '></td></tr>'; echo '<tr><td>' . _('Graph Value:') . '</td><td> - <input type="RADIO" name="GraphValue" value="Net" CHECKED>' . _('Net Sales Value') . '<br /> - <input type="RADIO" name="GraphValue" value="GP">' . _('Gross Profit') . '<br /> - <input type="RADIO" name="GraphValue" value="Quantity">' . _('Quantity') . '</td></tr>'; + <input type="radio"" name="GraphValue" value="Net" CHECKED>' . _('Net Sales Value') . '<br /> + <input type="radio"" name="GraphValue" value="GP">' . _('Gross Profit') . '<br /> + <input type="radio"" name="GraphValue" value="Quantity">' . _('Quantity') . '</td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type="submit" Name="ShowGraph" Value="' . _('Show Sales Graph') .'"></div>'; + echo '<br /><div class="centre"><input type="submit" Name="ShowGraph" Value="' . _('Show Sales Graph') .'" /></div>'; include('includes/footer.inc'); } else { Modified: trunk/SalesPeople.php =================================================================== --- trunk/SalesPeople.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesPeople.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -57,9 +57,6 @@ OR !is_numeric(filter_number_format($_POST['CommissionRate2']))) { $InputError = 1; prnMsg(_('The commission rates must be a floating point number'),'error'); - echo '<br/>Commission Rate 1 = ' . filter_number_format($_POST['CommissionRate1']); - echo '<br/>Commission Rate 2 = ' . filter_number_format($_POST['CommissionRate2']); - echo '<br/>The locale decimal point is ' . $LocaleInfo['decimal_point']; } elseif (!is_numeric(filter_number_format($_POST['Breakpoint']))) { $InputError = 1; prnMsg(_('The breakpoint should be a floating point number'),'error'); @@ -88,10 +85,10 @@ /*SelectedSalesPerson could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE salesman SET salesmanname='" . $_POST['SalesmanName'] . "', + $sql = "UPDATE salesman SET salesmanname='" . DB_escape_string($_POST['SalesmanName']) . "', commissionrate1='" . filter_number_format($_POST['CommissionRate1']) . "', - smantel='" . $_POST['SManTel'] . "', - smanfax='" . $_POST['SManFax'] . "', + smantel='" . DB_escape_string($_POST['SManTel']) . "', + smanfax='" . DB_escape_string($_POST['SManFax']) . "', breakpoint='" . filter_number_format($_POST['Breakpoint']) . "', commissionrate2='" . filter_number_format($_POST['CommissionRate2']) . "', current='" . $_POST['Current'] . "' @@ -110,7 +107,7 @@ smantel, smanfax, current) - VALUES ('" . $_POST['SalesmanCode'] . "', + VALUES ('" . DB_escape_string($_POST['SalesmanCode']) . "', '" . DB_escape_string($_POST['SalesmanName']) . "', '" . filter_number_format($_POST['CommissionRate1']) . "', '" . filter_number_format($_POST['CommissionRate2']) . "', @@ -275,9 +272,9 @@ $_POST['SalesmanName'] = $myrow['salesmanname']; $_POST['SManTel'] = $myrow['smantel']; $_POST['SManFax'] = $myrow['smanfax']; - $_POST['CommissionRate1'] = $myrow['commissionrate1']; - $_POST['Breakpoint'] = $myrow['breakpoint']; - $_POST['CommissionRate2'] = $myrow['commissionrate2']; + $_POST['CommissionRate1'] = locale_number_format($myrow['commissionrate1'],'Variable'); + $_POST['Breakpoint'] = locale_number_format($myrow['breakpoint'],'Variable'); + $_POST['CommissionRate2'] = locale_number_format($myrow['commissionrate2'],'Variable'); $_POST['Current'] = $myrow['current']; @@ -347,24 +344,24 @@ <td>' . _('Current?') . ':</td> <td><select name="Current">'; if ($_POST['Current']==1){ - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option selected value="1">' . _('Yes') . '</option>'; } else { - echo '<option value=1>' . _('Yes') . '</option>'; + echo '<option value="1">' . _('Yes') . '</option>'; } if ($_POST['Current']==0){ - echo '<option selected value=0>' . _('No') . '</option>'; + echo '<option selected value="0">' . _('No') . '</option>'; } else { - echo '<option value=0>' . _('No') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; } echo '</select></td> - </tr>'; + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; - echo '</table>'; - - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SalesTopItemsInquiry.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -3,11 +3,11 @@ /* $Id: SalesTopItemsInquiry.php 4261 2010-12-22 15:56:50Z $*/ include('includes/session.inc'); -$title = _('Sales Category Report'); +$title = _('Top Sales Inquiry'); include('includes/header.inc'); include('includes/DefineCartClass.php'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Inquiry') . '" alt="" />' . ' ' . _('Top Sales Items Inquiry') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; if (!isset($_POST['DateRange'])){ @@ -244,7 +244,7 @@ <td class="number">' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($SalesRow['netsalesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . $SalesRow['salesquantity'] . '</td> + <td class="number">' . locale_number_format($SalesRow['salesquantity'],'Variable') . '</td> </tr>'; $i++; @@ -266,7 +266,7 @@ <td class="number">' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . $CumulativeTotalQuantity . '</td> + <td class="number">' . locale_number_format($CumulativeTotalQuantity,'Variable') . '</td> </tr>'; echo '</table>'; Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCompletedOrder.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -519,7 +519,7 @@ $_POST['OrderNumber']=''; } echo '<td>' . _('Order Number') . ':</td> - <td><input type="text" name="OrderNumber" maxlength =8 size=9 value ="' . $_POST['OrderNumber'] . '"></td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" value ="' . $_POST['OrderNumber'] . '" /></td> <td>' . _('for all orders placed after') . ': </td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength="10" size="11" value="' . $_POST['OrdersAfterDate'] . '" /></td> <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '" /></td> @@ -542,7 +542,7 @@ echo '<div class="page_help_text"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . ' </font></div>'; echo '<br /> <table class="selection">'; - echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; + echo '<tr><td><font size="1">' . _('Select a stock category') . ':</font>'; echo '<select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { @@ -553,19 +553,23 @@ } } - echo '</select>'; - echo '<td><font size=1>' . _('Enter text extracts in the description') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td></tr>'; - echo '<tr><td></td>'; - echo '<td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td>'; - echo '<td><input type="text" name="StockCode" size="15" maxlength="18"></td>'; - echo '</tr>'; - echo '<tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; + echo '</select> + <td><font size="1">' . _('Enter text extracts in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> + </tr> + <tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; if (count($_SESSION['AllowedPageSecurityTokens'])>1){ echo '<input type="submit" name="ResetPart" value="' . _('Show All') . '" /></div>'; } - echo '</td></tr></table>'; + echo '</td> + </tr> + </table>'; } @@ -574,12 +578,14 @@ echo '<br /> <table cellpadding="2" colspan="7" class="selection">'; - $TableHeadings = '<tr><th>' . _('Code') . '</th> + $TableHeadings = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('On Hand') . '</th> <th>' . _('Purchase Orders') . '</th> <th>' . _('Sales Orders') . '</th> - <th>' . _('Units') . '</th></tr>'; + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeadings; @@ -597,17 +603,17 @@ } printf('<td><font size=1><input type="submit" name="SelectedStockItem" value="%s" /></font></td> - <td><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td class="number"><font size=1>%s</font></td> - <td><font size=1>%s</font></td></tr>', - $myrow['stockid'], - $myrow['description'], - locale_number_format($myrow['qoh'],$myrow['decimalplaces']), - locale_number_format($myrow['qoo'],$myrow['decimalplaces']), - locale_number_format($myrow['qdem'],$myrow['decimalplaces']), - $myrow['units']); + <td><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td><font size=1>%s</font></td></tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qoo'],$myrow['decimalplaces']), + locale_number_format($myrow['qdem'],$myrow['decimalplaces']), + $myrow['units']); //end of page full new headings if } @@ -631,7 +637,8 @@ <th>' . _('Order Date') . '</th> <th>' . _('Req Del Date') . '</th> <th>' . _('Delivery To') . '</th> - <th>' . _('Order Total') . '</th></tr>'; + <th>' . _('Order Total') . '</th> + </tr>'; echo $tableheader; @@ -654,23 +661,23 @@ $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - </tr>', - $ViewPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + </tr>', + $ViewPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue); //end of page full new headings if } Modified: trunk/SelectContract.php =================================================================== --- trunk/SelectContract.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectContract.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -27,7 +27,7 @@ } else { if (isset($_POST['SelectedCustomer'])) { echo _('For customer') . ': ' . $_POST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo '<input type="hidden" name="SelectedCustomer" value="' . $_POST['SelectedCustomer'] . '">'; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_POST['SelectedCustomer'] . '" />'; } } @@ -145,14 +145,14 @@ echo '<table cellpadding="2" colspan="7" width="98%" class="selection">'; $TableHeader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Issue To WO') . '</th> - <th>' . _('Costing') . '</th> - <th>' . _('Contract Ref') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Required Date') . '</th> + <th>' . _('Modify') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Issue To WO') . '</th> + <th>' . _('Costing') . '</th> + <th>' . _('Contract Ref') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Required Date') . '</th> </tr>'; echo $TableHeader; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCreditItems.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -541,7 +541,7 @@ $Narrative = $_POST['Narrative_' . $LineItem->LineNumber]; if (isset($_POST['Price_' . $LineItem->LineNumber])){ - if (isset($_POST['Gross']) AND $_POST['Gross']==True){ + if (isset($_POST['Gross']) AND $_POST['Gross']==true){ $TaxTotalPercent =0; foreach ($LineItem->Taxes AS $Tax) { if ($Tax->TaxOnTax ==1){ @@ -550,7 +550,7 @@ $TaxTotalPercent += $Tax->TaxRate; } } - $Price = round($_POST['Price_' . $LineItem->LineNumber]/($TaxTotalPercent + 1),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); + $Price = round(filter_number_format($_POST['Price_' . $LineItem->LineNumber])/($TaxTotalPercent + 1),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); } else { $Price = filter_number_format($_POST['Price_' . $LineItem->LineNumber]); } @@ -708,16 +708,16 @@ <td>' . $LineItem->ItemDescription . '</td>'; if ($LineItem->Controlled==0){ - echo '<td><input type="text" class="number" name="Quantity_' . $LineItem->LineNumber . '" maxlength="6" size="6" value=' . locale_number_format($LineItem->Quantity,$LineItem->DecimalPlaces) . '></td>'; + echo '<td><input type="text" class="number" name="Quantity_' . $LineItem->LineNumber . '" maxlength="6" size="6" value=' . locale_number_format(round($LineItem->Quantity,$LineItem->DecimalPlaces),$LineItem->DecimalPlaces) . '></td>'; } else { echo '<td class="number"><a href="' . $rootpath . '/CreditItemsControlled.php?LineNo=' . $LineItem->LineNumber . '">' . locale_number_format($LineItem->Quantity,$LineItem->DecimalPlaces) . '</a> - <input type=hidden name="Quantity_' . $LineItem->LineNumber . '" value=' . round($LineItem->Quantity,$LineItem->DecimalPlaces) . '></td>'; + <input type=hidden name="Quantity_' . $LineItem->LineNumber . '" value=' . locale_number_format(round($LineItem->Quantity,$LineItem->DecimalPlaces),$LineItem->DecimalPlaces) . '></td>'; } echo '<td>' . $LineItem->Units . '</td> <td><input type="text" class="number" name="Price_' . $LineItem->LineNumber . '" size=10 maxlength=12 value=' . locale_number_format($LineItem->Price,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '></td> <td><input type="CheckBox" name="Gross" value=False></td> - <td><input type="text" class="number" name="Discount_' . $LineItem->LineNumber . '" size=3 maxlength=3 value=' . ($LineItem->DiscountPercent * 100) . '>%</td> + <td><input type="text" class="number" name="Discount_' . $LineItem->LineNumber . '" size=3 maxlength=3 value=' . locale_number_format(($LineItem->DiscountPercent * 100),'Variable') . '>%</td> <td class="number">' . $DisplayLineTotal . '</td>'; @@ -741,7 +741,7 @@ if ($i>0){ echo '<br />'; } - echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size=4 value="' . locale_number_format($Tax->TaxRate*100,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '">'; + echo '<input type="text" class="number" name="' . $LineItem->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size="4" value="' . locale_number_format($Tax->TaxRate*100,'Variable') . '">'; $i++; if ($Tax->TaxOnTax ==1){ $TaxTotals[$Tax->TaxAuthID] += ($Tax->TaxRate * ($LineTotal + $TaxLineTotal)); @@ -765,7 +765,7 @@ </tr>'; echo $RowStarter; - echo '<td colspan=11><textarea name="Narrative_' . $LineItem->LineNumber . '" cols=100% rows=1>' . $LineItem->Narrative . '</textarea><br /></td></tr>'; + echo '<td colspan=11><textarea name="Narrative_' . $LineItem->LineNumber . '" cols="100%" rows="1">' . $LineItem->Narrative . '</textarea><br /></td></tr>'; $_SESSION['CreditItems'.$identifier]->total += $LineTotal; @@ -780,7 +780,6 @@ echo '<tr> <td colspan="5"></td>'; - echo '<td colspan="2" class="number">'. _('Credit Freight').'</td> <td><input type="text" class="number" size=6 maxlength=6 name="ChargeFreightCost" value="' . locale_number_format($_SESSION['CreditItems'.$identifier]->FreightCost,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '" /></td>'; @@ -805,7 +804,7 @@ echo '<br />'; } - echo '<input type="text" class="number" name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format(($FreightTaxLine->TaxRate * 100),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces) . '" />'; + echo '<input type="text" class="number" name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format(($FreightTaxLine->TaxRate * 100),'Variable') . '" />'; if ($FreightTaxLine->TaxOnTax ==1){ $TaxTotals[$FreightTaxLine->TaxAuthID] += ($FreightTaxLine->TaxRate * ($_SESSION['CreditItems'.$identifier]->FreightCost + $FreightTaxTotal)); @@ -933,7 +932,7 @@ /* Now show the stock item selection search stuff below */ - if (isset($_POST['PartSearch']) AND $_POST['PartSearch']!="" AND !isset($_POST['ProcessCredit'])){ + if (isset($_POST['PartSearch']) AND $_POST['PartSearch']!='' AND !isset($_POST['ProcessCredit'])){ echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '" />'; @@ -950,7 +949,7 @@ <tr> <td>' . _('Select a stock category') . ': <select name="StockCat">'; - echo '<option selected value="All">' . _('All'); + echo '<option selected value="All">' . _('All') . '</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ echo '<option selected value=' . $myrow1['categoryid'] . '>' . $myrow1['categorydescription'] . '</option>'; @@ -970,7 +969,7 @@ echo '<td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr>'; echo '<tr><td></td>'; echo '<td><font size="3"><b>' ._('OR') . '</b></font> ' . _('Enter extract of the Stock Code') . ': </td>'; - echo '<td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '"></td>'; + echo '<td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td>'; echo '</tr>'; echo '</table> <br /> @@ -1121,7 +1120,7 @@ '" . -$TaxTotal . "', '" . -$_SESSION['CreditItems'.$identifier]->FreightCost . "', '" . $_SESSION['CurrencyRate'] . "', - '" . $_POST['CreditText'] . "' + '" . DB_escape_string($_POST['CreditText']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The customer credit note transaction could not be added to the database because'); @@ -1139,7 +1138,7 @@ taxamount) VALUES ('" . $CreditTransID . "', '" . $TaxAuthID . "', - '" . -($TaxAmount)/$_SESSION['CurrencyRate'] . "')"; + '" . -$TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -1316,10 +1315,10 @@ /*1st off check if StockSerialItems already exists */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE stockid='" . $CreditLine->StockID . "' - AND loccode='" . $_SESSION['CreditItems'.$identifier]->Location . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE stockid='" . $CreditLine->StockID . "' + AND loccode='" . $_SESSION['CreditItems'.$identifier]->Location . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The existence of the serial stock item record could not be determined because'); $DbgMsg = _('The following SQL to find out if the serial stock item record existed already was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -1362,8 +1361,7 @@ '" . $StkMoveNo . "', '" . $CreditLine->StockID . "', '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "' - )"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -1381,7 +1379,7 @@ if ($CreditLine->MBflag=='B' OR $CreditLine->MBflag=='M') { $SQL = "UPDATE locstock - SET locstock.quantity = locstock.quantity + " . filter_number_format($CreditLine->Quantity) . " + SET locstock.quantity = locstock.quantity + " . $CreditLine->Quantity . " WHERE locstock.stockid = '" . $CreditLine->StockID . "' AND locstock.loccode = '" . $_SESSION['CreditItems'.$identifier]->Location . "'"; @@ -1400,11 +1398,11 @@ $SQL = "SELECT bom.component, bom.quantity, stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard - FROM bom INNER JOIN stockmaster - ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $CreditLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $CreditLine->StockID . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve assembly components from the database for') . ' ' . $CreditLine->StockID . ' ' . _('because'); $DbgMsg = _('The SQL that failed was'); @@ -1453,10 +1451,10 @@ '" . $_SESSION['CreditItems'.$identifier]->Branch . "', '" . $PeriodNo . "', '" . _('Assembly') .': ' . $CreditLine->StockID . "', - '" . filter_number_format($AssParts['quantity'] * $CreditLine->Quantity) . "', + '" . $AssParts['quantity'] * $CreditLine->Quantity . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->Quantity)) . "' + '" . $QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of') . ' ' . $CreditLine->StockID . ' ' . _('could not be inserted because'); @@ -1510,11 +1508,11 @@ '" . $SQLCreditDate . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . filter_number_format($CreditLine->DiscountPercent) . "', - '" . filter_number_format($CreditLine->StandardCost) . "', + '" . -$CreditLine->Quantity . "', + '" . $CreditLine->DiscountPercent . "', + '" . $CreditLine->StandardCost . "', '" . DB_escape_string($_POST['CreditText']) . "', 0, '" . $QtyOnHandPrior . "', @@ -1545,11 +1543,11 @@ '" . $SQLCreditDate . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . filter_number_format($CreditLine->DiscountPercent) . "', - '" . filter_number_format($CreditLine->StandardCost) . "', + '" . -$CreditLine->Quantity . "', + '" . $CreditLine->DiscountPercent . "', + '" . $CreditLine->StandardCost . "', '" . DB_escape_string($_POST['CreditText']) . "', 0)"; @@ -1639,8 +1637,8 @@ /*No updates to qty or cost data */ - $SQL = "UPDATE salesanalysis SET amt=amt-" . filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . ", - disc=disc-" . filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET amt=amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", + disc=disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $myrow[3] . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1653,10 +1651,10 @@ } else { - $SQL = "UPDATE salesanalysis SET Amt=Amt-" . filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . ", - Cost=Cost-" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . ", - Qty=Qty-" . filter_number_format($CreditLine->Quantity) . ", - Disc=Disc-" . filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET Amt=Amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", + Cost=Cost-" . $CreditLine->StandardCost * $CreditLine->Quantity . ", + Qty=Qty-" . $CreditLine->Quantity . ", + Disc=Disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $myrow[3] . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1686,11 +1684,11 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', 0, - '" . -filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1718,12 +1716,12 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -filter_number_format($CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', - '" . -filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "', + '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->StandardCost * $CreditLine->Quantity . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', - '" . -filter_number_format($CreditLine->Quantity) . "', - '" . -filter_number_format($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']) . "', + '" . -$CreditLine->Quantity . "', + '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1769,7 +1767,7 @@ '" . $PeriodNo . "', '" . $COGSAccount . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * -$CreditLine->Quantity) . "')"; + '" . ($CreditLine->StandardCost * -$CreditLine->Quantity) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of the stock credited GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1794,7 +1792,7 @@ '" . $PeriodNo . "', '" . $_POST['WriteOffGLCode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "' + '" . ($CreditLine->StandardCost * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of the stock credited GL posting could not be inserted because'); @@ -1817,7 +1815,7 @@ '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->StandardCost . "', - '" . filter_number_format($CreditLine->StandardCost * $CreditLine->Quantity) . "' + '" . ($CreditLine->StandardCost * $CreditLine->Quantity) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side (or write off) of the cost of sales GL posting could not be inserted because'); @@ -1848,7 +1846,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->Quantity . " @ " . $CreditLine->Price . "', - '" . filter_number_format(($CreditLine->Price * $CreditLine->Quantity)/$_SESSION['CurrencyRate']) . "' + '" . (($CreditLine->Price * $CreditLine->Quantity)/$_SESSION['CurrencyRate']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit note GL posting could not be inserted because'); @@ -1870,7 +1868,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . " - " . $CreditLine->StockID . " @ " . ($CreditLine->DiscountPercent * 100) . "%', - '" . -filter_number_format(($CreditLine->Price * $CreditLine->Quantity * $CreditLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "' + '" . -(($CreditLine->Price * $CreditLine->Quantity * $CreditLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "' )"; @@ -1900,7 +1898,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . -filter_number_format(($_SESSION['CreditItems'.$identifier]->total + $_SESSION['CreditItems'.$identifier]->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; + '" . -(($_SESSION['CreditItems'.$identifier]->total + $_SESSION['CreditItems'.$identifier]->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting for the credit note could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1920,7 +1918,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['freightact'] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . filter_number_format($_SESSION['CreditItems'.$identifier]->FreightCost/$_SESSION['CurrencyRate']) . "')"; + '" . ($_SESSION['CreditItems'.$identifier]->FreightCost/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting for this credit note could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1941,7 +1939,7 @@ '" . $PeriodNo . "', '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', - '" . filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . ($TaxAmount/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/SelectCustomer.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -23,7 +23,7 @@ } echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customers') . '</p>'; if (!isset($_SESSION['CustomerType'])) { //initialise if not already done - $_SESSION['CustomerType'] = ""; + $_SESSION['CustomerType'] = ''; } // only run geocode if integration is turned on and customer has been selected if ($_SESSION['geocode_integration'] == 1 AND $_SESSION['CustomerID'] != "") { @@ -38,7 +38,7 @@ custbranch.lat, custbranch.lng FROM debtorsmaster LEFT JOIN custbranch - ON debtorsmaster.debtorno = custbranch.debtorno + ON debtorsmaster.debtorno = custbranch.debtorno WHERE debtorsmaster.debtorno = '" . $_SESSION['CustomerID'] . "' ORDER BY debtorsmaster.debtorno"; $ErrMsg = _('An error occurred in retrieving the information'); @@ -85,13 +85,24 @@ $_POST['PageOffset'] = 1; } } -if (isset($_POST['Search']) OR isset($_POST['CSV']) OR isset($_POST['Go']) OR isset($_POST['Next']) OR isset($_POST['Previous'])) { +if (isset($_POST['Search']) + OR isset($_POST['CSV']) + OR isset($_POST['Go']) + OR isset($_POST['Next']) + OR isset($_POST['Previous'])) { + unset($_POST['JustSelectedACustomer']); if (isset($_POST['Search'])) { $_POST['PageOffset'] = 1; } - if (($_POST['Keywords'] == '') AND ($_POST['CustCode'] == '') AND ($_POST['CustPhone'] == '') AND ( $_POST['CustType'] == 'ALL') AND ($_POST['Area'] == 'ALL') AND ($_POST['CustAdd'] == '')) { + if (($_POST['Keywords'] == '') + AND ($_POST['CustCode'] == '') + AND ($_POST['CustPhone'] == '') + AND ($_POST['CustType'] == 'ALL') + AND ($_POST['Area'] == 'ALL') + AND ($_POST['CustAdd'] == '')) { + //no criteria set then default to all customers $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, @@ -200,7 +211,8 @@ echo '<div class="page_help_text">' . _('Select a menu option to operate using this customer') . '.</div><br />'; echo '<table cellpadding=4 width=90% class="selection"> - <tr><th width=33%>' . _('Customer Inquiries') . '</th> + <tr> + <th width=33%>' . _('Customer Inquiries') . '</th> <th width=33%>' . _('Customer Transactions') . '</th> <th width=33%>' . _('Customer Maintenance') . '</th> </tr>'; @@ -231,9 +243,10 @@ <th width=33%>' . _('Customer Transactions') . '</th> <th width=33%>' . _('Customer Maintenance') . '</th> </tr>'; - echo '<tr><td class="select">'; - echo '</td><td class="select">'; - echo '</td><td class="select">'; + echo '<tr> + <td class="select"></td> + <td class="select"></td> + <td class="select">'; if (!isset($_SESSION['SalesmanLogin']) or $_SESSION['SalesmanLogin'] == '') { echo '<a href="' . $rootpath . '/Customers.php?">' . _('Add a New Customer') . '</a><br />'; } @@ -248,18 +261,24 @@ echo '<table cellpadding="3" colspan="4" class="selection">'; echo '<tr><td colspan="2">' . _('Enter a partial Name') . ':</td><td>'; if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25">'; + echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25">'; + echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; } -echo '</td><td><font size=3><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</td><td>'; +echo '</td> + <td><font size=3><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</td> + <td>'; if (isset($_POST['CustCode'])) { echo '<input type="text" name="CustCode" value="' . $_POST['CustCode'] . '" size="15" maxlength="18" />'; } else { echo '<input type="text" name="CustCode" size="15" maxlength="18" />'; } -echo '</td></tr><tr><td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Enter a partial Phone Number') . ':</td><td>'; +echo '</td> + </tr> + <tr> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td>' . _('Enter a partial Phone Number') . ':</td> + <td>'; if (isset($_POST['CustPhone'])) { echo '<input type="text" name="CustPhone" value="' . $_POST['CustPhone'] . '" size="15" maxlength="18" />'; } else { @@ -267,15 +286,18 @@ } echo '</td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Enter part of the Address') . ':</td><td>'; + <td>' . _('Enter part of the Address') . ':</td> + <td>'; if (isset($_POST['CustAdd'])) { - echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25">'; + echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25" />'; } else { - echo '<input type="text" name="CustAdd" size="20" maxlength="25">'; + echo '<input type="text" name="CustAdd" size="20" maxlength="25" />'; } echo '</td></tr>'; -echo '<tr><td><font size=3><b>' . _('OR') . '</b></font></td> - <td>' . _('Choose a Type') . ':</td><td>'; +echo '<tr> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td>' . _('Choose a Type') . ':</td> + <td>'; if (isset($_POST['CustType'])) { // Show Customer Type drop down list $result2 = DB_query("SELECT typeid, typename FROM debtortype", $db); @@ -286,8 +308,8 @@ echo '<tr><td colspan="2">' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>'; } else { // If OK show select box with option selected - echo '<select name="CustType">'; - echo '<option value="ALL">' . _('Any') . '</option>'; + echo '<select name="CustType"> + <option value="ALL">' . _('Any') . '</option>'; while ($myrow = DB_fetch_array($result2)) { if ($_POST['CustType'] == $myrow['typename']) { echo '<option selected value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>'; @@ -308,8 +330,8 @@ echo '<tr><td colspan=2>' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>'; } else { // if OK show select box with available options to choose - echo '<select name="CustType">'; - echo '<option value="ALL">' . _('Any'). '</option>'; + echo '<select name="CustType"> + <option value="ALL">' . _('Any'). '</option>'; while ($myrow = DB_fetch_array($result2)) { echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>'; } //end while loop @@ -344,8 +366,8 @@ echo '</td></tr></table><br />'; echo '<div class="centre"> - <input type=submit name="Search" value="' . _('Search Now') . '" /> - <input type=submit name="CSV" value="' . _('CSV Format') . '" /> + <input type="submit" name="Search" value="' . _('Search Now') . '" /> + <input type="submit" name="CSV" value="' . _('CSV Format') . '" /> </div>'; if (isset($_SESSION['SalesmanLogin']) and $_SESSION['SalesmanLogin'] != '') { prnMsg(_('Your account enables you to see only customers allocated to you'), 'warn', _('Note: Sales-person Login')); @@ -379,9 +401,9 @@ $ListPage++; } echo '</select> - <input type=submit name="Go1" value="' . _('Go') . '" /> - <input type=submit name="Previous" value="' . _('Previous') . '" /> - <input type=submit name="Next" value="' . _('Next') . '" />'; + <input type="submit" name="Go1" value="' . _('Go') . '" /> + <input type="submit" name="Previous" value="' . _('Previous') . '" /> + <input type="submit" name="Next" value="' . _('Next') . '" />'; echo '</div>'; } echo '<br /> @@ -460,9 +482,9 @@ $ListPage++; } echo '</select> - <input type=submit name="Go2" value="' . _('Go') . '" /> - <input type=submit name="Previous" value="' . _('Previous') . '" /> - <input type=submit name="Next" value="' . _('Next') . '" />'; + <input type="submit" name="Go2" value="' . _('Go') . '" /> + <input type="submit" name="Previous" value="' . _('Previous') . '" /> + <input type="submit" name="Next" value="' . _('Next') . '" />'; } //end if results to show echo '</div></form>'; @@ -474,13 +496,22 @@ if ($lat == 0) { echo '<div class="centre">' . _('Mapping is enabled, but no Mapping data to display for this Customer.') . '</div>'; } else { - echo '<tr><td colspan=2>'; - echo '<table width=45% colspan=2 cellpadding=4>'; - echo '<tr><th width=33%>' . _('Customer Mapping') . '</th></tr>'; - echo '</td><td valign="top">'; /* Mapping */ - echo '<div class="centre">' . _('Mapping is enabled, Map will display below.') . '</div>'; - echo '<div align="center" id="map" style="width: ' . $map_width . 'px; height: ' . $map_height . 'px"></div><br />'; - echo '</th></tr></table>'; + echo '<tr> + <td colspan=2> + <table width="45%" colspan="2" cellpadding="4"> + <tr> + <th width=33%>' . _('Customer Mapping') . '</th> + </tr> + </td> + <th valign="top"> + <div class="centre">' . _('Mapping is enabled, Map will display below.') . ' + </div> + <div align="center" id="map" style="width: ' . $map_width . 'px; height: ' . $map_height . 'px"> + </div> + <br /> + </th> + </tr> + </table>'; } } // Extended Customer Info only if selected in Configuration Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-10-08 09:44:56 UTC (rev 4715) +++ trunk/includes/MiscFunctions.php 2011-10-09 00:16:14 UTC (rev 4716) @@ -317,7 +317,8 @@ function locale_number_format($Number, $DecimalPlaces=0) { global $DecimalPoint; global $ThousandsSeparator; - if ($DecimalPlaces=='Variable'){ + + if (!is_numeric($DecimalPlaces) AND $DecimalPlaces == 'Variable'){ $DecimalPlaces = mb_strlen($Number) - mb_strlen(intval($Number)); if ($DecimalPlaces > 0){ $DecimalPlaces--; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-11 09:10:23
|
Revision: 4718 http://web-erp.svn.sourceforge.net/web-erp/?rev=4718&view=rev Author: daintree Date: 2011-10-11 09:10:13 +0000 (Tue, 11 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Areas.php trunk/GLBalanceSheet.php trunk/SelectSalesOrder.php trunk/Shipments.php trunk/Shippers.php trunk/Shipt_Select.php Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Areas.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -195,9 +195,13 @@ $_POST['AreaCode'] = $myrow['areacode']; $_POST['AreaDescription'] = $myrow['areadescription']; - echo '<input type=hidden name=SelectedArea value="' . $SelectedArea . '">'; - echo '<input type=hidden name=AreaCode value="' .$_POST['AreaCode'] . '">'; - echo '<table class=selection><tr><td>' . _('Area Code') . ':</td><td>' . $_POST['AreaCode'] . '</td></tr>'; + echo '<input type=hidden name="SelectedArea" value="' . $SelectedArea . '" />'; + echo '<input type=hidden name="AreaCode" value="' .$_POST['AreaCode'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Area Code') . ':</td> + <td>' . $_POST['AreaCode'] . '</td> + </tr>'; } else { if (!isset($_POST['AreaCode'])) { @@ -209,16 +213,23 @@ echo '<table class="selection"> <tr> <td>' . _('Area Code') . ':</td> - <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size=3 maxlength=3></td> + <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size="3" maxlength=3></td> </tr>'; } echo '<tr><td>' . _('Area Name') . ':</td> - <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size=26 maxlength=25></td> + <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size="26" maxlength="25" /></td> </tr>'; - echo '<tr><td colspan=2><div class="centre"><input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .'></div></td></tr>'; - echo '</table></form>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .' /> + </div> + </td> + </tr> + </table> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/GLBalanceSheet.php =================================================================== --- trunk/GLBalanceSheet.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/GLBalanceSheet.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.21 $ */ - /* $Id$*/ /*Through deviousness and cunning, this system allows shows the balance sheets as at the end of any period selected - so first off need to show the input of criteria screen while the user is selecting the period end of the balance date meanwhile the system is posting any unposted transactions */ -//$PageSecurity = 8; include ('includes/session.inc'); $title = _('Balance Sheet'); @@ -24,9 +21,12 @@ . _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<br />' . _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection"><tr><td>'._('Select the balance date').':</td><td><select Name="BalancePeriodEnd">'; + echo '<table class="selection"> + <tr> + <td>'._('Select the balance date').':</td> + <td><select Name="BalancePeriodEnd">'; $periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'"; @@ -34,28 +34,38 @@ $myrow=DB_fetch_array($result, $db); $lastdate_in_period=$myrow[0]; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); while ($myrow=DB_fetch_array($Periods,$db)){ if( $myrow['periodno']== $periodno){ - echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period); + echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']); + echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td><td><select Name="Detail">'; - echo '<option selected VALUE="Summary">'._('Summary') . '</option>'; - echo '<option selected VALUE="Detailed">'._('All Accounts') . '</option>'; - echo '</select></td></tr>'; + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select Name="Detail"> + <option value="Summary">'._('Summary') . '</option> + <option selected value="Detailed">'._('All Accounts') . '</option> + </select></td> + </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="ShowBalanceSheet" Value="'._('Show on Screen (HTML)').'"></div>'; - echo '<br /><div class="centre"><input type=submit Name="PrintPDF" Value="'._('Produce PDF Report').'"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="ShowBalanceSheet" value="'._('Show on Screen (HTML)').'" /> + </div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"> + </div> + </form>'; /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -90,7 +100,8 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('The accumulated profits brought forward could not be calculated by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -128,7 +139,7 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('No general ledger accounts were returned by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -254,26 +265,26 @@ $FontSize = 8; $pdf->setFont('','B'); while ($Level>0) { - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $Level--; - } - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $YPos -= $line_height; + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $Level--; + } + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $YPos -= $line_height; - if ($SectionBalanceLY+$SectionBalance !=0){ - $FontSize =8; + if ($SectionBalanceLY+$SectionBalance !=0){ + $FontSize =8; $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,$Sections[$Section]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']),'right'); @@ -295,15 +306,15 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } exit; } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type=hidden name="BalancePeriodEnd" VALUE="' . $_POST['BalancePeriodEnd'] . '">'; + echo '<input type=hidden name="BalancePeriodEnd" value="' . $_POST['BalancePeriodEnd'] . '" />'; $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; @@ -350,22 +361,29 @@ $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because')); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/preview.gif" title="' . _('Search') . '" alt="" /> ' . _('HTML View') . '</p>'; - echo '<div class=invoice><table class="selection"><tr><th colspan=6><div class="centre"><font size=4 color=blue><b>' . - _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div></th></tr>'; + echo '<div class="invoice"> + <table class="selection"> + <tr> + <th colspan=6> + <div class="centre"><font size="4" color="blue"><b>' . + _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> - <th>'._('Account').'</td> - <th>'._('Account Name').'</td> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th>'._('Account').'</td> + <th>'._('Account Name').'</td> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">'._('Last Year').'</th> + </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th colspan="2"></th> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">' ._('Last Year') . '</th> + </tr>'; } @@ -401,22 +419,22 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -425,23 +443,23 @@ } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2">%s</td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) ); + $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -453,27 +471,27 @@ if ($Section!=''){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - </tr>'; + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> + </tr>'; } else { echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="3"></td> + <td><hr></td> + <td></td> + <td><hr></td> + </tr>'; } printf('<tr> - <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', + <td colspan="3"><font size="4">%s</font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', $Sections[$Section], locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -486,9 +504,9 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + <td colspan="6"><font size="4" color="blue"><b>%s</b></font></td> + </tr>', + $Sections[$myrow['sectioninaccounts']]); } } @@ -501,9 +519,9 @@ if ($_POST['Detail']=='Detailed'){ $ActGrp = $myrow['groupname']; printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); echo $TableHeader; } $GroupTotal[$Level]=0; @@ -535,63 +553,57 @@ $ActEnquiryURL = '<a href="' . $rootpath . '/GLAccountInquiry.php?Period=' . $_POST['BalancePeriodEnd'] . '&Account=' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . '</a>'; - $PrintString = '<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - </tr>'; - - printf($PrintString, - $ActEnquiryURL, - $myrow['accountname'], - locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) - ); + </tr>', + $ActEnquiryURL, + $myrow['accountname'], + locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces'])); $j++; - } - } //end of loop - while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $Level--; } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> + printf('<td colspan="2">%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ParentGroups[$Level], locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -600,7 +612,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> <td></td> <td><hr></td> @@ -617,50 +629,50 @@ printf('<tr> <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">%s</td> + </tr>', + $Sections[$Section], + locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); $Section = $myrow['sectioninaccounts']; if (isset($myrow['sectioninaccounts']) and $_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + <td colspan="6"><font size="4" color="blue"><b>%s</b></font></td> + </tr>', + $Sections[$myrow['sectioninaccounts']]); } echo '<tr> - <td colspan=3></td> + <td colspan="3"></td> <td><hr></td> - <td></td> - <td><hr></td> + <td></td> + <td><hr></td> </tr>'; printf('<tr> - <td colspan=3>'._('Check Total').'</font></td> - <td class=number>%s</td> + <td colspan="3">'._('Check Total').'</font></td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($CheckTotal,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($LYCheckTotal,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="3"></td> + <td><hr></td> <td></td> <td><hr></td> </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="SelectADifferentPeriod" Value="'._('Select A Different Balance Date').'"></div>'; + echo '<br /><div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Balance Date').'" /></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/SelectSalesOrder.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -65,7 +65,7 @@ $ItemArray = array(); while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + $ItemArray[$myrow['stockid']] = $myrow; } /* Now figure out if there are any components of Assembly items that need to be ordered too */ @@ -116,9 +116,27 @@ /* add any assembly item components from salesorders to the ItemArray */ while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + if (isset($ItemArray[$myrow['stockid']])){ + /* if the item is already in the ItemArray then just add the quantity to the existing item */ + $ItemArray[$myrow['stockid']]['orderqty'] += $myrow['orderqty']; + } else { /*it is not already in the ItemArray so add it */ + $ItemArray[$myrow['stockid']] = $myrow; + } } + + /* We need the items to order to be in supplier order so that only a single order is created for a supplier - so need to sort the multi-dimensional array to ensure it is listed by supplier sequence. To use array_multisort we need to get arrays of supplier with the same keys as the main array of rows + */ + foreach ($ItemArray as $key => $row) { + //to make the Supplier array with the keys of the $ItemArray + $SupplierArray[$key] = $row['supplierno']; + } + + /* Use array_multisort to Sort the ItemArray with supplierno ascending + Add $ItemArray as the last parameter, to sort by the common key + */ + array_multisort($SupplierArray, SORT_ASC, $ItemArray); + if (count($ItemArray)==0){ prnMsg(_('There might be no supplier purchasing data set up for any items on the selected sales order(s). No purchase orders have been created'),'warn'); } else { Modified: trunk/Shipments.php =================================================================== --- trunk/Shipments.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipments.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -251,6 +251,7 @@ purchorderdetails.quantityrecd, purchorderdetails.deliverydate, stockmaster.units, + stockmaster.decimalplaces, purchorderdetails.qtyinvoiced FROM purchorderdetails INNER JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid @@ -268,17 +269,17 @@ } $_SESSION['Shipment']->add_to_shipment($_GET['Add'], - $myrow['orderno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $myrow['qtyinvoiced'], - $myrow['unitprice'], - $myrow['units'], - $myrow['deliverydate'], - $myrow['quantityord'], - $myrow['quantityrecd'], - $StandardCost, - $db); + $myrow['orderno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $myrow['qtyinvoiced'], + $myrow['unitprice'], + $myrow['units'], + $myrow['deliverydate'], + $myrow['quantityord'], + $myrow['quantityrecd'], + $StandardCost, + $db); } if (isset($_GET['Delete']) AND $_SESSION['Shipment']->Closed==0){ //shipment is open and user hit delete on a line @@ -312,7 +313,7 @@ echo '<tr><td>'. _('Expected Arrival Date (ETA)'). ': </td>'; if (isset($_SESSION['Shipment']->ETA)) { - echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . $ETA . '" /></td>'; + echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength="10" size="10" value="' . $ETA . '" /></td>'; } else { echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td>'; } @@ -382,7 +383,7 @@ /* Always display all shipment lines */ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; - echo '<tr><th colspan=9><font color=navy size=3>'. _('Order Lines On This Shipment'). '</font></th></tr>'; + echo '<tr><th colspan="9"><font color="navy" size="3">'. _('Order Lines On This Shipment'). '</font></th></tr>'; $TableHeader = '<tr> <th>'. _('Order'). '</th> @@ -419,19 +420,22 @@ echo '<td>'.$LnItm->OrderNo.'</td> - <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class=number>' . locale_number_format($LnItm->QuantityOrd,2) . '</td> + <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class="number">' . locale_number_format($LnItm->QuantityOrd,2) . '</td> <td>'. $LnItm->UOM .'</td> - <td class=number>' . locale_number_format($LnItm->QuantityRecd,2) . '</td> - <td class=number>' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> - <td class=number>' . locale_number_format($LnItm->UnitPrice,2) . '</td> - <td class=number>' . locale_number_format($LnItm->StdCostUnit,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QuantityRecd,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> + <td class="number">' . locale_number_format($LnItm->UnitPrice,2) . '</td> + <td class="number">' . locale_number_format($LnItm->StdCostUnit,2) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->PODetailItem . '">'. _('Delete'). '</a></td> </tr>'; }//for each line on the shipment echo '</table>'; }//there are lines on the shipment -echo '<br /><div class="centre"><input type=submit name="Update" value="'. _('Update Shipment Details') . '" /></div><p>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="Update" value="'. _('Update Shipment Details') . '" /> + </div>'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation'] =$_SESSION['Shipment']->StockLocation; @@ -445,7 +449,8 @@ purchorderdetails.quantityord, purchorderdetails.quantityrecd, purchorderdetails.deliverydate, - stockmaster.units + stockmaster.units, + stockmaster.decimalplaces FROM purchorderdetails INNER JOIN purchorders ON purchorderdetails.orderno=purchorders.orderno INNER JOIN stockmaster @@ -496,10 +501,10 @@ echo '<td>' . $myrow['orderno'] . '</td> <td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityord'],2) . '</td> + <td class="number">' . locale_number_format($myrow['quantityord'],$myrow['decimalplaces']) . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityrecd'],2) . '</td> - <td class=number>' . ConvertSQLDate($myrow['deliverydate']) . '</td> + <td class="number">' . locale_number_format($myrow['quantityrecd'],,$myrow['decimalplaces']) . '</td> + <td class="number">' . ConvertSQLDate($myrow['deliverydate']) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . 'Add=' . $myrow['podetailitem'] . '">'. _('Add').'</a></td> </tr>'; Modified: trunk/Shippers.php =================================================================== --- trunk/Shippers.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shippers.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -32,12 +32,12 @@ if (mb_strlen($_POST['ShipperName']) >40) { $InputError = 1; - prnMsg( _("The shipper's name must be forty characters or less long"), 'error'); + prnMsg( _('The shipper\'s name must be forty characters or less long'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } elseif( trim($_POST['ShipperName']) == '' ) { $InputError = 1; - prnMsg( _("The shipper's name may not be empty"), 'error'); + prnMsg( _('The shipper\'s name may not be empty'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } @@ -48,13 +48,13 @@ would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE shippers SET shippername='" . $_POST['ShipperName'] . "' WHERE shipper_id = '".$SelectedShipper."'"; + $sql = "UPDATE shippers SET shippername='" . DB_escape_string($_POST['ShipperName']) . "' WHERE shipper_id = '".$SelectedShipper."'"; $msg = _('The shipper record has been updated'); } elseif ($InputError !=1) { /*SelectedShipper is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Shipper form */ - $sql = "INSERT INTO shippers (shippername) VALUES ('" . $_POST['ShipperName'] . "')"; + $sql = "INSERT INTO shippers (shippername) VALUES ('" . DB_escape_string($_POST['ShipperName']) . "')"; $msg = _('The shipper record has been added'); } @@ -126,7 +126,7 @@ $sql = "SELECT * FROM shippers ORDER BY shipper_id"; $result = DB_query($sql,$db); - echo '<table class=selection> + echo '<table class="selection"> <tr><th>'. _('Shipper ID'). '</th><th>'. _('Shipper Name'). '</th></tr>'; $k=0; //row colour counter @@ -141,13 +141,13 @@ } printf('<td>%s</td> <td>%s</td> - <td><a href="%sSelectedShipper=%s">'. _('Edit').' </td> - <td><a href="%sSelectedShipper=%s&delete=1">'. _('Delete'). '</td></tr>', + <td><a href="%sSelectedShipper=%s">'. _('Edit').'</a></td> + <td><a href="%sSelectedShipper=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this shipper?') . '\');">'. _('Delete'). '</a></td></tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?' , $myrow[0], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -158,12 +158,12 @@ if (isset($SelectedShipper)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?' . SID.'">'._('REVIEW RECORDS').'</a></div>'; + echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '">'._('REVIEW RECORDS').'</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedShipper)) { @@ -179,21 +179,26 @@ echo '<input type=hidden name="SelectedShipper" VALUE='. $SelectedShipper .'>'; echo '<input type=hidden name="Shipper_ID" VALUE=' . $_POST['Shipper_ID'] . '>'; - echo '<br /><table class=selection><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; + echo '<br /><table class="selection"><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; } else { - echo "<br /><table class=selection>"; + echo '<br /> + <table class="selection">'; } if (!isset($_POST['ShipperName'])) { $_POST['ShipperName']=''; } echo '<tr><td>'. _('Shipper Name') .':</td> - <td><input type="Text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . - ' value="'. $_POST['ShipperName'] .'" size=35 maxlength=40></td></tr> + <td><input type="text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . + ' value="'. $_POST['ShipperName'] .'" size="35" maxlength="40" /></td> + </tr> </table> - <br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div> + <br /> + <div class="centre"> + <input type="Submit" name="submit" value="'. _('Enter Information').'" /> + </div> </form>'; Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipt_Select.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -26,7 +26,7 @@ $SelectedSupplier=$_POST['SelectedSupplier']; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -34,7 +34,7 @@ unset($SelectedStockItem); } -If (isset($ShiptRef) && $ShiptRef!="") { +If (isset($ShiptRef) AND $ShiptRef!='') { if (!is_numeric($ShiptRef)){ echo '<br />'; prnMsg( _('The Shipment Number entered MUST be numeric') ); @@ -45,11 +45,11 @@ } else { if (isset($SelectedSupplier)) { echo '<br />' ._('For supplier'). ': '. $SelectedSupplier . ' ' . _('and'). ' '; - echo '<input type=hidden name="SelectedSupplier" value="'. $SelectedSupplier. '">'; + echo '<input type="hidden" name="SelectedSupplier" value="'. $SelectedSupplier. '" />'; } If (isset($SelectedStockItem)) { echo _('for the part'). ': ' . $SelectedStockItem . '.'; - echo '<input type=hidden name="SelectedStockItem" value="'. $SelectedStockItem. '">'; + echo '<input type="hidden" name="SelectedStockItem" value="'. $SelectedStockItem. '" />'; } } @@ -61,6 +61,7 @@ } $SQL = "SELECT stockmaster.stockid, description, + decimalplaces, SUM(locstock.quantity) AS qoh, units, SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qord @@ -75,7 +76,7 @@ $SQL .= " WHERE purchorderdetails.shiptref IS NOT NULL AND purchorderdetails.shiptref<>0 - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description " . LIKE . " '" . $SearchString . "' AND categoryid='" . $_POST['StockCat'] . "'"; } elseif ($_POST['StockCode']){ @@ -92,49 +93,53 @@ } $SQL .= " GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; - + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units"; + $ErrMsg = _('No Stock Items were returned from the database because'). ' - '. DB_error_msg($db); $StockItemsResult = DB_query($SQL,$db, $ErrMsg); } if (!isset($ShiptRef) or $ShiptRef==""){ - echo '<table class=selection><tr><td>'; - echo _('Shipment Number'). ': <input type="text" name="ShiptRef" MAXLENGTH =10 size=10> '. + echo '<table class="selection"><tr><td>'; + echo _('Shipment Number'). ': <input type="text" name="ShiptRef" maxlength="10" size="10" /> '. _('Into Stock Location').' :<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ $_POST['StockLocation'] = $_SESSION['UserStockLocation']; - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select>'; echo ' <select name="OpenOrClosed">'; if ($_POST['OpenOrClosed']==1){ - echo '<option selected VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option selected value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option value=0>'. _('Open Shipments Only') . '</option>'; } else { $_POST['OpenOrClosed']=0; - echo '<option VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option selected VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option selected value=0>'. _('Open Shipments Only') . '</option>'; } echo '</select></td></tr></table>'; - echo '<br /><div class=centre><input type=submit name="SearchShipments" VALUE="'. _('Search Shipments'). '"></div></div><br />'; + echo '<br /> + <div class="centre"> + <input type="submit" name="SearchShipments" value="'. _('Search Shipments'). '" /> + </div> + <br />'; } $SQL="SELECT categoryid, @@ -144,13 +149,14 @@ ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); -echo '<table class=selection>'; -echo '<tr><th colspan=5><font size=3 color=navy>'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th></tr>'; -?> -<tr> -<td><font size=1><?php echo _('Select a stock category');?>:</font> -<select name="StockCat"> -<?php +echo '<table class="selection">'; +echo '<tr> + <th colspan="5"><font size="3" color="navy">'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th> + </tr> + <tr> + <td><font size="1">' . _('Select a stock category') . ':</font> + <select name="StockCat">'; + while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid']==$_POST['StockCat']){ echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -158,31 +164,34 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } -?> -</select> -<td><font size=1><?php echo _('Enter text extracts in the');?> <b><?php echo _('description');?></b>:</font></td> -<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr> -<tr><td></td> -<td><font SIZE 3><b><?php echo _('OR');?> </b></font><font size=1><?php echo _('Enter extract of the');?> <b><?php echo _('Stock Code');?></b>:</font></td> -<td><input type="Text" name="StockCode" size=15 maxlength=18></td> -</tr> -</table><br /> +echo '</select> + <td><font size="1">' . _('Enter text extracts in the') . '<b> ' . _('description') . '</b>:</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1"> ' . _('Enter extract of the') . ' <b> ' . _('Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> + </tr> + </table> + <br />'; -<?php -echo '<div class=centre><input type=submit name="SearchParts" value="'._('Search Parts Now').'">'; -echo '<input type=submit name="ResetPart" value="'. _('Show All') .'"></div><br />'; +echo '<div class="centre"> + <input type="submit" name="SearchParts" value="'._('Search Parts Now').'" /> + <input type="submit" name="ResetPart" value="'. _('Show All') .'" /> + </div> + <br />'; if (isset($StockItemsResult)) { - echo '<table cellpadding=2 colspan=7 class="selection">'; + echo '<table class="selection">'; $TableHeader = '<tr> - <th>'. _('Code').'</th> - <th>'. _('Description').'</th> - <th>'. _('On Hand').'</th> - <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> - <th>'. _('Units').'</th> - </tr>'; - + <th>'. _('Code').'</th> + <th>'. _('Description').'</th> + <th>'. _('On Hand').'</th> + <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> + <th>'. _('Units').'</th> + </tr>'; echo $TableHeader; $j = 1; @@ -199,12 +208,16 @@ } /* Code Description On Hand Orders Ostdg Units Code Description On Hand Orders Ostdg Units */ - printf('<td><input type=submit name="SelectedStockItem" VALUE="%s" /></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', - $myrow['stockid'], $myrow['description'], $myrow['qoh'], $myrow['qord'],$myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td></tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qord'],$myrow['decimalplaces']), + $myrow['units']); $j++; If ($j == 15){ @@ -223,7 +236,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) && $ShiptRef !="") { + if (isset($ShiptRef) AND $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -274,14 +287,14 @@ if (DB_num_rows($ShipmentsResult)>0){ /*show a table of the shipments returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=95% class=selection>'; + echo '<table width="95%" class="selection">'; $TableHeader = '<tr> - <th>'. _('Shipment'). '</th> - <th>'. _('Supplier'). '</th> - <th>'. _('Vessel'). '</th> - <th>'. _('Voyage'). '</th> - <th>'. _('Expected Arrival'). '</th> - </tr>'; + <th>'. _('Shipment'). '</th> + <th>'. _('Supplier'). '</th> + <th>'. _('Vessel'). '</th> + <th>'. _('Voyage'). '</th> + <th>'. _('Expected Arrival'). '</th> + </tr>'; echo $TableHeader; @@ -328,18 +341,18 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%s">'._('Costing').'</a></td> - </tr>', - $myrow['shiptref'], - $myrow['suppname'], - $myrow['vessel'], - $myrow['voyage'], - $FormatedETA, - $URL_View_Shipment); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s">'._('Costing').'</a></td> + </tr>', + $myrow['shiptref'], + $myrow['suppname'], + $myrow['vessel'], + $myrow['voyage'], + $FormatedETA, + $URL_View_Shipment); } $j++; If ($j == 15){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-11 09:10:25
|
Revision: 4718 http://web-erp.svn.sourceforge.net/web-erp/?rev=4718&view=rev Author: daintree Date: 2011-10-11 09:10:13 +0000 (Tue, 11 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Areas.php trunk/GLBalanceSheet.php trunk/SelectSalesOrder.php trunk/Shipments.php trunk/Shippers.php trunk/Shipt_Select.php Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Areas.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -195,9 +195,13 @@ $_POST['AreaCode'] = $myrow['areacode']; $_POST['AreaDescription'] = $myrow['areadescription']; - echo '<input type=hidden name=SelectedArea value="' . $SelectedArea . '">'; - echo '<input type=hidden name=AreaCode value="' .$_POST['AreaCode'] . '">'; - echo '<table class=selection><tr><td>' . _('Area Code') . ':</td><td>' . $_POST['AreaCode'] . '</td></tr>'; + echo '<input type=hidden name="SelectedArea" value="' . $SelectedArea . '" />'; + echo '<input type=hidden name="AreaCode" value="' .$_POST['AreaCode'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Area Code') . ':</td> + <td>' . $_POST['AreaCode'] . '</td> + </tr>'; } else { if (!isset($_POST['AreaCode'])) { @@ -209,16 +213,23 @@ echo '<table class="selection"> <tr> <td>' . _('Area Code') . ':</td> - <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size=3 maxlength=3></td> + <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size="3" maxlength=3></td> </tr>'; } echo '<tr><td>' . _('Area Name') . ':</td> - <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size=26 maxlength=25></td> + <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size="26" maxlength="25" /></td> </tr>'; - echo '<tr><td colspan=2><div class="centre"><input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .'></div></td></tr>'; - echo '</table></form>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .' /> + </div> + </td> + </tr> + </table> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/GLBalanceSheet.php =================================================================== --- trunk/GLBalanceSheet.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/GLBalanceSheet.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.21 $ */ - /* $Id$*/ /*Through deviousness and cunning, this system allows shows the balance sheets as at the end of any period selected - so first off need to show the input of criteria screen while the user is selecting the period end of the balance date meanwhile the system is posting any unposted transactions */ -//$PageSecurity = 8; include ('includes/session.inc'); $title = _('Balance Sheet'); @@ -24,9 +21,12 @@ . _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<br />' . _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection"><tr><td>'._('Select the balance date').':</td><td><select Name="BalancePeriodEnd">'; + echo '<table class="selection"> + <tr> + <td>'._('Select the balance date').':</td> + <td><select Name="BalancePeriodEnd">'; $periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'"; @@ -34,28 +34,38 @@ $myrow=DB_fetch_array($result, $db); $lastdate_in_period=$myrow[0]; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); while ($myrow=DB_fetch_array($Periods,$db)){ if( $myrow['periodno']== $periodno){ - echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period); + echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']); + echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td><td><select Name="Detail">'; - echo '<option selected VALUE="Summary">'._('Summary') . '</option>'; - echo '<option selected VALUE="Detailed">'._('All Accounts') . '</option>'; - echo '</select></td></tr>'; + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select Name="Detail"> + <option value="Summary">'._('Summary') . '</option> + <option selected value="Detailed">'._('All Accounts') . '</option> + </select></td> + </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="ShowBalanceSheet" Value="'._('Show on Screen (HTML)').'"></div>'; - echo '<br /><div class="centre"><input type=submit Name="PrintPDF" Value="'._('Produce PDF Report').'"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="ShowBalanceSheet" value="'._('Show on Screen (HTML)').'" /> + </div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"> + </div> + </form>'; /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -90,7 +100,8 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('The accumulated profits brought forward could not be calculated by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -128,7 +139,7 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('No general ledger accounts were returned by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -254,26 +265,26 @@ $FontSize = 8; $pdf->setFont('','B'); while ($Level>0) { - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $Level--; - } - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $YPos -= $line_height; + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $Level--; + } + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $YPos -= $line_height; - if ($SectionBalanceLY+$SectionBalance !=0){ - $FontSize =8; + if ($SectionBalanceLY+$SectionBalance !=0){ + $FontSize =8; $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,$Sections[$Section]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']),'right'); @@ -295,15 +306,15 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } exit; } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type=hidden name="BalancePeriodEnd" VALUE="' . $_POST['BalancePeriodEnd'] . '">'; + echo '<input type=hidden name="BalancePeriodEnd" value="' . $_POST['BalancePeriodEnd'] . '" />'; $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; @@ -350,22 +361,29 @@ $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because')); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/preview.gif" title="' . _('Search') . '" alt="" /> ' . _('HTML View') . '</p>'; - echo '<div class=invoice><table class="selection"><tr><th colspan=6><div class="centre"><font size=4 color=blue><b>' . - _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div></th></tr>'; + echo '<div class="invoice"> + <table class="selection"> + <tr> + <th colspan=6> + <div class="centre"><font size="4" color="blue"><b>' . + _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> - <th>'._('Account').'</td> - <th>'._('Account Name').'</td> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th>'._('Account').'</td> + <th>'._('Account Name').'</td> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">'._('Last Year').'</th> + </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th colspan="2"></th> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">' ._('Last Year') . '</th> + </tr>'; } @@ -401,22 +419,22 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -425,23 +443,23 @@ } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2">%s</td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) ); + $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -453,27 +471,27 @@ if ($Section!=''){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - </tr>'; + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> + </tr>'; } else { echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="3"></td> + <td><hr></td> + <td></td> + <td><hr></td> + </tr>'; } printf('<tr> - <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', + <td colspan="3"><font size="4">%s</font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', $Sections[$Section], locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -486,9 +504,9 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + <td colspan="6"><font size="4" color="blue"><b>%s</b></font></td> + </tr>', + $Sections[$myrow['sectioninaccounts']]); } } @@ -501,9 +519,9 @@ if ($_POST['Detail']=='Detailed'){ $ActGrp = $myrow['groupname']; printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); echo $TableHeader; } $GroupTotal[$Level]=0; @@ -535,63 +553,57 @@ $ActEnquiryURL = '<a href="' . $rootpath . '/GLAccountInquiry.php?Period=' . $_POST['BalancePeriodEnd'] . '&Account=' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . '</a>'; - $PrintString = '<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - </tr>'; - - printf($PrintString, - $ActEnquiryURL, - $myrow['accountname'], - locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) - ); + </tr>', + $ActEnquiryURL, + $myrow['accountname'], + locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces'])); $j++; - } - } //end of loop - while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $Level--; } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> + printf('<td colspan="2">%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ParentGroups[$Level], locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -600,7 +612,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> <td></td> <td><hr></td> @@ -617,50 +629,50 @@ printf('<tr> <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">%s</td> + </tr>', + $Sections[$Section], + locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); $Section = $myrow['sectioninaccounts']; if (isset($myrow['sectioninaccounts']) and $_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + <td colspan="6"><font size="4" color="blue"><b>%s</b></font></td> + </tr>', + $Sections[$myrow['sectioninaccounts']]); } echo '<tr> - <td colspan=3></td> + <td colspan="3"></td> <td><hr></td> - <td></td> - <td><hr></td> + <td></td> + <td><hr></td> </tr>'; printf('<tr> - <td colspan=3>'._('Check Total').'</font></td> - <td class=number>%s</td> + <td colspan="3">'._('Check Total').'</font></td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($CheckTotal,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($LYCheckTotal,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="3"></td> + <td><hr></td> <td></td> <td><hr></td> </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="SelectADifferentPeriod" Value="'._('Select A Different Balance Date').'"></div>'; + echo '<br /><div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Balance Date').'" /></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/SelectSalesOrder.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -65,7 +65,7 @@ $ItemArray = array(); while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + $ItemArray[$myrow['stockid']] = $myrow; } /* Now figure out if there are any components of Assembly items that need to be ordered too */ @@ -116,9 +116,27 @@ /* add any assembly item components from salesorders to the ItemArray */ while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + if (isset($ItemArray[$myrow['stockid']])){ + /* if the item is already in the ItemArray then just add the quantity to the existing item */ + $ItemArray[$myrow['stockid']]['orderqty'] += $myrow['orderqty']; + } else { /*it is not already in the ItemArray so add it */ + $ItemArray[$myrow['stockid']] = $myrow; + } } + + /* We need the items to order to be in supplier order so that only a single order is created for a supplier - so need to sort the multi-dimensional array to ensure it is listed by supplier sequence. To use array_multisort we need to get arrays of supplier with the same keys as the main array of rows + */ + foreach ($ItemArray as $key => $row) { + //to make the Supplier array with the keys of the $ItemArray + $SupplierArray[$key] = $row['supplierno']; + } + + /* Use array_multisort to Sort the ItemArray with supplierno ascending + Add $ItemArray as the last parameter, to sort by the common key + */ + array_multisort($SupplierArray, SORT_ASC, $ItemArray); + if (count($ItemArray)==0){ prnMsg(_('There might be no supplier purchasing data set up for any items on the selected sales order(s). No purchase orders have been created'),'warn'); } else { Modified: trunk/Shipments.php =================================================================== --- trunk/Shipments.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipments.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -251,6 +251,7 @@ purchorderdetails.quantityrecd, purchorderdetails.deliverydate, stockmaster.units, + stockmaster.decimalplaces, purchorderdetails.qtyinvoiced FROM purchorderdetails INNER JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid @@ -268,17 +269,17 @@ } $_SESSION['Shipment']->add_to_shipment($_GET['Add'], - $myrow['orderno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $myrow['qtyinvoiced'], - $myrow['unitprice'], - $myrow['units'], - $myrow['deliverydate'], - $myrow['quantityord'], - $myrow['quantityrecd'], - $StandardCost, - $db); + $myrow['orderno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $myrow['qtyinvoiced'], + $myrow['unitprice'], + $myrow['units'], + $myrow['deliverydate'], + $myrow['quantityord'], + $myrow['quantityrecd'], + $StandardCost, + $db); } if (isset($_GET['Delete']) AND $_SESSION['Shipment']->Closed==0){ //shipment is open and user hit delete on a line @@ -312,7 +313,7 @@ echo '<tr><td>'. _('Expected Arrival Date (ETA)'). ': </td>'; if (isset($_SESSION['Shipment']->ETA)) { - echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . $ETA . '" /></td>'; + echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength="10" size="10" value="' . $ETA . '" /></td>'; } else { echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td>'; } @@ -382,7 +383,7 @@ /* Always display all shipment lines */ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; - echo '<tr><th colspan=9><font color=navy size=3>'. _('Order Lines On This Shipment'). '</font></th></tr>'; + echo '<tr><th colspan="9"><font color="navy" size="3">'. _('Order Lines On This Shipment'). '</font></th></tr>'; $TableHeader = '<tr> <th>'. _('Order'). '</th> @@ -419,19 +420,22 @@ echo '<td>'.$LnItm->OrderNo.'</td> - <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class=number>' . locale_number_format($LnItm->QuantityOrd,2) . '</td> + <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class="number">' . locale_number_format($LnItm->QuantityOrd,2) . '</td> <td>'. $LnItm->UOM .'</td> - <td class=number>' . locale_number_format($LnItm->QuantityRecd,2) . '</td> - <td class=number>' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> - <td class=number>' . locale_number_format($LnItm->UnitPrice,2) . '</td> - <td class=number>' . locale_number_format($LnItm->StdCostUnit,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QuantityRecd,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> + <td class="number">' . locale_number_format($LnItm->UnitPrice,2) . '</td> + <td class="number">' . locale_number_format($LnItm->StdCostUnit,2) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->PODetailItem . '">'. _('Delete'). '</a></td> </tr>'; }//for each line on the shipment echo '</table>'; }//there are lines on the shipment -echo '<br /><div class="centre"><input type=submit name="Update" value="'. _('Update Shipment Details') . '" /></div><p>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="Update" value="'. _('Update Shipment Details') . '" /> + </div>'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation'] =$_SESSION['Shipment']->StockLocation; @@ -445,7 +449,8 @@ purchorderdetails.quantityord, purchorderdetails.quantityrecd, purchorderdetails.deliverydate, - stockmaster.units + stockmaster.units, + stockmaster.decimalplaces FROM purchorderdetails INNER JOIN purchorders ON purchorderdetails.orderno=purchorders.orderno INNER JOIN stockmaster @@ -496,10 +501,10 @@ echo '<td>' . $myrow['orderno'] . '</td> <td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityord'],2) . '</td> + <td class="number">' . locale_number_format($myrow['quantityord'],$myrow['decimalplaces']) . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityrecd'],2) . '</td> - <td class=number>' . ConvertSQLDate($myrow['deliverydate']) . '</td> + <td class="number">' . locale_number_format($myrow['quantityrecd'],,$myrow['decimalplaces']) . '</td> + <td class="number">' . ConvertSQLDate($myrow['deliverydate']) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . 'Add=' . $myrow['podetailitem'] . '">'. _('Add').'</a></td> </tr>'; Modified: trunk/Shippers.php =================================================================== --- trunk/Shippers.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shippers.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -32,12 +32,12 @@ if (mb_strlen($_POST['ShipperName']) >40) { $InputError = 1; - prnMsg( _("The shipper's name must be forty characters or less long"), 'error'); + prnMsg( _('The shipper\'s name must be forty characters or less long'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } elseif( trim($_POST['ShipperName']) == '' ) { $InputError = 1; - prnMsg( _("The shipper's name may not be empty"), 'error'); + prnMsg( _('The shipper\'s name may not be empty'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } @@ -48,13 +48,13 @@ would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE shippers SET shippername='" . $_POST['ShipperName'] . "' WHERE shipper_id = '".$SelectedShipper."'"; + $sql = "UPDATE shippers SET shippername='" . DB_escape_string($_POST['ShipperName']) . "' WHERE shipper_id = '".$SelectedShipper."'"; $msg = _('The shipper record has been updated'); } elseif ($InputError !=1) { /*SelectedShipper is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Shipper form */ - $sql = "INSERT INTO shippers (shippername) VALUES ('" . $_POST['ShipperName'] . "')"; + $sql = "INSERT INTO shippers (shippername) VALUES ('" . DB_escape_string($_POST['ShipperName']) . "')"; $msg = _('The shipper record has been added'); } @@ -126,7 +126,7 @@ $sql = "SELECT * FROM shippers ORDER BY shipper_id"; $result = DB_query($sql,$db); - echo '<table class=selection> + echo '<table class="selection"> <tr><th>'. _('Shipper ID'). '</th><th>'. _('Shipper Name'). '</th></tr>'; $k=0; //row colour counter @@ -141,13 +141,13 @@ } printf('<td>%s</td> <td>%s</td> - <td><a href="%sSelectedShipper=%s">'. _('Edit').' </td> - <td><a href="%sSelectedShipper=%s&delete=1">'. _('Delete'). '</td></tr>', + <td><a href="%sSelectedShipper=%s">'. _('Edit').'</a></td> + <td><a href="%sSelectedShipper=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this shipper?') . '\');">'. _('Delete'). '</a></td></tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?' , $myrow[0], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -158,12 +158,12 @@ if (isset($SelectedShipper)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?' . SID.'">'._('REVIEW RECORDS').'</a></div>'; + echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '">'._('REVIEW RECORDS').'</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedShipper)) { @@ -179,21 +179,26 @@ echo '<input type=hidden name="SelectedShipper" VALUE='. $SelectedShipper .'>'; echo '<input type=hidden name="Shipper_ID" VALUE=' . $_POST['Shipper_ID'] . '>'; - echo '<br /><table class=selection><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; + echo '<br /><table class="selection"><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; } else { - echo "<br /><table class=selection>"; + echo '<br /> + <table class="selection">'; } if (!isset($_POST['ShipperName'])) { $_POST['ShipperName']=''; } echo '<tr><td>'. _('Shipper Name') .':</td> - <td><input type="Text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . - ' value="'. $_POST['ShipperName'] .'" size=35 maxlength=40></td></tr> + <td><input type="text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . + ' value="'. $_POST['ShipperName'] .'" size="35" maxlength="40" /></td> + </tr> </table> - <br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div> + <br /> + <div class="centre"> + <input type="Submit" name="submit" value="'. _('Enter Information').'" /> + </div> </form>'; Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipt_Select.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -26,7 +26,7 @@ $SelectedSupplier=$_POST['SelectedSupplier']; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -34,7 +34,7 @@ unset($SelectedStockItem); } -If (isset($ShiptRef) && $ShiptRef!="") { +If (isset($ShiptRef) AND $ShiptRef!='') { if (!is_numeric($ShiptRef)){ echo '<br />'; prnMsg( _('The Shipment Number entered MUST be numeric') ); @@ -45,11 +45,11 @@ } else { if (isset($SelectedSupplier)) { echo '<br />' ._('For supplier'). ': '. $SelectedSupplier . ' ' . _('and'). ' '; - echo '<input type=hidden name="SelectedSupplier" value="'. $SelectedSupplier. '">'; + echo '<input type="hidden" name="SelectedSupplier" value="'. $SelectedSupplier. '" />'; } If (isset($SelectedStockItem)) { echo _('for the part'). ': ' . $SelectedStockItem . '.'; - echo '<input type=hidden name="SelectedStockItem" value="'. $SelectedStockItem. '">'; + echo '<input type="hidden" name="SelectedStockItem" value="'. $SelectedStockItem. '" />'; } } @@ -61,6 +61,7 @@ } $SQL = "SELECT stockmaster.stockid, description, + decimalplaces, SUM(locstock.quantity) AS qoh, units, SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qord @@ -75,7 +76,7 @@ $SQL .= " WHERE purchorderdetails.shiptref IS NOT NULL AND purchorderdetails.shiptref<>0 - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description " . LIKE . " '" . $SearchString . "' AND categoryid='" . $_POST['StockCat'] . "'"; } elseif ($_POST['StockCode']){ @@ -92,49 +93,53 @@ } $SQL .= " GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; - + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units"; + $ErrMsg = _('No Stock Items were returned from the database because'). ' - '. DB_error_msg($db); $StockItemsResult = DB_query($SQL,$db, $ErrMsg); } if (!isset($ShiptRef) or $ShiptRef==""){ - echo '<table class=selection><tr><td>'; - echo _('Shipment Number'). ': <input type="text" name="ShiptRef" MAXLENGTH =10 size=10> '. + echo '<table class="selection"><tr><td>'; + echo _('Shipment Number'). ': <input type="text" name="ShiptRef" maxlength="10" size="10" /> '. _('Into Stock Location').' :<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ $_POST['StockLocation'] = $_SESSION['UserStockLocation']; - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select>'; echo ' <select name="OpenOrClosed">'; if ($_POST['OpenOrClosed']==1){ - echo '<option selected VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option selected value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option value=0>'. _('Open Shipments Only') . '</option>'; } else { $_POST['OpenOrClosed']=0; - echo '<option VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option selected VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option selected value=0>'. _('Open Shipments Only') . '</option>'; } echo '</select></td></tr></table>'; - echo '<br /><div class=centre><input type=submit name="SearchShipments" VALUE="'. _('Search Shipments'). '"></div></div><br />'; + echo '<br /> + <div class="centre"> + <input type="submit" name="SearchShipments" value="'. _('Search Shipments'). '" /> + </div> + <br />'; } $SQL="SELECT categoryid, @@ -144,13 +149,14 @@ ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); -echo '<table class=selection>'; -echo '<tr><th colspan=5><font size=3 color=navy>'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th></tr>'; -?> -<tr> -<td><font size=1><?php echo _('Select a stock category');?>:</font> -<select name="StockCat"> -<?php +echo '<table class="selection">'; +echo '<tr> + <th colspan="5"><font size="3" color="navy">'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th> + </tr> + <tr> + <td><font size="1">' . _('Select a stock category') . ':</font> + <select name="StockCat">'; + while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid']==$_POST['StockCat']){ echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -158,31 +164,34 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } -?> -</select> -<td><font size=1><?php echo _('Enter text extracts in the');?> <b><?php echo _('description');?></b>:</font></td> -<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr> -<tr><td></td> -<td><font SIZE 3><b><?php echo _('OR');?> </b></font><font size=1><?php echo _('Enter extract of the');?> <b><?php echo _('Stock Code');?></b>:</font></td> -<td><input type="Text" name="StockCode" size=15 maxlength=18></td> -</tr> -</table><br /> +echo '</select> + <td><font size="1">' . _('Enter text extracts in the') . '<b> ' . _('description') . '</b>:</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1"> ' . _('Enter extract of the') . ' <b> ' . _('Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> + </tr> + </table> + <br />'; -<?php -echo '<div class=centre><input type=submit name="SearchParts" value="'._('Search Parts Now').'">'; -echo '<input type=submit name="ResetPart" value="'. _('Show All') .'"></div><br />'; +echo '<div class="centre"> + <input type="submit" name="SearchParts" value="'._('Search Parts Now').'" /> + <input type="submit" name="ResetPart" value="'. _('Show All') .'" /> + </div> + <br />'; if (isset($StockItemsResult)) { - echo '<table cellpadding=2 colspan=7 class="selection">'; + echo '<table class="selection">'; $TableHeader = '<tr> - <th>'. _('Code').'</th> - <th>'. _('Description').'</th> - <th>'. _('On Hand').'</th> - <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> - <th>'. _('Units').'</th> - </tr>'; - + <th>'. _('Code').'</th> + <th>'. _('Description').'</th> + <th>'. _('On Hand').'</th> + <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> + <th>'. _('Units').'</th> + </tr>'; echo $TableHeader; $j = 1; @@ -199,12 +208,16 @@ } /* Code Description On Hand Orders Ostdg Units Code Description On Hand Orders Ostdg Units */ - printf('<td><input type=submit name="SelectedStockItem" VALUE="%s" /></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', - $myrow['stockid'], $myrow['description'], $myrow['qoh'], $myrow['qord'],$myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td></tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qord'],$myrow['decimalplaces']), + $myrow['units']); $j++; If ($j == 15){ @@ -223,7 +236,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) && $ShiptRef !="") { + if (isset($ShiptRef) AND $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -274,14 +287,14 @@ if (DB_num_rows($ShipmentsResult)>0){ /*show a table of the shipments returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=95% class=selection>'; + echo '<table width="95%" class="selection">'; $TableHeader = '<tr> - <th>'. _('Shipment'). '</th> - <th>'. _('Supplier'). '</th> - <th>'. _('Vessel'). '</th> - <th>'. _('Voyage'). '</th> - <th>'. _('Expected Arrival'). '</th> - </tr>'; + <th>'. _('Shipment'). '</th> + <th>'. _('Supplier'). '</th> + <th>'. _('Vessel'). '</th> + <th>'. _('Voyage'). '</th> + <th>'. _('Expected Arrival'). '</th> + </tr>'; echo $TableHeader; @@ -328,18 +341,18 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%s">'._('Costing').'</a></td> - </tr>', - $myrow['shiptref'], - $myrow['suppname'], - $myrow['vessel'], - $myrow['voyage'], - $FormatedETA, - $URL_View_Shipment); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s">'._('Costing').'</a></td> + </tr>', + $myrow['shiptref'], + $myrow['suppname'], + $myrow['vessel'], + $myrow['voyage'], + $FormatedETA, + $URL_View_Shipment); } $j++; If ($j == 15){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-14 06:08:17
|
Revision: 4719 http://web-erp.svn.sourceforge.net/web-erp/?rev=4719&view=rev Author: daintree Date: 2011-10-14 06:08:10 +0000 (Fri, 14 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/FixedAssetRegister.php trunk/SelectGLAccount.php trunk/StockCostUpdate.php trunk/StockDispatch.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/reportwriter/WriteForm.inc Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/FixedAssetRegister.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -4,7 +4,7 @@ $title = _('Fixed Asset Register'); $csv_output = ''; // Reports being generated in HTML, PDF and CSV/EXCEL format -if (isset($_POST['submit']) or isset($_POST['pdf']) or isset($_POST['csv'])) { +if (isset($_POST['submit']) OR isset($_POST['pdf']) OR isset($_POST['csv'])) { if (isset($_POST['pdf'])) { $PaperSize = 'A4_Landscape'; include ('includes/PDFStarter.php'); @@ -213,11 +213,11 @@ header('Location: ' .$_SESSION['reports_dir'] . '/FixedAssetRegister_' . Date('Y-m-d') .'.csv'); } else { - echo '<input type=hidden name="FromDate" value="' . $_POST['FromDate'] . '">'; - echo '<input type=hidden name="ToDate" value=' . $_POST['ToDate'] . '>'; - echo '<input type=hidden name="AssetCategory" value=' . $_POST['AssetCategory'] . '>'; - echo '<input type=hidden name="AssetID" value=' . $_POST['AssetID'] . '>'; - echo '<input type=hidden name="AssetLocation" value=' . $_POST['AssetLocation'] . '>'; + echo '<input type="hidden" name="FromDate" value="' . $_POST['FromDate'] . '" />'; + echo '<input type="hidden" name="ToDate" value=' . $_POST['ToDate'] . '>'; + echo '<input type="hidden" name="AssetCategory" value="' . $_POST['AssetCategory'] . '" />'; + echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'] . '" />'; + echo '<input type="hidden" name="AssetLocation" value="' . $_POST['AssetLocation'] . '" />'; //Total Values echo '<tr><th style="vertical-align:top" colspan="5">' . _('TOTAL') . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalCostBfwd, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; @@ -229,8 +229,8 @@ echo '<th style="text-align:right">' . locale_number_format($TotalNBV, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalDisposals, $_SESSION['CompanyRecord']['decimalplaces']) . '</th></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name="csv" value="' . _('Print as CSV') . '"></div></form>'; + echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="submit" name="csv" value="' . _('Print as CSV') . '" /></div></form>'; } } else { include ('includes/header.inc'); @@ -283,16 +283,16 @@ $_POST['ToDate'] = date($_SESSION['DefaultDateFormat']); } - echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '"></td>'; + echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '" /></td>'; echo '</tr>'; - echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '"></td> + echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> </tr> </table> <br />'; - + echo '<div class="centre"><input type="submit" name="submit" value="' . _('Show Assets') . '"> '; - echo '<input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '"></div>'; + echo '<input type="submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '" /></div>'; echo '</form>'; } include ('includes/footer.inc'); Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/SelectGLAccount.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -111,11 +111,11 @@ while ($myrow=DB_fetch_array($result)) { - printf("<tr><td><font size=1><input type=submit name='Select' VALUE='%s'</font></td> + printf('<tr><td><font size=1><input type="submit" name="Select" value="%s" /></font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> - </tr>", + </tr>', $myrow['accountcode'], $myrow['accountname'], $myrow['group_'], Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockCostUpdate.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -55,7 +55,7 @@ DB_free_result($OldResult); $OldCost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost']; - $NewCost =$_POST['MaterialCost'] + $_POST['LabourCost'] + $_POST['OverheadCost']; + $NewCost = filter_number_format($_POST['MaterialCost']) + filter_number_format($_POST['LabourCost']) + filter_number_format($_POST['OverheadCost']); $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $StockID . "'",$db); $myrow = DB_fetch_row($result); @@ -66,9 +66,9 @@ $Result = DB_Txn_Begin($db); ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']); - $SQL = "UPDATE stockmaster SET materialcost='" . $_POST['MaterialCost'] . "', - labourcost='" . $_POST['LabourCost'] . "', - overheadcost='" . $_POST['OverheadCost'] . "', + $SQL = "UPDATE stockmaster SET materialcost='" . filter_number_format($_POST['MaterialCost']) . "', + labourcost='" . filter_number_format($_POST['LabourCost']) . "', + overheadcost='" . filter_number_format($_POST['OverheadCost']) . "', lastcost='" . $OldCost . "', lastcostupdate ='" . Date('Y-m-d')."' WHERE stockid='" . $StockID . "'"; @@ -116,15 +116,15 @@ $myrow = DB_fetch_array($result); -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID .'" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table cellpadding=2 class=selection>'; -echo '<tr><th colspan=2>' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" 1 maxlength=20>'; -echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '"></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; +echo '<table cellpadding="2" class="selection">'; +echo '<tr><th colspan="2">' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" maxlength="20" />'; +echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '" /></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L') OR $myrow['mbflag']=='A' @@ -142,10 +142,10 @@ exit; } -echo '<input type=hidden name="OldMaterialCost" value="' . $myrow['materialcost'] .'">'; -echo '<input type=hidden name="OldLabourCost" value="' . $myrow['labourcost'] .'">'; -echo '<input type=hidden name="OldOverheadCost" value="' . $myrow['overheadcost'] .'">'; -echo '<input type=hidden name="QOH" value="' . $myrow['totalqoh'] .'">'; +echo '<input type="hidden" name="OldMaterialCost" value="' . $myrow['materialcost'] .'" />'; +echo '<input type="hidden" name="OldLabourCost" value="' . $myrow['labourcost'] .'" />'; +echo '<input type="hidden" name="OldOverheadCost" value="' . $myrow['overheadcost'] .'" />'; +echo '<input type="hidden" name="QOH" value="' . $myrow['totalqoh'] .'" />'; echo '<tr><td>' . _('Last Cost') .':</td> <td class="number">' . locale_number_format($myrow['lastcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; @@ -163,22 +163,27 @@ </tr>'; echo '<tr> <td>' . _('Standard Labour Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="LabourCost" value=' . $myrow['labourcost'] . '></td> + <td class="number"><input type="text" class="number" name="LabourCost" value="' . locale_number_format($myrow['labourcost'],4) . '" /></td> </tr>'; echo '<tr> <td>' . _('Standard Overhead Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="OverheadCost" value=' . $myrow['overheadcost'] . '></td> + <td class="number"><input type="text" class="number" name="OverheadCost" value="' . locale_number_format($myrow['overheadcost'],4) . '" /></td> </tr>'; } elseif ($myrow['mbflag']=='B' OR $myrow['mbflag']=='D') { echo '<tr> <td>' . _('Standard Cost') .':</td> - <td class="number"><input type="text" class="number" name="MaterialCost" value=' . $myrow['materialcost'] . '></td> + <td class="number"><input type="text" class="number" name="MaterialCost" value="' . locale_number_format($myrow['materialcost'],4) . '" /></td> </tr>'; } else { echo '<input type="hidden" name="LabourCost" value=0>'; echo '<input type="hidden" name="OverheadCost" value=0>'; } - echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '"><br /><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; } if ($myrow['mbflag']!='D'){ echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; @@ -187,6 +192,7 @@ echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; } -echo '</form></div>'; +echo '</form> + </div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockDispatch.php =================================================================== --- trunk/StockDispatch.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockDispatch.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -10,7 +10,7 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - if (!is_numeric($_POST['Percent'])) { + if (!is_numeric(filter_number_format($_POST['Percent']))) { $_POST['Percent'] = 0; } @@ -63,7 +63,7 @@ stockmaster.serialised, stockmaster.controlled, ROUND((locstock.reorderlevel - locstock.quantity) * - (1 + (" . $_POST['Percent'] . "/100))) + (1 + (" . filter_number_format($_POST['Percent']) . "/100))) as neededqty, (fromlocstock.quantity - fromlocstock.reorderlevel) as available, fromlocstock.reorderlevel as fromreorderlevel, @@ -89,9 +89,10 @@ $title = _('Stock Dispatch - Problem Report'); include('includes/header.inc'); prnMsg( _('The Stock Dispatch report could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); - echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /> + <a href="' .$rootpath . '/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br />$sql"; + echo '<br />' . $sql; } include('includes/footer.inc'); exit; @@ -101,7 +102,8 @@ include('includes/header.inc'); echo '<br />'; prnMsg( _('The stock dispatch did not have any items to list'),'warn'); - echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } @@ -226,7 +228,9 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); $DefaultLocation = $myrow['defaultlocation']; - echo '<br/><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; + echo '<br/> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, locationname @@ -235,8 +239,14 @@ if (!isset($_POST['FromLocation'])) { $_POST['FromLocation']=$DefaultLocation; } - echo '<table class=selection><tr><td>' . _('Dispatch Percent') . ':</td><td><input type ="text" name="Percent" class="number" size="8" value=0>'; - echo '<tr><td>' . _('From Stock Location') . ':</td><td><select name="FromLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Dispatch Percent') . ':</td> + <td><input type ="text" name="Percent" class="number" size="8" value="0" /> + </tr>'; + echo '<tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="FromLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['FromLocation']){ echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -244,22 +254,26 @@ echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; DB_data_seek($resultStkLocs,0); if (!isset($_POST['ToLocation'])) { $_POST['ToLocation']=$DefaultLocation; } - echo '<tr><td>' . _('To Stock Location') . ':</td><td><select name="ToLocation"> '; + echo '<tr> + <td>' . _('To Stock Location') . ':</td> + <td><select name="ToLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['ToLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - $SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; + $SQL="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ echo '</table></td></tr> @@ -274,7 +288,9 @@ // Define StockCat with 'name="StockCat[ ]" multiple' so can select more than one // Also have to change way define $WhereCategory for WHERE clause - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -305,14 +321,17 @@ echo '<option value="simple">' . _('Simple') . '</option>'; echo '</select></td><td> </td></tr>'; - echo '</table><br/><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</table> + <br/> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + </div>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ - function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$Trf_ID,$FromLocation,$ToLocation,$template) { Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocMovements.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -7,29 +7,30 @@ include('includes/header.inc'); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; -echo '<table class=selection><tr><td>'; -echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; +echo '<table class="selection"> + <tr> + <td> ' . _('From Stock Location') . ':<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -41,53 +42,59 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" size=12 maxlength=12 Value="' . $_POST['AfterDate'] . '">'; -echo '</td></tr></table><br />'; -echo '<div class=centre><input type=submit name="ShowMoves" VALUE="' . _('Show Stock Movements') . '"></div><br />'; +echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" />'; +echo ' ' . _('But after') . ': <input type="text" name="AfterDate" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" />'; +echo '</td> + </tr> + </table> + <br />'; +echo '<div class="centre"> + <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /> + </div> + <br />'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); $sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '". $SQLAfterDate . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); $MovtsResult = DB_query($sql, $db,$ErrMsg); echo '<table cellpadding=5 cellspacing="4 "class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Trans No') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Quantity on Hand') . '</th> - </tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Trans No') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Quantity on Hand') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -111,11 +118,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s</td> + <td class="number">%s</td> </tr>', mb_strtoupper($myrow['stockid']), mb_strtoupper($myrow['stockid']), Modified: trunk/StockLocStatus.php =================================================================== --- trunk/StockLocStatus.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocStatus.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -19,14 +19,16 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, - locationname - FROM locations"; + locationname + FROM locations"; $resultStkLocs = DB_query($sql,$db); -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"> + <img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; -echo '<table class=selection> +echo '<table class="selection"> <tr><td>' . _('From Stock Location') . ':</td> <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ @@ -45,9 +47,9 @@ } echo '</select></td></tr>'; -$SQL="SELECT categoryid, - categorydescription - FROM stockcategory +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ @@ -84,22 +86,27 @@ $_POST['BelowReorderQuantity']='All'; } if ($_POST['BelowReorderQuantity']=='All'){ - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option selected value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else if ($_POST['BelowReorderQuantity']=='Below') { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /> + </div>'; if (isset($_POST['ShowStatus'])){ @@ -142,21 +149,21 @@ ORDER BY locstock.stockid"; } - $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); - echo '<br /><table cellpadding=5 cellspacing=4 class="selection">'; + echo '<br /> + <table cellpadding="5" cellspacing="4" class="selection">'; $tableheader = '<tr> - <th>' . _('StockID') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> + <th>' . _('StockID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + <th>' . _('Demand') . '</th> + <th>' . _('Available') . '</th> + <th>' . _('On Order') . '</th> </tr>'; echo $tableheader; $j = 1; @@ -167,12 +174,11 @@ $StockID = $myrow['stockid']; $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' - AND salesorderdetails.completed=0 - AND salesorderdetails.stkcode='" . $StockID . "'"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.completed=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg); @@ -185,17 +191,16 @@ } //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. - $sql = "SELECT Sum((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' + $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN bom + ON salesorderdetails.stkcode=bom.parent + INNER JOIN stockmaster + ON stockmaster.stockid=bom.parent + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent AND stockmaster.mbflag='A'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); @@ -206,10 +211,11 @@ $DemandQty += $DemandRow[0]; } $sql = "SELECT SUM((woitems.qtyreqd-woitems.qtyrecd)*bom.quantity) AS dem - FROM workorders, woitems, bom - WHERE woitems.wo = workorders.wo - AND woitems.stockid = bom.parent - AND workorders.closed=0 + FROM workorders INNER JOIN woitems + ON woitems.wo = workorders.wo + INNER JOIN bom + ON woitems.stockid = bom.parent + WHERE workorders.closed=0 AND bom.component = '". $StockID . "' AND workorders.loccode='". $myrow['loccode'] ."'"; $DemandResult = DB_query($sql,$db, $ErrMsg); @@ -253,23 +259,23 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td> - </tr>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); - + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td> + </tr>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); + if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; @@ -285,31 +291,28 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($myrow['controlled']==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; } - } - - - //end of page full new headings if + } //end of page full new headings if } //end of if BelowOrderQuantity or all items } //end of while loop Modified: trunk/reportwriter/WriteForm.inc =================================================================== --- trunk/reportwriter/WriteForm.inc 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/reportwriter/WriteForm.inc 2011-10-14 06:08:10 UTC (rev 4719) @@ -289,9 +289,9 @@ case "uc": return mb_strtoupper($strData); case "lc": return strtolower($strData); case "neg": return -$strData; - case "rnd2d": return locale_number_format($strData, 2); - case "dlr": return '$ '.locale_number_format($strData, 2); - case "euro": return chr(128).' '.locale_number_format($strData, 2); // assumes standard FPDF fonts + case "rnd2d": return locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "dlr": return '$ '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "euro": return chr(128).' '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); // assumes standard FPDF fonts default: return $strData; // do nothing if Process not recognized } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-14 06:08:17
|
Revision: 4719 http://web-erp.svn.sourceforge.net/web-erp/?rev=4719&view=rev Author: daintree Date: 2011-10-14 06:08:10 +0000 (Fri, 14 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/FixedAssetRegister.php trunk/SelectGLAccount.php trunk/StockCostUpdate.php trunk/StockDispatch.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/reportwriter/WriteForm.inc Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/FixedAssetRegister.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -4,7 +4,7 @@ $title = _('Fixed Asset Register'); $csv_output = ''; // Reports being generated in HTML, PDF and CSV/EXCEL format -if (isset($_POST['submit']) or isset($_POST['pdf']) or isset($_POST['csv'])) { +if (isset($_POST['submit']) OR isset($_POST['pdf']) OR isset($_POST['csv'])) { if (isset($_POST['pdf'])) { $PaperSize = 'A4_Landscape'; include ('includes/PDFStarter.php'); @@ -213,11 +213,11 @@ header('Location: ' .$_SESSION['reports_dir'] . '/FixedAssetRegister_' . Date('Y-m-d') .'.csv'); } else { - echo '<input type=hidden name="FromDate" value="' . $_POST['FromDate'] . '">'; - echo '<input type=hidden name="ToDate" value=' . $_POST['ToDate'] . '>'; - echo '<input type=hidden name="AssetCategory" value=' . $_POST['AssetCategory'] . '>'; - echo '<input type=hidden name="AssetID" value=' . $_POST['AssetID'] . '>'; - echo '<input type=hidden name="AssetLocation" value=' . $_POST['AssetLocation'] . '>'; + echo '<input type="hidden" name="FromDate" value="' . $_POST['FromDate'] . '" />'; + echo '<input type="hidden" name="ToDate" value=' . $_POST['ToDate'] . '>'; + echo '<input type="hidden" name="AssetCategory" value="' . $_POST['AssetCategory'] . '" />'; + echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'] . '" />'; + echo '<input type="hidden" name="AssetLocation" value="' . $_POST['AssetLocation'] . '" />'; //Total Values echo '<tr><th style="vertical-align:top" colspan="5">' . _('TOTAL') . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalCostBfwd, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; @@ -229,8 +229,8 @@ echo '<th style="text-align:right">' . locale_number_format($TotalNBV, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalDisposals, $_SESSION['CompanyRecord']['decimalplaces']) . '</th></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name="csv" value="' . _('Print as CSV') . '"></div></form>'; + echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="submit" name="csv" value="' . _('Print as CSV') . '" /></div></form>'; } } else { include ('includes/header.inc'); @@ -283,16 +283,16 @@ $_POST['ToDate'] = date($_SESSION['DefaultDateFormat']); } - echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '"></td>'; + echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '" /></td>'; echo '</tr>'; - echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '"></td> + echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> </tr> </table> <br />'; - + echo '<div class="centre"><input type="submit" name="submit" value="' . _('Show Assets') . '"> '; - echo '<input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '"></div>'; + echo '<input type="submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '" /></div>'; echo '</form>'; } include ('includes/footer.inc'); Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/SelectGLAccount.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -111,11 +111,11 @@ while ($myrow=DB_fetch_array($result)) { - printf("<tr><td><font size=1><input type=submit name='Select' VALUE='%s'</font></td> + printf('<tr><td><font size=1><input type="submit" name="Select" value="%s" /></font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> - </tr>", + </tr>', $myrow['accountcode'], $myrow['accountname'], $myrow['group_'], Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockCostUpdate.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -55,7 +55,7 @@ DB_free_result($OldResult); $OldCost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost']; - $NewCost =$_POST['MaterialCost'] + $_POST['LabourCost'] + $_POST['OverheadCost']; + $NewCost = filter_number_format($_POST['MaterialCost']) + filter_number_format($_POST['LabourCost']) + filter_number_format($_POST['OverheadCost']); $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $StockID . "'",$db); $myrow = DB_fetch_row($result); @@ -66,9 +66,9 @@ $Result = DB_Txn_Begin($db); ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']); - $SQL = "UPDATE stockmaster SET materialcost='" . $_POST['MaterialCost'] . "', - labourcost='" . $_POST['LabourCost'] . "', - overheadcost='" . $_POST['OverheadCost'] . "', + $SQL = "UPDATE stockmaster SET materialcost='" . filter_number_format($_POST['MaterialCost']) . "', + labourcost='" . filter_number_format($_POST['LabourCost']) . "', + overheadcost='" . filter_number_format($_POST['OverheadCost']) . "', lastcost='" . $OldCost . "', lastcostupdate ='" . Date('Y-m-d')."' WHERE stockid='" . $StockID . "'"; @@ -116,15 +116,15 @@ $myrow = DB_fetch_array($result); -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID .'" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table cellpadding=2 class=selection>'; -echo '<tr><th colspan=2>' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" 1 maxlength=20>'; -echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '"></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; +echo '<table cellpadding="2" class="selection">'; +echo '<tr><th colspan="2">' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" maxlength="20" />'; +echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '" /></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L') OR $myrow['mbflag']=='A' @@ -142,10 +142,10 @@ exit; } -echo '<input type=hidden name="OldMaterialCost" value="' . $myrow['materialcost'] .'">'; -echo '<input type=hidden name="OldLabourCost" value="' . $myrow['labourcost'] .'">'; -echo '<input type=hidden name="OldOverheadCost" value="' . $myrow['overheadcost'] .'">'; -echo '<input type=hidden name="QOH" value="' . $myrow['totalqoh'] .'">'; +echo '<input type="hidden" name="OldMaterialCost" value="' . $myrow['materialcost'] .'" />'; +echo '<input type="hidden" name="OldLabourCost" value="' . $myrow['labourcost'] .'" />'; +echo '<input type="hidden" name="OldOverheadCost" value="' . $myrow['overheadcost'] .'" />'; +echo '<input type="hidden" name="QOH" value="' . $myrow['totalqoh'] .'" />'; echo '<tr><td>' . _('Last Cost') .':</td> <td class="number">' . locale_number_format($myrow['lastcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; @@ -163,22 +163,27 @@ </tr>'; echo '<tr> <td>' . _('Standard Labour Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="LabourCost" value=' . $myrow['labourcost'] . '></td> + <td class="number"><input type="text" class="number" name="LabourCost" value="' . locale_number_format($myrow['labourcost'],4) . '" /></td> </tr>'; echo '<tr> <td>' . _('Standard Overhead Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="OverheadCost" value=' . $myrow['overheadcost'] . '></td> + <td class="number"><input type="text" class="number" name="OverheadCost" value="' . locale_number_format($myrow['overheadcost'],4) . '" /></td> </tr>'; } elseif ($myrow['mbflag']=='B' OR $myrow['mbflag']=='D') { echo '<tr> <td>' . _('Standard Cost') .':</td> - <td class="number"><input type="text" class="number" name="MaterialCost" value=' . $myrow['materialcost'] . '></td> + <td class="number"><input type="text" class="number" name="MaterialCost" value="' . locale_number_format($myrow['materialcost'],4) . '" /></td> </tr>'; } else { echo '<input type="hidden" name="LabourCost" value=0>'; echo '<input type="hidden" name="OverheadCost" value=0>'; } - echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '"><br /><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; } if ($myrow['mbflag']!='D'){ echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; @@ -187,6 +192,7 @@ echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; } -echo '</form></div>'; +echo '</form> + </div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockDispatch.php =================================================================== --- trunk/StockDispatch.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockDispatch.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -10,7 +10,7 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - if (!is_numeric($_POST['Percent'])) { + if (!is_numeric(filter_number_format($_POST['Percent']))) { $_POST['Percent'] = 0; } @@ -63,7 +63,7 @@ stockmaster.serialised, stockmaster.controlled, ROUND((locstock.reorderlevel - locstock.quantity) * - (1 + (" . $_POST['Percent'] . "/100))) + (1 + (" . filter_number_format($_POST['Percent']) . "/100))) as neededqty, (fromlocstock.quantity - fromlocstock.reorderlevel) as available, fromlocstock.reorderlevel as fromreorderlevel, @@ -89,9 +89,10 @@ $title = _('Stock Dispatch - Problem Report'); include('includes/header.inc'); prnMsg( _('The Stock Dispatch report could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); - echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /> + <a href="' .$rootpath . '/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br />$sql"; + echo '<br />' . $sql; } include('includes/footer.inc'); exit; @@ -101,7 +102,8 @@ include('includes/header.inc'); echo '<br />'; prnMsg( _('The stock dispatch did not have any items to list'),'warn'); - echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } @@ -226,7 +228,9 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); $DefaultLocation = $myrow['defaultlocation']; - echo '<br/><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; + echo '<br/> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, locationname @@ -235,8 +239,14 @@ if (!isset($_POST['FromLocation'])) { $_POST['FromLocation']=$DefaultLocation; } - echo '<table class=selection><tr><td>' . _('Dispatch Percent') . ':</td><td><input type ="text" name="Percent" class="number" size="8" value=0>'; - echo '<tr><td>' . _('From Stock Location') . ':</td><td><select name="FromLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Dispatch Percent') . ':</td> + <td><input type ="text" name="Percent" class="number" size="8" value="0" /> + </tr>'; + echo '<tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="FromLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['FromLocation']){ echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -244,22 +254,26 @@ echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; DB_data_seek($resultStkLocs,0); if (!isset($_POST['ToLocation'])) { $_POST['ToLocation']=$DefaultLocation; } - echo '<tr><td>' . _('To Stock Location') . ':</td><td><select name="ToLocation"> '; + echo '<tr> + <td>' . _('To Stock Location') . ':</td> + <td><select name="ToLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['ToLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - $SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; + $SQL="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ echo '</table></td></tr> @@ -274,7 +288,9 @@ // Define StockCat with 'name="StockCat[ ]" multiple' so can select more than one // Also have to change way define $WhereCategory for WHERE clause - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -305,14 +321,17 @@ echo '<option value="simple">' . _('Simple') . '</option>'; echo '</select></td><td> </td></tr>'; - echo '</table><br/><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</table> + <br/> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + </div>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ - function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$Trf_ID,$FromLocation,$ToLocation,$template) { Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocMovements.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -7,29 +7,30 @@ include('includes/header.inc'); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; -echo '<table class=selection><tr><td>'; -echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; +echo '<table class="selection"> + <tr> + <td> ' . _('From Stock Location') . ':<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -41,53 +42,59 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" size=12 maxlength=12 Value="' . $_POST['AfterDate'] . '">'; -echo '</td></tr></table><br />'; -echo '<div class=centre><input type=submit name="ShowMoves" VALUE="' . _('Show Stock Movements') . '"></div><br />'; +echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" />'; +echo ' ' . _('But after') . ': <input type="text" name="AfterDate" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" />'; +echo '</td> + </tr> + </table> + <br />'; +echo '<div class="centre"> + <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /> + </div> + <br />'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); $sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '". $SQLAfterDate . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); $MovtsResult = DB_query($sql, $db,$ErrMsg); echo '<table cellpadding=5 cellspacing="4 "class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Trans No') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Quantity on Hand') . '</th> - </tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Trans No') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Quantity on Hand') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -111,11 +118,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s</td> + <td class="number">%s</td> </tr>', mb_strtoupper($myrow['stockid']), mb_strtoupper($myrow['stockid']), Modified: trunk/StockLocStatus.php =================================================================== --- trunk/StockLocStatus.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocStatus.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -19,14 +19,16 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, - locationname - FROM locations"; + locationname + FROM locations"; $resultStkLocs = DB_query($sql,$db); -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"> + <img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; -echo '<table class=selection> +echo '<table class="selection"> <tr><td>' . _('From Stock Location') . ':</td> <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ @@ -45,9 +47,9 @@ } echo '</select></td></tr>'; -$SQL="SELECT categoryid, - categorydescription - FROM stockcategory +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ @@ -84,22 +86,27 @@ $_POST['BelowReorderQuantity']='All'; } if ($_POST['BelowReorderQuantity']=='All'){ - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option selected value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else if ($_POST['BelowReorderQuantity']=='Below') { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /> + </div>'; if (isset($_POST['ShowStatus'])){ @@ -142,21 +149,21 @@ ORDER BY locstock.stockid"; } - $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); - echo '<br /><table cellpadding=5 cellspacing=4 class="selection">'; + echo '<br /> + <table cellpadding="5" cellspacing="4" class="selection">'; $tableheader = '<tr> - <th>' . _('StockID') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> + <th>' . _('StockID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + <th>' . _('Demand') . '</th> + <th>' . _('Available') . '</th> + <th>' . _('On Order') . '</th> </tr>'; echo $tableheader; $j = 1; @@ -167,12 +174,11 @@ $StockID = $myrow['stockid']; $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' - AND salesorderdetails.completed=0 - AND salesorderdetails.stkcode='" . $StockID . "'"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.completed=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg); @@ -185,17 +191,16 @@ } //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. - $sql = "SELECT Sum((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' + $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN bom + ON salesorderdetails.stkcode=bom.parent + INNER JOIN stockmaster + ON stockmaster.stockid=bom.parent + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent AND stockmaster.mbflag='A'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); @@ -206,10 +211,11 @@ $DemandQty += $DemandRow[0]; } $sql = "SELECT SUM((woitems.qtyreqd-woitems.qtyrecd)*bom.quantity) AS dem - FROM workorders, woitems, bom - WHERE woitems.wo = workorders.wo - AND woitems.stockid = bom.parent - AND workorders.closed=0 + FROM workorders INNER JOIN woitems + ON woitems.wo = workorders.wo + INNER JOIN bom + ON woitems.stockid = bom.parent + WHERE workorders.closed=0 AND bom.component = '". $StockID . "' AND workorders.loccode='". $myrow['loccode'] ."'"; $DemandResult = DB_query($sql,$db, $ErrMsg); @@ -253,23 +259,23 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td> - </tr>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); - + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td> + </tr>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); + if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; @@ -285,31 +291,28 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($myrow['controlled']==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; } - } - - - //end of page full new headings if + } //end of page full new headings if } //end of if BelowOrderQuantity or all items } //end of while loop Modified: trunk/reportwriter/WriteForm.inc =================================================================== --- trunk/reportwriter/WriteForm.inc 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/reportwriter/WriteForm.inc 2011-10-14 06:08:10 UTC (rev 4719) @@ -289,9 +289,9 @@ case "uc": return mb_strtoupper($strData); case "lc": return strtolower($strData); case "neg": return -$strData; - case "rnd2d": return locale_number_format($strData, 2); - case "dlr": return '$ '.locale_number_format($strData, 2); - case "euro": return chr(128).' '.locale_number_format($strData, 2); // assumes standard FPDF fonts + case "rnd2d": return locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "dlr": return '$ '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "euro": return chr(128).' '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); // assumes standard FPDF fonts default: return $strData; // do nothing if Process not recognized } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-14 06:11:21
|
Revision: 4720 http://web-erp.svn.sourceforge.net/web-erp/?rev=4720&view=rev Author: daintree Date: 2011-10-14 06:11:13 +0000 (Fri, 14 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/SelectRecurringSalesOrder.php trunk/SelectSupplier.php trunk/ShipmentCosting.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/StockCategories.php trunk/StockCheck.php trunk/includes/DefineSpecialOrderClass.php Modified: trunk/SelectRecurringSalesOrder.php =================================================================== --- trunk/SelectRecurringSalesOrder.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SelectRecurringSalesOrder.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -10,8 +10,10 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Inventory Items') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<table class="selection"><tr><td>'; -echo _('Select recurring order templates for delivery from:') . ' </td><td>' . '<select name="StockLocation">'; +echo '<table class="selection"> + <tr> + <td>' . _('Select recurring order templates for delivery from:') . ' </td> + <td>' . '<select name="StockLocation">'; $sql = "SELECT loccode, locationname FROM locations"; @@ -31,9 +33,11 @@ } } -echo '</select></td></tr></table>'; +echo '</select></td> + </tr> + </table>'; -echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '"></div>'; +echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '" /></div>'; if (isset($_POST['SearchRecurringOrders'])){ @@ -78,15 +82,15 @@ <table cellpadding="2" colspan="7" width="90%" class="selection">'; $tableheader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Cust Order') . ' #</th> - <th>' . _('Last Recurrence') . '</th> - <th>' . _('End Date') . '</th> - <th>' . _('Times p.a.') . '</th> - <th>' . _('Order Total') . '</th> - </tr>'; + <th>' . _('Modify') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Cust Order') . ' #</th> + <th>' . _('Last Recurrence') . '</th> + <th>' . _('End Date') . '</th> + <th>' . _('Times p.a.') . '</th> + <th>' . _('Order Total') . '</th> + </tr>'; echo $tableheader; @@ -109,23 +113,23 @@ $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - </tr>', - $ModifyPage, - $myrow['recurrorderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedLastRecurrence, - $FormatedStopDate, - $myrow['frequency'], - $FormatedOrderValue); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + </tr>', + $ModifyPage, + $myrow['recurrorderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedLastRecurrence, + $FormatedStopDate, + $myrow['frequency'], + $FormatedOrderValue); $j++; If ($j == 12){ Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SelectSupplier.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -145,11 +145,11 @@ echo '<br /> <table width=90% colspan=2 cellpadding=4> <tr> - <th width=33%>' . _('Supplier Inquiries') . '</th> - <th width=33%>' . _('Supplier Transactions') . '</th> - <th width=33%>' . _('Supplier Maintenance') . '</th> + <th width="33%">' . _('Supplier Inquiries') . '</th> + <th width="33%">' . _('Supplier Transactions') . '</th> + <th width="33%">' . _('Supplier Maintenance') . '</th> </tr>'; - echo '<tr><td valign=top class="select">'; /* Inquiry Options */ + echo '<tr><td valign="top" class="select">'; /* Inquiry Options */ echo '<a href="' . $rootpath . '/SupplierInquiry.php?SupplierID=' . $_SESSION['SupplierID'] . '">' . _('Supplier Account Inquiry') . '</a> <br /> <br />'; @@ -180,14 +180,14 @@ echo '<br />'; echo '<table width=90% colspan=2 cellpadding=4> <tr> - <th width=33%>' . _('Supplier Inquiries') . '</th> - <th width=33%>' . _('Supplier Transactions') . '</th> - <th width=33%>' . _('Supplier Maintenance') . '</th> + <th width="33%">' . _('Supplier Inquiries') . '</th> + <th width="33%">' . _('Supplier Transactions') . '</th> + <th width="33%">' . _('Supplier Maintenance') . '</th> </tr>'; echo '<tr> - <td valign=top class="select"></td> - <td valign=top class="select"></td> - <td valign=top class="select">'; /* Supplier Maintenance */ + <td valign="top" class="select"></td> + <td valign="top" class="select"></td> + <td valign="top" class="select">'; /* Supplier Maintenance */ echo '<a href="' . $rootpath . '/Suppliers.php">' . _('Add a New Supplier') . '</a><br />'; echo '</td> </tr> Modified: trunk/ShipmentCosting.php =================================================================== --- trunk/ShipmentCosting.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/ShipmentCosting.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -11,7 +11,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; -if (isset($_GET['NewShipment']) and $_GET['NewShipment']=='Yes'){ +if (isset($_GET['NewShipment']) AND $_GET['NewShipment']=='Yes'){ unset($_SESSION['Shipment']->LineItems); unset($_SESSION['Shipment']); } @@ -47,7 +47,7 @@ $HeaderData = DB_fetch_array($GetShiptHdrResult); echo '<br />'; echo '<table class="selection">'; -echo '<tr><th colspan=4><font size=3 color=navy>'._('Shipment Details').'</font></th></tr>'; +echo '<tr><th colspan="4"><font size="3" color="navy">'._('Shipment Details').'</font></th></tr>'; echo '<tr> <td><b>'. _('Shipment') .': </td> <td><b>' . $_GET['SelectedShipment'] . '</b></td> @@ -260,8 +260,7 @@ /*So we need to write off some of the variance to variances and only the balance of the quantity in stock to go to stock value */ - $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand) - * ($ItemShipmentCost - $StdCostUnit); + $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand) * ($ItemShipmentCost - $StdCostUnit); } @@ -286,7 +285,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['purchpricevaract'] . "', '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['deicmalplaces']) . _('shipment quantity > stock held - variance write off') . "', - " . filter_number_format($WriteOffToVariances) . ")"; + " . $WriteOffToVariances . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); @@ -306,7 +305,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', '" . $myrow['itemcode'] . ' ' . _('shipment avg cost adjt') . "', - '" . filter_number_format($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')"; + '" . ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment average cost adjustment for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); @@ -329,14 +328,23 @@ $CostIncrement = ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit) - $WriteOffToVariances) / $TotalQuantityOnHand; - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost=materialcost+" . filter_number_format($CostIncrement) . " - WHERE stockid='" . $myrow['itemcode'] . "'"; + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost=materialcost+" . $CostIncrement . ", + lastcostupdate='" . Date('Y-m-d') . "' + WHERE stockid='" . $myrow['itemcode'] . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE); + } else { - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost='" . filter_number_format($ItemShipmentCost) . "' WHERE stockid='" . $myrow['itemcode'] . "'"; + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost='" . $ItemShipmentCost . "', + lastcostupdate='" . Date('Y-m-d') . "' + WHERE stockid='" . $myrow['itemcode'] . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE); + } /* End of Weighted Average Costing Code */ @@ -356,7 +364,9 @@ '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $StockGLCodes['purchpricevaract'] . "', - '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "', " . filter_number_format(-$Variance * $myrow['totqtyrecd']) . ")"; + '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "', + " . -$Variance * $myrow['totqtyrecd'] . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The Positive GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); } @@ -378,7 +388,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', '" . $myrow['itemcode'] . ' ' ._('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty invoiced') . ' ' . $myrow['totqtyinvoiced'] . "', - " . filter_number_format($Variance * $myrow['totqtyinvoiced']) . ")"; + " . ($Variance * $myrow['totqtyinvoiced']) . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit GL entry for the shipment variance posting for') . ' ' . $myrow['itemcode'] . ' ' . _('could not be inserted because'); @@ -388,7 +398,9 @@ if ( $_POST['UpdateCost'] == 'Yes' ){ /*Only ever a standard costing option Weighted average costing implies cost updates taking place automatically */ - $QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid ='" . $myrow['itemcode'] . "'",$db); + $QOHResult = DB_query("SELECT SUM(quantity) + FROM locstock + WHERE stockid ='" . $myrow['itemcode'] . "'",$db); $QOHRow = DB_fetch_row($QOHResult); $QOH=$QOHRow[0]; @@ -411,7 +423,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', '" . _('Shipment of') . ' ' . $myrow['itemcode'] . " " . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "', - " . filter_number_format(-$ValueOfChange) . ")"; + " . -$ValueOfChange . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL credit for the shipment stock cost adjustment posting could not be inserted because'). ' ' . DB_error_msg($db); @@ -430,7 +442,8 @@ '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', '" . _('Shipment of') . ' ' . $myrow['itemcode'] . ' ' . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "', - " . filter_number_format($ValueOfChange) . ")"; + " . $ValueOfChange . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL debit for stock cost adjustment posting could not be inserted because') .' '. DB_error_msg($db); $Result = DB_query($SQL,$db, $ErrMsg,'',TRUE); @@ -438,10 +451,11 @@ } /*end of GL entries for a standard cost update */ /* Only the material cost is important for imported items */ - $sql = "UPDATE stockmaster SET materialcost=" . filter_number_format($ItemShipmentCost) . ", + $sql = "UPDATE stockmaster SET materialcost=" . $ItemShipmentCost . ", labourcost=0, overheadcost=0, - lastcost='" . filter_number_format($StdCostUnit) . "' + lastcost='" . $StdCostUnit . "', + lastcostupdate='" . Date('Y-m-d') . "' WHERE stockid='" . $myrow['itemcode'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The shipment cost details for the stock item could not be updated because'). ': ' . DB_error_msg($db); @@ -455,8 +469,8 @@ /* Item / Qty Inv/ FX price/ Local Val/ Portion of chgs/ Shipt Cost/ Std Cost/ Variance/ Var % */ echo '<td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td> - <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],2) . '</td> - <td class="number">' . locale_number_format($myrow['totqtyrecd'],2) . '</td> + <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],'Variable') . '</td> + <td class="number">' . locale_number_format($myrow['totqtyrecd'],'Variable') . '</td> <td class="number">' . locale_number_format($ItemCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($PortionOfCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -465,20 +479,24 @@ <td class="number">' . $VariancePercentage . '%</td></tr>'; } } -echo '<tr><td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td> - <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td></tr>'; +echo '<tr> + <td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td> + <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + </tr>'; -echo '<tr><td colspan=6 class="number">' . _('Total Value of all variances on this shipment') . '</td> - <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; +echo '<tr> + <td colspan="6" class="number">' . _('Total Value of all variances on this shipment') . '</td> + <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; echo '</table>'; echo '<br /> - <table colspan=2 width=95%> + <table colspan="2" width="95%"> <tr> - <td valign=top>'; // put this shipment charges side by side in a table (major table 2 cols) + <td valign="top">'; // put this shipment charges side by side in a table (major table 2 cols) $sql = "SELECT suppliers.suppname, supptrans.suppreference, @@ -505,7 +523,9 @@ $ChargesResult = DB_query($sql,$db); echo '<table cellpadding="2" colspan="6" class="selection">'; -echo '<tr><th colspan=6><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th></tr>'; +echo '<tr> + <th colspan="6"><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th> + </tr>'; $TableHeader = '<tr> <th>'. _('Supplier'). '</th> @@ -540,13 +560,16 @@ <td>' . $myrow['suppreference'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td>' . $myrow['stockid'] . '</td> - <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $TotalItemShipmentChgs += $myrow['value']; } -echo '<tr><td colspan=5 class="number"><font color=BLUE><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td> - <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; +echo '<tr> + <td colspan="5" class="number"><font color="blue"><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td> + <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; echo '</table>'; @@ -577,7 +600,9 @@ $ChargesResult = DB_query($sql,$db); echo '<table cellpadding="2" colspan="5" class="selection">'; -echo '<tr><th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th></tr>'; +echo '<tr> + <th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th> + </tr>'; $TableHeader = '<tr> <th>'. _('Supplier'). '</th> @@ -621,13 +646,15 @@ echo '</table>'; -echo '</td></tr></table>'; //major table close +echo '</td> + </tr> + </table>'; //major table close if ( isset($_GET['Close'])) { /* Only an opportunity to confirm user wishes to close */ // if the page was called with Close=Yes then show options to confirm OK to c echo '<div class="centre"> - <form method="POST" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">'; + <form method="post" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($_SESSION['WeightedAverageCosting']==0){ @@ -637,8 +664,11 @@ <option value="No">'. _('No') . '</option> </select>'; } - echo '<br /><br /><input type=submit name="Close" value="'. _('Confirm OK to Close'). '" />'; - echo '</form></div>'; + echo '<br /> + <br /> + <input type=submit name="Close" value="'. _('Confirm OK to Close'). '" /> + </form> + </div>'; } if ( isset($_POST['Close']) ){ /* OK do the shipment close journals */ Modified: trunk/SpecialOrder.php =================================================================== --- trunk/SpecialOrder.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SpecialOrder.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -28,7 +28,10 @@ } if (!isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ - echo '<br /><br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '<br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; + echo '<br /> + <br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . ' + <br /> + <a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; include('includes/footer.inc'); exit; } @@ -109,11 +112,13 @@ } echo '<div class="centre">'; if (!isset($_SESSION['SPL']->BranchCode)){ - echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; + echo '<br /> + <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; } else { - echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); + echo '<br /> + <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); } -echo '</div></font>'; +echo '</font></div>'; /*if the branch details and delivery details have not been entered then select them from the list */ if (!isset($_SESSION['SPL']->BranchCode)){ @@ -129,12 +134,15 @@ echo '<br /> <br />' . _('Select the customer branch to deliver the special to from the list below'); - echo '</div><br /><table class="selection">'; + echo '</div> + <br /> + <table class="selection">'; - $tableheader = '<tr><th>' ._('Code') . '</th> + $TableHeader = '<tr> + <th>' ._('Code') . '</th> <th>' . _('Branch Name') . '</th> </tr>'; - echo $tableheader; + echo $TableHeader; $j = 1; $k = 0; //row counter to determine background colour @@ -240,13 +248,22 @@ } } -if (isset($_POST['StkLocation'])) {$_SESSION['SPL']->StkLocation = $_POST['StkLocation'];} -if (isset($_POST['Initiator'])) {$_SESSION['SPL']->Initiator = $_POST['Initiator'];} -if (isset($_POST['QuotationRef'])) {$_SESSION['SPL']->QuotationRef = $_POST['QuotationRef'];} -if (isset($_POST['Comments'])) {$_SESSION['SPL']->Comments = $_POST['Comments'];} -if (isset($_POST['CustRef'])) {$_SESSION['SPL']->CustRef = $_POST['CustRef'];} +if (isset($_POST['StkLocation'])) { + $_SESSION['SPL']->StkLocation = $_POST['StkLocation']; +} +if (isset($_POST['Initiator'])) { + $_SESSION['SPL']->Initiator = $_POST['Initiator']; +} +if (isset($_POST['QuotationRef'])) { + $_SESSION['SPL']->QuotationRef = $_POST['QuotationRef']; +} +if (isset($_POST['Comments'])) { + $_SESSION['SPL']->Comments = $_POST['Comments']; +} +if (isset($_POST['CustRef'])) { + $_SESSION['SPL']->CustRef = $_POST['CustRef']; +} - if (isset($_POST['Commit'])){ /*User wishes to commit the order to the database */ /*First do some validation @@ -267,7 +284,6 @@ prnMsg( _('The person entering this order must be specified in the initiator field') . ' - ' . _('a blank initiator is not allowed'),'error'); } - if ($InputError!=1){ if (IsEmailAddress($_SESSION['UserEmail'])){ @@ -287,7 +303,7 @@ $AuthRow=DB_fetch_array($AuthResult); if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['SPL']->Order_Value()) { //user has authority to authrorise as well as create the order - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'.$_SESSION['SPL']->StatusComments.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'; $_SESSION['SPL']->AllowPrintPO=1; $_SESSION['SPL']->Status = 'Authorised'; } else { // no authority to authorise this order @@ -297,11 +313,7 @@ $AuthMessage = _('You can only authorise up to').' '.$_SESSION['SPL']->SuppCurrCode.' '.$AuthRow['authlevel'] .'.<br />'; } - prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. - $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '. - $AuthMessage . - _('If you think this is a mistake please contact the systems administrator') . '<br />'. - _('The order will be created with a status of pending and will require authorisation'), 'warn'); + prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '. $AuthMessage . _('If you think this is a mistake please contact the systems administrator') . '<br />'. _('The order will be created with a status of pending and will require authorisation'), 'warn'); $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails; $_SESSION['SPL']->Status = 'Pending'; @@ -373,7 +385,6 @@ $_SESSION['SPL']->PurchOrderNo = GetNextTransNo(18, $db); - /*Insert the purchase order detail records */ foreach ($_SESSION['SPL']->LineItems as $SPLLine) { @@ -448,8 +459,8 @@ '" . $OrderDate . "', '" . DB_escape_string($SPLLine->ItemDescription) . "', '" . $GLCode . "', - '" . filter_number_format($SPLLine->Cost) . "', - '" . filter_number_format($SPLLine->Quantity) . "')"; + '" . $SPLLine->Cost . "', + '" . $SPLLine->Quantity . "')"; $ErrMsg = _('One of the purchase order detail records could not be inserted into the database because'); $DbgMsg = _('The SQL statement used to insert the purchase order detail record and failed was'); @@ -538,14 +549,13 @@ $LineItemsSQL = $StartOf_LineItemsSQL . ", '" . DB_escape_string($StockItem->PartCode) . "', - '". filter_number_format($StockItem->Price) . "', - '" . filter_number_format($StockItem->Quantity) . "', + '". $StockItem->Price . "', + '" . $StockItem->Quantity . "', '" . $StockItem->LineNo . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg); } /* inserted line items into sales order details */ - unset ($_SESSION['SPL']); prnMsg(_('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created') .'<br/>' . _('Sales Order Number') . ' ' . $OrderNo . ' ' . _('has been entered') . '. <br/>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '<br />' . _('A freight charge may also be applicable'),'success'); if (count($_SESSION['AllowedPageSecurityTokens'])>1){ @@ -557,10 +567,9 @@ } $Result = DB_Txn_Commit($db); - - unset($_SESSION['SPL']); /*Clear the PO data to allow a newy to be input*/ - echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; - exit; + unset ($_SESSION['SPL']); + echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; + exit; } /*end if there were no input errors trapped */ } /* end of the code to do transfer the SPL object to the database - user hit the place Order*/ @@ -586,8 +595,11 @@ echo '<td>' . _('Initiated By') . ': <input type="text" name="Initiator" size="11" maxlength="10" value="' . $_SESSION['SPL']->Initiator . '" /></td> <td>' . _('Special Ref') . ': <input type="text" name="QuotationRef" size="16" maxlength="15" value="' . $_SESSION['SPL']->QuotationRef . '" /></td> - <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td></tr> - <tr><td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td></tr> + <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td> + </tr> + <tr> + <td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td> + </tr> </table> <hr>'; /* Rule off the header */ @@ -622,7 +634,7 @@ $DisplayLineCostTotalCurr = locale_number_format($LineCostTotal/$_SESSION['SPL']->SuppCurrExRate,$_SESSION['CompanyRecord']['decimalplaces']); $DisplayCost = locale_number_format($SPLLine->Cost,$_SESSION['SPL']->SuppCurrDecimalPlaces); $DisplayPrice = locale_number_format($SPLLine->Price,$_SESSION['SPL']->CustCurrDecimalPlaces); - $DisplayQuantity = locale_number_format($SPLLine->Quantity,2); + $DisplayQuantity = locale_number_format($SPLLine->Quantity,'Variable'); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -647,7 +659,7 @@ $DisplayTotal = locale_number_format($_SESSION['SPL']->total,$_SESSION['SPL']->CustCurrDecimalPlaces); echo '<tr> - <td colspan=8 class="number">' . _('TOTAL Excl Tax') . '</td> + <td colspan="8" class="number">' . _('TOTAL Excl Tax') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr> </table>'; @@ -663,11 +675,14 @@ if (!isset($_POST['ItemDescription'])) { $_POST['ItemDescription']=''; } -echo '<tr><td>' . _('Ordered item Description') . ':</td> - <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td></tr>'; +echo '<tr> + <td>' . _('Ordered item Description') . ':</td> + <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td> + </tr>'; -echo '<tr><td>' . _('Category') . ':</td> +echo '<tr> + <td>' . _('Category') . ':</td> <td><select name="StkCat">'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; @@ -682,23 +697,33 @@ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; /*default the order quantity to 1 unit */ $_POST['Qty'] = 1; -echo '<tr><td>' . _('Order Quantity') . ':</td> - <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . $_POST['Qty'] . '" /></td> +echo '<tr> + <td>' . _('Order Quantity') . ':</td> + <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . locale_number_format($_POST['Qty'],'Variable') . '" /></td> </tr>'; -if (!isset($_POST['Cost'])) {$_POST['Cost']='';} -echo '<tr><td>' . _('Unit Cost') . ':</td> - <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . $_POST['Cost'] . '" /></td></tr>'; +if (!isset($_POST['Cost'])) { + $_POST['Cost']=0; +} +echo '<tr> + <td>' . _('Unit Cost') . ':</td> + <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . locale_number_format($_POST['Cost'],$_SESSION['SPL']->SuppCurrDecimalPlaces) . '" /></td> + </tr>'; -if (!isset($_POST['Price'])) { $_POST['Price']='';} -echo '<tr><td>' . _('Unit Price') . ':</td> - <td><input type="text" class="number" size=15 maxlength=14 name="Price" value="' . $_POST['Price'] . '" /></td></tr>'; +if (!isset($_POST['Price'])) { + $_POST['Price']=0; +} +echo '<tr> + <td>' . _('Unit Price') . ':</td> + <td><input type="text" class="number" size="15" maxlength="14" name="Price" value="' . locale_number_format($_POST['Price'],$_SESSION['SPL']->CustCurrDecimalPlaces) . '" /></td> + </tr>'; /*Default the required delivery date to tomorrow as a starting point */ $_POST['ReqDelDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')+1,Date('y'))); @@ -710,11 +735,16 @@ echo '</table>'; /* end of main table */ -echo '<div class="centre"><input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" />'; +echo '<div class="centre"> + <input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" /> + <br /> + <br /> + <input type="submit" name="Cancel" value="' . _('Start Again') . '"> + <br /> + <br /> + <input type="submit" name="Commit" value="' . _('Process This Order') . '"> + </div> + </form>'; -echo '<br /><br /><input type="submit" name="Cancel" value="' . _('Start Again') . '">'; -echo '<br /><br /><input type="submit" name="Commit" value="' . _('Process This Order') . '">'; - -echo '</div></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockAdjustments.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -41,7 +41,9 @@ } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) + AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + $NewAdjustment = true; $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); @@ -49,7 +51,7 @@ $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; - if ($_POST['Quantity']=='' or !is_numeric(filter_number_format($_POST['Quantity']))){ + if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); @@ -165,7 +167,7 @@ '" . $_SESSION['Adjustment']->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', + '" . DB_escape_string($_SESSION['Adjustment']->Narrative) ."', '" . $_SESSION['Adjustment']->Quantity . "', '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' )"; @@ -332,7 +334,15 @@ $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, units, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; + + $sql="SELECT materialcost, + labourcost, + overheadcost, + units, + decimalplaces + FROM stockmaster + WHERE stockid='".$StockID."'"; + $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $_SESSION['Adjustment']->PartUnit=$myrow['units']; @@ -350,18 +360,22 @@ } else { echo '<input type="text" name="StockID" size=21 value="" maxlength=20></td></tr>'; } -echo '<tr><td>'. _('Partial Description'). ':</td><td><input type="text" name="StockText" size=21 value="' . - $_GET['Description'] .'"> '._('Partial Stock Code'). ':</td><td>'; +echo '<tr> + <td>'. _('Partial Description'). ':</td> + <td><input type="text" name="StockText" size="21" value="' . $_GET['Description'] .'" /> '._('Partial Stock Code'). ':</td> + <td>'; if (isset($StockID)) { - echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength=20>'; + echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength="20" />'; } else { - echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>'; + echo '<input type="text" name="StockCode" size=21 value="" maxlength="20" />'; } -echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; +echo '</td> + <td><input type="submit" name="CheckCode" value="'._('Check Part').'"></td> + </tr>'; if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ - echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . - $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; + echo '<tr> + <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td> + </tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> @@ -372,15 +386,15 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Adjustment']->StockLocation)){ if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -392,8 +406,10 @@ $Narrative =''; } -echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $Narrative . '"></td></tr>'; +echo '<tr> + <td>'. _('Comments On Why').':</td> + <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $Narrative . '" /></td> + </tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; @@ -402,16 +418,18 @@ if ($_SESSION['Adjustment']->StockLocation == ''){ $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '"> + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '">'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; } echo '</td></tr>'; //Select the tag -echo '<tr><td>'._('Select Tag').'</td><td><select name="tag">'; +echo '<tr> + <td>'._('Select Tag').'</td> + <td><select name="tag">'; $SQL = "SELECT tagref, tagdescription @@ -430,17 +448,26 @@ echo '</select></td>'; // End select tag -echo '</table><div class="centre"><br /><input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; +echo '</table> + <div class="centre"> + <br /> + <input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"> + <br />'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation']=''; } -echo '<br /><a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>'; -echo '<br /><a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; -echo '<br /><a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>'; -echo '<br /><a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>'; -echo '<br /><a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>'; +echo '<br /> + <a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>'; echo '</div></form>'; include('includes/footer.inc'); Modified: trunk/StockCategories.php =================================================================== --- trunk/StockCategories.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockCategories.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -7,8 +7,10 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($_GET['SelectedCategory'])){ $SelectedCategory = mb_strtoupper($_GET['SelectedCategory']); @@ -229,29 +231,29 @@ echo '<tr class="OddTableRows">'; $k=1; } - printf("<td>%s</td> - <td>%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 class=number>%s</td> - <td><a href=\"%sSelectedCategory=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCategory=%s&delete=yes\" onclick=\"return confirm('" . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - $myrow[5], - $myrow[6], - $myrow[7], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + printf('<td>%s</td> + <td>%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 class="number">%s</td> + <td><a href="%sSelectedCategory=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCategory=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[2], + $myrow[3], + $myrow[4], + $myrow[5], + $myrow[6], + $myrow[7], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -302,16 +304,23 @@ $_POST['MaterialUseageVarAc'] = $myrow['materialuseagevarac']; $_POST['WIPAct'] = $myrow['wipact']; } - echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; - echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '">'; - echo '<table class=selection><tr><td>' . _('Category Code') . ':</td><td>' . $_POST['CategoryID'] . '</td></tr>'; + echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '" />'; + echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Category Code') . ':</td> + <td>' . $_POST['CategoryID'] . '</td> + </tr>'; } else { //end of if $SelectedCategory only do the else when a new record is being entered if (!isset($_POST['CategoryID'])) { $_POST['CategoryID'] = ''; } - echo '<table class=selection><tr><td>' . _('Category Code') . ':</td> - <td><input type="Text" name="CategoryID" size=7 maxlength=6 value="' . $_POST['CategoryID'] . '"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Category Code') . ':</td> + <td><input type="text" name="CategoryID" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td> + </tr>'; } //SQL to poulate account selection boxes @@ -339,11 +348,13 @@ $_POST['CategoryDescription'] = ''; } - echo '<tr><td>' . _('Category Description') . ':</td> - <td><input type="Text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Category Description') . ':</td> + <td><input type="text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '" /></td></tr>'; - echo '<tr><td>' . _('Stock Type') . ':</td> + echo '<tr> + <td>' . _('Stock Type') . ':</td> <td><select name="StockType" onChange="ReloadForm(CategoryForm.UpdateTypes)" >'; if (isset($_POST['StockType']) and $_POST['StockType']=='F') { echo '<option selected value="F">' . _('Finished Goods') . '</option>'; @@ -366,7 +377,8 @@ echo '<option value="L">' . _('Labour') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; echo '<input type="submit" name="UpdateTypes" style="visibility:hidden;width:1px" value="Not Seen">'; if (isset($_POST['StockType']) and $_POST['StockType']=='L') { @@ -406,7 +418,8 @@ echo '</select></td></tr>'; DB_data_seek($BSAccountsResult,0); - echo '<tr><td>' . _('Stock Adjustments GL Code') . ':</td> + echo '<tr> + <td>' . _('Stock Adjustments GL Code') . ':</td> <td><select name="AdjGLAct">'; while ($myrow = DB_fetch_array($PnLAccountsResult)) { @@ -435,26 +448,32 @@ } //end while loop DB_data_seek($PnLAccountsResult,0); - echo '</select></td></tr><tr><td>'; + echo '</select></td> + </tr> + <tr> + <td>'; if (isset($_POST['StockType']) and $_POST['StockType']=='L') { echo _('Labour Efficiency Variance GL Code'); } else { echo _('Usage Variance GL Code'); } - echo ':</td><td><select name="MaterialUseageVarAc"></option>'; + echo ':</td> + <td><select name="MaterialUseageVarAc">'; while ($myrow = DB_fetch_array($PnLAccountsResult)) { if (isset($_POST['MaterialUseageVarAc']) and $myrow['accountcode']==$_POST['MaterialUseageVarAc']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } //end while loop DB_free_result($PnLAccountsResult); - echo '</select></td></tr> - </table>'; + echo '</select></td> + </tr> + </table>'; + if (!isset($SelectedCategory)) { $SelectedCategory=''; } @@ -476,14 +495,15 @@ '<br />The SQL was:<br />' . $sql; */ echo '<br /><table class=selection>'; - $TableHeader = '<tr><th>' . _('Property Label') . '</th> - <th>' . _('Control Type') . '</th> - <th>' . _('Default Value') . '</th> - <th>' . _('Numeric Value') . '</th> - <th>' . _('Minimum Value') . '</th> - <th>' . _('Maximum Value') . '</th> - <th>' . _('Require in SO') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('Property Label') . '</th> + <th>' . _('Control Type') . '</th> + <th>' . _('Default Value') . '</th> + <th>' . _('Numeric Value') . '</th> + <th>' . _('Minimum Value') . '</th> + <th>' . _('Maximum Value') . '</th> + <th>' . _('Require in SO') . '</th> + </tr>'; echo $TableHeader; $PropertyCounter =0; $HeadingCounter =0; @@ -494,25 +514,24 @@ } else { $HeadingCounter++; } - echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value=' . $myrow['stkcatpropid'] . '>'; - echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '"></td> + echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="' . $myrow['stkcatpropid'] . '" />'; + echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '" /></td> <td><select name="PropControlType' . $PropertyCounter . '">'; if ($myrow['controltype']==0){ - echo '<option selected value=0>' . _('Text Box') . '</option>'; + echo '<option selected value="0">' . _('Text Box') . '</option>'; } else { - echo '<option value=0>' . _('Text Box') . '</option>'; + echo '<option value="0">' . _('Text Box') . '</option>'; } if ($myrow['controltype']==1){ - echo '<option selected value=1>' . _('Select Box') . '</option>'; + echo '<option selected value="1">' . _('Select Box') . '</option>'; } else { - echo '<option value=1>' . _('Select Box') . '</option>'; + echo '<option value="1">' . _('Select Box') . '</option>'; } if ($myrow['controltype']==2){ - echo '<option selected value=2>' . _('Check Box') . '</option>'; + echo '<option selected value="2">' . _('Check Box') . '</option>'; } else { - echo '<option value=2>' . _('Check Box') . '</option>'; + echo '<option value="2">' . _('Check Box') . '</option>'; } - echo '</select></td> <td><input type="textbox" name="PropDefault' . $PropertyCounter . '" value="' . $myrow['defaultvalue'] . '"></td> <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"'; @@ -532,33 +551,37 @@ } echo '></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td> + </tr>'; $PropertyCounter++; } //end loop around defined properties for this category - echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty">'; - echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100"></td> - <td><select name="PropControlType' . $PropertyCounter . '">'; - echo '<option selected value=0>' . _('Text Box') . '</option>'; - echo '<option value=1>' . _('Select Box') . '</option>'; - echo '<option value=2>' . _('Check Box') . '</option>'; - echo '</select></td> - <td><input type="textbox" name="PropDefault' . $PropertyCounter . '"></td> - <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"></td> - <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '"></td> - <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '"></td> - <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'"></td></tr>'; + echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty" />'; + echo '<tr> + <td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" /></td> + <td><select name="PropControlType' . $PropertyCounter . '"> + <option selected value=0>' . _('Text Box') . '</option> + <option value=1>' . _('Select Box') . '</option> + <option value=2>' . _('Check Box') . '</option> + </select></td> + <td><input type="textbox" name="PropDefault' . $PropertyCounter . '" /></td> + <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '" /></td> + <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '" /></td> + <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '" /></td> + <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'" /></td> + </tr>'; echo '</table>'; - echo '<input type=hidden name="PropertyCounter" value=' . $PropertyCounter . '>'; + echo '<input type="hidden" name="PropertyCounter" value="' . $PropertyCounter . '" />'; } /* end if there is a category selected */ - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '"> + </div> + </form>'; - - echo '</form>'; - } //end if record deleted no point displaying form to add record Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockCheck.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -54,11 +54,12 @@ } if ($_POST['MakeStkChkData']=='AddUpdate'){ - $sql = "DELETE stockcheckfreeze FROM stockcheckfreeze - INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid - WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; + $sql = "DELETE stockcheckfreeze + FROM stockcheckfreeze + INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid + WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' + AND stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db) !=0) { @@ -83,12 +84,13 @@ '" . Date('Y-m-d') . "' FROM locstock INNER JOIN stockmaster ON locstock.stockid=stockmaster.stockid - WHERE locstock.loccode='" . $_POST['Location'] . "' AND - stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockmaster.mbflag!='A' AND - stockmaster.mbflag!='K' AND - stockmaster.mbflag!='D'"; + WHERE locstock.loccode='" . $_POST['Location'] . "' + AND stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.mbflag!='D'"; $result = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -112,26 +114,25 @@ } - $SQL = "SELECT stockmaster.categoryid, - stockcheckfreeze.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockcategory.categorydescription, - stockcheckfreeze.qoh - FROM stockcheckfreeze, - stockmaster, - stockcategory - WHERE stockcheckfreeze.stockid=stockmaster.stockid AND - stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid=stockcategory.categoryid AND - stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND - (stockmaster.mbflag='B' OR mbflag='M') AND - stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; - if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){ - $SQL .= ' AND stockcheckfreeze.qoh<>0'; - } + $SQL = "SELECT stockmaster.categoryid, + stockcheckfreeze.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockcategory.categorydescription, + stockcheckfreeze.qoh + FROM stockcheckfreeze INNER JOIN stockmaster + ON stockcheckfreeze.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND (stockmaster.mbflag='B' OR mbflag='M') + AND stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; + if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){ + $SQL .= " AND stockcheckfreeze.qoh<>0"; + } - $SQL .= ' ORDER BY stockmaster.categoryid, stockmaster.stockid'; + $SQL .= " ORDER BY stockmaster.categoryid, stockmaster.stockid"; $InventoryResult = DB_query($SQL,$db,'','',false,false); @@ -159,9 +160,9 @@ $Category = ''; - While ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){ + While ($InventoryCheckRow = DB_fetch_array($InventoryResult,$db)){ - if ($Category!=$InventoryPlan['categoryid']){ + if ($Category!=$InventoryCheckRow['categoryid']){ $FontSize=12; if ($Category!=''){ /*Then it's NOT the first time round */ /*draw a line under the CATEGORY TOTAL*/ @@ -169,8 +170,8 @@ $YPos -=(2*$line_height); } - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryPlan['categoryid'] . ' - ' . $InventoryPlan['categorydescription'], 'left'); - $Category = $InventoryPlan['categoryid']; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryCheckRow['categoryid'] . ' - ' . $InventoryCheckRow['categorydescription'], 'left'); + $Category = $InventoryCheckRow['categoryid']; } $FontSize=10; @@ -179,12 +180,11 @@ if (isset($_POST['ShowInfo']) and $_POST['ShowInfo']==true){ $SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand - FROM salesorderdetails, - salesorders - WHERE salesorderdetails.orderno=salesorders.orderno AND - salesorders.fromstkloc ='" . $_POST['Location'] . "' AND - salesorderdetails.stkcode = '" . $InventoryPlan['stockid'] . "' AND - salesorderdetails.completed = 0"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorderdetails.orderno=salesorders.orderno + WHERE salesorders.fromstkloc ='" . $_POST['Location'] . "' + AND salesorderdetails.stkcode = '" . $InventoryCheckRow['stockid'] . "' + AND salesorderdetails.completed = 0"; $DemandResult = DB_query($SQL,$db,'','',false, false); @@ -204,19 +204,17 @@ $DemandQty = $DemandRow['qtydemand']; //Also need to add in the demand for components of assembly items - $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) - AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent AND - salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $_POST['Location'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $InventoryPlan['stockid'] . "' AND - stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A'"; + $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.... [truncated message content] |
From: <dai...@us...> - 2011-10-14 06:11:21
|
Revision: 4720 http://web-erp.svn.sourceforge.net/web-erp/?rev=4720&view=rev Author: daintree Date: 2011-10-14 06:11:13 +0000 (Fri, 14 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/SelectRecurringSalesOrder.php trunk/SelectSupplier.php trunk/ShipmentCosting.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/StockCategories.php trunk/StockCheck.php trunk/includes/DefineSpecialOrderClass.php Modified: trunk/SelectRecurringSalesOrder.php =================================================================== --- trunk/SelectRecurringSalesOrder.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SelectRecurringSalesOrder.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -10,8 +10,10 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Inventory Items') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<table class="selection"><tr><td>'; -echo _('Select recurring order templates for delivery from:') . ' </td><td>' . '<select name="StockLocation">'; +echo '<table class="selection"> + <tr> + <td>' . _('Select recurring order templates for delivery from:') . ' </td> + <td>' . '<select name="StockLocation">'; $sql = "SELECT loccode, locationname FROM locations"; @@ -31,9 +33,11 @@ } } -echo '</select></td></tr></table>'; +echo '</select></td> + </tr> + </table>'; -echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '"></div>'; +echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '" /></div>'; if (isset($_POST['SearchRecurringOrders'])){ @@ -78,15 +82,15 @@ <table cellpadding="2" colspan="7" width="90%" class="selection">'; $tableheader = '<tr> - <th>' . _('Modify') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Cust Order') . ' #</th> - <th>' . _('Last Recurrence') . '</th> - <th>' . _('End Date') . '</th> - <th>' . _('Times p.a.') . '</th> - <th>' . _('Order Total') . '</th> - </tr>'; + <th>' . _('Modify') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Cust Order') . ' #</th> + <th>' . _('Last Recurrence') . '</th> + <th>' . _('End Date') . '</th> + <th>' . _('Times p.a.') . '</th> + <th>' . _('Order Total') . '</th> + </tr>'; echo $tableheader; @@ -109,23 +113,23 @@ $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - </tr>', - $ModifyPage, - $myrow['recurrorderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedLastRecurrence, - $FormatedStopDate, - $myrow['frequency'], - $FormatedOrderValue); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + </tr>', + $ModifyPage, + $myrow['recurrorderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedLastRecurrence, + $FormatedStopDate, + $myrow['frequency'], + $FormatedOrderValue); $j++; If ($j == 12){ Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SelectSupplier.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -145,11 +145,11 @@ echo '<br /> <table width=90% colspan=2 cellpadding=4> <tr> - <th width=33%>' . _('Supplier Inquiries') . '</th> - <th width=33%>' . _('Supplier Transactions') . '</th> - <th width=33%>' . _('Supplier Maintenance') . '</th> + <th width="33%">' . _('Supplier Inquiries') . '</th> + <th width="33%">' . _('Supplier Transactions') . '</th> + <th width="33%">' . _('Supplier Maintenance') . '</th> </tr>'; - echo '<tr><td valign=top class="select">'; /* Inquiry Options */ + echo '<tr><td valign="top" class="select">'; /* Inquiry Options */ echo '<a href="' . $rootpath . '/SupplierInquiry.php?SupplierID=' . $_SESSION['SupplierID'] . '">' . _('Supplier Account Inquiry') . '</a> <br /> <br />'; @@ -180,14 +180,14 @@ echo '<br />'; echo '<table width=90% colspan=2 cellpadding=4> <tr> - <th width=33%>' . _('Supplier Inquiries') . '</th> - <th width=33%>' . _('Supplier Transactions') . '</th> - <th width=33%>' . _('Supplier Maintenance') . '</th> + <th width="33%">' . _('Supplier Inquiries') . '</th> + <th width="33%">' . _('Supplier Transactions') . '</th> + <th width="33%">' . _('Supplier Maintenance') . '</th> </tr>'; echo '<tr> - <td valign=top class="select"></td> - <td valign=top class="select"></td> - <td valign=top class="select">'; /* Supplier Maintenance */ + <td valign="top" class="select"></td> + <td valign="top" class="select"></td> + <td valign="top" class="select">'; /* Supplier Maintenance */ echo '<a href="' . $rootpath . '/Suppliers.php">' . _('Add a New Supplier') . '</a><br />'; echo '</td> </tr> Modified: trunk/ShipmentCosting.php =================================================================== --- trunk/ShipmentCosting.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/ShipmentCosting.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -11,7 +11,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; -if (isset($_GET['NewShipment']) and $_GET['NewShipment']=='Yes'){ +if (isset($_GET['NewShipment']) AND $_GET['NewShipment']=='Yes'){ unset($_SESSION['Shipment']->LineItems); unset($_SESSION['Shipment']); } @@ -47,7 +47,7 @@ $HeaderData = DB_fetch_array($GetShiptHdrResult); echo '<br />'; echo '<table class="selection">'; -echo '<tr><th colspan=4><font size=3 color=navy>'._('Shipment Details').'</font></th></tr>'; +echo '<tr><th colspan="4"><font size="3" color="navy">'._('Shipment Details').'</font></th></tr>'; echo '<tr> <td><b>'. _('Shipment') .': </td> <td><b>' . $_GET['SelectedShipment'] . '</b></td> @@ -260,8 +260,7 @@ /*So we need to write off some of the variance to variances and only the balance of the quantity in stock to go to stock value */ - $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand) - * ($ItemShipmentCost - $StdCostUnit); + $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand) * ($ItemShipmentCost - $StdCostUnit); } @@ -286,7 +285,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['purchpricevaract'] . "', '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['deicmalplaces']) . _('shipment quantity > stock held - variance write off') . "', - " . filter_number_format($WriteOffToVariances) . ")"; + " . $WriteOffToVariances . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); @@ -306,7 +305,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', '" . $myrow['itemcode'] . ' ' . _('shipment avg cost adjt') . "', - '" . filter_number_format($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')"; + '" . ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment average cost adjustment for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); @@ -329,14 +328,23 @@ $CostIncrement = ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit) - $WriteOffToVariances) / $TotalQuantityOnHand; - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost=materialcost+" . filter_number_format($CostIncrement) . " - WHERE stockid='" . $myrow['itemcode'] . "'"; + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost=materialcost+" . $CostIncrement . ", + lastcostupdate='" . Date('Y-m-d') . "' + WHERE stockid='" . $myrow['itemcode'] . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE); + } else { - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost='" . filter_number_format($ItemShipmentCost) . "' WHERE stockid='" . $myrow['itemcode'] . "'"; + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost='" . $ItemShipmentCost . "', + lastcostupdate='" . Date('Y-m-d') . "' + WHERE stockid='" . $myrow['itemcode'] . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE); + } /* End of Weighted Average Costing Code */ @@ -356,7 +364,9 @@ '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $StockGLCodes['purchpricevaract'] . "', - '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "', " . filter_number_format(-$Variance * $myrow['totqtyrecd']) . ")"; + '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "', + " . -$Variance * $myrow['totqtyrecd'] . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The Positive GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because'); $result = DB_query($sql,$db, $ErrMsg,'',TRUE); } @@ -378,7 +388,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', '" . $myrow['itemcode'] . ' ' ._('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty invoiced') . ' ' . $myrow['totqtyinvoiced'] . "', - " . filter_number_format($Variance * $myrow['totqtyinvoiced']) . ")"; + " . ($Variance * $myrow['totqtyinvoiced']) . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit GL entry for the shipment variance posting for') . ' ' . $myrow['itemcode'] . ' ' . _('could not be inserted because'); @@ -388,7 +398,9 @@ if ( $_POST['UpdateCost'] == 'Yes' ){ /*Only ever a standard costing option Weighted average costing implies cost updates taking place automatically */ - $QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid ='" . $myrow['itemcode'] . "'",$db); + $QOHResult = DB_query("SELECT SUM(quantity) + FROM locstock + WHERE stockid ='" . $myrow['itemcode'] . "'",$db); $QOHRow = DB_fetch_row($QOHResult); $QOH=$QOHRow[0]; @@ -411,7 +423,7 @@ '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', '" . _('Shipment of') . ' ' . $myrow['itemcode'] . " " . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "', - " . filter_number_format(-$ValueOfChange) . ")"; + " . -$ValueOfChange . ")"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL credit for the shipment stock cost adjustment posting could not be inserted because'). ' ' . DB_error_msg($db); @@ -430,7 +442,8 @@ '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', '" . _('Shipment of') . ' ' . $myrow['itemcode'] . ' ' . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "', - " . filter_number_format($ValueOfChange) . ")"; + " . $ValueOfChange . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL debit for stock cost adjustment posting could not be inserted because') .' '. DB_error_msg($db); $Result = DB_query($SQL,$db, $ErrMsg,'',TRUE); @@ -438,10 +451,11 @@ } /*end of GL entries for a standard cost update */ /* Only the material cost is important for imported items */ - $sql = "UPDATE stockmaster SET materialcost=" . filter_number_format($ItemShipmentCost) . ", + $sql = "UPDATE stockmaster SET materialcost=" . $ItemShipmentCost . ", labourcost=0, overheadcost=0, - lastcost='" . filter_number_format($StdCostUnit) . "' + lastcost='" . $StdCostUnit . "', + lastcostupdate='" . Date('Y-m-d') . "' WHERE stockid='" . $myrow['itemcode'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The shipment cost details for the stock item could not be updated because'). ': ' . DB_error_msg($db); @@ -455,8 +469,8 @@ /* Item / Qty Inv/ FX price/ Local Val/ Portion of chgs/ Shipt Cost/ Std Cost/ Variance/ Var % */ echo '<td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td> - <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],2) . '</td> - <td class="number">' . locale_number_format($myrow['totqtyrecd'],2) . '</td> + <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],'Variable') . '</td> + <td class="number">' . locale_number_format($myrow['totqtyrecd'],'Variable') . '</td> <td class="number">' . locale_number_format($ItemCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($PortionOfCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -465,20 +479,24 @@ <td class="number">' . $VariancePercentage . '%</td></tr>'; } } -echo '<tr><td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td> - <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td></tr>'; +echo '<tr> + <td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td> + <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + </tr>'; -echo '<tr><td colspan=6 class="number">' . _('Total Value of all variances on this shipment') . '</td> - <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; +echo '<tr> + <td colspan="6" class="number">' . _('Total Value of all variances on this shipment') . '</td> + <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; echo '</table>'; echo '<br /> - <table colspan=2 width=95%> + <table colspan="2" width="95%"> <tr> - <td valign=top>'; // put this shipment charges side by side in a table (major table 2 cols) + <td valign="top">'; // put this shipment charges side by side in a table (major table 2 cols) $sql = "SELECT suppliers.suppname, supptrans.suppreference, @@ -505,7 +523,9 @@ $ChargesResult = DB_query($sql,$db); echo '<table cellpadding="2" colspan="6" class="selection">'; -echo '<tr><th colspan=6><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th></tr>'; +echo '<tr> + <th colspan="6"><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th> + </tr>'; $TableHeader = '<tr> <th>'. _('Supplier'). '</th> @@ -540,13 +560,16 @@ <td>' . $myrow['suppreference'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td>' . $myrow['stockid'] . '</td> - <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $TotalItemShipmentChgs += $myrow['value']; } -echo '<tr><td colspan=5 class="number"><font color=BLUE><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td> - <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; +echo '<tr> + <td colspan="5" class="number"><font color="blue"><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td> + <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; echo '</table>'; @@ -577,7 +600,9 @@ $ChargesResult = DB_query($sql,$db); echo '<table cellpadding="2" colspan="5" class="selection">'; -echo '<tr><th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th></tr>'; +echo '<tr> + <th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th> + </tr>'; $TableHeader = '<tr> <th>'. _('Supplier'). '</th> @@ -621,13 +646,15 @@ echo '</table>'; -echo '</td></tr></table>'; //major table close +echo '</td> + </tr> + </table>'; //major table close if ( isset($_GET['Close'])) { /* Only an opportunity to confirm user wishes to close */ // if the page was called with Close=Yes then show options to confirm OK to c echo '<div class="centre"> - <form method="POST" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">'; + <form method="post" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($_SESSION['WeightedAverageCosting']==0){ @@ -637,8 +664,11 @@ <option value="No">'. _('No') . '</option> </select>'; } - echo '<br /><br /><input type=submit name="Close" value="'. _('Confirm OK to Close'). '" />'; - echo '</form></div>'; + echo '<br /> + <br /> + <input type=submit name="Close" value="'. _('Confirm OK to Close'). '" /> + </form> + </div>'; } if ( isset($_POST['Close']) ){ /* OK do the shipment close journals */ Modified: trunk/SpecialOrder.php =================================================================== --- trunk/SpecialOrder.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/SpecialOrder.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -28,7 +28,10 @@ } if (!isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ - echo '<br /><br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '<br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; + echo '<br /> + <br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . ' + <br /> + <a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; include('includes/footer.inc'); exit; } @@ -109,11 +112,13 @@ } echo '<div class="centre">'; if (!isset($_SESSION['SPL']->BranchCode)){ - echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; + echo '<br /> + <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; } else { - echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); + echo '<br /> + <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); } -echo '</div></font>'; +echo '</font></div>'; /*if the branch details and delivery details have not been entered then select them from the list */ if (!isset($_SESSION['SPL']->BranchCode)){ @@ -129,12 +134,15 @@ echo '<br /> <br />' . _('Select the customer branch to deliver the special to from the list below'); - echo '</div><br /><table class="selection">'; + echo '</div> + <br /> + <table class="selection">'; - $tableheader = '<tr><th>' ._('Code') . '</th> + $TableHeader = '<tr> + <th>' ._('Code') . '</th> <th>' . _('Branch Name') . '</th> </tr>'; - echo $tableheader; + echo $TableHeader; $j = 1; $k = 0; //row counter to determine background colour @@ -240,13 +248,22 @@ } } -if (isset($_POST['StkLocation'])) {$_SESSION['SPL']->StkLocation = $_POST['StkLocation'];} -if (isset($_POST['Initiator'])) {$_SESSION['SPL']->Initiator = $_POST['Initiator'];} -if (isset($_POST['QuotationRef'])) {$_SESSION['SPL']->QuotationRef = $_POST['QuotationRef'];} -if (isset($_POST['Comments'])) {$_SESSION['SPL']->Comments = $_POST['Comments'];} -if (isset($_POST['CustRef'])) {$_SESSION['SPL']->CustRef = $_POST['CustRef'];} +if (isset($_POST['StkLocation'])) { + $_SESSION['SPL']->StkLocation = $_POST['StkLocation']; +} +if (isset($_POST['Initiator'])) { + $_SESSION['SPL']->Initiator = $_POST['Initiator']; +} +if (isset($_POST['QuotationRef'])) { + $_SESSION['SPL']->QuotationRef = $_POST['QuotationRef']; +} +if (isset($_POST['Comments'])) { + $_SESSION['SPL']->Comments = $_POST['Comments']; +} +if (isset($_POST['CustRef'])) { + $_SESSION['SPL']->CustRef = $_POST['CustRef']; +} - if (isset($_POST['Commit'])){ /*User wishes to commit the order to the database */ /*First do some validation @@ -267,7 +284,6 @@ prnMsg( _('The person entering this order must be specified in the initiator field') . ' - ' . _('a blank initiator is not allowed'),'error'); } - if ($InputError!=1){ if (IsEmailAddress($_SESSION['UserEmail'])){ @@ -287,7 +303,7 @@ $AuthRow=DB_fetch_array($AuthResult); if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['SPL']->Order_Value()) { //user has authority to authrorise as well as create the order - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'.$_SESSION['SPL']->StatusComments.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'; $_SESSION['SPL']->AllowPrintPO=1; $_SESSION['SPL']->Status = 'Authorised'; } else { // no authority to authorise this order @@ -297,11 +313,7 @@ $AuthMessage = _('You can only authorise up to').' '.$_SESSION['SPL']->SuppCurrCode.' '.$AuthRow['authlevel'] .'.<br />'; } - prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. - $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '. - $AuthMessage . - _('If you think this is a mistake please contact the systems administrator') . '<br />'. - _('The order will be created with a status of pending and will require authorisation'), 'warn'); + prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '. $AuthMessage . _('If you think this is a mistake please contact the systems administrator') . '<br />'. _('The order will be created with a status of pending and will require authorisation'), 'warn'); $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails; $_SESSION['SPL']->Status = 'Pending'; @@ -373,7 +385,6 @@ $_SESSION['SPL']->PurchOrderNo = GetNextTransNo(18, $db); - /*Insert the purchase order detail records */ foreach ($_SESSION['SPL']->LineItems as $SPLLine) { @@ -448,8 +459,8 @@ '" . $OrderDate . "', '" . DB_escape_string($SPLLine->ItemDescription) . "', '" . $GLCode . "', - '" . filter_number_format($SPLLine->Cost) . "', - '" . filter_number_format($SPLLine->Quantity) . "')"; + '" . $SPLLine->Cost . "', + '" . $SPLLine->Quantity . "')"; $ErrMsg = _('One of the purchase order detail records could not be inserted into the database because'); $DbgMsg = _('The SQL statement used to insert the purchase order detail record and failed was'); @@ -538,14 +549,13 @@ $LineItemsSQL = $StartOf_LineItemsSQL . ", '" . DB_escape_string($StockItem->PartCode) . "', - '". filter_number_format($StockItem->Price) . "', - '" . filter_number_format($StockItem->Quantity) . "', + '". $StockItem->Price . "', + '" . $StockItem->Quantity . "', '" . $StockItem->LineNo . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg); } /* inserted line items into sales order details */ - unset ($_SESSION['SPL']); prnMsg(_('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created') .'<br/>' . _('Sales Order Number') . ' ' . $OrderNo . ' ' . _('has been entered') . '. <br/>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '<br />' . _('A freight charge may also be applicable'),'success'); if (count($_SESSION['AllowedPageSecurityTokens'])>1){ @@ -557,10 +567,9 @@ } $Result = DB_Txn_Commit($db); - - unset($_SESSION['SPL']); /*Clear the PO data to allow a newy to be input*/ - echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; - exit; + unset ($_SESSION['SPL']); + echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; + exit; } /*end if there were no input errors trapped */ } /* end of the code to do transfer the SPL object to the database - user hit the place Order*/ @@ -586,8 +595,11 @@ echo '<td>' . _('Initiated By') . ': <input type="text" name="Initiator" size="11" maxlength="10" value="' . $_SESSION['SPL']->Initiator . '" /></td> <td>' . _('Special Ref') . ': <input type="text" name="QuotationRef" size="16" maxlength="15" value="' . $_SESSION['SPL']->QuotationRef . '" /></td> - <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td></tr> - <tr><td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td></tr> + <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td> + </tr> + <tr> + <td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td> + </tr> </table> <hr>'; /* Rule off the header */ @@ -622,7 +634,7 @@ $DisplayLineCostTotalCurr = locale_number_format($LineCostTotal/$_SESSION['SPL']->SuppCurrExRate,$_SESSION['CompanyRecord']['decimalplaces']); $DisplayCost = locale_number_format($SPLLine->Cost,$_SESSION['SPL']->SuppCurrDecimalPlaces); $DisplayPrice = locale_number_format($SPLLine->Price,$_SESSION['SPL']->CustCurrDecimalPlaces); - $DisplayQuantity = locale_number_format($SPLLine->Quantity,2); + $DisplayQuantity = locale_number_format($SPLLine->Quantity,'Variable'); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -647,7 +659,7 @@ $DisplayTotal = locale_number_format($_SESSION['SPL']->total,$_SESSION['SPL']->CustCurrDecimalPlaces); echo '<tr> - <td colspan=8 class="number">' . _('TOTAL Excl Tax') . '</td> + <td colspan="8" class="number">' . _('TOTAL Excl Tax') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr> </table>'; @@ -663,11 +675,14 @@ if (!isset($_POST['ItemDescription'])) { $_POST['ItemDescription']=''; } -echo '<tr><td>' . _('Ordered item Description') . ':</td> - <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td></tr>'; +echo '<tr> + <td>' . _('Ordered item Description') . ':</td> + <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td> + </tr>'; -echo '<tr><td>' . _('Category') . ':</td> +echo '<tr> + <td>' . _('Category') . ':</td> <td><select name="StkCat">'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; @@ -682,23 +697,33 @@ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; /*default the order quantity to 1 unit */ $_POST['Qty'] = 1; -echo '<tr><td>' . _('Order Quantity') . ':</td> - <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . $_POST['Qty'] . '" /></td> +echo '<tr> + <td>' . _('Order Quantity') . ':</td> + <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . locale_number_format($_POST['Qty'],'Variable') . '" /></td> </tr>'; -if (!isset($_POST['Cost'])) {$_POST['Cost']='';} -echo '<tr><td>' . _('Unit Cost') . ':</td> - <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . $_POST['Cost'] . '" /></td></tr>'; +if (!isset($_POST['Cost'])) { + $_POST['Cost']=0; +} +echo '<tr> + <td>' . _('Unit Cost') . ':</td> + <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . locale_number_format($_POST['Cost'],$_SESSION['SPL']->SuppCurrDecimalPlaces) . '" /></td> + </tr>'; -if (!isset($_POST['Price'])) { $_POST['Price']='';} -echo '<tr><td>' . _('Unit Price') . ':</td> - <td><input type="text" class="number" size=15 maxlength=14 name="Price" value="' . $_POST['Price'] . '" /></td></tr>'; +if (!isset($_POST['Price'])) { + $_POST['Price']=0; +} +echo '<tr> + <td>' . _('Unit Price') . ':</td> + <td><input type="text" class="number" size="15" maxlength="14" name="Price" value="' . locale_number_format($_POST['Price'],$_SESSION['SPL']->CustCurrDecimalPlaces) . '" /></td> + </tr>'; /*Default the required delivery date to tomorrow as a starting point */ $_POST['ReqDelDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')+1,Date('y'))); @@ -710,11 +735,16 @@ echo '</table>'; /* end of main table */ -echo '<div class="centre"><input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" />'; +echo '<div class="centre"> + <input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" /> + <br /> + <br /> + <input type="submit" name="Cancel" value="' . _('Start Again') . '"> + <br /> + <br /> + <input type="submit" name="Commit" value="' . _('Process This Order') . '"> + </div> + </form>'; -echo '<br /><br /><input type="submit" name="Cancel" value="' . _('Start Again') . '">'; -echo '<br /><br /><input type="submit" name="Commit" value="' . _('Process This Order') . '">'; - -echo '</div></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockAdjustments.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -41,7 +41,9 @@ } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) + AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + $NewAdjustment = true; $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); @@ -49,7 +51,7 @@ $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; - if ($_POST['Quantity']=='' or !is_numeric(filter_number_format($_POST['Quantity']))){ + if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); @@ -165,7 +167,7 @@ '" . $_SESSION['Adjustment']->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', + '" . DB_escape_string($_SESSION['Adjustment']->Narrative) ."', '" . $_SESSION['Adjustment']->Quantity . "', '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' )"; @@ -332,7 +334,15 @@ $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, units, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; + + $sql="SELECT materialcost, + labourcost, + overheadcost, + units, + decimalplaces + FROM stockmaster + WHERE stockid='".$StockID."'"; + $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $_SESSION['Adjustment']->PartUnit=$myrow['units']; @@ -350,18 +360,22 @@ } else { echo '<input type="text" name="StockID" size=21 value="" maxlength=20></td></tr>'; } -echo '<tr><td>'. _('Partial Description'). ':</td><td><input type="text" name="StockText" size=21 value="' . - $_GET['Description'] .'"> '._('Partial Stock Code'). ':</td><td>'; +echo '<tr> + <td>'. _('Partial Description'). ':</td> + <td><input type="text" name="StockText" size="21" value="' . $_GET['Description'] .'" /> '._('Partial Stock Code'). ':</td> + <td>'; if (isset($StockID)) { - echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength=20>'; + echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength="20" />'; } else { - echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>'; + echo '<input type="text" name="StockCode" size=21 value="" maxlength="20" />'; } -echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; +echo '</td> + <td><input type="submit" name="CheckCode" value="'._('Check Part').'"></td> + </tr>'; if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ - echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . - $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; + echo '<tr> + <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td> + </tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> @@ -372,15 +386,15 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Adjustment']->StockLocation)){ if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -392,8 +406,10 @@ $Narrative =''; } -echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $Narrative . '"></td></tr>'; +echo '<tr> + <td>'. _('Comments On Why').':</td> + <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $Narrative . '" /></td> + </tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; @@ -402,16 +418,18 @@ if ($_SESSION['Adjustment']->StockLocation == ''){ $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '"> + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '">'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; } echo '</td></tr>'; //Select the tag -echo '<tr><td>'._('Select Tag').'</td><td><select name="tag">'; +echo '<tr> + <td>'._('Select Tag').'</td> + <td><select name="tag">'; $SQL = "SELECT tagref, tagdescription @@ -430,17 +448,26 @@ echo '</select></td>'; // End select tag -echo '</table><div class="centre"><br /><input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; +echo '</table> + <div class="centre"> + <br /> + <input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"> + <br />'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation']=''; } -echo '<br /><a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>'; -echo '<br /><a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; -echo '<br /><a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>'; -echo '<br /><a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>'; -echo '<br /><a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>'; +echo '<br /> + <a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>'; +echo '<br /> + <a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>'; echo '</div></form>'; include('includes/footer.inc'); Modified: trunk/StockCategories.php =================================================================== --- trunk/StockCategories.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockCategories.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -7,8 +7,10 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($_GET['SelectedCategory'])){ $SelectedCategory = mb_strtoupper($_GET['SelectedCategory']); @@ -229,29 +231,29 @@ echo '<tr class="OddTableRows">'; $k=1; } - printf("<td>%s</td> - <td>%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 class=number>%s</td> - <td><a href=\"%sSelectedCategory=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCategory=%s&delete=yes\" onclick=\"return confirm('" . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - $myrow[5], - $myrow[6], - $myrow[7], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + printf('<td>%s</td> + <td>%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 class="number">%s</td> + <td><a href="%sSelectedCategory=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCategory=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[2], + $myrow[3], + $myrow[4], + $myrow[5], + $myrow[6], + $myrow[7], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -302,16 +304,23 @@ $_POST['MaterialUseageVarAc'] = $myrow['materialuseagevarac']; $_POST['WIPAct'] = $myrow['wipact']; } - echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; - echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '">'; - echo '<table class=selection><tr><td>' . _('Category Code') . ':</td><td>' . $_POST['CategoryID'] . '</td></tr>'; + echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '" />'; + echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Category Code') . ':</td> + <td>' . $_POST['CategoryID'] . '</td> + </tr>'; } else { //end of if $SelectedCategory only do the else when a new record is being entered if (!isset($_POST['CategoryID'])) { $_POST['CategoryID'] = ''; } - echo '<table class=selection><tr><td>' . _('Category Code') . ':</td> - <td><input type="Text" name="CategoryID" size=7 maxlength=6 value="' . $_POST['CategoryID'] . '"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Category Code') . ':</td> + <td><input type="text" name="CategoryID" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td> + </tr>'; } //SQL to poulate account selection boxes @@ -339,11 +348,13 @@ $_POST['CategoryDescription'] = ''; } - echo '<tr><td>' . _('Category Description') . ':</td> - <td><input type="Text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Category Description') . ':</td> + <td><input type="text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '" /></td></tr>'; - echo '<tr><td>' . _('Stock Type') . ':</td> + echo '<tr> + <td>' . _('Stock Type') . ':</td> <td><select name="StockType" onChange="ReloadForm(CategoryForm.UpdateTypes)" >'; if (isset($_POST['StockType']) and $_POST['StockType']=='F') { echo '<option selected value="F">' . _('Finished Goods') . '</option>'; @@ -366,7 +377,8 @@ echo '<option value="L">' . _('Labour') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; echo '<input type="submit" name="UpdateTypes" style="visibility:hidden;width:1px" value="Not Seen">'; if (isset($_POST['StockType']) and $_POST['StockType']=='L') { @@ -406,7 +418,8 @@ echo '</select></td></tr>'; DB_data_seek($BSAccountsResult,0); - echo '<tr><td>' . _('Stock Adjustments GL Code') . ':</td> + echo '<tr> + <td>' . _('Stock Adjustments GL Code') . ':</td> <td><select name="AdjGLAct">'; while ($myrow = DB_fetch_array($PnLAccountsResult)) { @@ -435,26 +448,32 @@ } //end while loop DB_data_seek($PnLAccountsResult,0); - echo '</select></td></tr><tr><td>'; + echo '</select></td> + </tr> + <tr> + <td>'; if (isset($_POST['StockType']) and $_POST['StockType']=='L') { echo _('Labour Efficiency Variance GL Code'); } else { echo _('Usage Variance GL Code'); } - echo ':</td><td><select name="MaterialUseageVarAc"></option>'; + echo ':</td> + <td><select name="MaterialUseageVarAc">'; while ($myrow = DB_fetch_array($PnLAccountsResult)) { if (isset($_POST['MaterialUseageVarAc']) and $myrow['accountcode']==$_POST['MaterialUseageVarAc']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } //end while loop DB_free_result($PnLAccountsResult); - echo '</select></td></tr> - </table>'; + echo '</select></td> + </tr> + </table>'; + if (!isset($SelectedCategory)) { $SelectedCategory=''; } @@ -476,14 +495,15 @@ '<br />The SQL was:<br />' . $sql; */ echo '<br /><table class=selection>'; - $TableHeader = '<tr><th>' . _('Property Label') . '</th> - <th>' . _('Control Type') . '</th> - <th>' . _('Default Value') . '</th> - <th>' . _('Numeric Value') . '</th> - <th>' . _('Minimum Value') . '</th> - <th>' . _('Maximum Value') . '</th> - <th>' . _('Require in SO') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('Property Label') . '</th> + <th>' . _('Control Type') . '</th> + <th>' . _('Default Value') . '</th> + <th>' . _('Numeric Value') . '</th> + <th>' . _('Minimum Value') . '</th> + <th>' . _('Maximum Value') . '</th> + <th>' . _('Require in SO') . '</th> + </tr>'; echo $TableHeader; $PropertyCounter =0; $HeadingCounter =0; @@ -494,25 +514,24 @@ } else { $HeadingCounter++; } - echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value=' . $myrow['stkcatpropid'] . '>'; - echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '"></td> + echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="' . $myrow['stkcatpropid'] . '" />'; + echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '" /></td> <td><select name="PropControlType' . $PropertyCounter . '">'; if ($myrow['controltype']==0){ - echo '<option selected value=0>' . _('Text Box') . '</option>'; + echo '<option selected value="0">' . _('Text Box') . '</option>'; } else { - echo '<option value=0>' . _('Text Box') . '</option>'; + echo '<option value="0">' . _('Text Box') . '</option>'; } if ($myrow['controltype']==1){ - echo '<option selected value=1>' . _('Select Box') . '</option>'; + echo '<option selected value="1">' . _('Select Box') . '</option>'; } else { - echo '<option value=1>' . _('Select Box') . '</option>'; + echo '<option value="1">' . _('Select Box') . '</option>'; } if ($myrow['controltype']==2){ - echo '<option selected value=2>' . _('Check Box') . '</option>'; + echo '<option selected value="2">' . _('Check Box') . '</option>'; } else { - echo '<option value=2>' . _('Check Box') . '</option>'; + echo '<option value="2">' . _('Check Box') . '</option>'; } - echo '</select></td> <td><input type="textbox" name="PropDefault' . $PropertyCounter . '" value="' . $myrow['defaultvalue'] . '"></td> <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"'; @@ -532,33 +551,37 @@ } echo '></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td> + </tr>'; $PropertyCounter++; } //end loop around defined properties for this category - echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty">'; - echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100"></td> - <td><select name="PropControlType' . $PropertyCounter . '">'; - echo '<option selected value=0>' . _('Text Box') . '</option>'; - echo '<option value=1>' . _('Select Box') . '</option>'; - echo '<option value=2>' . _('Check Box') . '</option>'; - echo '</select></td> - <td><input type="textbox" name="PropDefault' . $PropertyCounter . '"></td> - <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"></td> - <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '"></td> - <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '"></td> - <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'"></td></tr>'; + echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty" />'; + echo '<tr> + <td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" /></td> + <td><select name="PropControlType' . $PropertyCounter . '"> + <option selected value=0>' . _('Text Box') . '</option> + <option value=1>' . _('Select Box') . '</option> + <option value=2>' . _('Check Box') . '</option> + </select></td> + <td><input type="textbox" name="PropDefault' . $PropertyCounter . '" /></td> + <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '" /></td> + <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '" /></td> + <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '" /></td> + <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'" /></td> + </tr>'; echo '</table>'; - echo '<input type=hidden name="PropertyCounter" value=' . $PropertyCounter . '>'; + echo '<input type="hidden" name="PropertyCounter" value="' . $PropertyCounter . '" />'; } /* end if there is a category selected */ - echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '"> + </div> + </form>'; - - echo '</form>'; - } //end if record deleted no point displaying form to add record Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2011-10-14 06:08:10 UTC (rev 4719) +++ trunk/StockCheck.php 2011-10-14 06:11:13 UTC (rev 4720) @@ -54,11 +54,12 @@ } if ($_POST['MakeStkChkData']=='AddUpdate'){ - $sql = "DELETE stockcheckfreeze FROM stockcheckfreeze - INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid - WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; + $sql = "DELETE stockcheckfreeze + FROM stockcheckfreeze + INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid + WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' + AND stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db) !=0) { @@ -83,12 +84,13 @@ '" . Date('Y-m-d') . "' FROM locstock INNER JOIN stockmaster ON locstock.stockid=stockmaster.stockid - WHERE locstock.loccode='" . $_POST['Location'] . "' AND - stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockmaster.mbflag!='A' AND - stockmaster.mbflag!='K' AND - stockmaster.mbflag!='D'"; + WHERE locstock.loccode='" . $_POST['Location'] . "' + AND stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.mbflag!='D'"; $result = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -112,26 +114,25 @@ } - $SQL = "SELECT stockmaster.categoryid, - stockcheckfreeze.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockcategory.categorydescription, - stockcheckfreeze.qoh - FROM stockcheckfreeze, - stockmaster, - stockcategory - WHERE stockcheckfreeze.stockid=stockmaster.stockid AND - stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid=stockcategory.categoryid AND - stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND - (stockmaster.mbflag='B' OR mbflag='M') AND - stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; - if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){ - $SQL .= ' AND stockcheckfreeze.qoh<>0'; - } + $SQL = "SELECT stockmaster.categoryid, + stockcheckfreeze.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockcategory.categorydescription, + stockcheckfreeze.qoh + FROM stockcheckfreeze INNER JOIN stockmaster + ON stockcheckfreeze.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND (stockmaster.mbflag='B' OR mbflag='M') + AND stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; + if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){ + $SQL .= " AND stockcheckfreeze.qoh<>0"; + } - $SQL .= ' ORDER BY stockmaster.categoryid, stockmaster.stockid'; + $SQL .= " ORDER BY stockmaster.categoryid, stockmaster.stockid"; $InventoryResult = DB_query($SQL,$db,'','',false,false); @@ -159,9 +160,9 @@ $Category = ''; - While ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){ + While ($InventoryCheckRow = DB_fetch_array($InventoryResult,$db)){ - if ($Category!=$InventoryPlan['categoryid']){ + if ($Category!=$InventoryCheckRow['categoryid']){ $FontSize=12; if ($Category!=''){ /*Then it's NOT the first time round */ /*draw a line under the CATEGORY TOTAL*/ @@ -169,8 +170,8 @@ $YPos -=(2*$line_height); } - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryPlan['categoryid'] . ' - ' . $InventoryPlan['categorydescription'], 'left'); - $Category = $InventoryPlan['categoryid']; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryCheckRow['categoryid'] . ' - ' . $InventoryCheckRow['categorydescription'], 'left'); + $Category = $InventoryCheckRow['categoryid']; } $FontSize=10; @@ -179,12 +180,11 @@ if (isset($_POST['ShowInfo']) and $_POST['ShowInfo']==true){ $SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand - FROM salesorderdetails, - salesorders - WHERE salesorderdetails.orderno=salesorders.orderno AND - salesorders.fromstkloc ='" . $_POST['Location'] . "' AND - salesorderdetails.stkcode = '" . $InventoryPlan['stockid'] . "' AND - salesorderdetails.completed = 0"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorderdetails.orderno=salesorders.orderno + WHERE salesorders.fromstkloc ='" . $_POST['Location'] . "' + AND salesorderdetails.stkcode = '" . $InventoryCheckRow['stockid'] . "' + AND salesorderdetails.completed = 0"; $DemandResult = DB_query($SQL,$db,'','',false, false); @@ -204,19 +204,17 @@ $DemandQty = $DemandRow['qtydemand']; //Also need to add in the demand for components of assembly items - $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) - AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent AND - salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $_POST['Location'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $InventoryPlan['stockid'] . "' AND - stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A'"; + $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.... [truncated message content] |
From: <dai...@us...> - 2011-10-16 00:17:36
|
Revision: 4721 http://web-erp.svn.sourceforge.net/web-erp/?rev=4721&view=rev Author: daintree Date: 2011-10-16 00:17:27 +0000 (Sun, 16 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/StockReorderLevel.php trunk/StockSerialItemResearch.php trunk/StockSerialItems.php trunk/StockStatus.php trunk/StockTransferControlled.php trunk/StockTransfers.php trunk/StockUsage.php trunk/StockUsageGraph.php trunk/Stocks.php trunk/SuppContractChgs.php trunk/SuppCreditGRNs.php trunk/SuppFixedAssetChgs.php trunk/SuppInvGRNs.php trunk/SuppLoginSetup.php trunk/SuppPaymentRun.php trunk/SuppPriceList.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierCredit.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/LanguagesArray.php trunk/includes/OutputSerialItems.php trunk/includes/phplot/ChangeLog trunk/includes/phplot/NEWS.txt trunk/includes/phplot/README.txt trunk/includes/phplot/contrib/color_range.example.php trunk/includes/phplot/contrib/color_range.php trunk/includes/phplot/contrib/color_range.test1.php trunk/includes/phplot/contrib/color_range.test2.php trunk/includes/phplot/contrib/prune_labels.example.php trunk/includes/phplot/contrib/prune_labels.php trunk/includes/phplot/contrib/prune_labels.test.php trunk/includes/phplot/phplot.php trunk/includes/phplot/rgb.inc.php trunk/index.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransfer.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -25,7 +25,7 @@ } $ErrorMessage=''; for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) and $_POST['StockID' . $i]!=''){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); $myrow = DB_fetch_row($result); @@ -35,12 +35,12 @@ $_POST['LinesCounter'] -= 10; } DB_free_result( $result ); - if (!is_numeric($_POST['StockQTY' . $i])){ + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ $InputError = True; $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; $_POST['LinesCounter'] -= 10; } - if ($_POST['StockQTY' . $i] <= 0){ + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ $InputError = True; $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; $_POST['LinesCounter'] -= 10; @@ -53,7 +53,7 @@ $db); $myrow = DB_fetch_row($result); - if ($myrow[0] < $_POST['StockQTY' . $i]){ + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ $InputError = True; $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; $_POST['LinesCounter'] -= 10; @@ -94,7 +94,7 @@ recloc) VALUES ('" . $_POST['Trf_ID'] . "', '" . $_POST['StockID' . $i] . "', - '" . round($_POST['StockQTY' . $i], $DecimalRow['decimalplaces']) . "', + '" . round(filter_number_format($_POST['StockQTY' . $i]), $DecimalRow['decimalplaces']) . "', '" . Date('Y-m-d') . "', '" . $_POST['FromStockLocation'] ."', '" . $_POST['ToStockLocation'] . "')"; @@ -136,8 +136,9 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; - echo '<tr><th colspan=4><input type=hidden name="Trf_ID" value="' . $Trf_ID . '"><font size=3 color=blue>'. - _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th></tr>'; + echo '<tr> + <th colspan="4"><input type="hidden" name="Trf_ID" value="' . $Trf_ID . '" /><font size="3" color="blue">'. _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th> + </tr>'; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); @@ -197,8 +198,8 @@ $k++; echo '<tr> - <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> </tr>'; } }else { @@ -215,20 +216,24 @@ $_POST['StockQTY' . $i]=0; } echo '<tr> - <td><input type="text" name="StockID' . $i .'" size=21 maxlength=20 value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size=10 maxlength=10 class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i]) . '" /></td> </tr>'; $i++; } - echo '</table><br /><div class="centre"> - <input type="hidden" name="LinesCounter" value='. $i .'> - <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"> - <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '"><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="hidden" name="LinesCounter" value="'. $i .'" /> + <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '" /> + <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '" /> + <br />'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockID0);</script>'; - echo '</form></div>'; + echo '</form> + </div>'; include('includes/footer.inc'); } ?> \ No newline at end of file Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransferReceive.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -29,7 +29,7 @@ foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { if (is_numeric(filter_number_format($_POST['Qty' . $i]))){ /*Update the quantity received from the inputs */ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$_SESSION['Transfer']->TransferItem[$i]->DecimalPlaces); } else { prnMsg(_('The quantity entered for'). ' ' . $TrfLine->StockID . ' '. _('is not numeric') . '. ' . _('All quantities must be numeric'),'error'); $InputError = True; @@ -47,7 +47,7 @@ } else { $_SESSION['Transfer']->TransferItem[$i]->CancelBalance=0; } - $TotalQuantity += filter_number_format($TrfLine->Quantity); + $TotalQuantity += $TrfLine->Quantity; $i++; } /*end loop to validate and update the SESSION['Transfer'] data */ if ($TotalQuantity < 0){ @@ -95,8 +95,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('To') . ' ' . $_SESSION['Transfer']->StockLocationToName . "', - '" . filter_number_format(round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -127,7 +127,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity - " . filter_number_format($Item->BundleQty) . " + quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' @@ -145,7 +145,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "')"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item for the stock being transferred out of the existing location could not be inserted because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -164,7 +164,7 @@ '" . $StkMoveNo . "', '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "' + '" . -$Item->BundleQty . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -207,8 +207,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('From') . ' ' . $_SESSION['Transfer']->StockLocationFromName ."', - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the incoming stock cannot be added because'); @@ -241,7 +241,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity + '" . filter_number_format($Item->BundleQty) . "' + quantity= quantity + '" . $Item->BundleQty . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' @@ -259,7 +259,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record for the stock coming in could not be added because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -277,7 +277,7 @@ VALUES (" . $StkMoveNo . ", '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -286,7 +286,7 @@ } /*end if the transfer item is a controlled item */ $SQL = "UPDATE locstock - SET quantity = quantity - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity - '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; @@ -295,7 +295,7 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); $SQL = "UPDATE locstock - SET quantity = quantity + '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; @@ -306,13 +306,13 @@ prnMsg(_('A stock transfer for item code'). ' - ' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . ' '. _('has been created from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . ' ' . _('for a quantity of'). ' '. $TrfLine->Quantity,'success'); if ($TrfLine->CancelBalance==1){ - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - shipqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + shipqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; } else { - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; @@ -419,17 +419,19 @@ echo '<br /> <table class="selection">'; - echo '<tr><th colspan="7"><font size=3 color=blue>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th></tr>'; + echo '<tr> + <th colspan="7"><font size="3" color="blue">' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th> + </tr>'; $tableheader = '<tr> - <th>'. _('Item Code') . '</th> - <th>'. _('Item Description'). '</th> - <th>'. _('Quantity Dispatched'). '</th> - <th>'. _('Quantity Received'). '</th> - <th>'. _('Quantity To Receive'). '</th> - <th>'. _('Units'). '</th> - <th>'. _('Cancel Balance') . '</th> - </tr>'; + <th>'. _('Item Code') . '</th> + <th>'. _('Item Description'). '</th> + <th>'. _('Quantity Dispatched'). '</th> + <th>'. _('Quantity Received'). '</th> + <th>'. _('Quantity To Receive'). '</th> + <th>'. _('Units'). '</th> + <th>'. _('Cancel Balance') . '</th> + </tr>'; echo $tableheader; $k=0; @@ -445,30 +447,33 @@ echo '<td>' . $TrfLine->StockID . '</td> <td>' . $TrfLine->ItemDescription . '</td>'; - echo '<td class=number>' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; if (isset($_POST['Qty' . $i]) AND is_numeric(filter_number_format($_POST['Qty' . $i]))){ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); - $Qty = filter_number_format($_POST['Qty' . $i]); + + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + + $Qty = round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + } else if ($TrfLine->Controlled==1) { if (sizeOf($TrfLine->SerialItems)==0) { $Qty = 0; } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } - echo '<td class=number>' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; if ($TrfLine->Controlled==1){ - echo '<td class=number><input type=hidden name="Qty' . $i . '" value="' . $Qty . '"><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; + echo '<td class="number"><input type="hidden" name="Qty' . $i . '" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; } else { - echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength=10 class="number" size=auto value="' . $Qty . '"></td>'; + echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength="10" class="number" size="auto" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /></td>'; } echo '<td>' . $TrfLine->PartUnit . '</td>'; - echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1></td>'; + echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1 /></td>'; if ($TrfLine->Controlled==1){ @@ -484,9 +489,13 @@ $i++; /* the array of TransferItem s is indexed numerically and i matches the index no */ } /*end of foreach TransferItem */ - echo '</table><br /> - <div class="centre"><input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"><br /> - </form></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"> + <br /> + </div> + </form>'; echo '<a href="'.$_SERVER['PHP_SELF']. '?NewTransfer=true">'. _('Select A Different Transfer').'</a>'; } else { /*Not $_SESSION['Transfer'] set */ @@ -498,20 +507,26 @@ $LocResult = DB_query("SELECT locationname, loccode FROM locations",$db); - echo '<table class=selection>'; - echo '<tr><td>'. _('Select Location Receiving Into'). ':</td><td>'; + echo '<table class="selection">'; + echo '<tr> + <td>'. _('Select Location Receiving Into'). ':</td> + <td>'; echo '<select name="RecLocation" onChange="ReloadForm(form1.RefreshTransferList)">'; if (!isset($_POST['RecLocation'])){ $_POST['RecLocation'] = $_SESSION['UserStockLocation']; } while ($myrow=DB_fetch_array($LocResult)){ if ($myrow['loccode'] == $_POST['RecLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select><input type=submit name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td></tr></table><p>'; + echo '</select> + <input type="submit" name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td> + </tr> + </table> + <p />'; $sql = "SELECT DISTINCT reference, locations.locationname as trffromloc, @@ -527,7 +542,7 @@ $LocResult = DB_query($LocSql,$db); $LocRow = DB_fetch_array($LocResult); echo '<table class="selection">'; - echo '<tr><th colspan="4"><font size="3" color=blue>'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; + echo '<tr><th colspan="4"><font size="3" color="blue">'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; echo '<tr> <th>'. _('Transfer Ref'). '</th> <th>'. _('Transfer From'). '</th> @@ -543,9 +558,10 @@ $k++; } echo '<td class="number">' . $myrow['reference'] . '</td> - <td>' . $myrow['trffromloc'] . '</td> - <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td></tr>'; + <td>' . $myrow['trffromloc'] . '</td> + <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td> + </tr>'; } echo '</table>'; } else if (!isset($_POST['ProcessTransfer'])) { Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockMovements.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -27,8 +27,9 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } -echo '<br /><table cellpadding=2 class=selection>'; -echo '<tr><th colspan=10>' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength=20>'; +echo '<br /> + <table class="selection">'; +echo '<tr><th colspan="10">' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength="20" />'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; @@ -50,36 +51,37 @@ } } -echo '</select></th></tr>'; -echo '<tr><th colspan=10>' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['AfterDate'] . '">'; -echo ' <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '"></th></tr>'; +echo '</select></th> + </tr>'; +echo '<tr> + <th colspan="10">' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /> ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> + </tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); $sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.stockid = '" . $StockID . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '". $SQLAfterDate . "' + AND stockmoves.stockid = '" . $StockID . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; $DbgMsg = _('The SQL that failed was') . ' '; @@ -87,17 +89,17 @@ $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('New Qty') . '</th> - </tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th> + </tr>'; echo $tableheader; @@ -123,11 +125,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s%%</td> + <td class="number">%s</td> </tr>', $rootpath, $myrow['transno'], @@ -136,10 +138,9 @@ $DisplayTranDate, $myrow['debtorno'], $myrow['branchcode'], - locale_number_format($myrow['qty'], - $myrow['decimalplaces']), + locale_number_format($myrow['qty'],$myrow['decimalplaces']), $myrow['reference'], - locale_number_format($myrow['price'],2), + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); @@ -150,11 +151,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s%%</td> + <td class="number">%s</td> </tr>', $rootpath, $myrow['transno'], @@ -171,26 +172,26 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <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> - </tr>', - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <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> + </tr>', + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + locale_number_format($myrow['qty'],$myrow['decimalplaces']), + $myrow['reference'], + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($myrow['discountpercent']*100,2), + locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); } //end of page full new headings if } Modified: trunk/StockQuantityByDate.php =================================================================== --- trunk/StockQuantityByDate.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockQuantityByDate.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -6,19 +6,22 @@ $title = _('Stock On Hand By Date'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $resultStkLocs = DB_query($sql, $db); -echo '<table class=selection><tr>'; -echo '<td>' . _('For Stock Category') . ':</td> - <td><select name="StockCategory"> '; -echo '<option value="All">' . _('All') . '</option>'; +echo '<table class="selection"> + <tr> + <td>' . _('For Stock Category') . ':</td> + <td><select name="StockCategory"> + <option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockCategory']) AND $_POST['StockCategory']!='All'){ @@ -60,9 +63,15 @@ } echo '<td>' . _('On-Hand On Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size=12 maxlength=12 value="' . $_POST['OnHandDate'] . '"></td></tr>'; -echo '<tr><td colspan=6><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'"></div></td></tr></table>'; -echo '</form>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size="12" maxlength="12" value="' . $_POST['OnHandDate'] . '" /></td></tr>'; +echo '<tr> + <td colspan="6"> + <div class="centre"> + <input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'" /> + </div></td> + </tr> + </table> + </form>'; $TotalQuantity = 0; @@ -89,12 +98,14 @@ $SQLOnHandDate = FormatDateForSQL($_POST['OnHandDate']); - echo '<br /><table cellpadding=5 cellspacing=1 class=selection>'; + echo '<br /> + <table class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th></tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; echo $tableheader; while ($myrows=DB_fetch_array($StockResult)) { @@ -128,16 +139,16 @@ if($NumRows == 0){ printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> - <td>%s</td> - <td class="number">%s</td>', - 'StockID=' . mb_strtoupper($myrows['stockid']), - mb_strtoupper($myrows['stockid']), - $myrows['description'], - 0); + <td>%s</td> + <td class="number">%s</td>', + 'StockID=' . mb_strtoupper($myrows['stockid']), + mb_strtoupper($myrows['stockid']), + $myrows['description'], + 0); } else { printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> <td>%s</td> - <td class=number>%s</td>', + <td class="number">%s</td>', 'StockID=' . mb_strtoupper($myrows['stockid']), mb_strtoupper($myrows['stockid']), $myrows['description'], @@ -154,7 +165,9 @@ } }//end of while loop - echo '<tr><td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td></tr> + echo '<tr> + <td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td> + </tr> </table>'; } Modified: trunk/StockReorderLevel.php =================================================================== --- trunk/StockReorderLevel.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockReorderLevel.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -14,8 +14,9 @@ echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a>'; -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . $title. '</b> + </p>'; $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='" . $StockID . "'", $db); $myrow = DB_fetch_row($result); @@ -24,32 +25,35 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - stockmaster.decimalplaces - FROM locstock INNER JOIN locations - ON locstock.loccode=locations.loccode - INNER JOIN stockmaster - ON locstock.stockid=stockmaster.stockid - WHERE locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + stockmaster.decimalplaces + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + INNER JOIN stockmaster + ON locstock.stockid=stockmaster.stockid + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -echo '<table cellpadding="2" class="selection">'; -echo '<tr><th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20">'; -echo '<input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '"></th></tr>'; -echo '<tr><th colspan=3><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th></tr>'; +echo '<table class="selection">'; +echo '<tr> + <th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" /><input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '" /></th> + </tr>'; +echo '<tr> + <th colspan="3"><font color="blue" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th> + </tr>'; $TableHeader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -65,10 +69,12 @@ $k=1; } - if (isset($_POST['UpdateData']) AND is_numeric($_POST[$myrow['loccode']]) AND $_POST[$myrow['loccode']]>=0){ + if (isset($_POST['UpdateData']) + AND is_numeric(filter_number_format($_POST[$myrow['loccode']])) + AND $_POST[$myrow['loccode']]>=0){ $myrow['reorderlevel'] = $_POST[$myrow['loccode']]; - $sql = "UPDATE locstock SET reorderlevel = '" . $_POST[$myrow['loccode']] . "' + $sql = "UPDATE locstock SET reorderlevel = '" . filter_number_format($_POST[$myrow['loccode']]) . "' WHERE stockid = '" . $StockID . "' AND loccode = '" . $myrow['loccode'] ."'"; $UpdateReorderLevel = DB_query($sql, $db); @@ -76,12 +82,12 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', - $myrow['locationname'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - $myrow['loccode'], - $myrow['reorderlevel']); + <td class="number">%s</td> + <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', + $myrow['locationname'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + $myrow['loccode'], + $myrow['reorderlevel']); $j++; If ($j == 12){ $j=1; @@ -92,12 +98,18 @@ //end of while loop echo '</table> - <br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '" /><br /><br />'; + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; + echo '<a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; -echo '</div></form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockSerialItemResearch.php =================================================================== --- trunk/StockSerialItemResearch.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItemResearch.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -1,49 +1,50 @@ <?php /* $Id$*/ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Serial Item Research'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; //validate the submission if (isset($_POST['serialno'])) { - $SN = trim($_POST['serialno']); + $SerialNo = trim($_POST['serialno']); } elseif(isset($_GET['serialno'])) { - $SN = trim($_GET['serialno']); + $SerialNo = trim($_GET['serialno']); } else { - $SN = ''; + $SerialNo = ''; } -$SN = $SN; + echo '<div class="centre"> <br /> -<form name=SNRESEARCH method=post action="' . $_SERVER['PHP_SELF'] .'">'; +<form name="SerialNoResearch" method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Serial Number') .': <input ID="serialno" name="serialno" size=21 maxlength=20 VALUE="'. $SN . '"> -<input type=submit name=submit></div><br /> +echo _('Serial Number') .': <input ID="serialno" name="serialno" size="21" maxlength="20" value="'. $SerialNo . '" /> <input type="submit" name="submit" /> +</div> +<br /> </form>'; -echo "<SCRIPT> -document.getElementById('serialno').focus(); -</SCRIPT>"; +echo '<SCRIPT> +document.getElementById("serialno").focus(); +</SCRIPT>'; -if ($SN!='') { +if ($SerialNo!='') { //the point here is to allow a semi fuzzy search, but still keep someone from killing the db server - if (mb_strstr($SN,'%')){ - while(mb_strstr($SN,'%%')) { - $SN = str_replace('%%','%',$SN); + if (mb_strstr($SerialNo,'%')){ + while(mb_strstr($SerialNo,'%%')) { + $SerialNo = str_replace('%%','%',$SerialNo); } - if (mb_strlen($SN) < 11){ - $SN = str_replace('%','',$SN); + if (mb_strlen($SerialNo) < 11){ + $SerialNo = str_replace('%','',$SerialNo); prnMsg('You can not use LIKE with short numbers. It has been removed.','warn'); } } @@ -60,55 +61,56 @@ ON sm.type=st.typeid INNER JOIN locations l on sm.loccode = l.loccode - WHERE ssi.serialno like '$SN' + WHERE ssi.serialno " . LIKE . " '" . $SerialNo . "' ORDER BY stkmoveno"; $result = DB_query($SQL,$db); if (DB_num_rows($result) == 0){ - prnMsg( _('No History found for Serial Number'). ': <b>'.$SN.'</b>' , 'warn'); + prnMsg( _('No History found for Serial Number'). ': <b>'.$SerialNo.'</b>' , 'warn'); } else { - echo '<h4>'. _('Details for Serial Item').': <b>'.$SN.'</b><br />'. _('Length').'='.mb_strlen($SN).'</h4>'; - echo '<table class=selection>'; - echo "<tr><th>" . _('StockID') . "</th> - <th>" . _('CurInvQty') . "</th> - <th>" . _('Move Qty') . "</th> - <th>" . _('Move Type') . "</th> - <th>" . _('Trans #') . "</th> - <th>" . _('Location') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('DebtorNo') . "</th> - <th>" . _('Branch') . "</th> - <th>" . _('Move Ref') . "</th> - <th>" . _('Total Move Qty') . "</th> - </tr>"; + echo '<h4>'. _('Details for Serial Item').': <b>'.$SerialNo.'</b><br />'. _('Length').'='.mb_strlen($SerialNo).'</h4>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('StockID') . '</th> + <th>' . _('CurInvQty') . '</th> + <th>' . _('Move Qty') . '</th> + <th>' . _('Move Type') . '</th> + <th>' . _('Trans #') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('DebtorNo') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Move Ref') . '</th> + <th>' . _('Total Move Qty') . '</th> + </tr>'; while ($myrow=DB_fetch_row($result)) { - printf("<tr> - <td>%s<br />%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s (%s)</td> - <td class=number>%s</td> - <td>%s - %s</td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td class=number>%s</td> - </tr>", - $myrow[1], - $myrow[0], - $myrow[2], - $myrow[3], - $myrow[5], $myrow[4], - $myrow[6], - $myrow[7], $myrow[8], - $myrow[9], - $myrow[10], - $myrow[11], - $myrow[12], - $myrow[13] - ); + printf('<tr> + <td>%s<br />%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s (%s)</td> + <td class="number">%s</td> + <td>%s - %s</td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td class="number">%s</td> + </tr>', + $myrow[1], + $myrow[0], + $myrow[2], + $myrow[3], + $myrow[5], $myrow[4], + $myrow[6], + $myrow[7], $myrow[8], + $myrow[9], + $myrow[10], + $myrow[11], + $myrow[12], + $myrow[13] + ); } //END WHILE LIST LOOP echo '</table>'; } // ELSE THERE WHERE ROWS Modified: trunk/StockSerialItems.php =================================================================== --- trunk/StockSerialItems.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItems.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -5,8 +5,10 @@ $title = _('Stock Of Controlled Items'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; if (isset($_GET['StockID'])){ if (ContainsIllegalCharacters ($_GET['StockID'])){ @@ -70,50 +72,52 @@ $ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); $LocStockResult = DB_query($sql, $db, $ErrMsg); -echo '<table cellpadding=2 class="selection">'; +echo '<table class="selection">'; if ($Serialised==1){ - echo '<tr><th colspan="5"><font color=navy size=2>' . _('Serialised items in') . ' '; + echo '<tr><th colspan="5"><font color="navy" size="2">' . _('Serialised items in') . ' '; } else { - echo '<tr><th colspan="11"><font color=navy size=2>' . _('Controlled items in') . ' '; + echo '<tr><th colspan="11"><font color="navy" size="2">' . _('Controlled items in') . ' '; } echo $myrow[0]. '</font></th></tr>'; -echo '<tr><th colspan="11"><font color=navy size=2>' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th></tr>'; +echo '<tr> + <th colspan="11"><font color="navy" size="2">' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th> + </tr>'; if ($Serialised == 1){ $tableheader = '<tr> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - </tr>'; + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==0){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==1){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + </tr>'; } echo $tableheader; $TotalQuantity =0; Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockStatus.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -22,27 +22,25 @@ //echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; $result = DB_query("SELECT description, - units, - mbflag, - decimalplaces, - serialised, - controlled - FROM - stockmaster - WHERE - stockid='".$StockID."'", - $db, - _('Could not retrieve the requested item'), - _('The SQL used to retrieve the items was')); + units, + mbflag, + decimalplaces, + serialised, + controlled + FROM stockmaster + WHERE stockid='".$StockID."'", + $db, + _('Could not retrieve the requested item'), + _('The SQL used to retrieve the items was')); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$DecimalPlaces = $myrow[3]; -$Serialised = $myrow[4]; -$Controlled = $myrow[5]; +$DecimalPlaces = $myrow['decimalplaces']; +$Serialised = $myrow['serialised']; +$Controlled = $myrow['controlled']; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . - '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; + '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' : ' . _('in units of') . ' : ' . $myrow['units'] . '</b></p>'; $Its_A_KitSet_Assembly_Or_Dummy =False; if ($myrow[2]=='K'){ @@ -56,43 +54,43 @@ prnMsg( _('This is an dummy part and cannot have a stock holding') . ', ' . _('only the total quantity on outstanding sales orders is shown'),'info'); } -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method="post">'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<div class="centre"><input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; -echo ' <input type="submit" name="ShowStatus" VALUE="' . _('Show Stock Status') . '" /></div>'; +echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /></div>'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - locations.managed - FROM locstock, - locations - WHERE locstock.loccode=locations.loccode AND - locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + locations.managed + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -echo '<br /><table cellpadding="2" class="selection">'; +echo '<br /> + <table class="selection">'; if ($Its_A_KitSet_Assembly_Or_Dummy == True){ $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Demand') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Demand') . '</th> + </tr>'; } else { $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + <th>' . _('Demand') . '</th> + <th>' . _('Available') . '</th> + <th>' . _('On Order') . '</th> + </tr>'; } echo $tableheader; $j = 1; @@ -109,13 +107,12 @@ } $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $myrow['loccode'] . "' AND - salesorderdetails.completed=0 AND - salesorders.quotation=0 AND - salesorderdetails.stkcode='" . $StockID . "'"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.completed=0 + AND salesorders.quotation=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -129,17 +126,17 @@ //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent AND - salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $myrow['loccode'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $StockID . "' AND stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A' - AND salesorders.quotation=0"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN bom + ON salesorderdetails.stkcode=bom.parent + INNER JOIN stockmaster + ON stockmaster.stockid=bom.parent + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.mbflag='A' + AND salesorders.quotation=0"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -152,14 +149,14 @@ //Also the demand for the item as a component of works orders $sql = "SELECT SUM(qtypu*(woitems.qtyreqd - woitems.qtyrecd)) AS woqtydemo - FROM woitems INNER JOIN worequirements - ON woitems.stockid=worequirements.parentstockid - INNER JOIN workorders - ON woitems.wo=workorders.wo - AND woitems.wo=worequirements.wo - WHERE workorders.loccode='" . $myrow['loccode'] . "' - AND worequirements.stockid='" . $StockID . "' - AND workorders.closed=0"; + FROM woitems INNER JOIN worequirements + ON woitems.stockid=worequirements.parentstockid + INNER JOIN workorders + ON woitems.wo=workorders.wo + AND woitems.wo=worequirements.wo + WHERE workorders.loccode='" . $myrow['loccode'] . "' + AND worequirements.stockid='" . $StockID . "' + AND workorders.closed=0"; $ErrMsg = _('The workorder component demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -173,16 +170,14 @@ $sql="SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) - FROM purchorders - LEFT JOIN purchorderdetails - ON purchorders.orderno=purchorderdetails.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorderdetails.itemcode='" . $StockID . "' - AND purchorders.intostocklocation='" . $myrow['loccode'] . "' - AND (purchorders.status<>'Cancelled' - AND purchorders.status<>'Pending')"; + FROM purchorders LEFT JOIN purchorderdetails + ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN purchdata ON purchorders.supplierno=purchdata.supplierno + AND purchorderdetails.itemcode=purchdata.stockid + WHERE purchorderdetails.itemcode='" . $StockID . "' + AND purchorders.intostocklocation='" . $myrow['loccode'] . "' + AND (purchorders.status<>'Cancelled' + AND purchorders.status<>'Pending')"; $ErrMsg = _('The quantity on order for this product to be received into') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $QOOResult = DB_query($sql,$db,$ErrMsg, $DbgMsg); @@ -211,33 +206,32 @@ echo '<td>' . $myrow['locationname'] . '</td>'; printf('<td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td></tr>', - locale_number_format($myrow['quantity'], $DecimalPlaces), - locale_number_format($myrow['reorderlevel'], $DecimalPlaces), - locale_number_format($DemandQty, $DecimalPlaces), - locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), - locale_number_format($QOO, $DecimalPlaces) - ); + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td></tr>', + locale_number_format($myrow['quantity'], $DecimalPlaces), + locale_number_format($myrow['reorderlevel'], $DecimalPlaces), + locale_number_format($DemandQty, $DecimalPlaces), + locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), + locale_number_format($QOO, $DecimalPlaces) + ); if ($Serialised ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($Controlled==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Batches') . '</a></td></tr>'; } } else { /* It must be a dummy, assembly or kitset part */ printf('<td>%s</td> - <td class="number">%s</td> - </tr>', - $myrow['locationname'], - locale_number_format($DemandQty, $DecimalPlaces) - ); + <td class="number">%s</td> + </tr>', + $myrow['locationname'], + locale_number_format($DemandQty, $DecimalPlaces)); } //end of page full new headings if } @@ -268,13 +262,14 @@ /* only show pricing history for sales invoices - type=10 */ $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; - $DbgMsg = _('The SQL that failed was') . ' '; + $DbgMsg = _('The SQL that failed was'); $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $k=1; while ($myrow=DB_fetch_array($MovtsResult)) { - if ($LastPrice != $myrow['price'] OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ + if ($LastPrice != $myrow['price'] + OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ if (isset($qty)) { $DateRange=ConvertSQLDate($FromDate); if ($FromDate != $ToDate) { @@ -305,19 +300,22 @@ $PriceHistory[] = array($DateRange, $qty, $LastPrice, $LastDiscount); } if (isset($PriceHistory)) { - echo '<br /><table cellpadding="4" class="selection">'; - echo '<tr><th colspan=4><font color=navy size=2>' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th></tr>'; - $tableheader = "<tr> - <th>" . _('Date Range') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Price') . "</th> - <th>" . _('Discount') . "</th> - </tr>"; - + echo '<br /> + <table class="selection">'; + echo '<tr> + <th colspan="4"><font color="navy" size="2">' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th> + </tr>'; + $tableheader = '<tr> + <th>' . _('Date Range') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + </tr>'; + $j = 0; $k = 0; //row colour counter - foreach($PriceHistory as $ph) { + foreach($PriceHistory as $PreviousPrice) { $j--; if ($j < 0 ){ $j = 11; @@ -333,15 +331,14 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td class="number">%s... [truncated message content] |
From: <dai...@us...> - 2011-10-16 00:17:36
|
Revision: 4721 http://web-erp.svn.sourceforge.net/web-erp/?rev=4721&view=rev Author: daintree Date: 2011-10-16 00:17:27 +0000 (Sun, 16 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/StockReorderLevel.php trunk/StockSerialItemResearch.php trunk/StockSerialItems.php trunk/StockStatus.php trunk/StockTransferControlled.php trunk/StockTransfers.php trunk/StockUsage.php trunk/StockUsageGraph.php trunk/Stocks.php trunk/SuppContractChgs.php trunk/SuppCreditGRNs.php trunk/SuppFixedAssetChgs.php trunk/SuppInvGRNs.php trunk/SuppLoginSetup.php trunk/SuppPaymentRun.php trunk/SuppPriceList.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierCredit.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/LanguagesArray.php trunk/includes/OutputSerialItems.php trunk/includes/phplot/ChangeLog trunk/includes/phplot/NEWS.txt trunk/includes/phplot/README.txt trunk/includes/phplot/contrib/color_range.example.php trunk/includes/phplot/contrib/color_range.php trunk/includes/phplot/contrib/color_range.test1.php trunk/includes/phplot/contrib/color_range.test2.php trunk/includes/phplot/contrib/prune_labels.example.php trunk/includes/phplot/contrib/prune_labels.php trunk/includes/phplot/contrib/prune_labels.test.php trunk/includes/phplot/phplot.php trunk/includes/phplot/rgb.inc.php trunk/index.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransfer.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -25,7 +25,7 @@ } $ErrorMessage=''; for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) and $_POST['StockID' . $i]!=''){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); $myrow = DB_fetch_row($result); @@ -35,12 +35,12 @@ $_POST['LinesCounter'] -= 10; } DB_free_result( $result ); - if (!is_numeric($_POST['StockQTY' . $i])){ + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ $InputError = True; $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; $_POST['LinesCounter'] -= 10; } - if ($_POST['StockQTY' . $i] <= 0){ + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ $InputError = True; $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; $_POST['LinesCounter'] -= 10; @@ -53,7 +53,7 @@ $db); $myrow = DB_fetch_row($result); - if ($myrow[0] < $_POST['StockQTY' . $i]){ + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ $InputError = True; $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; $_POST['LinesCounter'] -= 10; @@ -94,7 +94,7 @@ recloc) VALUES ('" . $_POST['Trf_ID'] . "', '" . $_POST['StockID' . $i] . "', - '" . round($_POST['StockQTY' . $i], $DecimalRow['decimalplaces']) . "', + '" . round(filter_number_format($_POST['StockQTY' . $i]), $DecimalRow['decimalplaces']) . "', '" . Date('Y-m-d') . "', '" . $_POST['FromStockLocation'] ."', '" . $_POST['ToStockLocation'] . "')"; @@ -136,8 +136,9 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; - echo '<tr><th colspan=4><input type=hidden name="Trf_ID" value="' . $Trf_ID . '"><font size=3 color=blue>'. - _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th></tr>'; + echo '<tr> + <th colspan="4"><input type="hidden" name="Trf_ID" value="' . $Trf_ID . '" /><font size="3" color="blue">'. _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th> + </tr>'; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); @@ -197,8 +198,8 @@ $k++; echo '<tr> - <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> </tr>'; } }else { @@ -215,20 +216,24 @@ $_POST['StockQTY' . $i]=0; } echo '<tr> - <td><input type="text" name="StockID' . $i .'" size=21 maxlength=20 value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size=10 maxlength=10 class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i]) . '" /></td> </tr>'; $i++; } - echo '</table><br /><div class="centre"> - <input type="hidden" name="LinesCounter" value='. $i .'> - <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"> - <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '"><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="hidden" name="LinesCounter" value="'. $i .'" /> + <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '" /> + <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '" /> + <br />'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockID0);</script>'; - echo '</form></div>'; + echo '</form> + </div>'; include('includes/footer.inc'); } ?> \ No newline at end of file Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransferReceive.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -29,7 +29,7 @@ foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { if (is_numeric(filter_number_format($_POST['Qty' . $i]))){ /*Update the quantity received from the inputs */ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$_SESSION['Transfer']->TransferItem[$i]->DecimalPlaces); } else { prnMsg(_('The quantity entered for'). ' ' . $TrfLine->StockID . ' '. _('is not numeric') . '. ' . _('All quantities must be numeric'),'error'); $InputError = True; @@ -47,7 +47,7 @@ } else { $_SESSION['Transfer']->TransferItem[$i]->CancelBalance=0; } - $TotalQuantity += filter_number_format($TrfLine->Quantity); + $TotalQuantity += $TrfLine->Quantity; $i++; } /*end loop to validate and update the SESSION['Transfer'] data */ if ($TotalQuantity < 0){ @@ -95,8 +95,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('To') . ' ' . $_SESSION['Transfer']->StockLocationToName . "', - '" . filter_number_format(round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -127,7 +127,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity - " . filter_number_format($Item->BundleQty) . " + quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' @@ -145,7 +145,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "')"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item for the stock being transferred out of the existing location could not be inserted because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -164,7 +164,7 @@ '" . $StkMoveNo . "', '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "' + '" . -$Item->BundleQty . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -207,8 +207,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('From') . ' ' . $_SESSION['Transfer']->StockLocationFromName ."', - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the incoming stock cannot be added because'); @@ -241,7 +241,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity + '" . filter_number_format($Item->BundleQty) . "' + quantity= quantity + '" . $Item->BundleQty . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' @@ -259,7 +259,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record for the stock coming in could not be added because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -277,7 +277,7 @@ VALUES (" . $StkMoveNo . ", '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -286,7 +286,7 @@ } /*end if the transfer item is a controlled item */ $SQL = "UPDATE locstock - SET quantity = quantity - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity - '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; @@ -295,7 +295,7 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); $SQL = "UPDATE locstock - SET quantity = quantity + '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; @@ -306,13 +306,13 @@ prnMsg(_('A stock transfer for item code'). ' - ' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . ' '. _('has been created from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . ' ' . _('for a quantity of'). ' '. $TrfLine->Quantity,'success'); if ($TrfLine->CancelBalance==1){ - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - shipqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + shipqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; } else { - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; @@ -419,17 +419,19 @@ echo '<br /> <table class="selection">'; - echo '<tr><th colspan="7"><font size=3 color=blue>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th></tr>'; + echo '<tr> + <th colspan="7"><font size="3" color="blue">' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th> + </tr>'; $tableheader = '<tr> - <th>'. _('Item Code') . '</th> - <th>'. _('Item Description'). '</th> - <th>'. _('Quantity Dispatched'). '</th> - <th>'. _('Quantity Received'). '</th> - <th>'. _('Quantity To Receive'). '</th> - <th>'. _('Units'). '</th> - <th>'. _('Cancel Balance') . '</th> - </tr>'; + <th>'. _('Item Code') . '</th> + <th>'. _('Item Description'). '</th> + <th>'. _('Quantity Dispatched'). '</th> + <th>'. _('Quantity Received'). '</th> + <th>'. _('Quantity To Receive'). '</th> + <th>'. _('Units'). '</th> + <th>'. _('Cancel Balance') . '</th> + </tr>'; echo $tableheader; $k=0; @@ -445,30 +447,33 @@ echo '<td>' . $TrfLine->StockID . '</td> <td>' . $TrfLine->ItemDescription . '</td>'; - echo '<td class=number>' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; if (isset($_POST['Qty' . $i]) AND is_numeric(filter_number_format($_POST['Qty' . $i]))){ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); - $Qty = filter_number_format($_POST['Qty' . $i]); + + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + + $Qty = round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + } else if ($TrfLine->Controlled==1) { if (sizeOf($TrfLine->SerialItems)==0) { $Qty = 0; } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } - echo '<td class=number>' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; if ($TrfLine->Controlled==1){ - echo '<td class=number><input type=hidden name="Qty' . $i . '" value="' . $Qty . '"><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; + echo '<td class="number"><input type="hidden" name="Qty' . $i . '" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; } else { - echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength=10 class="number" size=auto value="' . $Qty . '"></td>'; + echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength="10" class="number" size="auto" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /></td>'; } echo '<td>' . $TrfLine->PartUnit . '</td>'; - echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1></td>'; + echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1 /></td>'; if ($TrfLine->Controlled==1){ @@ -484,9 +489,13 @@ $i++; /* the array of TransferItem s is indexed numerically and i matches the index no */ } /*end of foreach TransferItem */ - echo '</table><br /> - <div class="centre"><input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"><br /> - </form></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"> + <br /> + </div> + </form>'; echo '<a href="'.$_SERVER['PHP_SELF']. '?NewTransfer=true">'. _('Select A Different Transfer').'</a>'; } else { /*Not $_SESSION['Transfer'] set */ @@ -498,20 +507,26 @@ $LocResult = DB_query("SELECT locationname, loccode FROM locations",$db); - echo '<table class=selection>'; - echo '<tr><td>'. _('Select Location Receiving Into'). ':</td><td>'; + echo '<table class="selection">'; + echo '<tr> + <td>'. _('Select Location Receiving Into'). ':</td> + <td>'; echo '<select name="RecLocation" onChange="ReloadForm(form1.RefreshTransferList)">'; if (!isset($_POST['RecLocation'])){ $_POST['RecLocation'] = $_SESSION['UserStockLocation']; } while ($myrow=DB_fetch_array($LocResult)){ if ($myrow['loccode'] == $_POST['RecLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select><input type=submit name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td></tr></table><p>'; + echo '</select> + <input type="submit" name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td> + </tr> + </table> + <p />'; $sql = "SELECT DISTINCT reference, locations.locationname as trffromloc, @@ -527,7 +542,7 @@ $LocResult = DB_query($LocSql,$db); $LocRow = DB_fetch_array($LocResult); echo '<table class="selection">'; - echo '<tr><th colspan="4"><font size="3" color=blue>'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; + echo '<tr><th colspan="4"><font size="3" color="blue">'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; echo '<tr> <th>'. _('Transfer Ref'). '</th> <th>'. _('Transfer From'). '</th> @@ -543,9 +558,10 @@ $k++; } echo '<td class="number">' . $myrow['reference'] . '</td> - <td>' . $myrow['trffromloc'] . '</td> - <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td></tr>'; + <td>' . $myrow['trffromloc'] . '</td> + <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td> + </tr>'; } echo '</table>'; } else if (!isset($_POST['ProcessTransfer'])) { Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockMovements.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -27,8 +27,9 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } -echo '<br /><table cellpadding=2 class=selection>'; -echo '<tr><th colspan=10>' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength=20>'; +echo '<br /> + <table class="selection">'; +echo '<tr><th colspan="10">' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength="20" />'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; @@ -50,36 +51,37 @@ } } -echo '</select></th></tr>'; -echo '<tr><th colspan=10>' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['AfterDate'] . '">'; -echo ' <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '"></th></tr>'; +echo '</select></th> + </tr>'; +echo '<tr> + <th colspan="10">' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /> ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> + </tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); $sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.stockid = '" . $StockID . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '". $SQLAfterDate . "' + AND stockmoves.stockid = '" . $StockID . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; $DbgMsg = _('The SQL that failed was') . ' '; @@ -87,17 +89,17 @@ $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('New Qty') . '</th> - </tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th> + </tr>'; echo $tableheader; @@ -123,11 +125,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s%%</td> + <td class="number">%s</td> </tr>', $rootpath, $myrow['transno'], @@ -136,10 +138,9 @@ $DisplayTranDate, $myrow['debtorno'], $myrow['branchcode'], - locale_number_format($myrow['qty'], - $myrow['decimalplaces']), + locale_number_format($myrow['qty'],$myrow['decimalplaces']), $myrow['reference'], - locale_number_format($myrow['price'],2), + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); @@ -150,11 +151,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%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 class="number">%s%%</td> + <td class="number">%s</td> </tr>', $rootpath, $myrow['transno'], @@ -171,26 +172,26 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <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> - </tr>', - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <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> + </tr>', + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + locale_number_format($myrow['qty'],$myrow['decimalplaces']), + $myrow['reference'], + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($myrow['discountpercent']*100,2), + locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); } //end of page full new headings if } Modified: trunk/StockQuantityByDate.php =================================================================== --- trunk/StockQuantityByDate.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockQuantityByDate.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -6,19 +6,22 @@ $title = _('Stock On Hand By Date'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $resultStkLocs = DB_query($sql, $db); -echo '<table class=selection><tr>'; -echo '<td>' . _('For Stock Category') . ':</td> - <td><select name="StockCategory"> '; -echo '<option value="All">' . _('All') . '</option>'; +echo '<table class="selection"> + <tr> + <td>' . _('For Stock Category') . ':</td> + <td><select name="StockCategory"> + <option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockCategory']) AND $_POST['StockCategory']!='All'){ @@ -60,9 +63,15 @@ } echo '<td>' . _('On-Hand On Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size=12 maxlength=12 value="' . $_POST['OnHandDate'] . '"></td></tr>'; -echo '<tr><td colspan=6><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'"></div></td></tr></table>'; -echo '</form>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size="12" maxlength="12" value="' . $_POST['OnHandDate'] . '" /></td></tr>'; +echo '<tr> + <td colspan="6"> + <div class="centre"> + <input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'" /> + </div></td> + </tr> + </table> + </form>'; $TotalQuantity = 0; @@ -89,12 +98,14 @@ $SQLOnHandDate = FormatDateForSQL($_POST['OnHandDate']); - echo '<br /><table cellpadding=5 cellspacing=1 class=selection>'; + echo '<br /> + <table class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th></tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; echo $tableheader; while ($myrows=DB_fetch_array($StockResult)) { @@ -128,16 +139,16 @@ if($NumRows == 0){ printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> - <td>%s</td> - <td class="number">%s</td>', - 'StockID=' . mb_strtoupper($myrows['stockid']), - mb_strtoupper($myrows['stockid']), - $myrows['description'], - 0); + <td>%s</td> + <td class="number">%s</td>', + 'StockID=' . mb_strtoupper($myrows['stockid']), + mb_strtoupper($myrows['stockid']), + $myrows['description'], + 0); } else { printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> <td>%s</td> - <td class=number>%s</td>', + <td class="number">%s</td>', 'StockID=' . mb_strtoupper($myrows['stockid']), mb_strtoupper($myrows['stockid']), $myrows['description'], @@ -154,7 +165,9 @@ } }//end of while loop - echo '<tr><td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td></tr> + echo '<tr> + <td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td> + </tr> </table>'; } Modified: trunk/StockReorderLevel.php =================================================================== --- trunk/StockReorderLevel.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockReorderLevel.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -14,8 +14,9 @@ echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a>'; -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . $title. '</b> + </p>'; $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='" . $StockID . "'", $db); $myrow = DB_fetch_row($result); @@ -24,32 +25,35 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - stockmaster.decimalplaces - FROM locstock INNER JOIN locations - ON locstock.loccode=locations.loccode - INNER JOIN stockmaster - ON locstock.stockid=stockmaster.stockid - WHERE locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + stockmaster.decimalplaces + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + INNER JOIN stockmaster + ON locstock.stockid=stockmaster.stockid + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -echo '<table cellpadding="2" class="selection">'; -echo '<tr><th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20">'; -echo '<input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '"></th></tr>'; -echo '<tr><th colspan=3><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th></tr>'; +echo '<table class="selection">'; +echo '<tr> + <th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" /><input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '" /></th> + </tr>'; +echo '<tr> + <th colspan="3"><font color="blue" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th> + </tr>'; $TableHeader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -65,10 +69,12 @@ $k=1; } - if (isset($_POST['UpdateData']) AND is_numeric($_POST[$myrow['loccode']]) AND $_POST[$myrow['loccode']]>=0){ + if (isset($_POST['UpdateData']) + AND is_numeric(filter_number_format($_POST[$myrow['loccode']])) + AND $_POST[$myrow['loccode']]>=0){ $myrow['reorderlevel'] = $_POST[$myrow['loccode']]; - $sql = "UPDATE locstock SET reorderlevel = '" . $_POST[$myrow['loccode']] . "' + $sql = "UPDATE locstock SET reorderlevel = '" . filter_number_format($_POST[$myrow['loccode']]) . "' WHERE stockid = '" . $StockID . "' AND loccode = '" . $myrow['loccode'] ."'"; $UpdateReorderLevel = DB_query($sql, $db); @@ -76,12 +82,12 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', - $myrow['locationname'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - $myrow['loccode'], - $myrow['reorderlevel']); + <td class="number">%s</td> + <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', + $myrow['locationname'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + $myrow['loccode'], + $myrow['reorderlevel']); $j++; If ($j == 12){ $j=1; @@ -92,12 +98,18 @@ //end of while loop echo '</table> - <br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '" /><br /><br />'; + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; + echo '<a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; -echo '</div></form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockSerialItemResearch.php =================================================================== --- trunk/StockSerialItemResearch.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItemResearch.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -1,49 +1,50 @@ <?php /* $Id$*/ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Serial Item Research'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; //validate the submission if (isset($_POST['serialno'])) { - $SN = trim($_POST['serialno']); + $SerialNo = trim($_POST['serialno']); } elseif(isset($_GET['serialno'])) { - $SN = trim($_GET['serialno']); + $SerialNo = trim($_GET['serialno']); } else { - $SN = ''; + $SerialNo = ''; } -$SN = $SN; + echo '<div class="centre"> <br /> -<form name=SNRESEARCH method=post action="' . $_SERVER['PHP_SELF'] .'">'; +<form name="SerialNoResearch" method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Serial Number') .': <input ID="serialno" name="serialno" size=21 maxlength=20 VALUE="'. $SN . '"> -<input type=submit name=submit></div><br /> +echo _('Serial Number') .': <input ID="serialno" name="serialno" size="21" maxlength="20" value="'. $SerialNo . '" /> <input type="submit" name="submit" /> +</div> +<br /> </form>'; -echo "<SCRIPT> -document.getElementById('serialno').focus(); -</SCRIPT>"; +echo '<SCRIPT> +document.getElementById("serialno").focus(); +</SCRIPT>'; -if ($SN!='') { +if ($SerialNo!='') { //the point here is to allow a semi fuzzy search, but still keep someone from killing the db server - if (mb_strstr($SN,'%')){ - while(mb_strstr($SN,'%%')) { - $SN = str_replace('%%','%',$SN); + if (mb_strstr($SerialNo,'%')){ + while(mb_strstr($SerialNo,'%%')) { + $SerialNo = str_replace('%%','%',$SerialNo); } - if (mb_strlen($SN) < 11){ - $SN = str_replace('%','',$SN); + if (mb_strlen($SerialNo) < 11){ + $SerialNo = str_replace('%','',$SerialNo); prnMsg('You can not use LIKE with short numbers. It has been removed.','warn'); } } @@ -60,55 +61,56 @@ ON sm.type=st.typeid INNER JOIN locations l on sm.loccode = l.loccode - WHERE ssi.serialno like '$SN' + WHERE ssi.serialno " . LIKE . " '" . $SerialNo . "' ORDER BY stkmoveno"; $result = DB_query($SQL,$db); if (DB_num_rows($result) == 0){ - prnMsg( _('No History found for Serial Number'). ': <b>'.$SN.'</b>' , 'warn'); + prnMsg( _('No History found for Serial Number'). ': <b>'.$SerialNo.'</b>' , 'warn'); } else { - echo '<h4>'. _('Details for Serial Item').': <b>'.$SN.'</b><br />'. _('Length').'='.mb_strlen($SN).'</h4>'; - echo '<table class=selection>'; - echo "<tr><th>" . _('StockID') . "</th> - <th>" . _('CurInvQty') . "</th> - <th>" . _('Move Qty') . "</th> - <th>" . _('Move Type') . "</th> - <th>" . _('Trans #') . "</th> - <th>" . _('Location') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('DebtorNo') . "</th> - <th>" . _('Branch') . "</th> - <th>" . _('Move Ref') . "</th> - <th>" . _('Total Move Qty') . "</th> - </tr>"; + echo '<h4>'. _('Details for Serial Item').': <b>'.$SerialNo.'</b><br />'. _('Length').'='.mb_strlen($SerialNo).'</h4>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('StockID') . '</th> + <th>' . _('CurInvQty') . '</th> + <th>' . _('Move Qty') . '</th> + <th>' . _('Move Type') . '</th> + <th>' . _('Trans #') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('DebtorNo') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Move Ref') . '</th> + <th>' . _('Total Move Qty') . '</th> + </tr>'; while ($myrow=DB_fetch_row($result)) { - printf("<tr> - <td>%s<br />%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s (%s)</td> - <td class=number>%s</td> - <td>%s - %s</td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td class=number>%s</td> - </tr>", - $myrow[1], - $myrow[0], - $myrow[2], - $myrow[3], - $myrow[5], $myrow[4], - $myrow[6], - $myrow[7], $myrow[8], - $myrow[9], - $myrow[10], - $myrow[11], - $myrow[12], - $myrow[13] - ); + printf('<tr> + <td>%s<br />%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s (%s)</td> + <td class="number">%s</td> + <td>%s - %s</td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td class="number">%s</td> + </tr>', + $myrow[1], + $myrow[0], + $myrow[2], + $myrow[3], + $myrow[5], $myrow[4], + $myrow[6], + $myrow[7], $myrow[8], + $myrow[9], + $myrow[10], + $myrow[11], + $myrow[12], + $myrow[13] + ); } //END WHILE LIST LOOP echo '</table>'; } // ELSE THERE WHERE ROWS Modified: trunk/StockSerialItems.php =================================================================== --- trunk/StockSerialItems.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItems.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -5,8 +5,10 @@ $title = _('Stock Of Controlled Items'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; if (isset($_GET['StockID'])){ if (ContainsIllegalCharacters ($_GET['StockID'])){ @@ -70,50 +72,52 @@ $ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); $LocStockResult = DB_query($sql, $db, $ErrMsg); -echo '<table cellpadding=2 class="selection">'; +echo '<table class="selection">'; if ($Serialised==1){ - echo '<tr><th colspan="5"><font color=navy size=2>' . _('Serialised items in') . ' '; + echo '<tr><th colspan="5"><font color="navy" size="2">' . _('Serialised items in') . ' '; } else { - echo '<tr><th colspan="11"><font color=navy size=2>' . _('Controlled items in') . ' '; + echo '<tr><th colspan="11"><font color="navy" size="2">' . _('Controlled items in') . ' '; } echo $myrow[0]. '</font></th></tr>'; -echo '<tr><th colspan="11"><font color=navy size=2>' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th></tr>'; +echo '<tr> + <th colspan="11"><font color="navy" size="2">' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th> + </tr>'; if ($Serialised == 1){ $tableheader = '<tr> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - </tr>'; + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==0){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==1){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + </tr>'; } echo $tableheader; $TotalQuantity =0; Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockStatus.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -22,27 +22,25 @@ //echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; $result = DB_query("SELECT description, - units, - mbflag, - decimalplaces, - serialised, - controlled - FROM - stockmaster - WHERE - stockid='".$StockID."'", - $db, - _('Could not retrieve the requested item'), - _('The SQL used to retrieve the items was')); + units, + mbflag, + decimalplaces, + serialised, + controlled + FROM stockmaster + WHERE stockid='".$StockID."'", + $db, + _('Could not retrieve the requested item'), + _('The SQL used to retrieve the items was')); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$DecimalPlaces = $myrow[3]; -$Serialised = $myrow[4]; -$Controlled = $myrow[5]; +$DecimalPlaces = $myrow['decimalplaces']; +$Serialised = $myrow['serialised']; +$Controlled = $myrow['controlled']; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . - '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; + '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' : ' . _('in units of') . ' : ' . $myrow['units'] . '</b></p>'; $Its_A_KitSet_Assembly_Or_Dummy =False; if ($myrow[2]=='K'){ @@ -56,43 +54,43 @@ prnMsg( _('This is an dummy part and cannot have a stock holding') . ', ' . _('only the total quantity on outstanding sales orders is shown'),'info'); } -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method="post">'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<div class="centre"><input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; -echo ' <input type="submit" name="ShowStatus" VALUE="' . _('Show Stock Status') . '" /></div>'; +echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /></div>'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - locations.managed - FROM locstock, - locations - WHERE locstock.loccode=locations.loccode AND - locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + locations.managed + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -echo '<br /><table cellpadding="2" class="selection">'; +echo '<br /> + <table class="selection">'; if ($Its_A_KitSet_Assembly_Or_Dummy == True){ $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Demand') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Demand') . '</th> + </tr>'; } else { $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + <th>' . _('Demand') . '</th> + <th>' . _('Available') . '</th> + <th>' . _('On Order') . '</th> + </tr>'; } echo $tableheader; $j = 1; @@ -109,13 +107,12 @@ } $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $myrow['loccode'] . "' AND - salesorderdetails.completed=0 AND - salesorders.quotation=0 AND - salesorderdetails.stkcode='" . $StockID . "'"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.completed=0 + AND salesorders.quotation=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -129,17 +126,17 @@ //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent AND - salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $myrow['loccode'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $StockID . "' AND stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A' - AND salesorders.quotation=0"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN bom + ON salesorderdetails.stkcode=bom.parent + INNER JOIN stockmaster + ON stockmaster.stockid=bom.parent + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.mbflag='A' + AND salesorders.quotation=0"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -152,14 +149,14 @@ //Also the demand for the item as a component of works orders $sql = "SELECT SUM(qtypu*(woitems.qtyreqd - woitems.qtyrecd)) AS woqtydemo - FROM woitems INNER JOIN worequirements - ON woitems.stockid=worequirements.parentstockid - INNER JOIN workorders - ON woitems.wo=workorders.wo - AND woitems.wo=worequirements.wo - WHERE workorders.loccode='" . $myrow['loccode'] . "' - AND worequirements.stockid='" . $StockID . "' - AND workorders.closed=0"; + FROM woitems INNER JOIN worequirements + ON woitems.stockid=worequirements.parentstockid + INNER JOIN workorders + ON woitems.wo=workorders.wo + AND woitems.wo=worequirements.wo + WHERE workorders.loccode='" . $myrow['loccode'] . "' + AND worequirements.stockid='" . $StockID . "' + AND workorders.closed=0"; $ErrMsg = _('The workorder component demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -173,16 +170,14 @@ $sql="SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) - FROM purchorders - LEFT JOIN purchorderdetails - ON purchorders.orderno=purchorderdetails.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorderdetails.itemcode='" . $StockID . "' - AND purchorders.intostocklocation='" . $myrow['loccode'] . "' - AND (purchorders.status<>'Cancelled' - AND purchorders.status<>'Pending')"; + FROM purchorders LEFT JOIN purchorderdetails + ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN purchdata ON purchorders.supplierno=purchdata.supplierno + AND purchorderdetails.itemcode=purchdata.stockid + WHERE purchorderdetails.itemcode='" . $StockID . "' + AND purchorders.intostocklocation='" . $myrow['loccode'] . "' + AND (purchorders.status<>'Cancelled' + AND purchorders.status<>'Pending')"; $ErrMsg = _('The quantity on order for this product to be received into') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $QOOResult = DB_query($sql,$db,$ErrMsg, $DbgMsg); @@ -211,33 +206,32 @@ echo '<td>' . $myrow['locationname'] . '</td>'; printf('<td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td></tr>', - locale_number_format($myrow['quantity'], $DecimalPlaces), - locale_number_format($myrow['reorderlevel'], $DecimalPlaces), - locale_number_format($DemandQty, $DecimalPlaces), - locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), - locale_number_format($QOO, $DecimalPlaces) - ); + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td></tr>', + locale_number_format($myrow['quantity'], $DecimalPlaces), + locale_number_format($myrow['reorderlevel'], $DecimalPlaces), + locale_number_format($DemandQty, $DecimalPlaces), + locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), + locale_number_format($QOO, $DecimalPlaces) + ); if ($Serialised ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($Controlled==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' .$StockID . '">' . _('Batches') . '</a></td></tr>'; } } else { /* It must be a dummy, assembly or kitset part */ printf('<td>%s</td> - <td class="number">%s</td> - </tr>', - $myrow['locationname'], - locale_number_format($DemandQty, $DecimalPlaces) - ); + <td class="number">%s</td> + </tr>', + $myrow['locationname'], + locale_number_format($DemandQty, $DecimalPlaces)); } //end of page full new headings if } @@ -268,13 +262,14 @@ /* only show pricing history for sales invoices - type=10 */ $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; - $DbgMsg = _('The SQL that failed was') . ' '; + $DbgMsg = _('The SQL that failed was'); $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $k=1; while ($myrow=DB_fetch_array($MovtsResult)) { - if ($LastPrice != $myrow['price'] OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ + if ($LastPrice != $myrow['price'] + OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ if (isset($qty)) { $DateRange=ConvertSQLDate($FromDate); if ($FromDate != $ToDate) { @@ -305,19 +300,22 @@ $PriceHistory[] = array($DateRange, $qty, $LastPrice, $LastDiscount); } if (isset($PriceHistory)) { - echo '<br /><table cellpadding="4" class="selection">'; - echo '<tr><th colspan=4><font color=navy size=2>' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th></tr>'; - $tableheader = "<tr> - <th>" . _('Date Range') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Price') . "</th> - <th>" . _('Discount') . "</th> - </tr>"; - + echo '<br /> + <table class="selection">'; + echo '<tr> + <th colspan="4"><font color="navy" size="2">' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th> + </tr>'; + $tableheader = '<tr> + <th>' . _('Date Range') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + </tr>'; + $j = 0; $k = 0; //row colour counter - foreach($PriceHistory as $ph) { + foreach($PriceHistory as $PreviousPrice) { $j--; if ($j < 0 ){ $j = 11; @@ -333,15 +331,14 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td class="number">%s... [truncated message content] |
From: <dai...@us...> - 2011-10-17 09:14:13
|
Revision: 4723 http://web-erp.svn.sourceforge.net/web-erp/?rev=4723&view=rev Author: daintree Date: 2011-10-17 09:14:05 +0000 (Mon, 17 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Suppliers.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/Suppliers.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -954,13 +954,22 @@ echo '</select></td></tr></table>'; if (isset($_POST['New'])) { - echo '<p><div class="centre"><input type="Submit" name="submit" value="' . _('Add These New Supplier Details') . '"></form>'; + echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Add These New Supplier Details') . '" /></form>'; } else { - echo '<br /><p><div class="centre"><input type="Submit" name="submit" value="' . _('Update Supplier') . '"></div><br />'; + echo '<br /> + <div class="centre"> + <input type="Submit" name="submit" value="' . _('Update Supplier') . '" /> + </div> + <br />'; // echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br /></font></b>'; prnMsg(_('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed'), 'Warn'); - echo '<br /><div class=centre><input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; - echo '<br /><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; + echo '<br /> + <div class=centre> + <input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"> + </form>'; + echo '<br /> + <a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a> + </div>'; } echo '</div>'; } // end of main ifs Modified: trunk/Tax.php =================================================================== --- trunk/Tax.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/Tax.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -34,25 +34,25 @@ /*Now get the invoices for the tax report */ $SQL = "SELECT debtortrans.transno, - debtortrans.type, - systypes.typename, - debtortrans.trandate, - debtortrans.debtorno, - debtorsmaster.name, - debtortrans.branchcode, - debtortrans.order_, - (debtortrans.ovamount+debtortrans.ovfreight)/debtortrans.rate AS netamount, - debtortrans.ovfreight/debtortrans.rate AS freightamount, - debtortranstaxes.taxamount/debtortrans.rate AS tax - FROM debtortrans - INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN systypes ON debtortrans.type=systypes.typeid - INNER JOIN debtortranstaxes ON debtortrans.id = debtortranstaxes.debtortransid - WHERE debtortrans.prd >= '" . ($_POST['ToPeriod'] - $_POST['NoOfPeriods'] + 1) . "' - AND debtortrans.prd <= '" . $_POST['ToPeriod'] . "' - AND (debtortrans.type=10 OR debtortrans.type=11) - AND debtortranstaxes.taxauthid = '" . $_POST['TaxAuthority'] . "' - ORDER BY debtortrans.id"; + debtortrans.type, + systypes.typename, + debtortrans.trandate, + debtortrans.debtorno, + debtorsmaster.name, + debtortrans.branchcode, + debtortrans.order_, + (debtortrans.ovamount+debtortrans.ovfreight)/debtortrans.rate AS netamount, + debtortrans.ovfreight/debtortrans.rate AS freightamount, + debtortranstaxes.taxamount/debtortrans.rate AS tax + FROM debtortrans + INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN systypes ON debtortrans.type=systypes.typeid + INNER JOIN debtortranstaxes ON debtortrans.id = debtortranstaxes.debtortransid + WHERE debtortrans.prd >= '" . ($_POST['ToPeriod'] - $_POST['NoOfPeriods'] + 1) . "' + AND debtortrans.prd <= '" . $_POST['ToPeriod'] . "' + AND (debtortrans.type=10 OR debtortrans.type=11) + AND debtortranstaxes.taxauthid = '" . $_POST['TaxAuthority'] . "' + ORDER BY debtortrans.id"; $DebtorTransResult = DB_query($SQL,$db,'','',false,false); //don't trap errors in DB_query @@ -91,8 +91,8 @@ $LeftOvers = $pdf->addTextWrap(140,$YPos,60,$FontSize,ConvertSQLDate($DebtorTransRow['trandate']),'left'); $LeftOvers = $pdf->addTextWrap(200,$YPos,150,$FontSize, $DebtorTransRow['name'],'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize, $DebtorTransRow['branchcode'],'left'); - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['netamount'],2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['tax'],2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['netamount'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['tax'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -=$line_height; if ($YPos < $Bottom_Margin + $line_height){ @@ -118,8 +118,8 @@ if ($_POST['DetailOrSummary']=='Detail'){ /*Print out the outputs totals */ - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Outputs,2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Outputs,$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); /*Rule off under output totals */ $pdf->line(410, $YPos-5,530, $YPos-5); @@ -190,8 +190,8 @@ $LeftOvers = $pdf->addTextWrap(140,$YPos,60,$FontSize,ConvertSQLDate($SuppTransRow['trandate']),'left'); $LeftOvers = $pdf->addTextWrap(200,$YPos,150,$FontSize, $SuppTransRow['suppname'],'left'); - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($SuppTransRow['netamount'],2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($SuppTransRow['taxamt'],2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($SuppTransRow['netamount'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($SuppTransRow['taxamt'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -=$line_height; if ($YPos < $Bottom_Margin + $line_height){ @@ -217,8 +217,8 @@ if ($_POST['DetailOrSummary']=='Detail'){ /*Print out the input totals */ - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Inputs,2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($InputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Inputs,$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($InputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); /*Rule off under input totals */ $pdf->line(410, $YPos-5,530, $YPos-5); @@ -253,17 +253,17 @@ $YPos -= (2*$line_height); $LeftOvers = $pdf->addTextWrap(40,$YPos,180,$FontSize,_('Total Sales and Income (incl Tax)'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($Outputs+$OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($Outputs+$OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= $line_height; $LeftOvers = $pdf->addTextWrap(40,$YPos,180,$FontSize,_('Tax On Liable Sales'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= $line_height; $LeftOvers = $pdf->addTextWrap(40,$YPos,200,$FontSize,_('Tax On Purchases'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($InputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($InputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= (2*$line_height); $LeftOvers = $pdf->addTextWrap(40,$YPos,500,$FontSize,_('Adjustments for Tax paid to Customs, FBT, entertainments etc must also be entered'),'left'); @@ -289,7 +289,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') . '" alt="" />' . $title. '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -301,19 +301,21 @@ echo '<option Value=' . $myrow['taxid'] . '>' . $myrow['description'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Return Covering') . ':</font></td> + echo '<tr> + <td>' . _('Return Covering') . ':</font></td> <td><select name="NoOfPeriods"> <option value=1>' . _('One Month') . '</option>' . '<option selected value=2>' ._('Two Months') . '</option>' . '<option value=3>' . _('Quarter') . '</option>' . '<option value=6>' . _('Six Months') . '</option>' . - '</select></td></tr>'; + '</select></td> + </tr>'; - echo '<tr><td>' . _('Return To') . ':</td> + echo '<tr> + <td>' . _('Return To') . ':</td> <td><select name="ToPeriod">'; - $DefaultPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),0,Date('Y'))),$db); $sql = "SELECT periodno, @@ -325,23 +327,28 @@ while ($myrow = DB_fetch_array($Periods,$db)){ if ($myrow['periodno']==$DefaultPeriod){ - echo '<option selected VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Detail Or Summary Only') . ':</font></td> + echo '<tr> + <td>' . _('Detail Or Summary Only') . ':</font></td> <td><select name="DetailOrSummary"> - <option Value="Detail">' . _('Detail and Summary') . '</option> - <option selected value="Summary">' . _('Summary Only') . '</option> - </select></td></tr>'; + <option value="Detail">' . _('Detail and Summary') . '</option> + <option selected value="Summary">' . _('Summary Only') . '</option> + </select></td> + </tr>'; echo '</table> - <br /><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div> </form>'; Modified: trunk/TaxAuthorities.php =================================================================== --- trunk/TaxAuthorities.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxAuthorities.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -6,8 +6,10 @@ $title = _('Tax Authorities'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') - . '" alt="" />' . $title. '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') + . '" alt="" />' . $title. ' + </p>'; if (isset($_POST['SelectedTaxAuthID'])){ $SelectedTaxAuthID =$_POST['SelectedTaxAuthID']; @@ -32,14 +34,14 @@ delete code below*/ $sql = "UPDATE taxauthorities - SET taxglcode ='" . $_POST['TaxGLCode'] . "', - purchtaxglaccount ='" . $_POST['PurchTaxGLCode'] . "', - description = '" . $_POST['Description'] . "', - bank = '". $_POST['Bank']."', - bankacctype = '". $_POST['BankAccType']."', - bankacc = '". $_POST['BankAcc']."', - bankswift = '". $_POST['BankSwift']."' - WHERE taxid = '" . $SelectedTaxAuthID . "'"; + SET taxglcode ='" . $_POST['TaxGLCode'] . "', + purchtaxglaccount ='" . $_POST['PurchTaxGLCode'] . "', + description = '" . DB_escape_string($_POST['Description']) . "', + bank = '" . $_POST['Bank'] . "', + bankacctype = '". $_POST['BankAccType'] . "', + bankacc = '". DB_escape_string($_POST['BankAcc']) . "', + bankswift = '". DB_escape_string($_POST['BankSwift']) . "' + WHERE taxid = '" . $SelectedTaxAuthID . "'"; $ErrMsg = _('The update of this tax authority failed because'); $result = DB_query($sql,$db,$ErrMsg); @@ -61,11 +63,11 @@ VALUES ( '" . $_POST['TaxGLCode'] . "', '" . $_POST['PurchTaxGLCode'] . "', - '" .$_POST['Description'] . "', - '" .$_POST['Bank'] . "', - '" .$_POST['BankAccType'] . "', - '" .$_POST['BankAcc'] . "', - '" .$_POST['BankSwift'] . "' + '" . DB_escape_string($_POST['Description']) . "', + '" . $_POST['Bank'] . "', + '" . $_POST['BankAccType'] . "', + '" . DB_escape_string($_POST['BankAcc']) . "', + '" . DB_escape_string($_POST['BankSwift']) . "' )"; $Errmsg = _('The addition of this tax authority failed because'); @@ -126,30 +128,30 @@ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTaxAuthID will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of tax authorities will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ $sql = "SELECT taxid, - description, - taxglcode, - purchtaxglaccount, - bank, - bankacc, - bankacctype, - bankswift - FROM taxauthorities"; + description, + taxglcode, + purchtaxglaccount, + bank, + bankacc, + bankacctype, + bankswift + FROM taxauthorities"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The defined tax authorities could not be retrieved because'); $DbgMsg = _('The following SQL to retrieve the tax authorities was used'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection>'; - echo '<tr> - <th>' . _('ID') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Input Tax') . '<br />' . _('GL Account') . '</th> - <th>' . _('Output Tax') . '<br />' . _('GL Account') . '</th> - <th>' . _('Bank') . '</th> - <th>' . _('Bank Account') . '</th> - <th>' . _('Bank Act Type') . '</th> - <th>' . _('Bank Swift') . '</th> - </tr></font>'; + echo '<table class="selection"> + <tr> + <th>' . _('ID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Input Tax') . '<br />' . _('GL Account') . '</th> + <th>' . _('Output Tax') . '<br />' . _('GL Account') . '</th> + <th>' . _('Bank') . '</th> + <th>' . _('Bank Account') . '</th> + <th>' . _('Bank Act Type') . '</th> + <th>' . _('Bank Swift') . '</th> + </tr>'; $k=0; while ($myrow = DB_fetch_row($result)) { @@ -161,7 +163,7 @@ $k++; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -169,24 +171,24 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s&SelectedTaxAuthID=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s&SelectedTaxAuthID=%s&delete=yes\">" . _('Delete') . "</a></td> - <td><td><a href=\"%s&TaxAuthority=%s\">" . _('Edit Rates') . "</a></td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[3], - $myrow[2], - $myrow[4], - $myrow[5], - $myrow[6], - $myrow[7], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $rootpath . '/TaxAuthorityRates.php?', - $myrow[0]); + <td><a href="%sSelectedTaxAuthID=%s">' . _('Edit') . '</a></td> + <td><a href="%sSelectedTaxAuthID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax authority?') . '\');">' . _('Delete') . '</a></td> + <td><td><a href="%sTaxAuthority=%s">' . _('Edit Rates') . '</a></td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[3], + $myrow[2], + $myrow[4], + $myrow[5], + $myrow[6], + $myrow[7], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $rootpath . '/TaxAuthorityRates.php?', + $myrow[0]); } //END WHILE LIST LOOP @@ -199,7 +201,9 @@ if (isset($SelectedTaxAuthID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review all defined tax authority records') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review all defined tax authority records') . '</a> + </div>'; } @@ -210,14 +214,14 @@ //editing an existing tax authority $sql = "SELECT taxglcode, - purchtaxglaccount, - description, - bank, - bankacc, - bankacctype, - bankswift - FROM taxauthorities - WHERE taxid='" . $SelectedTaxAuthID . "'"; + purchtaxglaccount, + description, + bank, + bankacc, + bankacctype, + bankswift + FROM taxauthorities + WHERE taxid='" . $SelectedTaxAuthID . "'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -231,56 +235,57 @@ $_POST['BankSwift'] = $myrow['bankswift']; - echo "<input type=hidden name='SelectedTaxAuthID' VALUE=" . $SelectedTaxAuthID . '>'; + echo '<input type="hidden" name="SelectedTaxAuthID" value="' . $SelectedTaxAuthID . '" />'; } //end of if $SelectedTaxAuthID only do the else when a new record is being entered $SQL = "SELECT accountcode, - accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=0 - ORDER BY accountcode"; + accountname + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=0 + ORDER BY accountcode"; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { $_POST['Description']=''; } -echo '<table class=selection> -<tr><td>' . _('Tax Type Description') . ":</td> -<td><input type=Text name='Description' size=21 maxlength=20 value='" . $_POST['Description'] . "'></td></tr>"; +echo '<table class="selection"> + <tr> + <td>' . _('Tax Type Description') . ':</td> + <td><input type="text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '"></td> + </tr> + <tr> + <td>' . _('Input tax GL Account') . ':</td> + <td><select name="PurchTaxGLCode">'; - -echo '<tr><td>' . _('Input tax GL Account') . ':</td> - <td><select name="PurchTaxGLCode">'; - while ($myrow = DB_fetch_array($result)) { if (isset($_POST['PurchTaxGLCode']) and $myrow['accountcode']==$_POST['PurchTaxGLCode']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; DB_data_seek($result,0); -echo '<tr><td>' . _('Output tax GL Account') . ':</td> - <td><select name="TaxGLCode">'; +echo '<tr> + <td>' . _('Output tax GL Account') . ':</td> + <td><select name="TaxGLCode">'; - while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGLCode']) and $myrow['accountcode']==$_POST['TaxGLCode']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['accountcode'] . "'>" . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop @@ -297,20 +302,32 @@ $_POST['BankSwift']=''; } -echo '</select></td></tr>'; -echo '<tr><td>' . _('Bank Name') . ':</td>'; -echo '<td><input type=Text name="Bank" size=41 maxlength=40 value="' . $_POST['Bank'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Account Type') . ':</td>'; -echo '<td><input type=Text name="BankAccType" size=15 maxlength=20 value="' . $_POST['BankAccType'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Account') . ':</td>'; -echo '<td><input type=Text name="BankAcc" size=21 maxlength=20 value="' . $_POST['BankAcc'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Swift No') . ':</td>'; -echo '<td><input type=Text name="BankSwift" size=15 maxlength=14 value="' . $_POST['BankSwift'] . '"></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Bank Name') . ':</td> + <td><input type="text" name="Bank" size="41" maxlength="40" value="' . $_POST['Bank'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Account Type') . ':</td> + <td><input type="text" name="BankAccType" size="15" maxlength="20" value="' . $_POST['BankAccType'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Account') . ':</td> + <td><input type="text" name="BankAcc" size="21" maxlength="20" value="' . $_POST['BankAcc'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Swift No') . ':</td> + <td><input type="text" name="BankSwift" size="15" maxlength="14" value="' . $_POST['BankSwift'] . '" /></td> + </tr> + </table>'; -echo '</table>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; -echo '<br /><div class="centre"><input type=submit name=submit value=' . _('Enter Information') . '></div></form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/TaxAuthorityRates.php =================================================================== --- trunk/TaxAuthorityRates.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxAuthorityRates.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -12,8 +12,10 @@ $title = _('Tax Rates'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') - . '" alt="" />' . $title. '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') + . '" alt="" />' . $title. ' + </p>'; if (!isset($TaxAuthority)){ @@ -34,7 +36,7 @@ while ($myrow=DB_fetch_array($TaxRatesResult)){ - $sql = "UPDATE taxauthrates SET taxrate=" . ($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']]/100) . " + $sql = "UPDATE taxauthrates SET taxrate=" . (filter_number_format($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']])/100) . " WHERE taxcatid = '" . $myrow['taxcatid'] . "' AND dispatchtaxprovince = '" . $myrow['dispatchtaxprovince'] . "' AND taxauthority = '" . $TaxAuthority . "'"; @@ -49,35 +51,39 @@ /*Display updated rates */ -$TaxAuthDetail = DB_query("SELECT description FROM taxauthorities WHERE taxid='" . $TaxAuthority . "'",$db); +$TaxAuthDetail = DB_query("SELECT description + FROM taxauthorities WHERE taxid='" . $TaxAuthority . "'",$db); $myrow = DB_fetch_row($TaxAuthDetail); echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type=hidden name="TaxAuthority" value="' . $TaxAuthority . '">'; +echo '<input type=hidden name="TaxAuthority" value="' . $TaxAuthority . '" />'; $TaxRatesResult = DB_query("SELECT taxauthrates.taxcatid, taxcategories.taxcatname, taxauthrates.taxrate, taxauthrates.dispatchtaxprovince, taxprovinces.taxprovincename - FROM taxauthrates INNER JOIN taxauthorities - ON taxauthrates.taxauthority=taxauthorities.taxid - INNER JOIN taxprovinces - ON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid - INNER JOIN taxcategories - ON taxauthrates.taxcatid=taxcategories.taxcatid - WHERE taxauthrates.taxauthority='" . $TaxAuthority . "' - ORDER BY taxauthrates.dispatchtaxprovince, - taxauthrates.taxcatid", - $db); + FROM taxauthrates INNER JOIN taxauthorities + ON taxauthrates.taxauthority=taxauthorities.taxid + INNER JOIN taxprovinces + ON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid + INNER JOIN taxcategories + ON taxauthrates.taxcatid=taxcategories.taxcatid + WHERE taxauthrates.taxauthority='" . $TaxAuthority . "' + ORDER BY taxauthrates.dispatchtaxprovince, + taxauthrates.taxcatid", + $db); if (DB_num_rows($TaxRatesResult)>0){ - echo '<table cellpadding=2 class="selection">'; - echo '<tr><th colspan=3><font size=3 color=navy>' . _('Update') . ' ' . $myrow[0] . ' ' . _('Rates') . '</font></th></tr>'; - $TableHeader = '<tr><th>' . _('Deliveries From') . '<br />' . _('Tax Province') . '</th> + echo '<table class="selection">'; + echo '<tr> + <th colspan="3"><font size="3" color="navy">' . _('Update') . ' ' . $myrow[0] . ' ' . _('Rates') . '</font></th> + </tr>'; + $TableHeader = '<tr> + <th>' . _('Deliveries From') . '<br />' . _('Tax Province') . '</th> <th>' . _('Tax Category') . '</th> <th>' . _('Tax Rate') . ' %</th> </tr>'; @@ -89,7 +95,7 @@ while ($myrow = DB_fetch_array($TaxRatesResult)){ if ($OldProvince!=$myrow['dispatchtaxprovince'] AND $OldProvince!=''){ - echo '<tr bgcolor="#555555"><font size=1> </font><td colspan=3></td></tr>'; + echo '<tr bgcolor="#555555"><td colspan="3"></td></tr>'; } if ($k==1){ @@ -101,13 +107,13 @@ } printf('<td>%s</td> - <td>%s</td> - <td><input type="text" class="number" name=%s maxlength=5 size=5 value=%s></td> - </tr>', - $myrow['taxprovincename'], - $myrow['taxcatname'], - $myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid'], - $myrow['taxrate']*100 ); + <td>%s</td> + <td><input type="text" class="number" name=%s maxlength="5" size="5" value="%s" /></td> + </tr>', + $myrow['taxprovincename'], + $myrow['taxcatname'], + $myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid'], + locale_number_format($myrow['taxrate']*100,2)); $OldProvince = $myrow['dispatchtaxprovince']; @@ -116,7 +122,7 @@ echo '</table>'; echo '<br /> <div class="centre"> - <input type=submit name="UpdateRates" VALUE="' . _('Update Rates') . '">'; + <input type="submit" name="UpdateRates" value="' . _('Update Rates') . '" />'; } //end if tax taxcatid/rates to show else { prnMsg(_('There are no tax rates to show - perhaps the dispatch tax province records have not yet been created?'),'warn'); @@ -124,11 +130,16 @@ echo '</form>'; -echo '<br /><br /><a href="' . $rootpath . '/TaxAuthorities.php">' . _('Tax Authorities') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxGroups.php">' . _('Tax Groupings') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxCategories.php">' . _('Tax Categories') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxProvinces.php">' . _('Dispatch Tax Provinces') . '</a>'; -echo '</div>'; +echo '<br /> + <br /> + <a href="' . $rootpath . '/TaxAuthorities.php">' . _('Tax Authorities') . '</a> + <br /> + <a href="' . $rootpath . '/TaxGroups.php">' . _('Tax Groupings') . '</a> + <br /> + <a href="' . $rootpath . '/TaxCategories.php">' . _('Tax Categories') . '</a> + <br /> + <a href="' . $rootpath . '/TaxProvinces.php">' . _('Dispatch Tax Provinces') . '</a> + </div>'; include( 'includes/footer.inc' ); ?> \ No newline at end of file Modified: trunk/TaxCategories.php =================================================================== --- trunk/TaxCategories.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxCategories.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -26,9 +26,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['TaxCategoryName'],'&')>0 OR mb_strpos($_POST['TaxCategoryName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['TaxCategoryName'])) { $InputError = 1; - prnMsg( _('The tax category name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The tax category name cannot contain the character') . " '&' " . _('or the character') ." ' " . _('or a space') ,'error'); } if (trim($_POST['TaxCategoryName']) == '') { $InputError = 1; @@ -162,10 +162,10 @@ $ErrMsg = _('Could not get tax categories because'); $result = DB_query($sql,$db,$ErrMsg); - echo '<table class=selection> - <tr> - <th>' . _('Tax Categories') . '</th> - </tr>'; + echo '<table class="selection"> + <tr> + <th>' . _('Tax Categories') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -178,18 +178,20 @@ $k++; } - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax category?') . '\');">' . _('Delete') .'</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow[1] . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax category?') . '\');">' . _('Delete') .'</a></td> + </tr>'; } //END WHILE LIST LOOP - echo '</table><p>'; + echo '</table><p />'; } //end of ifs and buts! if (isset($SelectedTaxCategory)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Categories') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Categories') . '</a> + </div>'; } echo '<p>'; @@ -216,24 +218,26 @@ $_POST['TaxCategoryName'] = $myrow['taxcatname']; - echo '<input type="hidden" name="SelectedTaxCategory" value="' . $myrow['taxcatid'] . '">'; - echo '<table class=selection>'; + echo '<input type="hidden" name="SelectedTaxCategory" value="' . $myrow['taxcatid'] . '" />'; + echo '<table class="selection">'; } } else { $_POST['TaxCategoryName']=''; - echo '<table class=selection>'; + echo '<table class="selection">'; } echo '<tr> - <td>' . _('Tax Category Name') . ':' . '</td> - <td><input type="text" name="TaxCategoryName" size=30 maxlength=30 value="' . $_POST['TaxCategoryName'] . '"></td> - </tr>'; - echo '</table>'; + <td>' . _('Tax Category Name') . ':' . '</td> + <td><input type="text" name="TaxCategoryName" size=30 maxlength=30 value="' . $_POST['TaxCategoryName'] . '" /></td> + </tr> + </table>'; - echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/TaxGroups.php =================================================================== --- trunk/TaxGroups.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxGroups.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -22,7 +22,7 @@ /* actions to take once the user has clicked the submit button ie the page has called itself with some user input */ //first off validate inputs sensible - if (isset($_POST['GroupName']) && mb_strlen($_POST['GroupName'])<4){ + if (isset($_POST['GroupName']) AND mb_strlen($_POST['GroupName'])<4){ $InputError = 1; prnMsg(_('The Group description entered must be at least 4 characters long'),'error'); } @@ -38,12 +38,15 @@ $SuccessMsg = _('The tax group description was updated to') . ' ' . $_POST['GroupName']; } else { // Add new tax group - $result = DB_query("SELECT taxgroupid FROM taxgroups WHERE taxgroupdescription='" . $_POST['GroupName'] . "'",$db); + $result = DB_query("SELECT taxgroupid + FROM taxgroups + WHERE taxgroupdescription='" . $_POST['GroupName'] . "'",$db); if (DB_num_rows($result)==1){ prnMsg( _('A new tax group could not be added because a tax group already exists for') . ' ' . $_POST['GroupName'],'warn'); unset($sql); } else { - $sql = "INSERT INTO taxgroups (taxgroupdescription) VALUES ('". $_POST['GroupName'] . "')"; + $sql = "INSERT INTO taxgroups (taxgroupdescription) + VALUES ('". $_POST['GroupName'] . "')"; $ErrMsg = _('The addition of the group failed because'); $SuccessMsg = _('Added the new tax group') . ' ' . $_POST['GroupName']; } @@ -54,11 +57,11 @@ $TaxAuthority = $_GET['TaxAuthority']; if( isset($_GET['add']) ) { // adding a tax authority to a tax group $sql = "INSERT INTO taxgrouptaxes ( taxgroupid, - taxauthid, - calculationorder) + taxauthid, + calculationorder) VALUES ('" . $SelectedGroup . "', - '" . $TaxAuthority . "', - 0)"; + '" . $TaxAuthority . "', + 0)"; $ErrMsg = _('The addition of the tax failed because'); $SuccessMsg = _('The tax was added.'); @@ -74,7 +77,7 @@ unset($_GET['TaxAuthority']); } // Need to exec the query - if (isset($sql) && $InputError != 1 ) { + if (isset($sql) AND $InputError != 1 ) { $result = DB_query($sql,$db,$ErrMsg); if( $result ) { prnMsg( $SuccessMsg,'success'); @@ -101,10 +104,10 @@ //need to do a reality check to ensure that taxontax is relevant only for taxes after the first tax $sql = "SELECT taxauthid, - taxontax - FROM taxgrouptaxes - WHERE taxgroupid='" . $SelectedGroup . "' - ORDER BY calculationorder"; + taxontax + FROM taxgrouptaxes + WHERE taxgroupid='" . $SelectedGroup . "' + ORDER BY calculationorder"; $Result = DB_query($sql,$db,_('Could not get tax authorities in the selected tax group')); @@ -112,7 +115,9 @@ $myrow=DB_fetch_array($Result); if ($myrow['taxontax']==1){ prnMsg(_('It is inappropriate to set tax on tax where the tax is the first in the calculation order. The system has changed it back to no tax on tax for this tax authority'),'warning'); - $Result = DB_query("UPDATE taxgrouptaxes SET taxontax=0 WHERE taxgroupid='" . $SelectedGroup . "' AND taxauthid='" . $myrow['taxauthid'] . "'",$db); + $Result = DB_query("UPDATE taxgrouptaxes SET taxontax=0 + WHERE taxgroupid='" . $SelectedGroup . "' + AND taxauthid='" . $myrow['taxauthid'] . "'",$db); } } } elseif (isset($_GET['Delete'])) { @@ -126,7 +131,8 @@ prnMsg( _('Cannot delete this tax group because some customer branches are setup using it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer branches referring to this tax group'); } else { - $sql= "SELECT COUNT(*) FROM suppliers WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql= "SELECT COUNT(*) FROM suppliers + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -134,9 +140,11 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers referring to this tax group'); } else { - $sql="DELETE FROM taxgrouptaxes WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql="DELETE FROM taxgrouptaxes + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); - $sql="DELETE FROM taxgroups WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql="DELETE FROM taxgroups + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); prnMsg( $_GET['GroupID'] . ' ' . _('tax group has been deleted') . '!','success'); } @@ -150,8 +158,8 @@ /* If its the first time the page has been displayed with no parameters then none of the above are true and the list of tax groups will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of tax group taxes*/ $sql = "SELECT taxgroupid, - taxgroupdescription - FROM taxgroups"; + taxgroupdescription + FROM taxgroups"; $result = DB_query($sql,$db); if( DB_num_rows($result) == 0 ) { @@ -159,9 +167,11 @@ prnMsg(_('There are no tax groups configured.'),'info'); echo '</div>'; } else { - echo '<table class=selection>'; - echo '<tr><th>' . _('Group No') . '</th> - <th>' . _('Tax Group') . '</th></tr>'; + echo '<table class="selection"> + <tr> + <th>' . _('Group No') . '</th> + <th>' . _('Tax Group') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { @@ -174,17 +184,17 @@ } printf('<td>%s</td> - <td>%s</td> - <td><a href="%s&SelectedGroup=%s">' . _('Edit') . '</a></td> - <td><a href="%s&SelectedGroup=%s&Delete=1&GroupID=%s">' . _('Delete') . '</a></td> - </tr>', - $myrow['taxgroupid'], - $myrow['taxgroupdescription'], - $_SERVER['PHP_SELF'] . '?', - $myrow['taxgroupid'], - $_SERVER['PHP_SELF'] . '?', - $myrow['taxgroupid'], - urlencode($myrow['taxgroupdescription'])); + <td>%s</td> + <td><a href="%s&SelectedGroup=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SelectedGroup=%s&Delete=1&GroupID=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax group?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['taxgroupid'], + $myrow['taxgroupdescription'], + $_SERVER['PHP_SELF'] . '?', + $myrow['taxgroupid'], + $_SERVER['PHP_SELF'] . '?', + $myrow['taxgroupid'], + urlencode($myrow['taxgroupdescription'])); } //END WHILE LIST LOOP echo '</table>'; @@ -193,16 +203,18 @@ if (isset($SelectedGroup)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Existing Groups') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Existing Groups') . '</a> + </div>'; } if (isset($SelectedGroup)) { //editing an existing role $sql = "SELECT taxgroupid, - taxgroupdescription - FROM taxgroups - WHERE taxgroupid='" . $SelectedGroup . "'"; + taxgroupdescription + FROM taxgroups + WHERE taxgroupid='" . $SelectedGroup . "'"; $result = DB_query($sql, $db); if ( DB_num_rows($result) == 0 ) { prnMsg( _('The selected tax group is no longer available.'),'warn'); @@ -216,7 +228,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if( isset($_POST['SelectedGroup'])) { - echo '<input type="hidden" name="SelectedGroup" value="' . $_POST['SelectedGroup'] . '">'; + echo '<input type="hidden" name="SelectedGroup" value="' . $_POST['SelectedGroup'] . '" />'; } echo '<table class="selection">'; @@ -224,8 +236,10 @@ $_POST['GroupName']=''; } echo '<tr><td>' . _('Tax Group') . ':</td> - <td><input type="text" name="GroupName" size=40 maxlength=40 value="' . $_POST['GroupName'] . '"></td>'; -echo '<td><input type="submit" name="submit" value="' . _('Enter Group') . '"></td></tr></form>'; + <td><input type="text" name="GroupName" size=40 maxlength=40 value="' . $_POST['GroupName'] . '" /></td>'; +echo '<td><input type="submit" name="submit" value="' . _('Enter Group') . '"></td> + </tr> + </form>'; if (isset($SelectedGroup)) { @@ -260,17 +274,18 @@ /* the order and tax on tax will only be an issue if more than one tax authority in the group */ if (count($TaxAuthsUsed)>0) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID .'">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type=hidden name="SelectedGroup" value="' . $SelectedGroup .'">'; - echo '<table class="selection">'; - echo '<tr><th colspan=3><font size=3 color=navy>'._('Calculation Order').'</font></th></tr>'; - - echo '<tr> - <th>'._('Tax Authority').'</th> - <th>'._('Order').'</th> - <th>'._('Tax on Prior Taxes').'</th> - </tr>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type=hidden name="SelectedGroup" value="' . $SelectedGroup .'" />'; + echo '<table class="selection"> + <tr> + <th colspan=3><font size="3" color="navy">'._('Calculation Order').'</font></th> + </tr> + <tr> + <th>'._('Tax Authority').'</th> + <th>'._('Order').'</th> + <th>'._('Tax on Prior Taxes').'</th> + </tr>'; $k=0; //row colour counter for ($i=1;$i < count($TaxAuthRow)+1;$i++) { if ($k==1){ @@ -285,10 +300,9 @@ $TaxAuthRow[$i]['calculationorder'] = $i; } - echo '<td>' . $TaxAuthRow[$i]['taxname'] . '</td><td>'. - '<input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . - $TaxAuthRow[$i]['calculationorder'] . '" size=2 maxlength=2 style="width: 100%"></td>'; - echo '<td><select name="TaxOnTax_' . $TaxAuthRow[$i]['taxauthid'] . '" style="width: 100%">'; + echo '<td>' . $TaxAuthRow[$i]['taxname'] . '</td> + <td><input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . $TaxAuthRow[$i]['calculationorder'] . '" size="2" maxlength="2" style="width: 100%" /></td> + <td><select name="TaxOnTax_' . $TaxAuthRow[$i]['taxauthid'] . '" style="width: 100%">'; if ($TaxAuthRow[$i]['taxontax']==1){ echo '<option selected value=1>' . _('Yes') . '</option>'; echo '<option value=0>' . _('No') . '</option>'; @@ -296,35 +310,42 @@ echo '<option value=1>' . _('Yes') . '</option>'; echo '<option selected value=0>' . _('No') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateOrder" value="' . _('Update Order') . '"></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="UpdateOrder" value="' . _('Update Order') . '" /> + </div>'; } echo '</form>'; if (DB_num_rows($Result)>0 ) { echo '<br />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> - <th colspan=4>'._('Assigned Taxes') . '</th> + <th colspan="4">'._('Assigned Taxes') . '</th> <th></th> - <th colspan=2>' . _('Available Taxes') . '</th> + <th colspan="2">' . _('Available Taxes') . '</th> + </tr> + <tr> + <th>' . _('Tax Auth ID') . '</th> + <th>' . _('Tax Authority Name') . '</th> + <th>' . _('Calculation Order') . '</th> + <th>' . _('Tax on Prior Tax(es)') . '</th> + <th></th> + <th>' . _('Tax Auth ID') . '</th> + <th>' . _('Tax Authority Name') . '</th> </tr>'; - echo '<tr> - <th>' . _('Tax Auth ID') . '</th> - <th>' . _('Tax Authority Name') . '</th> - <th>' . _('Calculation Order') . '</th> - <th>' . _('Tax on Prior Tax(es)') . '</th> - <th></th> - <th>' . _('Tax Auth ID') . '</th> - <th>' . _('Tax Authority Name') . '</th> - </tr>'; } else { - echo '<br /><div class="centre">' . _('There are no tax authorities defined to allocate to this tax group').'</div>'; + echo '<br /> + <div class="centre">' . + _('There are no tax authorities defined to allocate to this tax group').' + </div>'; } $k=0; //row colour counter @@ -351,7 +372,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href="%s&SelectedGroup=%s&remove=1&TaxAuthority=%s">' . _('Remove') . '</a></td> + <td><a href="%sSelectedGroup=%s&remove=1&TaxAuthority=%s" onclick="return confirm(\'' . _('Are you sure you wish to remove this tax authority from the group?') . '\');">' . _('Remove') . '</a></td> <td> </td> <td> </td>', $AvailRow['taxid'], @@ -371,7 +392,7 @@ <td> </td> <td>%s</td> <td>%s</td> - <td><a href="%s&SelectedGroup=%s&add=1&TaxAuthority=%s">' . _('Add') . '</a></td>', + <td><a href="%sSelectedGroup=%s&add=1&TaxAuthority=%s">' . _('Add') . '</a></td>', $AvailRow['taxid'], $AvailRow['taxname'], $_SERVER['PHP_SELF'] . '?', Modified: trunk/TaxProvinces.php =================================================================== --- trunk/TaxProvinces.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxProvinces.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -7,7 +7,9 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.' + </p>'; if ( isset($_GET['SelectedTaxProvince']) ) $SelectedTaxProvince = $_GET['SelectedTaxProvince']; @@ -25,9 +27,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['TaxProvinceName'],'&')>0 OR mb_strpos($_POST['TaxProvinceName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['TaxProvinceName'])) { $InputError = 1; - prnMsg( _('The tax province name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The tax province name cannot contain any of the illegal characters'),'error'); } if (trim($_POST['TaxProvinceName']) == '') { $InputError = 1; @@ -74,22 +76,24 @@ WHERE taxprovincename " .LIKE. " '".$_POST['TaxProvinceName'] ."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); + if ( $myrow[0] > 0 ) { + $InputError = 1; prnMsg( _('The tax province cannot be created because another with the same name already exists'),'error'); + } else { - $sql = "INSERT INTO taxprovinces ( - taxprovincename ) - VALUES ( - '" . $_POST['TaxProvinceName'] ."' - )"; + + $sql = "INSERT INTO taxprovinces (taxprovincename ) + VALUES ('" . $_POST['TaxProvinceName'] ."')"; + $ErrMsg = _('Could not add tax province'); $result = DB_query($sql,$db, $ErrMsg); $TaxProvinceID = DB_Last_Insert_ID($db, 'taxprovinces', 'taxprovinceid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) SELECT taxauthorities.taxid, '" . $TaxProvinceID . "', taxcategories.taxcatid - FROM taxauthorities CROSS JOIN taxcategories"; + FROM taxauthorities CROSS JOIN taxcategories"; $ErrMsg = _('Could not add tax authority rates for the new dispatch tax province. The rates of tax will not be able to be added - manual database interaction will be required to use this dispatch tax province'); $result = DB_query($sql,$db, $ErrMsg); } @@ -156,10 +160,10 @@ $ErrMsg = _('Could not get tax categories because'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> - <tr> - <th>" . _('Tax Provinces') . "</th> - </tr>"; + echo '<table class="selection"> + <tr> + <th>' . _('Tax Provinces') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -172,10 +176,10 @@ $k++; } - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTaxProvince=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTaxProvince=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow[1] . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxProvince=' . $myrow[0] . '">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxProvince=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td> + </tr>'; } //END WHILE LIST LOOP echo '</table><p>'; @@ -183,7 +187,9 @@ if (isset($SelectedTaxProvince)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Provinces') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Provinces') . '</a> + </div>'; } echo '<p>'; @@ -210,7 +216,7 @@ $_POST['TaxProvinceName'] = $myrow['taxprovincename']; - echo '<input type=hidden name="SelectedTaxProvince" value="' . $myrow['taxprovinceid'] . '">'; + echo '<input type="hidden" name="SelectedTaxProvince" value="' . $myrow['taxprovinceid'] . '" />'; echo '<table class="selection">'; } @@ -219,22 +225,28 @@ echo '<table class="selection">'; } echo '<tr> - <td>' . _('Tax Province Name') . ':' . '</td> - <td><input type="text" name="TaxProvinceName" size="30" maxlength="30" value="' . $_POST['TaxProvinceName'] . '"></td> - </tr>'; - echo '</table>'; + <td>' . _('Tax Province Name') . ':' . '</td> + <td><input type="text" name="TaxProvinceName" size="30" maxlength="30" value="' . $_POST['TaxProvinceName'] . '" /></td> + </tr> + </table>'; - echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /> + <div class="centre"> + <input type=Submit name=submit value="' . _('Enter Information') . '" /> + </div>'; echo '</form>'; } //end if record deleted no point displaying form to add record -echo '<div class="centre">'; -echo '<br /><a href="' . $rootpath . '/TaxAuthorities.php">' . _('Edit/Review Tax Authorities') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxGroups.php">' . _('Edit/Review Tax Groupings') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxCategories.php">' . _('Edit/Review Tax Categories') . '</a>'; -echo '</div>'; +echo '<div class="centre"> + <br /> + <a href="' . $rootpath . '/TaxAuthorities.php">' . _('Edit/Review Tax Authorities') . '</a> + <br /> + <a href="' . $rootpath . '/TaxGroups.php">' . _('Edit/Review Tax Groupings') . '</a> + <br /> + <a href="' . $rootpath . '/TaxCategories.php">' . _('Edit/Review Tax Categories') . '</a> + </div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/TopItems.php =================================================================== --- trunk/TopItems.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TopItems.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -11,9 +11,9 @@ if (!(isset($_POST['Search']))) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="POST">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table cellpadding="3" colspan="4" class="selection">'; + echo '<table class="selection">'; //to view store location echo '<tr> <td width="150">' . _('Select Location') . ' </td> @@ -21,17 +21,20 @@ <td><select name="Location">'; $sql = "SELECT loccode, locationname - FROM `locations`"; + FROM locations"; $result = DB_query($sql, $db); echo '<option value="All">' . _('All') . '</option>'; while ($myrow = DB_fetch_array($result)) { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['loccode'] . ' - ' . $myrow['locationname'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; //to view list of customer - echo '<tr><td width="150">' . _('Select Customer Type') . '</td> - <td>:</td> - <td><select name="Customers">'; + echo '<tr> + <td width="150">' . _('Select Customer Type') . '</td> + <td>:</td> + <td><select name="Customers">'; + $sql = "SELECT typename, typeid FROM debtortype"; @@ -41,17 +44,20 @@ echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } echo '</select></td> - </tr>'; + </tr>'; //view order by list to display - echo '<tr> <td width="150">' . _('Select Order By ') . ' </td> - <td>:</td> - <td><select name="Sequence">'; - echo ' <option value="totalinvoiced">' . _('Total Pieces') . '</option>'; - echo ' <option value="valuesales">' . _('Value of Sales') . '</option>'; - echo ' </select></td> - </tr>'; + echo '<tr> + <td width="150">' . _('Select Order By ') . ' </td> + <td>:</td> + <td><select name="Sequence"> + <option value="totalinvoiced">' . _('Total Pieces') . '</option> + <option value="valuesales">' . _('Value of Sales') . '</option> + </select></td> + </tr>'; //View number of days - echo '<tr><td>' . _('Number Of Days') . ' </td><td>:</td> + echo '<tr> + <td>' . _('Number Of Days') . ' </td> + <td>:</td> <td><input class="number" tabindex="3" type="text" name="NumberOfDays" size="8" maxlength="8" value="0" /></td> </tr>'; //view number of NumberOfTopItems items @@ -65,8 +71,8 @@ </tr> </table> <br /> - <div class=centre> - <input tabindex=5 type="submit" name="Search" value="' . _('Search') . '" /> + <div class="centre"> + <input tabindex="5" type="submit" name="Search" value="' . _('Search') . '" /> </div> </form>'; } else { @@ -164,7 +170,8 @@ echo '<form action="PDFTopItems.php" method="GET"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr><th>' . _('#') . '</th> + $TableHeader = '<tr> + <th>' . _('#') . '</th> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Total Invoiced') . '</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-17 09:14:13
|
Revision: 4723 http://web-erp.svn.sourceforge.net/web-erp/?rev=4723&view=rev Author: daintree Date: 2011-10-17 09:14:05 +0000 (Mon, 17 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Suppliers.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/Suppliers.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -954,13 +954,22 @@ echo '</select></td></tr></table>'; if (isset($_POST['New'])) { - echo '<p><div class="centre"><input type="Submit" name="submit" value="' . _('Add These New Supplier Details') . '"></form>'; + echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Add These New Supplier Details') . '" /></form>'; } else { - echo '<br /><p><div class="centre"><input type="Submit" name="submit" value="' . _('Update Supplier') . '"></div><br />'; + echo '<br /> + <div class="centre"> + <input type="Submit" name="submit" value="' . _('Update Supplier') . '" /> + </div> + <br />'; // echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br /></font></b>'; prnMsg(_('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed'), 'Warn'); - echo '<br /><div class=centre><input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; - echo '<br /><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; + echo '<br /> + <div class=centre> + <input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"> + </form>'; + echo '<br /> + <a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a> + </div>'; } echo '</div>'; } // end of main ifs Modified: trunk/Tax.php =================================================================== --- trunk/Tax.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/Tax.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -34,25 +34,25 @@ /*Now get the invoices for the tax report */ $SQL = "SELECT debtortrans.transno, - debtortrans.type, - systypes.typename, - debtortrans.trandate, - debtortrans.debtorno, - debtorsmaster.name, - debtortrans.branchcode, - debtortrans.order_, - (debtortrans.ovamount+debtortrans.ovfreight)/debtortrans.rate AS netamount, - debtortrans.ovfreight/debtortrans.rate AS freightamount, - debtortranstaxes.taxamount/debtortrans.rate AS tax - FROM debtortrans - INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN systypes ON debtortrans.type=systypes.typeid - INNER JOIN debtortranstaxes ON debtortrans.id = debtortranstaxes.debtortransid - WHERE debtortrans.prd >= '" . ($_POST['ToPeriod'] - $_POST['NoOfPeriods'] + 1) . "' - AND debtortrans.prd <= '" . $_POST['ToPeriod'] . "' - AND (debtortrans.type=10 OR debtortrans.type=11) - AND debtortranstaxes.taxauthid = '" . $_POST['TaxAuthority'] . "' - ORDER BY debtortrans.id"; + debtortrans.type, + systypes.typename, + debtortrans.trandate, + debtortrans.debtorno, + debtorsmaster.name, + debtortrans.branchcode, + debtortrans.order_, + (debtortrans.ovamount+debtortrans.ovfreight)/debtortrans.rate AS netamount, + debtortrans.ovfreight/debtortrans.rate AS freightamount, + debtortranstaxes.taxamount/debtortrans.rate AS tax + FROM debtortrans + INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN systypes ON debtortrans.type=systypes.typeid + INNER JOIN debtortranstaxes ON debtortrans.id = debtortranstaxes.debtortransid + WHERE debtortrans.prd >= '" . ($_POST['ToPeriod'] - $_POST['NoOfPeriods'] + 1) . "' + AND debtortrans.prd <= '" . $_POST['ToPeriod'] . "' + AND (debtortrans.type=10 OR debtortrans.type=11) + AND debtortranstaxes.taxauthid = '" . $_POST['TaxAuthority'] . "' + ORDER BY debtortrans.id"; $DebtorTransResult = DB_query($SQL,$db,'','',false,false); //don't trap errors in DB_query @@ -91,8 +91,8 @@ $LeftOvers = $pdf->addTextWrap(140,$YPos,60,$FontSize,ConvertSQLDate($DebtorTransRow['trandate']),'left'); $LeftOvers = $pdf->addTextWrap(200,$YPos,150,$FontSize, $DebtorTransRow['name'],'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize, $DebtorTransRow['branchcode'],'left'); - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['netamount'],2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['tax'],2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['netamount'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($DebtorTransRow['tax'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -=$line_height; if ($YPos < $Bottom_Margin + $line_height){ @@ -118,8 +118,8 @@ if ($_POST['DetailOrSummary']=='Detail'){ /*Print out the outputs totals */ - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Outputs,2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Outputs,$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); /*Rule off under output totals */ $pdf->line(410, $YPos-5,530, $YPos-5); @@ -190,8 +190,8 @@ $LeftOvers = $pdf->addTextWrap(140,$YPos,60,$FontSize,ConvertSQLDate($SuppTransRow['trandate']),'left'); $LeftOvers = $pdf->addTextWrap(200,$YPos,150,$FontSize, $SuppTransRow['suppname'],'left'); - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($SuppTransRow['netamount'],2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($SuppTransRow['taxamt'],2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize, locale_number_format($SuppTransRow['netamount'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize, locale_number_format($SuppTransRow['taxamt'],$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -=$line_height; if ($YPos < $Bottom_Margin + $line_height){ @@ -217,8 +217,8 @@ if ($_POST['DetailOrSummary']=='Detail'){ /*Print out the input totals */ - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Inputs,2),'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($InputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,8, locale_number_format($Inputs,$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,8, locale_number_format($InputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); /*Rule off under input totals */ $pdf->line(410, $YPos-5,530, $YPos-5); @@ -253,17 +253,17 @@ $YPos -= (2*$line_height); $LeftOvers = $pdf->addTextWrap(40,$YPos,180,$FontSize,_('Total Sales and Income (incl Tax)'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($Outputs+$OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($Outputs+$OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= $line_height; $LeftOvers = $pdf->addTextWrap(40,$YPos,180,$FontSize,_('Tax On Liable Sales'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($OutputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($OutputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= $line_height; $LeftOvers = $pdf->addTextWrap(40,$YPos,200,$FontSize,_('Tax On Purchases'),'left'); - $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($InputTax,2),'right'); + $LeftOvers = $pdf->addTextWrap(220,$YPos,100,$FontSize,locale_number_format($InputTax,$_SESSION['CompanyRecord']['decimalplaces']),'right'); $YPos -= (2*$line_height); $LeftOvers = $pdf->addTextWrap(40,$YPos,500,$FontSize,_('Adjustments for Tax paid to Customs, FBT, entertainments etc must also be entered'),'left'); @@ -289,7 +289,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') . '" alt="" />' . $title. '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -301,19 +301,21 @@ echo '<option Value=' . $myrow['taxid'] . '>' . $myrow['description'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Return Covering') . ':</font></td> + echo '<tr> + <td>' . _('Return Covering') . ':</font></td> <td><select name="NoOfPeriods"> <option value=1>' . _('One Month') . '</option>' . '<option selected value=2>' ._('Two Months') . '</option>' . '<option value=3>' . _('Quarter') . '</option>' . '<option value=6>' . _('Six Months') . '</option>' . - '</select></td></tr>'; + '</select></td> + </tr>'; - echo '<tr><td>' . _('Return To') . ':</td> + echo '<tr> + <td>' . _('Return To') . ':</td> <td><select name="ToPeriod">'; - $DefaultPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),0,Date('Y'))),$db); $sql = "SELECT periodno, @@ -325,23 +327,28 @@ while ($myrow = DB_fetch_array($Periods,$db)){ if ($myrow['periodno']==$DefaultPeriod){ - echo '<option selected VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Detail Or Summary Only') . ':</font></td> + echo '<tr> + <td>' . _('Detail Or Summary Only') . ':</font></td> <td><select name="DetailOrSummary"> - <option Value="Detail">' . _('Detail and Summary') . '</option> - <option selected value="Summary">' . _('Summary Only') . '</option> - </select></td></tr>'; + <option value="Detail">' . _('Detail and Summary') . '</option> + <option selected value="Summary">' . _('Summary Only') . '</option> + </select></td> + </tr>'; echo '</table> - <br /><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div> </form>'; Modified: trunk/TaxAuthorities.php =================================================================== --- trunk/TaxAuthorities.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxAuthorities.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -6,8 +6,10 @@ $title = _('Tax Authorities'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') - . '" alt="" />' . $title. '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') + . '" alt="" />' . $title. ' + </p>'; if (isset($_POST['SelectedTaxAuthID'])){ $SelectedTaxAuthID =$_POST['SelectedTaxAuthID']; @@ -32,14 +34,14 @@ delete code below*/ $sql = "UPDATE taxauthorities - SET taxglcode ='" . $_POST['TaxGLCode'] . "', - purchtaxglaccount ='" . $_POST['PurchTaxGLCode'] . "', - description = '" . $_POST['Description'] . "', - bank = '". $_POST['Bank']."', - bankacctype = '". $_POST['BankAccType']."', - bankacc = '". $_POST['BankAcc']."', - bankswift = '". $_POST['BankSwift']."' - WHERE taxid = '" . $SelectedTaxAuthID . "'"; + SET taxglcode ='" . $_POST['TaxGLCode'] . "', + purchtaxglaccount ='" . $_POST['PurchTaxGLCode'] . "', + description = '" . DB_escape_string($_POST['Description']) . "', + bank = '" . $_POST['Bank'] . "', + bankacctype = '". $_POST['BankAccType'] . "', + bankacc = '". DB_escape_string($_POST['BankAcc']) . "', + bankswift = '". DB_escape_string($_POST['BankSwift']) . "' + WHERE taxid = '" . $SelectedTaxAuthID . "'"; $ErrMsg = _('The update of this tax authority failed because'); $result = DB_query($sql,$db,$ErrMsg); @@ -61,11 +63,11 @@ VALUES ( '" . $_POST['TaxGLCode'] . "', '" . $_POST['PurchTaxGLCode'] . "', - '" .$_POST['Description'] . "', - '" .$_POST['Bank'] . "', - '" .$_POST['BankAccType'] . "', - '" .$_POST['BankAcc'] . "', - '" .$_POST['BankSwift'] . "' + '" . DB_escape_string($_POST['Description']) . "', + '" . $_POST['Bank'] . "', + '" . $_POST['BankAccType'] . "', + '" . DB_escape_string($_POST['BankAcc']) . "', + '" . DB_escape_string($_POST['BankSwift']) . "' )"; $Errmsg = _('The addition of this tax authority failed because'); @@ -126,30 +128,30 @@ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTaxAuthID will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of tax authorities will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ $sql = "SELECT taxid, - description, - taxglcode, - purchtaxglaccount, - bank, - bankacc, - bankacctype, - bankswift - FROM taxauthorities"; + description, + taxglcode, + purchtaxglaccount, + bank, + bankacc, + bankacctype, + bankswift + FROM taxauthorities"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The defined tax authorities could not be retrieved because'); $DbgMsg = _('The following SQL to retrieve the tax authorities was used'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection>'; - echo '<tr> - <th>' . _('ID') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Input Tax') . '<br />' . _('GL Account') . '</th> - <th>' . _('Output Tax') . '<br />' . _('GL Account') . '</th> - <th>' . _('Bank') . '</th> - <th>' . _('Bank Account') . '</th> - <th>' . _('Bank Act Type') . '</th> - <th>' . _('Bank Swift') . '</th> - </tr></font>'; + echo '<table class="selection"> + <tr> + <th>' . _('ID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Input Tax') . '<br />' . _('GL Account') . '</th> + <th>' . _('Output Tax') . '<br />' . _('GL Account') . '</th> + <th>' . _('Bank') . '</th> + <th>' . _('Bank Account') . '</th> + <th>' . _('Bank Act Type') . '</th> + <th>' . _('Bank Swift') . '</th> + </tr>'; $k=0; while ($myrow = DB_fetch_row($result)) { @@ -161,7 +163,7 @@ $k++; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -169,24 +171,24 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s&SelectedTaxAuthID=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s&SelectedTaxAuthID=%s&delete=yes\">" . _('Delete') . "</a></td> - <td><td><a href=\"%s&TaxAuthority=%s\">" . _('Edit Rates') . "</a></td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[3], - $myrow[2], - $myrow[4], - $myrow[5], - $myrow[6], - $myrow[7], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $_SERVER['PHP_SELF'] . '?', - $myrow[0], - $rootpath . '/TaxAuthorityRates.php?', - $myrow[0]); + <td><a href="%sSelectedTaxAuthID=%s">' . _('Edit') . '</a></td> + <td><a href="%sSelectedTaxAuthID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax authority?') . '\');">' . _('Delete') . '</a></td> + <td><td><a href="%sTaxAuthority=%s">' . _('Edit Rates') . '</a></td> + </tr>', + $myrow[0], + $myrow[1], + $myrow[3], + $myrow[2], + $myrow[4], + $myrow[5], + $myrow[6], + $myrow[7], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $rootpath . '/TaxAuthorityRates.php?', + $myrow[0]); } //END WHILE LIST LOOP @@ -199,7 +201,9 @@ if (isset($SelectedTaxAuthID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review all defined tax authority records') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review all defined tax authority records') . '</a> + </div>'; } @@ -210,14 +214,14 @@ //editing an existing tax authority $sql = "SELECT taxglcode, - purchtaxglaccount, - description, - bank, - bankacc, - bankacctype, - bankswift - FROM taxauthorities - WHERE taxid='" . $SelectedTaxAuthID . "'"; + purchtaxglaccount, + description, + bank, + bankacc, + bankacctype, + bankswift + FROM taxauthorities + WHERE taxid='" . $SelectedTaxAuthID . "'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -231,56 +235,57 @@ $_POST['BankSwift'] = $myrow['bankswift']; - echo "<input type=hidden name='SelectedTaxAuthID' VALUE=" . $SelectedTaxAuthID . '>'; + echo '<input type="hidden" name="SelectedTaxAuthID" value="' . $SelectedTaxAuthID . '" />'; } //end of if $SelectedTaxAuthID only do the else when a new record is being entered $SQL = "SELECT accountcode, - accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=0 - ORDER BY accountcode"; + accountname + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=0 + ORDER BY accountcode"; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { $_POST['Description']=''; } -echo '<table class=selection> -<tr><td>' . _('Tax Type Description') . ":</td> -<td><input type=Text name='Description' size=21 maxlength=20 value='" . $_POST['Description'] . "'></td></tr>"; +echo '<table class="selection"> + <tr> + <td>' . _('Tax Type Description') . ':</td> + <td><input type="text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '"></td> + </tr> + <tr> + <td>' . _('Input tax GL Account') . ':</td> + <td><select name="PurchTaxGLCode">'; - -echo '<tr><td>' . _('Input tax GL Account') . ':</td> - <td><select name="PurchTaxGLCode">'; - while ($myrow = DB_fetch_array($result)) { if (isset($_POST['PurchTaxGLCode']) and $myrow['accountcode']==$_POST['PurchTaxGLCode']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; DB_data_seek($result,0); -echo '<tr><td>' . _('Output tax GL Account') . ':</td> - <td><select name="TaxGLCode">'; +echo '<tr> + <td>' . _('Output tax GL Account') . ':</td> + <td><select name="TaxGLCode">'; - while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGLCode']) and $myrow['accountcode']==$_POST['TaxGLCode']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['accountcode'] . "'>" . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop @@ -297,20 +302,32 @@ $_POST['BankSwift']=''; } -echo '</select></td></tr>'; -echo '<tr><td>' . _('Bank Name') . ':</td>'; -echo '<td><input type=Text name="Bank" size=41 maxlength=40 value="' . $_POST['Bank'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Account Type') . ':</td>'; -echo '<td><input type=Text name="BankAccType" size=15 maxlength=20 value="' . $_POST['BankAccType'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Account') . ':</td>'; -echo '<td><input type=Text name="BankAcc" size=21 maxlength=20 value="' . $_POST['BankAcc'] . '"></td></tr>'; -echo '<tr><td>' . _('Bank Swift No') . ':</td>'; -echo '<td><input type=Text name="BankSwift" size=15 maxlength=14 value="' . $_POST['BankSwift'] . '"></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Bank Name') . ':</td> + <td><input type="text" name="Bank" size="41" maxlength="40" value="' . $_POST['Bank'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Account Type') . ':</td> + <td><input type="text" name="BankAccType" size="15" maxlength="20" value="' . $_POST['BankAccType'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Account') . ':</td> + <td><input type="text" name="BankAcc" size="21" maxlength="20" value="' . $_POST['BankAcc'] . '" /></td> + </tr> + <tr> + <td>' . _('Bank Swift No') . ':</td> + <td><input type="text" name="BankSwift" size="15" maxlength="14" value="' . $_POST['BankSwift'] . '" /></td> + </tr> + </table>'; -echo '</table>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; -echo '<br /><div class="centre"><input type=submit name=submit value=' . _('Enter Information') . '></div></form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/TaxAuthorityRates.php =================================================================== --- trunk/TaxAuthorityRates.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxAuthorityRates.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -12,8 +12,10 @@ $title = _('Tax Rates'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') - . '" alt="" />' . $title. '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Supplier Types') + . '" alt="" />' . $title. ' + </p>'; if (!isset($TaxAuthority)){ @@ -34,7 +36,7 @@ while ($myrow=DB_fetch_array($TaxRatesResult)){ - $sql = "UPDATE taxauthrates SET taxrate=" . ($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']]/100) . " + $sql = "UPDATE taxauthrates SET taxrate=" . (filter_number_format($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']])/100) . " WHERE taxcatid = '" . $myrow['taxcatid'] . "' AND dispatchtaxprovince = '" . $myrow['dispatchtaxprovince'] . "' AND taxauthority = '" . $TaxAuthority . "'"; @@ -49,35 +51,39 @@ /*Display updated rates */ -$TaxAuthDetail = DB_query("SELECT description FROM taxauthorities WHERE taxid='" . $TaxAuthority . "'",$db); +$TaxAuthDetail = DB_query("SELECT description + FROM taxauthorities WHERE taxid='" . $TaxAuthority . "'",$db); $myrow = DB_fetch_row($TaxAuthDetail); echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type=hidden name="TaxAuthority" value="' . $TaxAuthority . '">'; +echo '<input type=hidden name="TaxAuthority" value="' . $TaxAuthority . '" />'; $TaxRatesResult = DB_query("SELECT taxauthrates.taxcatid, taxcategories.taxcatname, taxauthrates.taxrate, taxauthrates.dispatchtaxprovince, taxprovinces.taxprovincename - FROM taxauthrates INNER JOIN taxauthorities - ON taxauthrates.taxauthority=taxauthorities.taxid - INNER JOIN taxprovinces - ON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid - INNER JOIN taxcategories - ON taxauthrates.taxcatid=taxcategories.taxcatid - WHERE taxauthrates.taxauthority='" . $TaxAuthority . "' - ORDER BY taxauthrates.dispatchtaxprovince, - taxauthrates.taxcatid", - $db); + FROM taxauthrates INNER JOIN taxauthorities + ON taxauthrates.taxauthority=taxauthorities.taxid + INNER JOIN taxprovinces + ON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid + INNER JOIN taxcategories + ON taxauthrates.taxcatid=taxcategories.taxcatid + WHERE taxauthrates.taxauthority='" . $TaxAuthority . "' + ORDER BY taxauthrates.dispatchtaxprovince, + taxauthrates.taxcatid", + $db); if (DB_num_rows($TaxRatesResult)>0){ - echo '<table cellpadding=2 class="selection">'; - echo '<tr><th colspan=3><font size=3 color=navy>' . _('Update') . ' ' . $myrow[0] . ' ' . _('Rates') . '</font></th></tr>'; - $TableHeader = '<tr><th>' . _('Deliveries From') . '<br />' . _('Tax Province') . '</th> + echo '<table class="selection">'; + echo '<tr> + <th colspan="3"><font size="3" color="navy">' . _('Update') . ' ' . $myrow[0] . ' ' . _('Rates') . '</font></th> + </tr>'; + $TableHeader = '<tr> + <th>' . _('Deliveries From') . '<br />' . _('Tax Province') . '</th> <th>' . _('Tax Category') . '</th> <th>' . _('Tax Rate') . ' %</th> </tr>'; @@ -89,7 +95,7 @@ while ($myrow = DB_fetch_array($TaxRatesResult)){ if ($OldProvince!=$myrow['dispatchtaxprovince'] AND $OldProvince!=''){ - echo '<tr bgcolor="#555555"><font size=1> </font><td colspan=3></td></tr>'; + echo '<tr bgcolor="#555555"><td colspan="3"></td></tr>'; } if ($k==1){ @@ -101,13 +107,13 @@ } printf('<td>%s</td> - <td>%s</td> - <td><input type="text" class="number" name=%s maxlength=5 size=5 value=%s></td> - </tr>', - $myrow['taxprovincename'], - $myrow['taxcatname'], - $myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid'], - $myrow['taxrate']*100 ); + <td>%s</td> + <td><input type="text" class="number" name=%s maxlength="5" size="5" value="%s" /></td> + </tr>', + $myrow['taxprovincename'], + $myrow['taxcatname'], + $myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid'], + locale_number_format($myrow['taxrate']*100,2)); $OldProvince = $myrow['dispatchtaxprovince']; @@ -116,7 +122,7 @@ echo '</table>'; echo '<br /> <div class="centre"> - <input type=submit name="UpdateRates" VALUE="' . _('Update Rates') . '">'; + <input type="submit" name="UpdateRates" value="' . _('Update Rates') . '" />'; } //end if tax taxcatid/rates to show else { prnMsg(_('There are no tax rates to show - perhaps the dispatch tax province records have not yet been created?'),'warn'); @@ -124,11 +130,16 @@ echo '</form>'; -echo '<br /><br /><a href="' . $rootpath . '/TaxAuthorities.php">' . _('Tax Authorities') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxGroups.php">' . _('Tax Groupings') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxCategories.php">' . _('Tax Categories') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxProvinces.php">' . _('Dispatch Tax Provinces') . '</a>'; -echo '</div>'; +echo '<br /> + <br /> + <a href="' . $rootpath . '/TaxAuthorities.php">' . _('Tax Authorities') . '</a> + <br /> + <a href="' . $rootpath . '/TaxGroups.php">' . _('Tax Groupings') . '</a> + <br /> + <a href="' . $rootpath . '/TaxCategories.php">' . _('Tax Categories') . '</a> + <br /> + <a href="' . $rootpath . '/TaxProvinces.php">' . _('Dispatch Tax Provinces') . '</a> + </div>'; include( 'includes/footer.inc' ); ?> \ No newline at end of file Modified: trunk/TaxCategories.php =================================================================== --- trunk/TaxCategories.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxCategories.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -26,9 +26,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['TaxCategoryName'],'&')>0 OR mb_strpos($_POST['TaxCategoryName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['TaxCategoryName'])) { $InputError = 1; - prnMsg( _('The tax category name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The tax category name cannot contain the character') . " '&' " . _('or the character') ." ' " . _('or a space') ,'error'); } if (trim($_POST['TaxCategoryName']) == '') { $InputError = 1; @@ -162,10 +162,10 @@ $ErrMsg = _('Could not get tax categories because'); $result = DB_query($sql,$db,$ErrMsg); - echo '<table class=selection> - <tr> - <th>' . _('Tax Categories') . '</th> - </tr>'; + echo '<table class="selection"> + <tr> + <th>' . _('Tax Categories') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -178,18 +178,20 @@ $k++; } - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax category?') . '\');">' . _('Delete') .'</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow[1] . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxCategory=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax category?') . '\');">' . _('Delete') .'</a></td> + </tr>'; } //END WHILE LIST LOOP - echo '</table><p>'; + echo '</table><p />'; } //end of ifs and buts! if (isset($SelectedTaxCategory)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Categories') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Categories') . '</a> + </div>'; } echo '<p>'; @@ -216,24 +218,26 @@ $_POST['TaxCategoryName'] = $myrow['taxcatname']; - echo '<input type="hidden" name="SelectedTaxCategory" value="' . $myrow['taxcatid'] . '">'; - echo '<table class=selection>'; + echo '<input type="hidden" name="SelectedTaxCategory" value="' . $myrow['taxcatid'] . '" />'; + echo '<table class="selection">'; } } else { $_POST['TaxCategoryName']=''; - echo '<table class=selection>'; + echo '<table class="selection">'; } echo '<tr> - <td>' . _('Tax Category Name') . ':' . '</td> - <td><input type="text" name="TaxCategoryName" size=30 maxlength=30 value="' . $_POST['TaxCategoryName'] . '"></td> - </tr>'; - echo '</table>'; + <td>' . _('Tax Category Name') . ':' . '</td> + <td><input type="text" name="TaxCategoryName" size=30 maxlength=30 value="' . $_POST['TaxCategoryName'] . '" /></td> + </tr> + </table>'; - echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/TaxGroups.php =================================================================== --- trunk/TaxGroups.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxGroups.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -22,7 +22,7 @@ /* actions to take once the user has clicked the submit button ie the page has called itself with some user input */ //first off validate inputs sensible - if (isset($_POST['GroupName']) && mb_strlen($_POST['GroupName'])<4){ + if (isset($_POST['GroupName']) AND mb_strlen($_POST['GroupName'])<4){ $InputError = 1; prnMsg(_('The Group description entered must be at least 4 characters long'),'error'); } @@ -38,12 +38,15 @@ $SuccessMsg = _('The tax group description was updated to') . ' ' . $_POST['GroupName']; } else { // Add new tax group - $result = DB_query("SELECT taxgroupid FROM taxgroups WHERE taxgroupdescription='" . $_POST['GroupName'] . "'",$db); + $result = DB_query("SELECT taxgroupid + FROM taxgroups + WHERE taxgroupdescription='" . $_POST['GroupName'] . "'",$db); if (DB_num_rows($result)==1){ prnMsg( _('A new tax group could not be added because a tax group already exists for') . ' ' . $_POST['GroupName'],'warn'); unset($sql); } else { - $sql = "INSERT INTO taxgroups (taxgroupdescription) VALUES ('". $_POST['GroupName'] . "')"; + $sql = "INSERT INTO taxgroups (taxgroupdescription) + VALUES ('". $_POST['GroupName'] . "')"; $ErrMsg = _('The addition of the group failed because'); $SuccessMsg = _('Added the new tax group') . ' ' . $_POST['GroupName']; } @@ -54,11 +57,11 @@ $TaxAuthority = $_GET['TaxAuthority']; if( isset($_GET['add']) ) { // adding a tax authority to a tax group $sql = "INSERT INTO taxgrouptaxes ( taxgroupid, - taxauthid, - calculationorder) + taxauthid, + calculationorder) VALUES ('" . $SelectedGroup . "', - '" . $TaxAuthority . "', - 0)"; + '" . $TaxAuthority . "', + 0)"; $ErrMsg = _('The addition of the tax failed because'); $SuccessMsg = _('The tax was added.'); @@ -74,7 +77,7 @@ unset($_GET['TaxAuthority']); } // Need to exec the query - if (isset($sql) && $InputError != 1 ) { + if (isset($sql) AND $InputError != 1 ) { $result = DB_query($sql,$db,$ErrMsg); if( $result ) { prnMsg( $SuccessMsg,'success'); @@ -101,10 +104,10 @@ //need to do a reality check to ensure that taxontax is relevant only for taxes after the first tax $sql = "SELECT taxauthid, - taxontax - FROM taxgrouptaxes - WHERE taxgroupid='" . $SelectedGroup . "' - ORDER BY calculationorder"; + taxontax + FROM taxgrouptaxes + WHERE taxgroupid='" . $SelectedGroup . "' + ORDER BY calculationorder"; $Result = DB_query($sql,$db,_('Could not get tax authorities in the selected tax group')); @@ -112,7 +115,9 @@ $myrow=DB_fetch_array($Result); if ($myrow['taxontax']==1){ prnMsg(_('It is inappropriate to set tax on tax where the tax is the first in the calculation order. The system has changed it back to no tax on tax for this tax authority'),'warning'); - $Result = DB_query("UPDATE taxgrouptaxes SET taxontax=0 WHERE taxgroupid='" . $SelectedGroup . "' AND taxauthid='" . $myrow['taxauthid'] . "'",$db); + $Result = DB_query("UPDATE taxgrouptaxes SET taxontax=0 + WHERE taxgroupid='" . $SelectedGroup . "' + AND taxauthid='" . $myrow['taxauthid'] . "'",$db); } } } elseif (isset($_GET['Delete'])) { @@ -126,7 +131,8 @@ prnMsg( _('Cannot delete this tax group because some customer branches are setup using it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer branches referring to this tax group'); } else { - $sql= "SELECT COUNT(*) FROM suppliers WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql= "SELECT COUNT(*) FROM suppliers + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -134,9 +140,11 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers referring to this tax group'); } else { - $sql="DELETE FROM taxgrouptaxes WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql="DELETE FROM taxgrouptaxes + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); - $sql="DELETE FROM taxgroups WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; + $sql="DELETE FROM taxgroups + WHERE taxgroupid='" . $_GET['SelectedGroup'] . "'"; $result = DB_query($sql,$db); prnMsg( $_GET['GroupID'] . ' ' . _('tax group has been deleted') . '!','success'); } @@ -150,8 +158,8 @@ /* If its the first time the page has been displayed with no parameters then none of the above are true and the list of tax groups will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of tax group taxes*/ $sql = "SELECT taxgroupid, - taxgroupdescription - FROM taxgroups"; + taxgroupdescription + FROM taxgroups"; $result = DB_query($sql,$db); if( DB_num_rows($result) == 0 ) { @@ -159,9 +167,11 @@ prnMsg(_('There are no tax groups configured.'),'info'); echo '</div>'; } else { - echo '<table class=selection>'; - echo '<tr><th>' . _('Group No') . '</th> - <th>' . _('Tax Group') . '</th></tr>'; + echo '<table class="selection"> + <tr> + <th>' . _('Group No') . '</th> + <th>' . _('Tax Group') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { @@ -174,17 +184,17 @@ } printf('<td>%s</td> - <td>%s</td> - <td><a href="%s&SelectedGroup=%s">' . _('Edit') . '</a></td> - <td><a href="%s&SelectedGroup=%s&Delete=1&GroupID=%s">' . _('Delete') . '</a></td> - </tr>', - $myrow['taxgroupid'], - $myrow['taxgroupdescription'], - $_SERVER['PHP_SELF'] . '?', - $myrow['taxgroupid'], - $_SERVER['PHP_SELF'] . '?', - $myrow['taxgroupid'], - urlencode($myrow['taxgroupdescription'])); + <td>%s</td> + <td><a href="%s&SelectedGroup=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SelectedGroup=%s&Delete=1&GroupID=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this tax group?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['taxgroupid'], + $myrow['taxgroupdescription'], + $_SERVER['PHP_SELF'] . '?', + $myrow['taxgroupid'], + $_SERVER['PHP_SELF'] . '?', + $myrow['taxgroupid'], + urlencode($myrow['taxgroupdescription'])); } //END WHILE LIST LOOP echo '</table>'; @@ -193,16 +203,18 @@ if (isset($SelectedGroup)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Existing Groups') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Existing Groups') . '</a> + </div>'; } if (isset($SelectedGroup)) { //editing an existing role $sql = "SELECT taxgroupid, - taxgroupdescription - FROM taxgroups - WHERE taxgroupid='" . $SelectedGroup . "'"; + taxgroupdescription + FROM taxgroups + WHERE taxgroupid='" . $SelectedGroup . "'"; $result = DB_query($sql, $db); if ( DB_num_rows($result) == 0 ) { prnMsg( _('The selected tax group is no longer available.'),'warn'); @@ -216,7 +228,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if( isset($_POST['SelectedGroup'])) { - echo '<input type="hidden" name="SelectedGroup" value="' . $_POST['SelectedGroup'] . '">'; + echo '<input type="hidden" name="SelectedGroup" value="' . $_POST['SelectedGroup'] . '" />'; } echo '<table class="selection">'; @@ -224,8 +236,10 @@ $_POST['GroupName']=''; } echo '<tr><td>' . _('Tax Group') . ':</td> - <td><input type="text" name="GroupName" size=40 maxlength=40 value="' . $_POST['GroupName'] . '"></td>'; -echo '<td><input type="submit" name="submit" value="' . _('Enter Group') . '"></td></tr></form>'; + <td><input type="text" name="GroupName" size=40 maxlength=40 value="' . $_POST['GroupName'] . '" /></td>'; +echo '<td><input type="submit" name="submit" value="' . _('Enter Group') . '"></td> + </tr> + </form>'; if (isset($SelectedGroup)) { @@ -260,17 +274,18 @@ /* the order and tax on tax will only be an issue if more than one tax authority in the group */ if (count($TaxAuthsUsed)>0) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID .'">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type=hidden name="SelectedGroup" value="' . $SelectedGroup .'">'; - echo '<table class="selection">'; - echo '<tr><th colspan=3><font size=3 color=navy>'._('Calculation Order').'</font></th></tr>'; - - echo '<tr> - <th>'._('Tax Authority').'</th> - <th>'._('Order').'</th> - <th>'._('Tax on Prior Taxes').'</th> - </tr>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type=hidden name="SelectedGroup" value="' . $SelectedGroup .'" />'; + echo '<table class="selection"> + <tr> + <th colspan=3><font size="3" color="navy">'._('Calculation Order').'</font></th> + </tr> + <tr> + <th>'._('Tax Authority').'</th> + <th>'._('Order').'</th> + <th>'._('Tax on Prior Taxes').'</th> + </tr>'; $k=0; //row colour counter for ($i=1;$i < count($TaxAuthRow)+1;$i++) { if ($k==1){ @@ -285,10 +300,9 @@ $TaxAuthRow[$i]['calculationorder'] = $i; } - echo '<td>' . $TaxAuthRow[$i]['taxname'] . '</td><td>'. - '<input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . - $TaxAuthRow[$i]['calculationorder'] . '" size=2 maxlength=2 style="width: 100%"></td>'; - echo '<td><select name="TaxOnTax_' . $TaxAuthRow[$i]['taxauthid'] . '" style="width: 100%">'; + echo '<td>' . $TaxAuthRow[$i]['taxname'] . '</td> + <td><input type="text" class="number" name="CalcOrder_' . $TaxAuthRow[$i]['taxauthid'] . '" value="' . $TaxAuthRow[$i]['calculationorder'] . '" size="2" maxlength="2" style="width: 100%" /></td> + <td><select name="TaxOnTax_' . $TaxAuthRow[$i]['taxauthid'] . '" style="width: 100%">'; if ($TaxAuthRow[$i]['taxontax']==1){ echo '<option selected value=1>' . _('Yes') . '</option>'; echo '<option value=0>' . _('No') . '</option>'; @@ -296,35 +310,42 @@ echo '<option value=1>' . _('Yes') . '</option>'; echo '<option selected value=0>' . _('No') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateOrder" value="' . _('Update Order') . '"></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="UpdateOrder" value="' . _('Update Order') . '" /> + </div>'; } echo '</form>'; if (DB_num_rows($Result)>0 ) { echo '<br />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> - <th colspan=4>'._('Assigned Taxes') . '</th> + <th colspan="4">'._('Assigned Taxes') . '</th> <th></th> - <th colspan=2>' . _('Available Taxes') . '</th> + <th colspan="2">' . _('Available Taxes') . '</th> + </tr> + <tr> + <th>' . _('Tax Auth ID') . '</th> + <th>' . _('Tax Authority Name') . '</th> + <th>' . _('Calculation Order') . '</th> + <th>' . _('Tax on Prior Tax(es)') . '</th> + <th></th> + <th>' . _('Tax Auth ID') . '</th> + <th>' . _('Tax Authority Name') . '</th> </tr>'; - echo '<tr> - <th>' . _('Tax Auth ID') . '</th> - <th>' . _('Tax Authority Name') . '</th> - <th>' . _('Calculation Order') . '</th> - <th>' . _('Tax on Prior Tax(es)') . '</th> - <th></th> - <th>' . _('Tax Auth ID') . '</th> - <th>' . _('Tax Authority Name') . '</th> - </tr>'; } else { - echo '<br /><div class="centre">' . _('There are no tax authorities defined to allocate to this tax group').'</div>'; + echo '<br /> + <div class="centre">' . + _('There are no tax authorities defined to allocate to this tax group').' + </div>'; } $k=0; //row colour counter @@ -351,7 +372,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href="%s&SelectedGroup=%s&remove=1&TaxAuthority=%s">' . _('Remove') . '</a></td> + <td><a href="%sSelectedGroup=%s&remove=1&TaxAuthority=%s" onclick="return confirm(\'' . _('Are you sure you wish to remove this tax authority from the group?') . '\');">' . _('Remove') . '</a></td> <td> </td> <td> </td>', $AvailRow['taxid'], @@ -371,7 +392,7 @@ <td> </td> <td>%s</td> <td>%s</td> - <td><a href="%s&SelectedGroup=%s&add=1&TaxAuthority=%s">' . _('Add') . '</a></td>', + <td><a href="%sSelectedGroup=%s&add=1&TaxAuthority=%s">' . _('Add') . '</a></td>', $AvailRow['taxid'], $AvailRow['taxname'], $_SERVER['PHP_SELF'] . '?', Modified: trunk/TaxProvinces.php =================================================================== --- trunk/TaxProvinces.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TaxProvinces.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -7,7 +7,9 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.' + </p>'; if ( isset($_GET['SelectedTaxProvince']) ) $SelectedTaxProvince = $_GET['SelectedTaxProvince']; @@ -25,9 +27,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['TaxProvinceName'],'&')>0 OR mb_strpos($_POST['TaxProvinceName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['TaxProvinceName'])) { $InputError = 1; - prnMsg( _('The tax province name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The tax province name cannot contain any of the illegal characters'),'error'); } if (trim($_POST['TaxProvinceName']) == '') { $InputError = 1; @@ -74,22 +76,24 @@ WHERE taxprovincename " .LIKE. " '".$_POST['TaxProvinceName'] ."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); + if ( $myrow[0] > 0 ) { + $InputError = 1; prnMsg( _('The tax province cannot be created because another with the same name already exists'),'error'); + } else { - $sql = "INSERT INTO taxprovinces ( - taxprovincename ) - VALUES ( - '" . $_POST['TaxProvinceName'] ."' - )"; + + $sql = "INSERT INTO taxprovinces (taxprovincename ) + VALUES ('" . $_POST['TaxProvinceName'] ."')"; + $ErrMsg = _('Could not add tax province'); $result = DB_query($sql,$db, $ErrMsg); $TaxProvinceID = DB_Last_Insert_ID($db, 'taxprovinces', 'taxprovinceid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) SELECT taxauthorities.taxid, '" . $TaxProvinceID . "', taxcategories.taxcatid - FROM taxauthorities CROSS JOIN taxcategories"; + FROM taxauthorities CROSS JOIN taxcategories"; $ErrMsg = _('Could not add tax authority rates for the new dispatch tax province. The rates of tax will not be able to be added - manual database interaction will be required to use this dispatch tax province'); $result = DB_query($sql,$db, $ErrMsg); } @@ -156,10 +160,10 @@ $ErrMsg = _('Could not get tax categories because'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> - <tr> - <th>" . _('Tax Provinces') . "</th> - </tr>"; + echo '<table class="selection"> + <tr> + <th>' . _('Tax Provinces') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -172,10 +176,10 @@ $k++; } - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTaxProvince=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTaxProvince=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; - echo '</tr>'; + echo '<td>' . $myrow[1] . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxProvince=' . $myrow[0] . '">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTaxProvince=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td> + </tr>'; } //END WHILE LIST LOOP echo '</table><p>'; @@ -183,7 +187,9 @@ if (isset($SelectedTaxProvince)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Provinces') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Tax Provinces') . '</a> + </div>'; } echo '<p>'; @@ -210,7 +216,7 @@ $_POST['TaxProvinceName'] = $myrow['taxprovincename']; - echo '<input type=hidden name="SelectedTaxProvince" value="' . $myrow['taxprovinceid'] . '">'; + echo '<input type="hidden" name="SelectedTaxProvince" value="' . $myrow['taxprovinceid'] . '" />'; echo '<table class="selection">'; } @@ -219,22 +225,28 @@ echo '<table class="selection">'; } echo '<tr> - <td>' . _('Tax Province Name') . ':' . '</td> - <td><input type="text" name="TaxProvinceName" size="30" maxlength="30" value="' . $_POST['TaxProvinceName'] . '"></td> - </tr>'; - echo '</table>'; + <td>' . _('Tax Province Name') . ':' . '</td> + <td><input type="text" name="TaxProvinceName" size="30" maxlength="30" value="' . $_POST['TaxProvinceName'] . '" /></td> + </tr> + </table>'; - echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /> + <div class="centre"> + <input type=Submit name=submit value="' . _('Enter Information') . '" /> + </div>'; echo '</form>'; } //end if record deleted no point displaying form to add record -echo '<div class="centre">'; -echo '<br /><a href="' . $rootpath . '/TaxAuthorities.php">' . _('Edit/Review Tax Authorities') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxGroups.php">' . _('Edit/Review Tax Groupings') . '</a>'; -echo '<br /><a href="' . $rootpath . '/TaxCategories.php">' . _('Edit/Review Tax Categories') . '</a>'; -echo '</div>'; +echo '<div class="centre"> + <br /> + <a href="' . $rootpath . '/TaxAuthorities.php">' . _('Edit/Review Tax Authorities') . '</a> + <br /> + <a href="' . $rootpath . '/TaxGroups.php">' . _('Edit/Review Tax Groupings') . '</a> + <br /> + <a href="' . $rootpath . '/TaxCategories.php">' . _('Edit/Review Tax Categories') . '</a> + </div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/TopItems.php =================================================================== --- trunk/TopItems.php 2011-10-16 07:24:19 UTC (rev 4722) +++ trunk/TopItems.php 2011-10-17 09:14:05 UTC (rev 4723) @@ -11,9 +11,9 @@ if (!(isset($_POST['Search']))) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="POST">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table cellpadding="3" colspan="4" class="selection">'; + echo '<table class="selection">'; //to view store location echo '<tr> <td width="150">' . _('Select Location') . ' </td> @@ -21,17 +21,20 @@ <td><select name="Location">'; $sql = "SELECT loccode, locationname - FROM `locations`"; + FROM locations"; $result = DB_query($sql, $db); echo '<option value="All">' . _('All') . '</option>'; while ($myrow = DB_fetch_array($result)) { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['loccode'] . ' - ' . $myrow['locationname'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; //to view list of customer - echo '<tr><td width="150">' . _('Select Customer Type') . '</td> - <td>:</td> - <td><select name="Customers">'; + echo '<tr> + <td width="150">' . _('Select Customer Type') . '</td> + <td>:</td> + <td><select name="Customers">'; + $sql = "SELECT typename, typeid FROM debtortype"; @@ -41,17 +44,20 @@ echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } echo '</select></td> - </tr>'; + </tr>'; //view order by list to display - echo '<tr> <td width="150">' . _('Select Order By ') . ' </td> - <td>:</td> - <td><select name="Sequence">'; - echo ' <option value="totalinvoiced">' . _('Total Pieces') . '</option>'; - echo ' <option value="valuesales">' . _('Value of Sales') . '</option>'; - echo ' </select></td> - </tr>'; + echo '<tr> + <td width="150">' . _('Select Order By ') . ' </td> + <td>:</td> + <td><select name="Sequence"> + <option value="totalinvoiced">' . _('Total Pieces') . '</option> + <option value="valuesales">' . _('Value of Sales') . '</option> + </select></td> + </tr>'; //View number of days - echo '<tr><td>' . _('Number Of Days') . ' </td><td>:</td> + echo '<tr> + <td>' . _('Number Of Days') . ' </td> + <td>:</td> <td><input class="number" tabindex="3" type="text" name="NumberOfDays" size="8" maxlength="8" value="0" /></td> </tr>'; //view number of NumberOfTopItems items @@ -65,8 +71,8 @@ </tr> </table> <br /> - <div class=centre> - <input tabindex=5 type="submit" name="Search" value="' . _('Search') . '" /> + <div class="centre"> + <input tabindex="5" type="submit" name="Search" value="' . _('Search') . '" /> </div> </form>'; } else { @@ -164,7 +170,8 @@ echo '<form action="PDFTopItems.php" method="GET"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr><th>' . _('#') . '</th> + $TableHeader = '<tr> + <th>' . _('#') . '</th> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Total Invoiced') . '</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-17 09:29:40
|
Revision: 4724 http://web-erp.svn.sourceforge.net/web-erp/?rev=4724&view=rev Author: daintree Date: 2011-10-17 09:29:33 +0000 (Mon, 17 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php Modified: trunk/TopItems.php =================================================================== --- trunk/TopItems.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/TopItems.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -10,7 +10,9 @@ //check if input already if (!(isset($_POST['Search']))) { - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . '</p>'; + echo '<p class="page_title_text"> + <img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . ' + </p>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/UnitsOfMeasure.php =================================================================== --- trunk/UnitsOfMeasure.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/UnitsOfMeasure.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -25,9 +25,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['MeasureName'],'&')>0 OR mb_strpos($_POST['MeasureName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['MeasureName'])) { $InputError = 1; - prnMsg( _('The unit of measure cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The unit of measure cannot contain any of the illegal characters') ,'error'); } if (trim($_POST['MeasureName']) == '') { $InputError = 1; @@ -81,11 +81,8 @@ $InputError = 1; prnMsg( _('The unit of measure can not be created because another with the same name already exists.'),'error'); } else { - $sql = "INSERT INTO unitsofmeasure ( - unitname ) - VALUES ( - '" . $_POST['MeasureName'] ."' - )"; + $sql = "INSERT INTO unitsofmeasure (unitname ) + VALUES ('" . $_POST['MeasureName'] ."')"; } $msg = _('New unit of measure added'); } @@ -186,7 +183,7 @@ echo '<td>' . $myrow[1] . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this unit of measure?') . '\');">' . _('Delete') .'</a></td>'; echo '</tr>'; } //END WHILE LIST LOOP @@ -195,10 +192,12 @@ if (isset($SelectedMeasureID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Units of Measure') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Units of Measure') . '</a> + </div>'; } -echo '<p>'; +echo '<p />'; if (! isset($_GET['delete'])) { @@ -223,7 +222,7 @@ $_POST['MeasureID'] = $myrow['unitid']; $_POST['MeasureName'] = $myrow['unitname']; - echo '<input type="hidden" name="SelectedMeasureID" value="' . $_POST['MeasureID'] . '">'; + echo '<input type="hidden" name="SelectedMeasureID" value="' . $_POST['MeasureID'] . '" />'; echo '<table class="selection">'; } @@ -233,11 +232,13 @@ } echo '<tr> <td>' . _('Unit of Measure') . ':' . '</td> - <td><input type="text" name="MeasureName" size="30" maxlength="30" value="' . $_POST['MeasureName'] . '"></td> + <td><input type="text" name="MeasureName" size="30" maxlength="30" value="' . $_POST['MeasureName'] . '" /></td> </tr>'; echo '</table>'; - echo '<div class="centre"><input type="submit" name="Submit" value=' . _('Enter Information') . '></div>'; + echo '<div class="centre"> + <input type="submit" name="Submit" value=' . _('Enter Information') . '> + </div>'; echo '</form>'; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/UpgradeDatabase.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -14,22 +14,26 @@ if (!isset($_SESSION['VersionNumber'])){ prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is not actually recorded at this version'),'info'); - echo '<table><tr><td>' . _('Select the version you are upgrading from:') . '</td> - <td><select name="OldVersion" >'; - echo '<option selected value="Manual">' . _('Apply database changes manually') . '</option>'; - echo '<option value="3.00">' . _('Version 3.00') . '</option>'; - echo '<option value="3.01">' . _('Version 3.01') . '</option>'; - echo '<option value="3.02">' . _('Version 3.02') . '</option>'; - echo '<option value="3.03">' . _('Version 3.03') . '</option>'; - echo '<option value="3.04">' . _('Version 3.04') . '</option>'; - echo '<option value="3.05">' . _('Version 3.05') . '</option>'; - echo '<option value="3.06">' . _('Version 3.06') . '</option>'; - echo '<option value="3.07">' . _('Version 3.07') . '</option>'; - echo '<option value="3.08">' . _('Version 3.08') . '</option>'; - echo '<option value="3.09">' . _('Version 3.09') . '</option>'; - echo '<option value="3.10">' . _('Version 3.10') . '</option>'; - echo '<option value="3.11.x">' . _('Version 3.11 or 4.01 - 4.02') . '</option>'; - echo '</select></td></tr></table>'; + echo '<table class="selection"> + <tr> + <td>' . _('Select the version you are upgrading from:') . '</td> + <td><select name="OldVersion" > + <option selected value="Manual">' . _('Apply database changes manually') . '</option> + <option value="3.00">' . _('Version 3.00') . '</option> + <option value="3.01">' . _('Version 3.01') . '</option> + <option value="3.02">' . _('Version 3.02') . '</option> + <option value="3.03">' . _('Version 3.03') . '</option> + <option value="3.04">' . _('Version 3.04') . '</option> + <option value="3.05">' . _('Version 3.05') . '</option> + <option value="3.06">' . _('Version 3.06') . '</option> + <option value="3.07">' . _('Version 3.07') . '</option> + <option value="3.08">' . _('Version 3.08') . '</option> + <option value="3.09">' . _('Version 3.09') . '</option> + <option value="3.10">' . _('Version 3.10') . '</option> + <option value="3.11.x">' . _('Version 3.11 or 4.01 - 4.02') . '</option> + </select></td> + </tr> + </table>'; } else { if ($_SESSION['VersionNumber']=='4.00RC1'){ $_SESSION['VersionNumber']='3.12'; @@ -130,8 +134,11 @@ $ScriptFileEntries = sizeof($SQLEntries); $sql =''; $InAFunction = false; - echo '<br /><table> - <tr><th colspan=2>' . _('Applying') . ' ' . $SQLScriptFile . '</th></tr>'; + echo '<br /> + <table> + <tr> + <th colspan="2">' . _('Applying') . ' ' . $SQLScriptFile . '</th> + </tr>'; for ($i=0; $i<=$ScriptFileEntries; $i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-17 09:29:43
|
Revision: 4724 http://web-erp.svn.sourceforge.net/web-erp/?rev=4724&view=rev Author: daintree Date: 2011-10-17 09:29:33 +0000 (Mon, 17 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php Modified: trunk/TopItems.php =================================================================== --- trunk/TopItems.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/TopItems.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -10,7 +10,9 @@ //check if input already if (!(isset($_POST['Search']))) { - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . '</p>'; + echo '<p class="page_title_text"> + <img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Top Sales Order Search') . '" alt="" />' . ' ' . _('Top Sales Order Search') . ' + </p>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?name="SelectCustomer" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/UnitsOfMeasure.php =================================================================== --- trunk/UnitsOfMeasure.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/UnitsOfMeasure.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -25,9 +25,9 @@ //first off validate inputs sensible - if (mb_strpos($_POST['MeasureName'],'&')>0 OR mb_strpos($_POST['MeasureName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['MeasureName'])) { $InputError = 1; - prnMsg( _('The unit of measure cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The unit of measure cannot contain any of the illegal characters') ,'error'); } if (trim($_POST['MeasureName']) == '') { $InputError = 1; @@ -81,11 +81,8 @@ $InputError = 1; prnMsg( _('The unit of measure can not be created because another with the same name already exists.'),'error'); } else { - $sql = "INSERT INTO unitsofmeasure ( - unitname ) - VALUES ( - '" . $_POST['MeasureName'] ."' - )"; + $sql = "INSERT INTO unitsofmeasure (unitname ) + VALUES ('" . $_POST['MeasureName'] ."')"; } $msg = _('New unit of measure added'); } @@ -186,7 +183,7 @@ echo '<td>' . $myrow[1] . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedMeasureID=' . $myrow[0] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this unit of measure?') . '\');">' . _('Delete') .'</a></td>'; echo '</tr>'; } //END WHILE LIST LOOP @@ -195,10 +192,12 @@ if (isset($SelectedMeasureID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Units of Measure') . '</a></div>'; + echo '<div class="centre"> + <a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Units of Measure') . '</a> + </div>'; } -echo '<p>'; +echo '<p />'; if (! isset($_GET['delete'])) { @@ -223,7 +222,7 @@ $_POST['MeasureID'] = $myrow['unitid']; $_POST['MeasureName'] = $myrow['unitname']; - echo '<input type="hidden" name="SelectedMeasureID" value="' . $_POST['MeasureID'] . '">'; + echo '<input type="hidden" name="SelectedMeasureID" value="' . $_POST['MeasureID'] . '" />'; echo '<table class="selection">'; } @@ -233,11 +232,13 @@ } echo '<tr> <td>' . _('Unit of Measure') . ':' . '</td> - <td><input type="text" name="MeasureName" size="30" maxlength="30" value="' . $_POST['MeasureName'] . '"></td> + <td><input type="text" name="MeasureName" size="30" maxlength="30" value="' . $_POST['MeasureName'] . '" /></td> </tr>'; echo '</table>'; - echo '<div class="centre"><input type="submit" name="Submit" value=' . _('Enter Information') . '></div>'; + echo '<div class="centre"> + <input type="submit" name="Submit" value=' . _('Enter Information') . '> + </div>'; echo '</form>'; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-10-17 09:14:05 UTC (rev 4723) +++ trunk/UpgradeDatabase.php 2011-10-17 09:29:33 UTC (rev 4724) @@ -14,22 +14,26 @@ if (!isset($_SESSION['VersionNumber'])){ prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is not actually recorded at this version'),'info'); - echo '<table><tr><td>' . _('Select the version you are upgrading from:') . '</td> - <td><select name="OldVersion" >'; - echo '<option selected value="Manual">' . _('Apply database changes manually') . '</option>'; - echo '<option value="3.00">' . _('Version 3.00') . '</option>'; - echo '<option value="3.01">' . _('Version 3.01') . '</option>'; - echo '<option value="3.02">' . _('Version 3.02') . '</option>'; - echo '<option value="3.03">' . _('Version 3.03') . '</option>'; - echo '<option value="3.04">' . _('Version 3.04') . '</option>'; - echo '<option value="3.05">' . _('Version 3.05') . '</option>'; - echo '<option value="3.06">' . _('Version 3.06') . '</option>'; - echo '<option value="3.07">' . _('Version 3.07') . '</option>'; - echo '<option value="3.08">' . _('Version 3.08') . '</option>'; - echo '<option value="3.09">' . _('Version 3.09') . '</option>'; - echo '<option value="3.10">' . _('Version 3.10') . '</option>'; - echo '<option value="3.11.x">' . _('Version 3.11 or 4.01 - 4.02') . '</option>'; - echo '</select></td></tr></table>'; + echo '<table class="selection"> + <tr> + <td>' . _('Select the version you are upgrading from:') . '</td> + <td><select name="OldVersion" > + <option selected value="Manual">' . _('Apply database changes manually') . '</option> + <option value="3.00">' . _('Version 3.00') . '</option> + <option value="3.01">' . _('Version 3.01') . '</option> + <option value="3.02">' . _('Version 3.02') . '</option> + <option value="3.03">' . _('Version 3.03') . '</option> + <option value="3.04">' . _('Version 3.04') . '</option> + <option value="3.05">' . _('Version 3.05') . '</option> + <option value="3.06">' . _('Version 3.06') . '</option> + <option value="3.07">' . _('Version 3.07') . '</option> + <option value="3.08">' . _('Version 3.08') . '</option> + <option value="3.09">' . _('Version 3.09') . '</option> + <option value="3.10">' . _('Version 3.10') . '</option> + <option value="3.11.x">' . _('Version 3.11 or 4.01 - 4.02') . '</option> + </select></td> + </tr> + </table>'; } else { if ($_SESSION['VersionNumber']=='4.00RC1'){ $_SESSION['VersionNumber']='3.12'; @@ -130,8 +134,11 @@ $ScriptFileEntries = sizeof($SQLEntries); $sql =''; $InAFunction = false; - echo '<br /><table> - <tr><th colspan=2>' . _('Applying') . ' ' . $SQLScriptFile . '</th></tr>'; + echo '<br /> + <table> + <tr> + <th colspan="2">' . _('Applying') . ' ' . $SQLScriptFile . '</th> + </tr>'; for ($i=0; $i<=$ScriptFileEntries; $i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fox...@us...> - 2011-10-19 01:32:55
|
Revision: 4727 http://web-erp.svn.sourceforge.net/web-erp/?rev=4727&view=rev Author: foxdeluxe Date: 2011-10-19 01:32:48 +0000 (Wed, 19 Oct 2011) Log Message: ----------- number formatting Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMs.php trunk/ContractOtherReqts.php trunk/CustomerAllocations.php trunk/CustomerReceipt.php Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/BOMExtendedQty.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -15,7 +15,7 @@ $PageNumber=1; $line_height=12; - if (!$_POST['Quantity'] OR !is_numeric($_POST['Quantity'])) { + if (!$_POST['Quantity'] OR !is_numeric(filter_number_format($_POST['Quantity']))) { $_POST['Quantity'] = 1; } @@ -48,7 +48,7 @@ // This finds the top level $sql = "INSERT INTO passbom (part, extendedqpa, sortpart) SELECT bom.component AS part, - (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa, + (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa, CONCAT(bom.parent,bom.component) AS sortpart FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' @@ -76,7 +76,7 @@ bom.loccode, bom.effectiveafter, bom.effectiveto, - (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa + (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() @@ -331,4 +331,4 @@ $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader function -?> \ No newline at end of file +?> Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/BOMs.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -226,13 +226,13 @@ $Errors[$i] = 'EffectiveTo'; $i++; } - if (!is_numeric($_POST['Quantity'])) { + if (!is_numeric(filter_number_format($_POST['Quantity']))) { $InputError = 1; prnMsg(_('The quantity entered must be numeric'),'error'); $Errors[$i] = 'Quantity'; $i++; } - if ($_POST['Quantity']==0) { + if (filter_number_format($_POST['Quantity']==0)) { $InputError = 1; prnMsg(_('The quantity entered cannot be zero'),'error'); $Errors[$i] = 'Quantity'; @@ -270,7 +270,7 @@ loccode='" . $_POST['LocCode'] . "', effectiveafter='" . $EffectiveAfterSQL . "', effectiveto='" . $EffectiveToSQL . "', - quantity= '" . $_POST['Quantity'] . "', + quantity= '" . filter_number_format($_POST['Quantity']) . "', autoissue='" . $_POST['AutoIssue'] . "' WHERE bom.parent='" . $SelectedParent . "' AND bom.component='" . $SelectedComponent . "'"; @@ -317,7 +317,7 @@ '" . $_POST['Component'] . "', '" . $_POST['WorkCentreAdded'] . "', '" . $_POST['LocCode'] . "', - " . $_POST['Quantity'] . ", + " . filter_number_format($_POST['Quantity']) . ", '" . $EffectiveAfterSQL . "', '" . $EffectiveToSQL . "', " . $_POST['AutoIssue'] . ")"; @@ -867,4 +867,4 @@ } //end StockID already selected include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/ContractOtherReqts.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -28,8 +28,8 @@ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractRequirement($ContractComponentID); } else { - $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Quantity=$_POST['Qty'.$ContractComponentID]; - $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->CostPerUnit=$_POST['CostPerUnit'.$ContractComponentID]; + $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Quantity=filter_number_format($_POST['Qty'.$ContractComponentID]); + $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->CostPerUnit=filter_number_format($_POST['CostPerUnit'.$ContractComponentID]); $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Requirement=$_POST['Requirement'.$ContractComponentID]; } } // end loop around the items on the contract requirements array @@ -55,18 +55,18 @@ } if (isset($_POST['EnterNewRequirement'])){ $InputError = false; - if (!is_numeric($_POST['Quantity'])){ + if (!is_numeric(filter_number_format($_POST['Quantity']))){ prnMsg(_('The quantity of the new requirement is expected to be numeric'),'error'); $InputError = true; } - if (!is_numeric($_POST['CostPerUnit'])){ + if (!is_numeric(filter_number_format($_POST['CostPerUnit']))){ prnMsg(_('The cost per unit of the new requirement is expected to be numeric'),'error'); $InputError = true; } if (!$InputError){ $_SESSION['Contract'.$identifier]->Add_To_ContractRequirements ($_POST['RequirementDescription'], - $_POST['Quantity'], - $_POST['CostPerUnit']); + filter_number_format($_POST['Quantity']), + filter_number_format($_POST['CostPerUnit'])); unset($_POST['RequirementDescription']); unset($_POST['Quantity']); unset($_POST['CostPerUnit']); @@ -146,4 +146,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/CustomerAllocations.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -40,29 +40,29 @@ // loop through amounts allocated using AllocnItm->ID for each record if (isset($_POST['Amt' . $AllocCounter])) { // allocatable charge amounts - if (!is_numeric($_POST['Amt' . $AllocCounter])) { + if (!is_numeric(filter_number_format($_POST['Amt' . $AllocCounter]))) { $_POST['Amt' . $AllocCounter] = 0; } - if ($_POST['Amt' . $AllocCounter] < 0) { + if (filter_number_format($_POST['Amt' . $AllocCounter] < 0)) { prnMsg(_('Amount entered was negative') . '. ' . _('Only positive amounts are allowed') . '.','warn'); $_POST['Amt' . $AllocCounter] = 0; } if (isset($_POST['All' . $AllocCounter]) and $_POST['All' . $AllocCounter] == True) { $_POST['Amt' . $AllocCounter] = $_POST['YetToAlloc' . $AllocCounter]; } - if ($_POST['Amt' . $AllocCounter] > $_POST['YetToAlloc' . $AllocCounter]) { + if (filter_number_format($_POST['Amt' . $AllocCounter]) > filter_number_format($_POST['YetToAlloc' . $AllocCounter])) { $_POST['Amt' . $AllocCounter]=$_POST['YetToAlloc' . $AllocCounter]; // Amount entered must be smaller than unallocated amount } - $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->AllocAmt = $_POST['Amt' . $AllocCounter]; + $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->AllocAmt = filter_number_format($_POST['Amt' . $AllocCounter]); // recalcuate the new difference on exchange (a +positive amount is a gain -ve a loss) $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch = - ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->TransExRate) - - ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->ExRate); + (filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->TransExRate) - + (filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->ExRate); $TotalDiffOnExch = $TotalDiffOnExch + $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch; - $TotalAllocated = $TotalAllocated + $_POST['Amt' . $AllocCounter]; + $TotalAllocated = $TotalAllocated + filter_number_format($_POST['Amt' . $AllocCounter]); } } @@ -576,4 +576,4 @@ echo '</td></tr></table>'; // end Page Border include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/CustomerReceipt.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -63,15 +63,15 @@ } $_SESSION['ReceiptBatch']->DateBanked = $_POST['DateBanked']; if (isset($_POST['ExRate']) and $_POST['ExRate']!=''){ - if (is_numeric($_POST['ExRate'])){ - $_SESSION['ReceiptBatch']->ExRate = $_POST['ExRate']; + if (is_numeric(filter_number_format($_POST['ExRate']))){ + $_SESSION['ReceiptBatch']->ExRate = filter_number_format($_POST['ExRate']); } else { prnMsg(_('The exchange rate entered should be numeric'),'warn'); } } if (isset($_POST['FunctionalExRate']) and $_POST['FunctionalExRate']!=''){ - if (is_numeric($_POST['FunctionalExRate'])){ - $_SESSION['ReceiptBatch']->FunctionalExRate=$_POST['FunctionalExRate']; //ex rate between receipt currency and account currency + if (is_numeric(filter_number_format($_POST['FunctionalExRate']))){ + $_SESSION['ReceiptBatch']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between receipt currency and account currency } else { prnMsg(_('The functional exchange rate entered should be numeric'),'warn'); } @@ -1078,4 +1078,4 @@ } echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fox...@us...> - 2011-10-19 01:32:55
|
Revision: 4727 http://web-erp.svn.sourceforge.net/web-erp/?rev=4727&view=rev Author: foxdeluxe Date: 2011-10-19 01:32:48 +0000 (Wed, 19 Oct 2011) Log Message: ----------- number formatting Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMs.php trunk/ContractOtherReqts.php trunk/CustomerAllocations.php trunk/CustomerReceipt.php Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/BOMExtendedQty.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -15,7 +15,7 @@ $PageNumber=1; $line_height=12; - if (!$_POST['Quantity'] OR !is_numeric($_POST['Quantity'])) { + if (!$_POST['Quantity'] OR !is_numeric(filter_number_format($_POST['Quantity']))) { $_POST['Quantity'] = 1; } @@ -48,7 +48,7 @@ // This finds the top level $sql = "INSERT INTO passbom (part, extendedqpa, sortpart) SELECT bom.component AS part, - (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa, + (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa, CONCAT(bom.parent,bom.component) AS sortpart FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' @@ -76,7 +76,7 @@ bom.loccode, bom.effectiveafter, bom.effectiveto, - (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa + (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() @@ -331,4 +331,4 @@ $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader function -?> \ No newline at end of file +?> Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/BOMs.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -226,13 +226,13 @@ $Errors[$i] = 'EffectiveTo'; $i++; } - if (!is_numeric($_POST['Quantity'])) { + if (!is_numeric(filter_number_format($_POST['Quantity']))) { $InputError = 1; prnMsg(_('The quantity entered must be numeric'),'error'); $Errors[$i] = 'Quantity'; $i++; } - if ($_POST['Quantity']==0) { + if (filter_number_format($_POST['Quantity']==0)) { $InputError = 1; prnMsg(_('The quantity entered cannot be zero'),'error'); $Errors[$i] = 'Quantity'; @@ -270,7 +270,7 @@ loccode='" . $_POST['LocCode'] . "', effectiveafter='" . $EffectiveAfterSQL . "', effectiveto='" . $EffectiveToSQL . "', - quantity= '" . $_POST['Quantity'] . "', + quantity= '" . filter_number_format($_POST['Quantity']) . "', autoissue='" . $_POST['AutoIssue'] . "' WHERE bom.parent='" . $SelectedParent . "' AND bom.component='" . $SelectedComponent . "'"; @@ -317,7 +317,7 @@ '" . $_POST['Component'] . "', '" . $_POST['WorkCentreAdded'] . "', '" . $_POST['LocCode'] . "', - " . $_POST['Quantity'] . ", + " . filter_number_format($_POST['Quantity']) . ", '" . $EffectiveAfterSQL . "', '" . $EffectiveToSQL . "', " . $_POST['AutoIssue'] . ")"; @@ -867,4 +867,4 @@ } //end StockID already selected include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/ContractOtherReqts.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -28,8 +28,8 @@ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractRequirement($ContractComponentID); } else { - $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Quantity=$_POST['Qty'.$ContractComponentID]; - $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->CostPerUnit=$_POST['CostPerUnit'.$ContractComponentID]; + $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Quantity=filter_number_format($_POST['Qty'.$ContractComponentID]); + $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->CostPerUnit=filter_number_format($_POST['CostPerUnit'.$ContractComponentID]); $_SESSION['Contract'.$identifier]->ContractReqts[$ContractComponentID]->Requirement=$_POST['Requirement'.$ContractComponentID]; } } // end loop around the items on the contract requirements array @@ -55,18 +55,18 @@ } if (isset($_POST['EnterNewRequirement'])){ $InputError = false; - if (!is_numeric($_POST['Quantity'])){ + if (!is_numeric(filter_number_format($_POST['Quantity']))){ prnMsg(_('The quantity of the new requirement is expected to be numeric'),'error'); $InputError = true; } - if (!is_numeric($_POST['CostPerUnit'])){ + if (!is_numeric(filter_number_format($_POST['CostPerUnit']))){ prnMsg(_('The cost per unit of the new requirement is expected to be numeric'),'error'); $InputError = true; } if (!$InputError){ $_SESSION['Contract'.$identifier]->Add_To_ContractRequirements ($_POST['RequirementDescription'], - $_POST['Quantity'], - $_POST['CostPerUnit']); + filter_number_format($_POST['Quantity']), + filter_number_format($_POST['CostPerUnit'])); unset($_POST['RequirementDescription']); unset($_POST['Quantity']); unset($_POST['CostPerUnit']); @@ -146,4 +146,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/CustomerAllocations.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -40,29 +40,29 @@ // loop through amounts allocated using AllocnItm->ID for each record if (isset($_POST['Amt' . $AllocCounter])) { // allocatable charge amounts - if (!is_numeric($_POST['Amt' . $AllocCounter])) { + if (!is_numeric(filter_number_format($_POST['Amt' . $AllocCounter]))) { $_POST['Amt' . $AllocCounter] = 0; } - if ($_POST['Amt' . $AllocCounter] < 0) { + if (filter_number_format($_POST['Amt' . $AllocCounter] < 0)) { prnMsg(_('Amount entered was negative') . '. ' . _('Only positive amounts are allowed') . '.','warn'); $_POST['Amt' . $AllocCounter] = 0; } if (isset($_POST['All' . $AllocCounter]) and $_POST['All' . $AllocCounter] == True) { $_POST['Amt' . $AllocCounter] = $_POST['YetToAlloc' . $AllocCounter]; } - if ($_POST['Amt' . $AllocCounter] > $_POST['YetToAlloc' . $AllocCounter]) { + if (filter_number_format($_POST['Amt' . $AllocCounter]) > filter_number_format($_POST['YetToAlloc' . $AllocCounter])) { $_POST['Amt' . $AllocCounter]=$_POST['YetToAlloc' . $AllocCounter]; // Amount entered must be smaller than unallocated amount } - $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->AllocAmt = $_POST['Amt' . $AllocCounter]; + $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->AllocAmt = filter_number_format($_POST['Amt' . $AllocCounter]); // recalcuate the new difference on exchange (a +positive amount is a gain -ve a loss) $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch = - ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->TransExRate) - - ($_POST['Amt' . $AllocCounter] / $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->ExRate); + (filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->TransExRate) - + (filter_number_format($_POST['Amt' . $AllocCounter]) / $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->ExRate); $TotalDiffOnExch = $TotalDiffOnExch + $_SESSION['Alloc']->Allocs[$_POST['AllocID' . $AllocCounter]]->DiffOnExch; - $TotalAllocated = $TotalAllocated + $_POST['Amt' . $AllocCounter]; + $TotalAllocated = $TotalAllocated + filter_number_format($_POST['Amt' . $AllocCounter]); } } @@ -576,4 +576,4 @@ echo '</td></tr></table>'; // end Page Border include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-10-18 05:51:03 UTC (rev 4726) +++ trunk/CustomerReceipt.php 2011-10-19 01:32:48 UTC (rev 4727) @@ -63,15 +63,15 @@ } $_SESSION['ReceiptBatch']->DateBanked = $_POST['DateBanked']; if (isset($_POST['ExRate']) and $_POST['ExRate']!=''){ - if (is_numeric($_POST['ExRate'])){ - $_SESSION['ReceiptBatch']->ExRate = $_POST['ExRate']; + if (is_numeric(filter_number_format($_POST['ExRate']))){ + $_SESSION['ReceiptBatch']->ExRate = filter_number_format($_POST['ExRate']); } else { prnMsg(_('The exchange rate entered should be numeric'),'warn'); } } if (isset($_POST['FunctionalExRate']) and $_POST['FunctionalExRate']!=''){ - if (is_numeric($_POST['FunctionalExRate'])){ - $_SESSION['ReceiptBatch']->FunctionalExRate=$_POST['FunctionalExRate']; //ex rate between receipt currency and account currency + if (is_numeric(filter_number_format($_POST['FunctionalExRate']))){ + $_SESSION['ReceiptBatch']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between receipt currency and account currency } else { prnMsg(_('The functional exchange rate entered should be numeric'),'warn'); } @@ -1078,4 +1078,4 @@ } echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-19 09:40:51
|
Revision: 4728 http://web-erp.svn.sourceforge.net/web-erp/?rev=4728&view=rev Author: daintree Date: 2011-10-19 09:40:44 +0000 (Wed, 19 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMs.php Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-19 01:32:48 UTC (rev 4727) +++ trunk/BOMExtendedQty.php 2011-10-19 09:40:44 UTC (rev 4728) @@ -258,28 +258,37 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<br /><br /><form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table class="selection">'; + echo '<br /> + <br /> + <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('Part') . ':</td> + echo '<tr> + <td>' . _('Part') . ':</td> <td><input type ="text" name="Part" size="20">'; - echo '<tr><td>' . _('Quantity') . ':</td> - <td><input type="text" class="number" name="Quantity" size="4"></td></tr>'; + echo '<tr> + <td>' . _('Quantity') . ':</td> + <td><input type="text" class="number" name="Quantity" size="4" /></td></tr>'; - echo '<tr><td>' . _('Selection Option') . ':</td> + echo '<tr> + <td>' . _('Selection Option') . ':</td> <td><select name="Select"> <option selected value="All">' . _('Show All Parts') . '</option> <option value="Shortages">' . _('Only Show Shortages') . '</option> - </select></td></tr>'; - echo '<tr><td>' . _('Print Option') . ':</td> + </select></td> + </tr>'; + echo '<tr> + <td>' . _('Print Option') . ':</td> <td><select name="Fill"> <option selected value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> <option value="no">' . _('Plain Print') . '</option> - </select></td></tr>'; + </select></td> + </tr>'; echo '</table> <br /> <br /> <div class="centre"> - <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"> + <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; include('includes/footer.inc'); Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-19 01:32:48 UTC (rev 4727) +++ trunk/BOMs.php 2011-10-19 09:40:44 UTC (rev 4728) @@ -72,30 +72,30 @@ global $ParentMBflag; // Modified by POPAD&T $sql = "SELECT bom.component, - stockmaster.description, - locations.locationname, - workcentres.description, - bom.quantity, - bom.effectiveafter, - bom.effectiveto, - stockmaster.mbflag, - bom.autoissue, - stockmaster.controlled, - locstock.quantity AS qoh, - stockmaster.decimalplaces - FROM bom, - stockmaster, - locations, - workcentres, - locstock - WHERE bom.component='".$Component."' - AND bom.parent = '".$Parent."' - AND bom.component=stockmaster.stockid - AND bom.loccode = locations.loccode - AND locstock.loccode=bom.loccode - AND bom.component = locstock.stockid - AND bom.workcentreadded=workcentres.code - AND stockmaster.stockid=bom.component"; + stockmaster.description, + locations.locationname, + workcentres.description, + bom.quantity, + bom.effectiveafter, + bom.effectiveto, + stockmaster.mbflag, + bom.autoissue, + stockmaster.controlled, + locstock.quantity AS qoh, + stockmaster.decimalplaces + FROM bom, + stockmaster, + locations, + workcentres, + locstock + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."' + AND bom.component=stockmaster.stockid + AND bom.loccode = locations.loccode + AND locstock.loccode=bom.loccode + AND bom.component = locstock.stockid + AND bom.workcentreadded=workcentres.code + AND stockmaster.stockid=bom.component"; $ErrMsg = _('Could not retrieve the BOM components because'); $DbgMsg = _('The SQL used to retrieve the components was'); @@ -132,38 +132,38 @@ $QuantityOnHand = locale_number_format($myrow[10],$myrow[11]); } printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> - <td>'.$DrillText.'</a></td> - <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> - </tr>', - $Level1, - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - ConvertSQLDate($myrow[5]), - ConvertSQLDate($myrow[6]), - $AutoIssue, - $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?', - $Parent, - $myrow[0], - $DrillLink, - $DrillID, - $_SERVER['PHP_SELF'] . '?', - $Parent, - $myrow[0], - $UltimateParent); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $Level1, + $myrow[0], + $myrow[1], + $myrow[2], + $myrow[3], + locale_number_format($myrow[4],'Variable'), + ConvertSQLDate($myrow[5]), + ConvertSQLDate($myrow[6]), + $AutoIssue, + $QuantityOnHand, + $_SERVER['PHP_SELF'] . '?', + $Parent, + $myrow[0], + $DrillLink, + $DrillID, + $_SERVER['PHP_SELF'] . '?', + $Parent, + $myrow[0], + $UltimateParent); } //END WHILE LIST LOOP } //end of function DisplayBOMItems @@ -232,7 +232,7 @@ $Errors[$i] = 'Quantity'; $i++; } - if (filter_number_format($_POST['Quantity']==0)) { + if (filter_number_format($_POST['Quantity'])==0) { $InputError = 1; prnMsg(_('The quantity entered cannot be zero'),'error'); $Errors[$i] = 'Quantity'; @@ -293,10 +293,10 @@ /*Now check to see that the component is not already on the BOM */ $sql = "SELECT component FROM bom - WHERE parent='".$SelectedParent."' - AND component='" . $_POST['Component'] . "' - AND workcentreadded='" . $_POST['WorkCentreAdded'] . "' - AND loccode='" . $_POST['LocCode'] . "'" ; + WHERE parent='".$SelectedParent."' + AND component='" . $_POST['Component'] . "' + AND workcentreadded='" . $_POST['WorkCentreAdded'] . "' + AND loccode='" . $_POST['LocCode'] . "'" ; $ErrMsg = _('An error occurred in checking the component is not already on the BOM'); $DbgMsg = _('The SQL that was used to check the component was not already on the BOM and that failed in the process was'); @@ -306,13 +306,13 @@ if (DB_num_rows($result)==0) { $sql = "INSERT INTO bom (parent, - component, - workcentreadded, - loccode, - quantity, - effectiveafter, - effectiveto, - autoissue) + component, + workcentreadded, + loccode, + quantity, + effectiveafter, + effectiveto, + autoissue) VALUES ('".$SelectedParent."', '" . $_POST['Component'] . "', '" . $_POST['WorkCentreAdded'] . "', @@ -330,7 +330,6 @@ UpdateCost($db, $_POST['Component']); $msg = _('A new component part') . ' ' . $_POST['Component'] . ' ' . _('has been added to the bill of material for part') . ' - ' . $SelectedParent . '.'; - } else { /*The component must already be on the BOM */ @@ -350,13 +349,17 @@ //the link to delete a selected record was clicked instead of the Submit button - $sql="DELETE FROM bom WHERE parent='".$SelectedParent."' AND component='".$SelectedComponent."'"; + $sql="DELETE FROM bom + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."'"; $ErrMsg = _('Could not delete this BOM components because'); $DbgMsg = _('The SQL used to delete the BOM was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - $ComponentSQL = "SELECT component from bom where parent='" . $SelectedParent ."'"; + $ComponentSQL = "SELECT component + FROM bom + WHERE parent='" . $SelectedParent ."'"; $ComponentResult = DB_query($ComponentSQL,$db); $ComponentArray = DB_fetch_row($ComponentResult); UpdateCost($db, $ComponentArray[0]); @@ -505,7 +508,9 @@ echo '</table> <br /> <table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th> + </tr>'; $BOMTree = array(); //BOMTree is a 2 dimensional array with three elements for each item in the array - Level, Parent, Component @@ -514,20 +519,22 @@ display_children($SelectedParent, 1, $BOMTree); $TableHeader = '<tr> - <th>' . _('Level') . '</th> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th> - <th>' . _('Auto Issue') . '</th> - <th>' . _('Qty On Hand') . '</th> + <th>' . _('Level') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + <th>' . _('Auto Issue') . '</th> + <th>' . _('Qty On Hand') . '</th> </tr>'; echo $TableHeader; if(count($BOMTree) == 0) { - echo '<tr class="OddTableRows"><td colspan="8">'._('No materials found.').'</td></tr>'; + echo '<tr class="OddTableRows"> + <td colspan="8">'._('No materials found.').'</td> + </tr>'; } else { $UltimateParent = $SelectedParent; $k = 0; @@ -547,7 +554,8 @@ DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } - echo '</table><br />'; + echo '</table> + <br />'; if (! isset($_GET['delete'])) { @@ -558,14 +566,14 @@ //editing a selected component from the link to the line item $sql = "SELECT loccode, - effectiveafter, - effectiveto, - workcentreadded, - quantity, - autoissue - FROM bom - WHERE parent='".$SelectedParent."' - AND component='".$SelectedComponent."'"; + effectiveafter, + effectiveto, + workcentreadded, + quantity, + autoissue + FROM bom + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -574,7 +582,7 @@ $_POST['EffectiveAfter'] = ConvertSQLDate($myrow['effectiveafter']); $_POST['EffectiveTo'] = ConvertSQLDate($myrow['effectiveto']); $_POST['WorkCentreAdded'] = $myrow['workcentreadded']; - $_POST['Quantity'] = $myrow['quantity']; + $_POST['Quantity'] = locale_number_format($myrow['quantity'],'Variable'); $_POST['AutoIssue'] = $myrow['autoissue']; prnMsg(_('Edit the details of the selected component in the fields below') . '. <br />' . _('Click on the Enter Information button to update the component details'),'info'); @@ -582,8 +590,11 @@ <input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; echo '<input type="hidden" name="SelectedComponent" value="' . $SelectedComponent . '" />'; echo '<table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>'. ('Edit Component Details') .'</font></b></th></tr>'; - echo '<tr><td>' . _('Component') . ':</td> + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>'. ('Edit Component Details') .'</font></b></th> + </tr>'; + echo '<tr> + <td>' . _('Component') . ':</td> <td><b>' . $SelectedComponent . '</b></td> </tr>'; @@ -593,8 +604,12 @@ /* echo "Enter the details of a new component in the fields below. <br />Click on 'Enter Information' to add the new component, once all fields are completed."; */ echo '<table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . ('New Component Details') .'</font></b></th></tr>'; - echo '<tr><td>' . _('Component code') . ':</td><td>'; + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>' . ('New Component Details') .'</font></b></th> + </tr>'; + echo '<tr> + <td>' . _('Component code') . ':</td> + <td>'; echo '<select ' . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) .' tabindex="1" name="Component">'; if ($ParentMBflag=='A'){ /*Its an assembly */ @@ -632,10 +647,12 @@ echo '<option value="' .$myrow['stockid'].'">' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description'] . '</option>'; } //end while loop - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } - echo '<tr><td>' . _('Location') . ': </td> + echo '<tr> + <td>' . _('Location') . ': </td> <td><select tabindex="2" name="LocCode">'; DB_free_result($result); @@ -656,8 +673,9 @@ echo '</select></td> </tr> - <tr><td>' . _('Work Centre Added') . ': </td> - <td><select tabindex="3" name="WorkCentreAdded">'; + <tr> + <td>' . _('Work Centre Added') . ': </td> + <td><select tabindex="3" name="WorkCentreAdded">'; $sql = "SELECT code, description FROM workcentres"; $result = DB_query($sql,$db); @@ -682,7 +700,8 @@ echo '</select></td> </tr> - <tr><td>' . _('Quantity') . ': </td> + <tr> + <td>' . _('Quantity') . ': </td> <td><input ' . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) .' tabindex="4" type="text" class="number" name="Quantity" class="number" size="10" maxlength="8" value="'; if (isset($_POST['Quantity'])){ echo $_POST['Quantity']; @@ -690,7 +709,8 @@ echo 1; } - echo '"></td></tr>'; + echo '" /></td> + </tr>'; if (!isset($_POST['EffectiveTo']) OR $_POST['EffectiveTo']=='') { $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d'),(Date('y')+20))); @@ -699,10 +719,14 @@ $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } - echo '<tr><td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'"></td></tr> - <tr><td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'"></td></tr>'; + echo '<tr> + <td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'" /></td> + </tr> + <tr> + <td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'" /></td> + </tr>'; if ($ParentMBflag=='M' OR $ParentMBflag=='G'){ echo '<tr><td>' . _('Auto Issue this Component to Work Orders') . ':</td> @@ -723,11 +747,14 @@ echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoIssue" value="0">'; + echo '<input type="hidden" name="AutoIssue" value="0" />'; } echo '</table> - <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '"></form></div>'; + <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '" /> + + </form> + </div>'; } //end if record deleted no point displaying form to add record @@ -752,16 +779,17 @@ $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, stockmaster.mbflag, SUM(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.description " . LIKE . " '".$SearchString."' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.description " . LIKE . " '".$SearchString."' AND (stockmaster.mbflag='M' OR stockmaster.mbflag='K' OR stockmaster.mbflag='A' OR stockmaster.mbflag='G') GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, stockmaster.mbflag ORDER BY stockmaster.stockid"; @@ -770,11 +798,11 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.decimalplaces, sum(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' AND (stockmaster.mbflag='M' OR stockmaster.mbflag='K' OR stockmaster.mbflag='G' @@ -782,7 +810,8 @@ GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.units, - stockmaster.mbflag + stockmaster.mbflag, + stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -797,74 +826,79 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title . '</p>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. '</font> + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size="1">' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. '</font> <br /> <table class="selection" cellpadding="3" colspan="4"> <tr><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> - <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25"></td> - <td><font size=3><b>' . _('OR') . '</b></font></td> - <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> - <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18"></td> + <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25" /></td> + <td><font size="3"><b>' . _('OR') . '</b></font></td> + <td><font size="1">' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18" /></td> </tr> </table> - <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; + <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { - - echo '<br /><table cellpadding="2" colspan="7" class="selection">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; - - echo $TableHeader; - - $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">';; - $k=0; - } else { - echo '<tr class="OddTableRows">';; - $k++; + if (isset($_POST['Search']) + AND isset($result) + AND !isset($SelectedParent)) { + + echo '<br /> + <table cellpadding="2" colspan="7" class="selection">'; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; + + echo $TableHeader; + + $j = 1; + $k=0; //row colour counter + while ($myrow=DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">';; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k++; + } + if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ + $StockOnHand = _('N/A'); + } else { + $StockOnHand = locale_number_format($myrow['totalonhand'],$myrow['decimalplaces']); + } + $tab = $j+3; + printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + $StockOnHand, + $myrow['units']); + + $j++; + //end of page full new headings if } - if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ - $StockOnHand = _('N/A'); - } else { - $StockOnHand = locale_number_format($myrow['totalonhand'],2); - } - $tab = $j+3; - printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s"</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', - $myrow['stockid'], - $myrow['description'], - $StockOnHand, - $myrow['units']); - - $j++; -//end of page full new headings if + //end of while loop + + echo '</table>'; + } -//end of while loop + //end if results to show + + if (!isset($SelectedParent) or $SelectedParent=='') { + echo '<script>defaultControl(document.forms[0].StockCode);</script>'; + } else { + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; + } + + echo '</form>'; - echo '</table>'; - -} -//end if results to show - -if (!isset($SelectedParent) or $SelectedParent=='') { - echo '<script>defaultControl(document.forms[0].StockCode);</script>'; -} else { - echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; -} - -echo '</form>'; - } //end StockID already selected include('includes/footer.inc'); -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-19 09:40:55
|
Revision: 4728 http://web-erp.svn.sourceforge.net/web-erp/?rev=4728&view=rev Author: daintree Date: 2011-10-19 09:40:44 +0000 (Wed, 19 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMs.php Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-19 01:32:48 UTC (rev 4727) +++ trunk/BOMExtendedQty.php 2011-10-19 09:40:44 UTC (rev 4728) @@ -258,28 +258,37 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<br /><br /><form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table class="selection">'; + echo '<br /> + <br /> + <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('Part') . ':</td> + echo '<tr> + <td>' . _('Part') . ':</td> <td><input type ="text" name="Part" size="20">'; - echo '<tr><td>' . _('Quantity') . ':</td> - <td><input type="text" class="number" name="Quantity" size="4"></td></tr>'; + echo '<tr> + <td>' . _('Quantity') . ':</td> + <td><input type="text" class="number" name="Quantity" size="4" /></td></tr>'; - echo '<tr><td>' . _('Selection Option') . ':</td> + echo '<tr> + <td>' . _('Selection Option') . ':</td> <td><select name="Select"> <option selected value="All">' . _('Show All Parts') . '</option> <option value="Shortages">' . _('Only Show Shortages') . '</option> - </select></td></tr>'; - echo '<tr><td>' . _('Print Option') . ':</td> + </select></td> + </tr>'; + echo '<tr> + <td>' . _('Print Option') . ':</td> <td><select name="Fill"> <option selected value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> <option value="no">' . _('Plain Print') . '</option> - </select></td></tr>'; + </select></td> + </tr>'; echo '</table> <br /> <br /> <div class="centre"> - <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"> + <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; include('includes/footer.inc'); Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-19 01:32:48 UTC (rev 4727) +++ trunk/BOMs.php 2011-10-19 09:40:44 UTC (rev 4728) @@ -72,30 +72,30 @@ global $ParentMBflag; // Modified by POPAD&T $sql = "SELECT bom.component, - stockmaster.description, - locations.locationname, - workcentres.description, - bom.quantity, - bom.effectiveafter, - bom.effectiveto, - stockmaster.mbflag, - bom.autoissue, - stockmaster.controlled, - locstock.quantity AS qoh, - stockmaster.decimalplaces - FROM bom, - stockmaster, - locations, - workcentres, - locstock - WHERE bom.component='".$Component."' - AND bom.parent = '".$Parent."' - AND bom.component=stockmaster.stockid - AND bom.loccode = locations.loccode - AND locstock.loccode=bom.loccode - AND bom.component = locstock.stockid - AND bom.workcentreadded=workcentres.code - AND stockmaster.stockid=bom.component"; + stockmaster.description, + locations.locationname, + workcentres.description, + bom.quantity, + bom.effectiveafter, + bom.effectiveto, + stockmaster.mbflag, + bom.autoissue, + stockmaster.controlled, + locstock.quantity AS qoh, + stockmaster.decimalplaces + FROM bom, + stockmaster, + locations, + workcentres, + locstock + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."' + AND bom.component=stockmaster.stockid + AND bom.loccode = locations.loccode + AND locstock.loccode=bom.loccode + AND bom.component = locstock.stockid + AND bom.workcentreadded=workcentres.code + AND stockmaster.stockid=bom.component"; $ErrMsg = _('Could not retrieve the BOM components because'); $DbgMsg = _('The SQL used to retrieve the components was'); @@ -132,38 +132,38 @@ $QuantityOnHand = locale_number_format($myrow[10],$myrow[11]); } printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> - <td>'.$DrillText.'</a></td> - <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> - </tr>', - $Level1, - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - ConvertSQLDate($myrow[5]), - ConvertSQLDate($myrow[6]), - $AutoIssue, - $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?', - $Parent, - $myrow[0], - $DrillLink, - $DrillID, - $_SERVER['PHP_SELF'] . '?', - $Parent, - $myrow[0], - $UltimateParent); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $Level1, + $myrow[0], + $myrow[1], + $myrow[2], + $myrow[3], + locale_number_format($myrow[4],'Variable'), + ConvertSQLDate($myrow[5]), + ConvertSQLDate($myrow[6]), + $AutoIssue, + $QuantityOnHand, + $_SERVER['PHP_SELF'] . '?', + $Parent, + $myrow[0], + $DrillLink, + $DrillID, + $_SERVER['PHP_SELF'] . '?', + $Parent, + $myrow[0], + $UltimateParent); } //END WHILE LIST LOOP } //end of function DisplayBOMItems @@ -232,7 +232,7 @@ $Errors[$i] = 'Quantity'; $i++; } - if (filter_number_format($_POST['Quantity']==0)) { + if (filter_number_format($_POST['Quantity'])==0) { $InputError = 1; prnMsg(_('The quantity entered cannot be zero'),'error'); $Errors[$i] = 'Quantity'; @@ -293,10 +293,10 @@ /*Now check to see that the component is not already on the BOM */ $sql = "SELECT component FROM bom - WHERE parent='".$SelectedParent."' - AND component='" . $_POST['Component'] . "' - AND workcentreadded='" . $_POST['WorkCentreAdded'] . "' - AND loccode='" . $_POST['LocCode'] . "'" ; + WHERE parent='".$SelectedParent."' + AND component='" . $_POST['Component'] . "' + AND workcentreadded='" . $_POST['WorkCentreAdded'] . "' + AND loccode='" . $_POST['LocCode'] . "'" ; $ErrMsg = _('An error occurred in checking the component is not already on the BOM'); $DbgMsg = _('The SQL that was used to check the component was not already on the BOM and that failed in the process was'); @@ -306,13 +306,13 @@ if (DB_num_rows($result)==0) { $sql = "INSERT INTO bom (parent, - component, - workcentreadded, - loccode, - quantity, - effectiveafter, - effectiveto, - autoissue) + component, + workcentreadded, + loccode, + quantity, + effectiveafter, + effectiveto, + autoissue) VALUES ('".$SelectedParent."', '" . $_POST['Component'] . "', '" . $_POST['WorkCentreAdded'] . "', @@ -330,7 +330,6 @@ UpdateCost($db, $_POST['Component']); $msg = _('A new component part') . ' ' . $_POST['Component'] . ' ' . _('has been added to the bill of material for part') . ' - ' . $SelectedParent . '.'; - } else { /*The component must already be on the BOM */ @@ -350,13 +349,17 @@ //the link to delete a selected record was clicked instead of the Submit button - $sql="DELETE FROM bom WHERE parent='".$SelectedParent."' AND component='".$SelectedComponent."'"; + $sql="DELETE FROM bom + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."'"; $ErrMsg = _('Could not delete this BOM components because'); $DbgMsg = _('The SQL used to delete the BOM was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - $ComponentSQL = "SELECT component from bom where parent='" . $SelectedParent ."'"; + $ComponentSQL = "SELECT component + FROM bom + WHERE parent='" . $SelectedParent ."'"; $ComponentResult = DB_query($ComponentSQL,$db); $ComponentArray = DB_fetch_row($ComponentResult); UpdateCost($db, $ComponentArray[0]); @@ -505,7 +508,9 @@ echo '</table> <br /> <table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th> + </tr>'; $BOMTree = array(); //BOMTree is a 2 dimensional array with three elements for each item in the array - Level, Parent, Component @@ -514,20 +519,22 @@ display_children($SelectedParent, 1, $BOMTree); $TableHeader = '<tr> - <th>' . _('Level') . '</th> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th> - <th>' . _('Auto Issue') . '</th> - <th>' . _('Qty On Hand') . '</th> + <th>' . _('Level') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + <th>' . _('Auto Issue') . '</th> + <th>' . _('Qty On Hand') . '</th> </tr>'; echo $TableHeader; if(count($BOMTree) == 0) { - echo '<tr class="OddTableRows"><td colspan="8">'._('No materials found.').'</td></tr>'; + echo '<tr class="OddTableRows"> + <td colspan="8">'._('No materials found.').'</td> + </tr>'; } else { $UltimateParent = $SelectedParent; $k = 0; @@ -547,7 +554,8 @@ DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } - echo '</table><br />'; + echo '</table> + <br />'; if (! isset($_GET['delete'])) { @@ -558,14 +566,14 @@ //editing a selected component from the link to the line item $sql = "SELECT loccode, - effectiveafter, - effectiveto, - workcentreadded, - quantity, - autoissue - FROM bom - WHERE parent='".$SelectedParent."' - AND component='".$SelectedComponent."'"; + effectiveafter, + effectiveto, + workcentreadded, + quantity, + autoissue + FROM bom + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -574,7 +582,7 @@ $_POST['EffectiveAfter'] = ConvertSQLDate($myrow['effectiveafter']); $_POST['EffectiveTo'] = ConvertSQLDate($myrow['effectiveto']); $_POST['WorkCentreAdded'] = $myrow['workcentreadded']; - $_POST['Quantity'] = $myrow['quantity']; + $_POST['Quantity'] = locale_number_format($myrow['quantity'],'Variable'); $_POST['AutoIssue'] = $myrow['autoissue']; prnMsg(_('Edit the details of the selected component in the fields below') . '. <br />' . _('Click on the Enter Information button to update the component details'),'info'); @@ -582,8 +590,11 @@ <input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; echo '<input type="hidden" name="SelectedComponent" value="' . $SelectedComponent . '" />'; echo '<table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>'. ('Edit Component Details') .'</font></b></th></tr>'; - echo '<tr><td>' . _('Component') . ':</td> + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>'. ('Edit Component Details') .'</font></b></th> + </tr>'; + echo '<tr> + <td>' . _('Component') . ':</td> <td><b>' . $SelectedComponent . '</b></td> </tr>'; @@ -593,8 +604,12 @@ /* echo "Enter the details of a new component in the fields below. <br />Click on 'Enter Information' to add the new component, once all fields are completed."; */ echo '<table class="selection">'; - echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . ('New Component Details') .'</font></b></th></tr>'; - echo '<tr><td>' . _('Component code') . ':</td><td>'; + echo '<tr> + <th colspan="13"><div class="centre"><font color="blue" size="3"><b>' . ('New Component Details') .'</font></b></th> + </tr>'; + echo '<tr> + <td>' . _('Component code') . ':</td> + <td>'; echo '<select ' . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) .' tabindex="1" name="Component">'; if ($ParentMBflag=='A'){ /*Its an assembly */ @@ -632,10 +647,12 @@ echo '<option value="' .$myrow['stockid'].'">' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description'] . '</option>'; } //end while loop - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } - echo '<tr><td>' . _('Location') . ': </td> + echo '<tr> + <td>' . _('Location') . ': </td> <td><select tabindex="2" name="LocCode">'; DB_free_result($result); @@ -656,8 +673,9 @@ echo '</select></td> </tr> - <tr><td>' . _('Work Centre Added') . ': </td> - <td><select tabindex="3" name="WorkCentreAdded">'; + <tr> + <td>' . _('Work Centre Added') . ': </td> + <td><select tabindex="3" name="WorkCentreAdded">'; $sql = "SELECT code, description FROM workcentres"; $result = DB_query($sql,$db); @@ -682,7 +700,8 @@ echo '</select></td> </tr> - <tr><td>' . _('Quantity') . ': </td> + <tr> + <td>' . _('Quantity') . ': </td> <td><input ' . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) .' tabindex="4" type="text" class="number" name="Quantity" class="number" size="10" maxlength="8" value="'; if (isset($_POST['Quantity'])){ echo $_POST['Quantity']; @@ -690,7 +709,8 @@ echo 1; } - echo '"></td></tr>'; + echo '" /></td> + </tr>'; if (!isset($_POST['EffectiveTo']) OR $_POST['EffectiveTo']=='') { $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d'),(Date('y')+20))); @@ -699,10 +719,14 @@ $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } - echo '<tr><td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'"></td></tr> - <tr><td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'"></td></tr>'; + echo '<tr> + <td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'" /></td> + </tr> + <tr> + <td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'" /></td> + </tr>'; if ($ParentMBflag=='M' OR $ParentMBflag=='G'){ echo '<tr><td>' . _('Auto Issue this Component to Work Orders') . ':</td> @@ -723,11 +747,14 @@ echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoIssue" value="0">'; + echo '<input type="hidden" name="AutoIssue" value="0" />'; } echo '</table> - <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '"></form></div>'; + <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '" /> + + </form> + </div>'; } //end if record deleted no point displaying form to add record @@ -752,16 +779,17 @@ $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, stockmaster.mbflag, SUM(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.description " . LIKE . " '".$SearchString."' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.description " . LIKE . " '".$SearchString."' AND (stockmaster.mbflag='M' OR stockmaster.mbflag='K' OR stockmaster.mbflag='A' OR stockmaster.mbflag='G') GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, stockmaster.mbflag ORDER BY stockmaster.stockid"; @@ -770,11 +798,11 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.decimalplaces, sum(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' AND (stockmaster.mbflag='M' OR stockmaster.mbflag='K' OR stockmaster.mbflag='G' @@ -782,7 +810,8 @@ GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.units, - stockmaster.mbflag + stockmaster.mbflag, + stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -797,74 +826,79 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title . '</p>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. '</font> + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size="1">' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. '</font> <br /> <table class="selection" cellpadding="3" colspan="4"> <tr><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> - <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25"></td> - <td><font size=3><b>' . _('OR') . '</b></font></td> - <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> - <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18"></td> + <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25" /></td> + <td><font size="3"><b>' . _('OR') . '</b></font></td> + <td><font size="1">' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18" /></td> </tr> </table> - <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; + <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { - - echo '<br /><table cellpadding="2" colspan="7" class="selection">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; - - echo $TableHeader; - - $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">';; - $k=0; - } else { - echo '<tr class="OddTableRows">';; - $k++; + if (isset($_POST['Search']) + AND isset($result) + AND !isset($SelectedParent)) { + + echo '<br /> + <table cellpadding="2" colspan="7" class="selection">'; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; + + echo $TableHeader; + + $j = 1; + $k=0; //row colour counter + while ($myrow=DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">';; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k++; + } + if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ + $StockOnHand = _('N/A'); + } else { + $StockOnHand = locale_number_format($myrow['totalonhand'],$myrow['decimalplaces']); + } + $tab = $j+3; + printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + $StockOnHand, + $myrow['units']); + + $j++; + //end of page full new headings if } - if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ - $StockOnHand = _('N/A'); - } else { - $StockOnHand = locale_number_format($myrow['totalonhand'],2); - } - $tab = $j+3; - printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s"</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', - $myrow['stockid'], - $myrow['description'], - $StockOnHand, - $myrow['units']); - - $j++; -//end of page full new headings if + //end of while loop + + echo '</table>'; + } -//end of while loop + //end if results to show + + if (!isset($SelectedParent) or $SelectedParent=='') { + echo '<script>defaultControl(document.forms[0].StockCode);</script>'; + } else { + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; + } + + echo '</form>'; - echo '</table>'; - -} -//end if results to show - -if (!isset($SelectedParent) or $SelectedParent=='') { - echo '<script>defaultControl(document.forms[0].StockCode);</script>'; -} else { - echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; -} - -echo '</form>'; - } //end StockID already selected include('includes/footer.inc'); -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |