|
From: <dai...@us...> - 2011-09-24 07:39:44
|
Revision: 4704
http://web-erp.svn.sourceforge.net/web-erp/?rev=4704&view=rev
Author: daintree
Date: 2011-09-24 07:39:35 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
number_formats
Modified Paths:
--------------
trunk/PrintCustOrder.php
trunk/PrintCustOrder_generic.php
trunk/PrintCustStatements.php
trunk/PrintCustTransPortrait.php
trunk/PurchData.php
trunk/RecurringSalesOrders.php
trunk/RecurringSalesOrdersProcess.php
trunk/ReorderLevel.php
trunk/ReorderLevelLocation.php
trunk/ReverseGRN.php
trunk/includes/LanguageSetup.php
Removed Paths:
-------------
trunk/ReportBug.php
Modified: trunk/PrintCustOrder.php
===================================================================
--- trunk/PrintCustOrder.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/PrintCustOrder.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -2,8 +2,6 @@
/* $Id$ */
-//$PageSecurity = 2;
-
include('includes/session.inc');
include('includes/class.pdf.php');
include('includes/SQL_CommonFunctions.inc');
@@ -25,51 +23,51 @@
/*retrieve the order details from the database to print */
$ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database');
$sql = "SELECT salesorders.customerref,
- salesorders.comments,
- salesorders.orddate,
- salesorders.deliverto,
- salesorders.deladd1,
- salesorders.deladd2,
- salesorders.deladd3,
- salesorders.deladd4,
- salesorders.deladd5,
- salesorders.deladd6,
- salesorders.debtorno,
- salesorders.branchcode,
- salesorders.deliverydate,
- debtorsmaster.name,
- debtorsmaster.address1,
- debtorsmaster.address2,
- debtorsmaster.address3,
- debtorsmaster.address4,
- debtorsmaster.address5,
- debtorsmaster.address6,
- shippers.shippername,
- salesorders.printedpackingslip,
- salesorders.datepackingslipprinted,
- locations.locationname
- FROM salesorders INNER JOIN debtorsmaster
- ON salesorders.debtorno=debtorsmaster.debtorno
- INNER JOIN shippers
- ON salesorders.shipvia=shippers.shipper_id
- INNER JOIN locations
- ON salesorders.fromstkloc=locations.loccode
- WHERE salesorders.orderno='" . $_GET['TransNo']. "'";
+ salesorders.comments,
+ salesorders.orddate,
+ salesorders.deliverto,
+ salesorders.deladd1,
+ salesorders.deladd2,
+ salesorders.deladd3,
+ salesorders.deladd4,
+ salesorders.deladd5,
+ salesorders.deladd6,
+ salesorders.debtorno,
+ salesorders.branchcode,
+ salesorders.deliverydate,
+ debtorsmaster.name,
+ debtorsmaster.address1,
+ debtorsmaster.address2,
+ debtorsmaster.address3,
+ debtorsmaster.address4,
+ debtorsmaster.address5,
+ debtorsmaster.address6,
+ shippers.shippername,
+ salesorders.printedpackingslip,
+ salesorders.datepackingslipprinted,
+ locations.locationname
+ FROM salesorders INNER JOIN debtorsmaster
+ ON salesorders.debtorno=debtorsmaster.debtorno
+ INNER JOIN shippers
+ ON salesorders.shipvia=shippers.shipper_id
+ INNER JOIN locations
+ ON salesorders.fromstkloc=locations.loccode
+ WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']). "'";
$result=DB_query($sql,$db, $ErrMsg);
//If there are no rows, there's a problem.
if (DB_num_rows($result)==0){
-/* Javier */ $ListCount = 0;
+ $ListCount = 0;
$title = _('Print Packing Slip Error');
include('includes/header.inc');
echo '<div class=centre><br /><br /><br />';
prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', '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>
+ <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();
@@ -85,16 +83,24 @@
prnMsg( _('The packing slip for order number') . ' ' . $_GET['TransNo'] . ' ' .
_('has previously been printed') . '. ' . _('It was printed on'). ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) .
'<br />' . _('This check is there to ensure that duplicate packing slips are not produced and dispatched more than once to the customer'), 'warn' );
- echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'
+ echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'
. _('Do a Re-Print') . ' (' . _('On Pre-Printed Stationery') . ') ' . _('Even Though Previously Printed') . '</a><p>' .
- '<a href="' . $rootpath. '/PrintCustOrder_generic.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>';
+ '<a href="' . $rootpath. '/PrintCustOrder_generic.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>';
echo '<br /><br /><br />';
echo _('Or select another Order Number to Print');
- echo '<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 '<table class="table_index">
+ <tr>
+ <td class="menu_group_item">
+ <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;
@@ -109,13 +115,14 @@
$PageNumber = 1;
$ErrMsg = _('There was a problem retrieving the details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database');
$sql = "SELECT salesorderdetails.stkcode,
- stockmaster.description,
- salesorderdetails.quantity,
- salesorderdetails.qtyinvoiced,
- salesorderdetails.unitprice
- FROM salesorderdetails INNER JOIN stockmaster
- ON salesorderdetails.stkcode=stockmaster.stockid
- WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'";
+ stockmaster.description,
+ salesorderdetails.quantity,
+ salesorderdetails.qtyinvoiced,
+ salesorderdetails.unitprice,
+ stockmaster.decimalplaces
+ FROM salesorderdetails INNER JOIN stockmaster
+ ON salesorderdetails.stkcode=stockmaster.stockid
+ WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'";
$result=DB_query($sql, $db, $ErrMsg);
if (DB_num_rows($result)>0){
@@ -162,9 +169,9 @@
while ($myrow2=DB_fetch_array($result)){
- $DisplayQty = locale_number_format($myrow2['quantity'],2);
- $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2);
- $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2);
+ $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']);
+ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']);
+ $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']);
$LeftOvers = $pdf->addTextWrap(13,$YPos,135,$FontSize,$myrow2['stkcode']);
$LeftOvers = $pdf->addTextWrap(148,$YPos,239,$FontSize,$myrow2['description']);
@@ -188,14 +195,16 @@
$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='" .$_GET['TransNo'] . "'";
+ $sql = "UPDATE salesorders SET printedpackingslip=1,
+ datepackingslipprinted='" . Date('Y-m-d') . "'
+ WHERE salesorders.orderno='" .filter_number_format($_GET['TransNo']) . "'";
$result = DB_query($sql,$db);
} else {
$title = _('Print Packing Slip Error');
include('includes/header.inc');
echo '<p>'. _('There were no outstanding items on the order to deliver. A dispatch note cannot be printed').
- '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Print Another Packing Slip/Order').
- '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>';
+ '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order').
+ '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
include('includes/footer.inc');
exit;
} /*end if there are order details to show on the order*/
Modified: trunk/PrintCustOrder_generic.php
===================================================================
--- trunk/PrintCustOrder_generic.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/PrintCustOrder_generic.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -11,7 +11,7 @@
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 />
@@ -65,7 +65,7 @@
WHERE salesorders.debtorno=debtorsmaster.debtorno
AND salesorders.shipvia=shippers.shipper_id
AND salesorders.fromstkloc=locations.loccode
- AND salesorders.orderno='" . $_GET['TransNo'] . "'";
+ AND salesorders.orderno='" . filter_number_format($_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='" . $_GET['TransNo'] . "'";
+ WHERE salesorderdetails.orderno='" . filter_number_format($_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='" .$_GET['TransNo'] . "'";
+ WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'";
$result = DB_query($sql,$db);
}
Modified: trunk/PrintCustStatements.php
===================================================================
--- trunk/PrintCustStatements.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/PrintCustStatements.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -23,16 +23,14 @@
}
if (isset($_GET['FromCust'])) {
- $getFrom = $_GET['FromCust'];
- $_POST['FromCust'] = $getFrom;
+ $_POST['FromCust'] = $_GET['FromCust'];
}
if (isset($_GET['ToCust'])) {
- $getTo = $_GET['ToCust'];
- $_POST['ToCust'] = $getTo;
+ $_POST['ToCust'] = $_GET['ToCust'];
}
-If (isset($_POST['PrintPDF']) && isset($_POST['FromCust']) && $_POST['FromCust']!=''){
+If (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){
$_POST['FromCust'] = mb_strtoupper($_POST['FromCust']);
If (!isset($_POST['ToCust'])){
@@ -68,6 +66,7 @@
debtorsmaster.lastpaid,
debtorsmaster.lastpaiddate,
currencies.currency,
+ currencies.decimalplaces AS currdecimalplaces,
paymentterms.terms
FROM debtorsmaster INNER JOIN currencies
ON debtorsmaster.currcode=currencies.currabrev
@@ -163,8 +162,8 @@
while ($myrow=DB_fetch_array($SetldTrans)){
- $DisplayAlloc = locale_number_format($myrow['alloc'],2);
- $DisplayOutstanding = locale_number_format($myrow['ostdg'],2);
+ $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']);
+ $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']);
$FontSize=9;
@@ -174,10 +173,10 @@
$FontSize=10;
if ($myrow['total']>0){
- $DisplayTotal = locale_number_format($myrow['total'],2);
+ $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']);
$LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,$DisplayTotal, 'right');
} else {
- $DisplayTotal = locale_number_format(-$myrow['total'],2);
+ $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']);
$LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,60,$FontSize,$DisplayTotal, 'right');
}
$LeftOvers = $pdf->addTextWrap($Left_Margin+459,$YPos,60,$FontSize,$DisplayAlloc, 'right');
@@ -214,8 +213,8 @@
while ($myrow=DB_fetch_array($OstdgTrans)){
- $DisplayAlloc = locale_number_format($myrow['alloc'],2);
- $DisplayOutstanding = locale_number_format($myrow['ostdg'],2);
+ $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']);
+ $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']);
$FontSize=9;
$LeftOvers = $pdf->addTextWrap($Left_Margin+1,$YPos,60,$FontSize,$myrow['typename'], 'left');
@@ -224,10 +223,10 @@
$FontSize=10;
if ($myrow['total']>0){
- $DisplayTotal = locale_number_format($myrow['total'],2);
+ $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']);
$LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,55,$FontSize,$DisplayTotal, 'right');
} else {
- $DisplayTotal = locale_number_format(-$myrow['total'],2);
+ $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']);
$LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,55,$FontSize,$DisplayTotal, 'right');
}
@@ -344,11 +343,11 @@
/*Now print out the footer and totals */
- $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2);
- $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2);
- $DisplayBalance = locale_number_format($AgedAnalysis['balance'],2);
- $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2);
- $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],2);
+ $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$StmtHeader['currdecimalplaces']);
+ $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$StmtHeader['currdecimalplaces']);
+ $DisplayBalance = locale_money_format($AgedAnalysis['balance'],$StmtHeader['currdecimalplaces']);
+ $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']);
+ $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']);
$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+(4*$line_height),$Left_Margin,$Bottom_Margin+(4*$line_height));
@@ -376,9 +375,9 @@
$pdf->line($Left_Margin, $YPos,$Perforation,$YPos);
- if (mb_strlen($StmtHeader['lastpaiddate'])>1 && $StmtHeader['lastpaid']!=0){
+ if (mb_strlen($StmtHeader['lastpaiddate'])>1 AND $StmtHeader['lastpaid']!=0){
$pdf->addText($Left_Margin+5, $Bottom_Margin+13, $FontSize, _('Last payment received').' ' . ConvertSQLDate($StmtHeader['lastpaiddate']) .
- ' ' . _('Amount received was').' ' . locale_number_format($StmtHeader['lastpaid'],2));
+ ' ' . _('Amount received was').' ' . locale_money_format($StmtHeader['lastpaid'],$StmtHeader['currdecimalplaces']));
}
/*also show the total due in the remittance section */
@@ -411,19 +410,19 @@
$title = _('Select Statements to Print');
include('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>';
- if (!isset($_POST['FromCust']) || $_POST['FromCust']=='') {
+ if (!isset($_POST['FromCust']) OR $_POST['FromCust']=='') {
/*if FromTransNo is not set then show a form to allow input of either a single statement number or a range of statements to be printed. Also get the last statement 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"><table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<tr><td>' . _('Starting Customer statement to print (Customer code)'). '
- </td><td><input Type=text max=6 size=7 name=FromCust value="1"></td></tr>
+ </td><td><input type="text" max="6" size="7" name="FromCust" value="1" /></td></tr>
<tr><td>'. _('Ending Customer statement to print (Customer code)').'</td><td>
- <input Type=text max=6 size=7 name=ToCust value="zzzzzz"></td></tr></table>
+ <input type="text" max="6" size="7" name="ToCust" value="zzzzzz"></td></tr></table>
<br /><div class="centre">
- <input type=Submit Name="PrintPDF" Value="' .
+ <input type="submit" name="PrintPDF" value="' .
_('Print All Statements in the Range Selected').'">
</div>';
}
Modified: trunk/PrintCustTransPortrait.php
===================================================================
--- trunk/PrintCustTransPortrait.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/PrintCustTransPortrait.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -5,9 +5,9 @@
include('includes/session.inc');
if (isset($_GET['FromTransNo'])) {
- $FromTransNo = $_GET['FromTransNo'];
+ $FromTransNo = filter_number_format($_GET['FromTransNo']);
} elseif (isset($_POST['FromTransNo'])){
- $FromTransNo = $_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;
}
@@ -69,7 +69,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
@@ -164,7 +164,7 @@
INNER JOIN currencies
ON debtorsmaster.currcode=currencies.currabrev
WHERE debtortrans.type=10
- AND debtortrans.transno='" . $FromTransNo . "'";
+ AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'";
if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') {
$sql = $sql . " AND debtorsmaster.ediinvoices=0";
@@ -217,7 +217,7 @@
INNER JOIN currencies
ON debtorsmaster.currcode=currencies.currabrev
WHERE debtortrans.type=11
- AND debtortrans.transno='" . $FromTransNo . "'";
+ AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'";
if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No'){
@@ -234,7 +234,7 @@
prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error');
if ($debug==1){
- prnMsg (_('The SQL used to get this information that failed was') . "<br />" . $sql,'error');
+ prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error');
}
include ('includes/footer.inc');
exit;
@@ -260,7 +260,7 @@
FROM stockmoves INNER JOIN stockmaster
ON stockmoves.stockid = stockmaster.stockid
WHERE stockmoves.type=10
- AND stockmoves.transno='" . $FromTransNo . "'
+ AND stockmoves.transno='" . filter_number_format($FromTransNo) . "'
AND stockmoves.show_on_inv_crds=1";
} else {
/* only credit notes to be retrieved */
@@ -279,7 +279,7 @@
FROM stockmoves INNER JOIN stockmaster
ON stockmoves.stockid = stockmaster.stockid
WHERE stockmoves.type=11
- AND stockmoves.transno='" . $FromTransNo . "'
+ AND stockmoves.transno='" . filter_number_format($FromTransNo) . "'
AND stockmoves.show_on_inv_crds=1";
} // end else
@@ -537,7 +537,7 @@
echo '<option value="Credit">' . _('Credit Notes') . '</option>';
} else {
echo '<option selected value="Credit">' . _('Credit Notes') . '</option>';
- echo '<option VALUE="Invoice">' . _('Invoices') . '</option>';
+ echo '<option value="Invoice">' . _('Invoices') . '</option>';
}
echo '</select></td></tr>';
@@ -545,11 +545,11 @@
if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){
echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>';
- echo '<option VALUE="Yes">' . _('Print PDF EDI Transactions Too') . '</option>';
+ echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>';
} else {
- echo '<option VALUE="No">' . _('Do not Print PDF EDI Transactions') . '</option>';
+ echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>';
echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>';
}
@@ -642,7 +642,7 @@
INNER JOIN currencies
ON debtorsmaster.currcode=currencies.currabrev
WHERE debtortrans.type=10
- AND debtortrans.transno='" . $FromTransNo . "'";
+ AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'";
} else { //its a credit note
$sql = "SELECT debtortrans.trandate,
@@ -682,7 +682,7 @@
INNER JOIN currencies
ON debtorsmaster.currcode=currencies.currabrev
WHERE debtortrans.type=11
- AND debtortrans.transno='" . $FromTransNo . "'";
+ AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'";
}
@@ -729,7 +729,7 @@
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*/
@@ -809,7 +809,7 @@
FROM stockmoves INNER JOIN stockmaster
ON stockmoves.stockid = stockmaster.stockid
WHERE stockmoves.type=10
- AND stockmoves.transno='" . $FromTransNo . "'
+ AND stockmoves.transno='" . filter_number_format($FromTransNo) . "'
AND stockmoves.show_on_inv_crds=1";
} else { /* then its a credit note */
@@ -848,7 +848,7 @@
FROM stockmoves INNER JOIN stockmaster
ON stockmoves.stockid = stockmaster.stockid
WHERE stockmoves.type=11
- AND stockmoves.transno='" . $FromTransNo . "'
+ AND stockmoves.transno='" . filter_number_format($FromTransNo) . "'
AND stockmoves.show_on_inv_crds=1";
}
@@ -903,11 +903,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'],
@@ -949,7 +949,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>
@@ -997,7 +997,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>
+ echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td>
</tr>
</table>';
echo '<table class="table1">
@@ -1051,7 +1051,7 @@
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>
+ 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>';
Modified: trunk/PurchData.php
===================================================================
--- trunk/PurchData.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/PurchData.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -25,7 +25,7 @@
$NoPurchasingData=0;
-echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br />';
+echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a><br />';
if (isset($_POST['SupplierDescription'])) {
$_POST['SupplierDescription'] = trim($_POST['SupplierDescription']);
@@ -37,25 +37,24 @@
$InputError = 1;
prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error');
}
- if (!is_numeric($_POST['Price'])) {
+ if (!is_numeric(filter_number_format($_POST['Price']))) {
$InputError = 1;
unset($_POST['Price']);
prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error');
- }
- if ($_POST['Price'] == 0) {
+ }elseif ($_POST['Price'] == 0) {
prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn');
}
- if (!is_numeric($_POST['LeadTime'])) {
+ if (!is_numeric(filter_number_format($_POST['LeadTime']))) {
$InputError = 1;
unset($_POST['LeadTime']);
prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error');
}
- if (!is_numeric($_POST['MinOrderQty'])) {
+ if (!is_numeric(filter_number_format($_POST['MinOrderQty']))) {
$InputError = 1;
unset($_POST['MinOrderQty']);
prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error');
}
- if (!is_numeric($_POST['ConversionFactor'])) {
+ if (!is_numeric(filter_number_format($_POST['ConversionFactor']))) {
$InputError = 1;
unset($_POST['ConversionFactor']);
prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error');
@@ -74,14 +73,14 @@
preferred)
VALUES ('" . $SupplierID . "',
'" . $StockID . "',
- '" . $_POST['Price'] . "',
+ '" . filter_number_format($_POST['Price']) . "',
'" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
'" . $_POST['SuppliersUOM'] . "',
- '" . $_POST['ConversionFactor'] . "',
+ '" . filter_number_format($_POST['ConversionFactor']) . "',
'" . $_POST['SupplierDescription'] . "',
'" . $_POST['SupplierCode'] . "',
- '" . $_POST['LeadTime'] . "',
- '" . $_POST['MinOrderQty'] . "',
+ '" . filter_number_format($_POST['LeadTime']) . "',
+ '" . filter_number_format($_POST['MinOrderQty']) . "',
'" . $_POST['Preferred'] . "')";
$ErrMsg = _('The supplier purchasing details could not be added to the database because');
$DbgMsg = _('The SQL that failed was');
@@ -89,14 +88,14 @@
prnMsg(_('This supplier purchasing data has been added to the database'), 'success');
}
if ($InputError == 0 AND isset($_POST['UpdateRecord'])) {
- $sql = "UPDATE purchdata SET price='" . $_POST['Price'] . "',
+ $sql = "UPDATE purchdata SET price='" . filter_number_format($_POST['Price']) . "',
effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
suppliersuom='" . $_POST['SuppliersUOM'] . "',
- conversionfactor='" . $_POST['ConversionFactor'] . "',
+ conversionfactor='" . filter_number_format($_POST['ConversionFactor']) . "',
supplierdescription='" . $_POST['SupplierDescription'] . "',
suppliers_partno='" . $_POST['SupplierCode'] . "',
- leadtime='" . $_POST['LeadTime'] . "',
- minorderqty='" . $_POST['MinOrderQty'] . "',
+ leadtime='" . filter_number_format($_POST['LeadTime']) . "',
+ minorderqty='" . filter_number_format($_POST['MinOrderQty']) . "',
preferred='" . $_POST['Preferred'] . "'
WHERE purchdata.stockid='".$StockID."'
AND purchdata.supplierno='".$SupplierID."'
@@ -136,20 +135,23 @@
if (!isset($_GET['Edit'])) {
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />';
- $sql = "SELECT purchdata.supplierno,
- suppliers.suppname,
- purchdata.price,
- suppliers.currcode,
- purchdata.effectivefrom,
- purchdata.suppliersuom,
- purchdata.supplierdescription,
- purchdata.leadtime,
- purchdata.suppliers_partno,
- purchdata.minorderqty,
- purchdata.preferred,
- purchdata.conversionfactor
+ $sql = "SELECT purchdata.supplierno,
+ suppliers.suppname,
+ purchdata.price,
+ suppliers.currcode,
+ purchdata.effectivefrom,
+ purchdata.suppliersuom,
+ purchdata.supplierdescription,
+ purchdata.leadtime,
+ purchdata.suppliers_partno,
+ purchdata.minorderqty,
+ purchdata.preferred,
+ purchdata.conversionfactor,
+ currencies.decimalplaces AS currdecimalplaces
FROM purchdata INNER JOIN suppliers
ON purchdata.supplierno=suppliers.supplierid
+ INNER JOIN currencies
+ ON suppliers.currcode=currencies.currabrev
WHERE purchdata.stockid = '" . $StockID . "'
ORDER BY purchdata.effectivefrom DESC";
$ErrMsg = _('The supplier purchasing details for the selected part could not be retrieved because');
@@ -189,24 +191,24 @@
} else {
$DisplayPreferred = _('No');
}
- printf("<td>%s</td>
- <td class=number>%s</td>
+ printf('<td>%s</td>
+ <td class="number">%s</td>
<td>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
- <td>%s " . _('days') . "</td>
+ <td>%s ' . _('days') . '</td>
<td>%s</td>
- <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td>
- <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td>
- </tr>",
+ <td><a href="%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s">' . _('Edit') . '</a></td>
+ <td><a href="%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s" onclick=\'return confirm("' . _('Are you sure you wish to delete this suppliers price?') . '");\'>' . _('Delete') . '</a></td>
+ </tr>',
$myrow['suppname'],
- locale_number_format($myrow['price'], 3),
+ locale_money_format($myrow['price'], $myrow['currdecimalplaces']),
$myrow['suppliersuom'],
$myrow['conversionfactor'],
- locale_number_format($myrow['price']/$myrow['conversionfactor'],2),
+ locale_money_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']),
$myrow['currcode'],
ConvertSQLDate($myrow['effectivefrom']),
$myrow['minorderqty'],
@@ -232,7 +234,13 @@
} /* Only show the existing purchasing data records if one is not being edited */
if (isset($SupplierID) AND $SupplierID != '' AND !isset($_POST['SearchSupplier'])) { /*NOT EDITING AN EXISTING BUT SUPPLIER selected OR ENTERED*/
- $sql = "SELECT suppliers.suppname, suppliers.currcode FROM suppliers WHERE supplierid='".$SupplierID."'";
+ $sql = "SELECT suppliers.suppname,
+ suppliers.currcode,
+ currencies.decimalplaces AS currdecimalplaces
+ FROM suppliers
+ INNER JOIN currencies
+ ON suppliers.currcode=currencies.currabrev
+ WHERE supplierid='".$SupplierID."'";
$ErrMsg = _('The supplier details for the selected supplier could not be retrieved because');
$DbgMsg = _('The SQL that failed was');
$SuppSelResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
@@ -240,6 +248,7 @@
$myrow = DB_fetch_array($SuppSelResult);
$SuppName = $myrow['suppname'];
$CurrCode = $myrow['currcode'];
+ $CurrDecimalPlaces = $myrow['currdecimalplaces'];
} else {
prnMsg(_('The supplier code') . ' ' . $SupplierID . ' ' . _('is not an existing supplier in the database') . '. ' . _('You must enter an alternative supplier code or select a supplier using the search facility below'), 'error');
unset($SupplierID);
@@ -249,16 +258,18 @@
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />';
}
if (!isset($_POST['SearchSupplier'])) {
- echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=3 colspan=4 class=selection><tr>';
+ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
+ <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 '<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 '<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;
};
@@ -326,15 +337,16 @@
$StockID = '';
$StockUOM = 'each';
}
- echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=2 colspan=7 class=selection>';
+ 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>
<th>' . _('Supplier Name') . '</th>
- <th>' . _('Currency') . '</th>
- <th>' . _('Address 1') . '</th>
- <th>' . _('Address 2') . '</th>
- <th>' . _('Address 3') . '</th>
- </tr>';
+ <th>' . _('Currency') . '</th>
+ <th>' . _('Address 1') . '</th>
+ <th>' . _('Address 2') . '</th>
+ <th>' . _('Address 3') . '</th>
+ </tr>';
echo $TableHeader;
$k = 0;
while ($myrow = DB_fetch_array($SuppliersResult)) {
@@ -359,8 +371,8 @@
$myrow['address2'],
$myrow['address3']);
- echo '<input type=hidden name=StockID value="' . $StockID . '">';
- echo '<input type=hidden name=StockUOM value="' . $StockUOM . '">';
+ echo '<input type="hidden" name="StockID" value="' . $StockID . '" />';
+ echo '<input type="hidden" name="StockUOM" value="' . $StockUOM . '" />';
}
//end of while loop
@@ -384,7 +396,7 @@
purchdata.minorderqty,
purchdata.preferred,
stockmaster.units,
- currencies.decimalplaces
+ currencies.decimalplaces AS currdecimalplaces
FROM purchdata INNER JOIN suppliers
ON purchdata.supplierno=suppliers.supplierid
INNER JOIN stockmaster
@@ -401,6 +413,7 @@
$_POST['Price'] = $myrow['price'];
$_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']);
$CurrCode = $myrow['currcode'];
+ $CurrDecimalPlaces = $myrow['currdecimalplaces'];
$_POST['SuppliersUOM'] = $myrow['suppliersuom'];
$_POST['SupplierDescription'] = $myrow['supplierdescription'];
$_POST['LeadTime'] = $myrow['leadtime'];
@@ -418,10 +431,10 @@
}
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 . '">';
+ <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />';
if ($SupplierID!='') {
echo '<td>'.$SuppName;
}
@@ -432,7 +445,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 = '';
}
@@ -457,7 +470,7 @@
echo '<tr><td>' . _('Currency') . ':</td>
<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=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>';
+ <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_money_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></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>';
echo '<tr><td>' . _('Our Unit of Measure') . ':</td>';
@@ -467,17 +480,17 @@
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>
- <td><input type="text" class=number name="ConversionFactor" maxlength=12 size=12 value=' . $_POST['ConversionFactor'] . '></td></tr>';
+ <td><input type="text" class="number" name="ConversionFactor" maxlength="12" size="12" value=' . $_POST['ConversionFactor'] . '></td></tr>';
echo '<tr><td>' . _('Supplier Stock Code') . ':</td>
- <td><input type="text" name="SupplierCode" maxlength=15 size=15 value="' . $_POST['SupplierCode'] . '"></td></tr>';
+ <td><input type="text" name="SupplierCode" maxlength="15" size="15" value="' . $_POST['SupplierCode'] . '"></td></tr>';
echo '<tr><td>' . _('MinOrderQty') . ':</td>
- <td><input type="text" class=number name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>';
+ <td><input type="text" class="number" name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>';
echo '<tr><td>' . _('Supplier Stock Description') . ':</td>
- <td><input type="text" name="SupplierDescription" maxlength=50 size=51 value="' . $_POST['SupplierDescription'] . '"></td></tr>';
+ <td><input type="text" name="SupplierDescription" maxlength="50" size="51" value="' . $_POST['SupplierDescription'] . '"></td></tr>';
if (!isset($_POST['LeadTime']) OR $_POST['LeadTime'] == "") {
$_POST['LeadTime'] = 1;
}
Modified: trunk/RecurringSalesOrders.php
===================================================================
--- trunk/RecurringSalesOrders.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/RecurringSalesOrders.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -16,9 +16,9 @@
$identifier=$_GET['identifier'];
}
-if ($_GET['NewRecurringOrder']=='Yes'){
+if (isset($_GET['NewRecurringOrder'])){
$NewRecurringOrder ='Yes';
-} elseif ($_POST['NewRecurringOrder']=='Yes'){
+} elseif (isset($_POST['NewRecurringOrder'])){
$NewRecurringOrder ='Yes';
} else {
$NewRecurringOrder ='No';
@@ -57,12 +57,12 @@
recurringsalesorders.stopdate,
recurringsalesorders.lastrecurrence,
recurringsalesorders.autoinvoice
- FROM recurringsalesorders,
- debtorsmaster,
- salestypes
- WHERE recurringsalesorders.ordertype=salestypes.typeabbrev
- AND recurringsalesorders.debtorno = debtorsmaster.debtorno
- AND recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'";
+ FROM recurringsalesorders
+ INNER JOIN debtorsmaster
+ ON recurringsalesorders.debtorno = debtorsmaster.debtorno
+ INNER JOIN salestypes
+ ON recurringsalesorders.ordertype=salestypes.typeabbrev
+ WHERE recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'";
$ErrMsg = _('The order cannot be retrieved because');
$GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg);
@@ -84,7 +84,7 @@
$_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia'];
$BestShipper = $myrow['shipvia'];
$_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto'];
- $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']);
+ //$_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']);
$_SESSION['Items'.$identifier]->DelAdd1 = $myrow['deladd1'];
$_SESSION['Items'.$identifier]->DelAdd2 = $myrow['deladd2'];
$_SESSION['Items'.$identifier]->DelAdd3 = $myrow['deladd3'];
@@ -160,11 +160,11 @@
if (isset($_POST['DeleteRecurringOrder'])){
- $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'";
+ $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_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='" . $_POST['ExistingRecurrOrderNo'] . "'";
+ $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'";
$ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo'];
$result = DB_query($sql,$db,$ErrMsg);
@@ -200,7 +200,6 @@
if ($InputErrors == 0 ){ /*Error checks above all passed ok so lets go*/
-
if ($NewRecurringOrder=='Yes'){
/* finally write the recurring order header to the database and then the line details*/
@@ -234,7 +233,7 @@
'" . $_SESSION['Items'.$identifier]->Branch . "',
'". $_SESSION['Items'.$identifier]->CustRef ."',
'". $_SESSION['Items'.$identifier]->Comments ."',
- '" . Date("Y-m-d H:i") . "',
+ '" . Date('Y-m-d H:i') . "',
'" . $_SESSION['Items'.$identifier]->DefaultSalesType . "',
'" . $_SESSION['Items'.$identifier]->DeliverTo . "',
'" . $_SESSION['Items'.$identifier]->DelAdd1 . "',
@@ -254,32 +253,37 @@
'" . $_POST['AutoInvoice'] . "')";
$ErrMsg = _('The recurring order cannot be added because');
- $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,true);
+ $DbgMsg = _('The SQL that failed was');
+ $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,$DbgMsg,true);
+
+ echo '<br/>' . $HeaderSQL;
$RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno');
echo 'xxx'.$RecurrOrderNo;
- $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (
- recurrorderno,
- stkcode,
- unitprice,
- quantity,
- discountpercent,
- narrative)
- values ('";
-
+ $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno,
+ stkcode,
+ unitprice,
+ quantity,
+ discountpercent,
+ narrative)
+ VALUES ('";
+
foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) {
$LineItemsSQL = $StartOf_LineItemsSQL .
- $RecurrOrderNo . "',
- '" . $StockItem->StockID . "',
- '". $StockItem->Price . "',
- '" . $StockItem->Quantity . "',
- '" . $StockItem->DiscountPercent . "',
- '" . $StockItem->Narrative . "'
- )";
+ $RecurrOrderNo . "',
+ '" . $StockItem->StockID . "',
+ '". filter_number_format($StockItem->Price) . "',
+ '" . filter_number_format($StockItem->Quantity) . "',
+ '" . filter_number_format($StockItem->DiscountPercent) . "',
+ '" . $StockItem->Narrative . "')";
$Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true);
+
+ echo '<br/>' . $LineItemsSQL;
+
} /* inserted line items into sales order details */
-
+
+ $result = DB_Txn_Commit($db);
prnmsg(_('The new recurring order template has been added'),'success');
} else { /* must be updating an existing recurring order */
@@ -287,7 +291,7 @@
stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "',
frequency = '" . $_POST['Frequency'] . "',
autoinvoice = '" . $_POST['AutoInvoice'] . "'
- WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'";
+ WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'";
$ErrMsg = _('The recurring order cannot be updated because');
$UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg);
@@ -304,7 +308,6 @@
exit;
}
- $result = DB_Txn_Commit($db);
}
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') .
@@ -333,8 +336,8 @@
foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) {
$LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent);
- $DisplayLineTotal = locale_number_format($LineTotal,2);
- $DisplayPrice = locale_number_format($StockItem->Price,2);
+ $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces);
+ $DisplayPrice = locale_money_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces);
$DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces);
$DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2);
@@ -347,28 +350,29 @@
$k=1;
}
- echo '<td>$StockItem->StockID</td>
- <td>$StockItem->ItemDescription</td>
- <td class=number>$DisplayQuantity</td>
- <td>$StockItem->Units</td>
- <td class=number>$DisplayPrice</td>
- <td class=number>$DisplayDiscount</td>
- <td class=number>$DisplayLineTotal</td>
+ echo '<td>' . $StockItem->StockID . '</td>
+ <td>' . $StockItem->ItemDescription . '</td>
+ <td class="number">' . $DisplayQuantity . '</td>
+ <td>' . $StockItem->Units . '</td>
+ <td class="number">' . $DisplayPrice . '</td>
+ <td class="number">' . $DisplayDiscount . '</td>
+ <td class="number">' . $DisplayLineTotal . '</td>
</tr>';
- $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal;
- $_SESSION['Items'.$identifier]->totalVolume = $_SESSION['Items'.$identifier]->totalVolume + ($StockItem->Quantity * $StockItem->Volume);
- $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + ($StockItem->Quantity * $StockItem->Weight);
+ $_SESSION['Items'.$identifier]->total += $LineTotal;
+ $_SESSION['Items'.$identifier]->totalVolume += ($StockItem->Quantity * $StockItem->Volume);
+ $_SESSION['Items'.$identifier]->totalWeight += ($StockItem->Quantity * $StockItem->Weight);
}
-$DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,2);
+$DisplayTotal = locale_money_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces);
echo '<tr>
- <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td>
- <td class=number>$DisplayTotal</td>
-</tr></table>';
+ <td colspan="6" class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td>
+ <td class="number">' . $DisplayTotal . '</td>
+ </tr>
+ </table>';
-echo '<br /><table class=selection>';
-echo '<tr><th colspan=7><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>';
+echo '<br /><table class="selection">';
+echo '<tr><th colspan="7"><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>';
echo '<tr>
<td>'. _('Deliver To') .':</td>
@@ -415,7 +419,7 @@
if ($NewRecurringOrder=='Yes'){
echo '<tr>
<td>'. _('Start Date') .':</td>
- <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>';
+ <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>';
} else {
echo '<tr>
<td>'. _('Last Recurrence') . ':</td>
@@ -429,7 +433,7 @@
echo '<tr>
<td>'. _('Finish Date') .':</td>
- <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>';
+ <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>';
echo '<tr>
<td>'. _('Frequency of Recurrence') .':</td>
@@ -493,15 +497,15 @@
echo '<br /><div class="centre">';
if ($NewRecurringOrder=='Yes'){
- echo '<input type="hidden" name="NewRecurringOrder" value="Yes">';
- echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '">';
+ 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="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />';
- echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '">';
+ echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />';
echo '<hr>';
- echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');">';
+ echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');" />';
}
echo '</form></div>';
Modified: trunk/RecurringSalesOrdersProcess.php
===================================================================
--- trunk/RecurringSalesOrdersProcess.php 2011-09-23 09:13:29 UTC (rev 4703)
+++ trunk/RecurringSalesOrdersProcess.php 2011-09-24 07:39:35 UTC (rev 4704)
@@ -4,7 +4,7 @@
/*need to allow this script to run from Cron or windows scheduler */
$AllowAnyone = true;
-/* Get this puppy to run from cron (cd weberp && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */
+/* Get this puppy to run from cron (cd webERP && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */
if (isset($_GET['Database'])) {
$_SESSION['DatabaseName'] = $_GET['Database'];
$DatabaseName = $_GET['Database'];
@@ -27,50 +27,50 @@
include('includes/GetSalesTransGLCodes.inc');
include('includes/htmlMimeMail.php');
-$sql = 'SELECT recurringsalesorders.recurrorderno,
- recurringsalesorders.debtorno,
- recurringsalesorders.branchcode,
- recurringsalesorders.customerref,
- recurringsalesorders.buyername,
- recurringsalesorders.comments,
- recurringsalesorders.orddate,
- recurringsalesorders.ordertype,
- recurringsalesorders.shipvia,
- recurringsalesorders.deladd1,
- recurringsalesorders.deladd2,
- recurringsalesorders.deladd3,
- recurringsalesorders.deladd4,
- recurringsalesorders.deladd5,
- recurringsalesorders.deladd6,
- recurringsalesorders.contactphone,
- recurringsalesorders.contactemail,
- recurringsalesorders.deliverto,
- recurringsalesorders.freightcost,
- recurringsalesorders.fromstkloc,
- recurringsalesorders.lastrecurrence,
- recurringsalesorders.stopdate,
- recurringsalesorders.frequency,
- recurringsalesorders.autoinvoice,
- debtorsmaster.name,
- debtorsmaster.currcode,
- salestypes.sales_type,
- custbranch.area,
- custbranch.taxgroupid,
- locations.contact,
- locations.email
- FROM recurringsalesorders,
- debtorsmaster,
- custbranch,
- salestypes,
- locations
- WHERE recurringsalesorders.ordertype=salestypes.typeabbrev
- AND recurringsalesorders.debtorno = debtorsmaster.debtorno
- AND recurringsalesorders.debtorno = custbranch.debtorno
- AND recurringsalesorders.branchcode = custbranch.branchcode
- AND recurringsalesorders.fromstkloc=locations.loccode
- AND recurringsalesorders.ordertype=salestypes.typeabbrev
- AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency)
- AND DATE_ADD(recurringsalesorders.lastrecurrence, ' . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ') <= recurringsalesorders.stopdate';
+$sql = "SELECT recurringsalesorders.recurrorderno,
+ recurringsalesorders.debtorno,
+ recurringsalesorders.branchcode,
+ recurringsalesorders.customerref,
+ recurringsalesorders.buyername,
+ recurringsalesorders.comments,
+ recurringsalesorders.orddate,
+ recurringsalesorders.ordertype,
+ recurringsalesorders.shipvia,
+ recurringsalesorders.deladd1,
+ recurringsalesorders.deladd2,
+ recurringsalesorders.deladd3,
+ recurringsalesorders.deladd4,
+ recurringsalesorders.deladd5,
+ recurringsalesorders.deladd6,
+ recurringsalesorders.contactphone,
+ recurringsalesorders.contactemail,
+ recurringsalesorders.deliverto,
+ recurringsalesorders.freightcost,
+ recurringsalesorders.fromstkloc,
+ recurringsalesorders.lastrecurrence,
+ recurringsalesorders.stopdate,
+ recurringsalesorders.frequency,
+ recurringsalesorders.autoinvoice,
+ debtorsmaster.name,
+ debtorsmaster.currcode,
+ salestypes.sales_type,
+ custbranch.area,
+ custbranch.taxgroupid,
+ locations.contact,
+ locations.email
+ FROM recurringsalesorders,
+ debtorsmaster,
+ custbranch,
+ salestypes,
+ locations
+ WHERE recurringsalesorders.ordertype=salestypes.typeabbrev
+ AND recurringsalesorders.debtorno = debtorsmaster.debtorno
+ AND recurringsalesorders.debtorno = custbranch.debtorno
+ AND recurringsalesorders.branchcode = custbranch.branchcode
+ AND recurringsalesorders.fromstkloc=locations.loccode
+ AND recurringsalesorders.ordertype=salestypes.typeabbrev
+ AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency)
+ AND DATE_ADD(recurringsalesorders.lastrecurrence, " . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ") <= recurringsalesorders.stopdate";
$RecurrOrdersDueResult = DB_query($sql,$db,_('There was a problem retrieving the recurring sales order templates. The database reported:'));
@@ -178,12 +178,12 @@
while ($RecurrOrderLineRow=DB_fetch_array($LineItemsResult)) {
$LineItemsSQL = $StartOf_LineItemsSQL .
- " '" . $LineCounter . "',
- '" . $RecurrOrderLineRow['stkcode'] . "',
- '". $RecurrOrderLineRow['unitprice'] . "',
- '" . $RecurrOrderLineRow['quantity'] . "',
- '" . floatval($RecurrOrderLineRow['discountpercent']) . "',
- '" . $RecurrOrderLineRow['narrative'] . "')";
+ " '" . $LineCounter . "',
+ '" . $RecurrOrderLineRow['stkcode'] . "',
+ '". $RecurrOrderLineRow['unitprice'] . "',
+ '" . $RecurrOrderLineRow['quantity'] . "',
+ '" . floatval($RecurrOrderLineRow['discountpercent']) . "',
+ '" . $RecurrOrderLineRow['narrative'] . "')";
$Ins_LineItemResult = DB_query($LineItemsSQL,$db,_('Could not insert the order lines from the recurring order template'),true); /*Populating a new order line items*/
$LineCounter ++;
@@ -427,9 +427,9 @@
if ($myrow[0]>0){ /*Update the existing record that already exists */
$SQL = "UPDATE salesanalysis
- SET amt=amt+" . ($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ",
+ SET amt=amt+" . filter_number_format($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ",
qty=qty +" . $RecurrOrderLineRow['quantity'] . ",
- disc=disc+" . ($RecurrOrderLineRow['discountpercent'] * $RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . "
+ disc=disc+" . filter_number_format($...
[truncated message content] |