This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 2011-10-30 09:17:35
|
Revision: 4738 http://web-erp.svn.sourceforge.net/web-erp/?rev=4738&view=rev Author: daintree Date: 2011-10-30 09:17:27 +0000 (Sun, 30 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/CustomerReceipt.php trunk/CustomerTransInquiry.php trunk/Customers.php trunk/DailyBankTransactions.php trunk/DailySalesInquiry.php trunk/DebtorsAtPeriodEnd.php trunk/Stocks.php trunk/doc/Change.log Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/BOMExtendedQty.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -77,7 +77,7 @@ bom.effectiveafter, bom.effectiveto, (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa - FROM bom + FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; @@ -188,11 +188,13 @@ GROUP BY purchorderdetails.itemcode) AS poqty, (SELECT SUM(woitems.qtyreqd - woitems.qtyrecd) as netwoqty - FROM woitems + FROM woitems INNER JOIN workorders + ON woitems.wo = workorders.wo WHERE woitems.stockid = tempbom.component + AND workorders.closed=0 GROUP BY woitems.stockid) AS woqty - FROM tempbom,stockmaster - WHERE tempbom.component = stockmaster.stockid + FROM tempbom INNER JOIN stockmaster + ON tempbom.component = stockmaster.stockid GROUP BY tempbom.component, stockmaster.description, stockmaster.decimalplaces, Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/CustomerReceipt.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -52,7 +52,7 @@ $_SESSION['ReceiptBatch']->BankAccountName = $myrow[0]; $_SESSION['ReceiptBatch']->AccountCurrency=$myrow[1]; unset($result); - } elseif (DB_num_rows($result)==0 and !$BankAccountEmpty){ + } elseif (DB_num_rows($result)==0 AND !$BankAccountEmpty){ prnMsg( _('The bank account number') . ' ' . $_POST['BankAccount'] . ' ' . _('is not set up as a bank account'),'error'); include ('includes/footer.inc'); exit; @@ -62,7 +62,7 @@ $_POST['DateBanked'] = Date($_SESSION['DefaultDateFormat']); } $_SESSION['ReceiptBatch']->DateBanked = $_POST['DateBanked']; - if (isset($_POST['ExRate']) and $_POST['ExRate']!=''){ + if (isset($_POST['ExRate']) AND $_POST['ExRate']!=''){ if (is_numeric(filter_number_format($_POST['ExRate']))){ $_SESSION['ReceiptBatch']->ExRate = filter_number_format($_POST['ExRate']); } else { Modified: trunk/CustomerTransInquiry.php =================================================================== --- trunk/CustomerTransInquiry.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/CustomerTransInquiry.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -6,18 +6,20 @@ $title = _('Customer Transactions Inquiry'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Transaction Inquiry') . '" alt="" />' . ' ' . _('Transaction Inquiry') . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Transaction Inquiry') . '" alt="" />' . ' ' . _('Transaction Inquiry') . ' + </p>'; echo '<div class="page_help_text">' . _('Choose which type of transaction to report on.') . '</div> <br />'; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table cellpadding=2 class=selection><tr>'; +echo '<table class="selection"> + <tr> + <td>' . _('Type') . ':</td> + <td><select tabindex="1" name="TransType"> '; -echo '<td>' . _('Type') . ':</td> - <td><select tabindex="1" name="TransType"> '; - $sql = "SELECT typeid, typename FROM systypes @@ -35,7 +37,7 @@ echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option Value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } echo '</select></td>'; @@ -46,31 +48,38 @@ if (!isset($_POST['ToDate'])){ $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); } -echo '<td>' . _('From') . ':</td><td><input tabindex="2" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="TEXT" name="FromDate" maxlength="10" size="11" VALUE="' . $_POST['FromDate'] . '"></td>'; -echo '<td>' . _('To') . ':</td><td><input tabindex="3" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="TEXT" name="ToDate" maxlength="10" size="11" VALUE="' . $_POST['ToDate'] . '"></td>'; +echo '<td>' . _('From') . ':</td> + <td><input tabindex="2" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + <td>' . _('To') . ':</td> + <td><input tabindex="3" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td>'; -echo "</tr></table><br /><div class='centre'><input tabindex=4 type=submit name='ShowResults' VALUE='" . _('Show Transactions') . "'>"; +echo '</tr></table> + <br /> + <div class="centre"> + <input tabindex="4" type="submit" name="ShowResults" value="' . _('Show Transactions') . '"> + </div> + </form>'; -echo '</form></div>'; - if (isset($_POST['ShowResults']) && $_POST['TransType'] != ''){ $SQL_FromDate = FormatDateForSQL($_POST['FromDate']); $SQL_ToDate = FormatDateForSQL($_POST['ToDate']); $sql = "SELECT transno, - trandate, - debtortrans.debtorno, - branchcode, - reference, - invtext, - order_, - rate, - ovamount+ovgst+ovfreight+ovdiscount as totalamt, - currcode, - typename - FROM debtortrans - INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno - INNER JOIN systypes ON debtortrans.type = systypes.typeid - WHERE "; + trandate, + debtortrans.debtorno, + branchcode, + reference, + invtext, + order_, + debtortrans.rate, + ovamount+ovgst+ovfreight+ovdiscount as totalamt, + currcode, + typename, + decimalplaces AS currdecimalplaces + FROM debtortrans + INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN systypes ON debtortrans.type = systypes.typeid + WHERE "; $sql = $sql . "trandate >='" . $SQL_FromDate . "' AND trandate <= '" . $SQL_ToDate . "'"; if ($_POST['TransType']!='All') { @@ -82,21 +91,23 @@ $DbgMsg = _('The SQL that failed was'); $TransResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); - echo '<br /><table cellpadding=2 class=selection>'; + echo '<br /> + <table class="selection">'; - $tableheader = "<tr> - <th>" . _('Type') . "</th> - <th>" . _('Number') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('Customer') . "</th> - <th>" . _('Branch') . "</th> - <th>" . _('Reference') . "</th> - <th>" . _('Comments') . "</th> - <th>" . _('Order') . "</th> - <th>" . _('Ex Rate') . "</th> - <th>" . _('Amount') . "</th> - <th>" . _('Currency') . '</th></tr>'; - echo $tableheader; + $TableHeader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Ex Rate') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Currency') . '</th> + </tr>'; + echo $TableHeader; $RowCounter = 1; $k = 0; //row colour counter @@ -111,70 +122,69 @@ $k++; } - $format_base = "<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td width='200'>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td>"; + $format_base = '<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td width="200">%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td>'; if ($_POST['TransType']==10){ /* invoices */ - printf("$format_base - <td><a target='_blank' href='%s/PrintCustTrans.php?%&FromTransNo=%s&InvOrCredit=Invoice'><IMG SRC='%s' title='" . _('Click to preview the invoice') . "'></a></td> - </tr>", - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['debtorno'], - $myrow['branchcode'], - $myrow['reference'], - $myrow['invtext'], - $myrow['order_'], - $myrow['rate'], - locale_number_format($myrow['totalamt'],2), - $myrow['currcode'], - $rootpath, - SID, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images/preview.gif'); + printf($format_base . + '<td><a target="_blank" href=%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice"><img src="%s" title="' . _('Click to preview the invoice') . '"></a></td> + </tr>', + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['debtorno'], + $myrow['branchcode'], + $myrow['reference'], + $myrow['invtext'], + $myrow['order_'], + locale_number_format($myrow['rate'],6), + locale_number_format($myrow['totalamt'],$myrow['currdecimalplaces']), + $myrow['currcode'], + $rootpath, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images/preview.gif'); + } elseif ($_POST['TransType']==11){ /* credit notes */ - printf("$format_base - <td><a target='_blank' href='%s/PrintCustTrans.php?%s&FromTransNo=%s&InvOrCredit=Credit'><IMG SRC='%s' title='" . _('Click to preview the credit') . "'></a></td> - </tr>", - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['debtorno'], - $myrow['branchcode'], - $myrow['reference'], - $myrow['invtext'], - $myrow['order_'], - $myrow['rate'], - locale_number_format($myrow['totalamt'],2), - $myrow['currcode'], - $rootpath, - SID, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images/preview.gif'); + printf($format_base . + '<td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit"><img src="%s" title="' . _('Click to preview the credit') . '"></a></td> + </tr>', + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['debtorno'], + $myrow['branchcode'], + $myrow['reference'], + $myrow['invtext'], + $myrow['order_'], + locale_number_format($myrow['rate'],6), + locale_number_format($myrow['totalamt'],$myrow['currdecimalplaces']), + $myrow['currcode'], + $rootpath, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images/preview.gif'); } else { /* otherwise */ - printf("$format_base</tr>", - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['debtorno'], - $myrow['branchcode'], - $myrow['reference'], - $myrow['invtext'], - $myrow['order_'], - $myrow['rate'], - locale_number_format($myrow['totalamt'],2), - $myrow['currcode']); + printf($format_base . '</tr>', + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['debtorno'], + $myrow['branchcode'], + $myrow['reference'], + $myrow['invtext'], + $myrow['order_'], + locale_number_format($myrow['rate'],6), + locale_number_format($myrow['totalamt'],$myrow['currdecimalplaces']), + $myrow['currcode']); } } Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/Customers.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -10,8 +10,10 @@ include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . - '" alt="" />' . ' ' . _('Customer Maintenance') . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . + '" alt="" />' . ' ' . _('Customer Maintenance') . ' + </p>'; if (isset($Errors)) { unset($Errors); @@ -84,37 +86,12 @@ prnMsg( _('The Line 6 of the address must be fifteen characters or less long'),'error'); $Errors[$i] = 'Address6'; $i++; - } - elseif (mb_strlen($_POST['Phone']) >25) { + } elseif (!is_numeric(filter_number_format($_POST['CreditLimit']))) { $InputError = 1; - prnMsg(_('The telephone number must be 25 characters or less long'),'error'); - $Errors[$i] = 'Telephone'; - $i++; - } - elseif (mb_strlen($_POST['Fax']) >25) { - $InputError = 1; - prnMsg(_('The fax number must be 25 characters or less long'),'error'); - $Errors[$i] = 'Fax'; - $i++; - } - elseif (mb_strlen($_POST['Email']) >55) { - $InputError = 1; - prnMsg(_('The email address must be 55 characters or less long'),'error'); - $Errors[$i] = 'Email'; - $i++; - } - elseif (mb_strlen($_POST['Email'])>0 and !IsEmailAddress($_POST['Email'])) { - $InputError = 1; - prnMsg(_('The email address is not correctly formed'),'error'); - $Errors[$i] = 'Email'; - $i++; - } - elseif (!is_numeric($_POST['CreditLimit'])) { - $InputError = 1; prnMsg( _('The credit limit must be numeric'),'error'); $Errors[$i] = 'CreditLimit'; $i++; - } elseif (!is_numeric($_POST['PymtDiscount'])) { + } elseif (!is_numeric(filter_number_format($_POST['PymtDiscount']))) { $InputError = 1; prnMsg( _('The payment discount must be numeric'),'error'); $Errors[$i] = 'PymtDiscount'; @@ -124,22 +101,22 @@ prnMsg( _('The customer since field must be a date in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); $Errors[$i] = 'ClientSince'; $i++; - } elseif (!is_numeric($_POST['Discount'])) { + } elseif (!is_numeric(filter_number_format($_POST['Discount']))) { $InputError = 1; prnMsg( _('The discount percentage must be numeric'),'error'); $Errors[$i] = 'Discount'; $i++; - } elseif ((double) $_POST['CreditLimit'] <0) { + } elseif (filter_number_format($_POST['CreditLimit']) <0) { $InputError = 1; prnMsg( _('The credit limit must be a positive number'),'error'); $Errors[$i] = 'CreditLimit'; $i++; - } elseif (((double) $_POST['PymtDiscount']> 10) OR ((double) $_POST['PymtDiscount'] <0)) { + } elseif ((filter_number_format($_POST['PymtDiscount'])> 10) OR (filter_number_format($_POST['PymtDiscount']) <0)) { $InputError = 1; prnMsg( _('The payment discount is expected to be less than 10% and greater than or equal to 0'),'error'); $Errors[$i] = 'PymtDiscount'; $i++; - } elseif (((double) $_POST['Discount']> 100) OR ((double) $_POST['Discount'] <0)) { + } elseif ((filter_number_format($_POST['Discount'])> 100) OR (filter_number_format($_POST['Discount']) <0)) { $InputError = 1; prnMsg( _('The discount is expected to be less than 100% and greater than or equal to 0'),'error'); $Errors[$i] = 'Discount'; @@ -171,10 +148,10 @@ clientsince='" . $SQL_ClientSince. "', holdreason='" . $_POST['HoldReason'] . "', paymentterms='" . $_POST['PaymentTerms'] . "', - discount='" . ($_POST['Discount'])/100 . "', + discount='" . filter_number_format($_POST['Discount'])/100 . "', discountcode='" . $_POST['DiscountCode'] . "', - pymtdiscount='" . ($_POST['PymtDiscount'])/100 . "', - creditlimit='" . $_POST['CreditLimit'] . "', + pymtdiscount='" . filter_number_format($_POST['PymtDiscount'])/100 . "', + creditlimit='" . filter_number_format($_POST['CreditLimit']) . "', salestype = '" . $_POST['SalesType'] . "', invaddrbranch='" . $_POST['AddrInvBranch'] . "', taxref='" . $_POST['TaxRef'] . "', @@ -201,10 +178,10 @@ clientsince='" . $SQL_ClientSince . "', holdreason='" . $_POST['HoldReason'] . "', paymentterms='" . $_POST['PaymentTerms'] . "', - discount='" . ($_POST['Discount'])/100 . "', + discount='" . filter_number_format($_POST['Discount'])/100 . "', discountcode='" . $_POST['DiscountCode'] . "', - pymtdiscount='" . ($_POST['PymtDiscount'])/100 . "', - creditlimit='" . $_POST['CreditLimit'] . "', + pymtdiscount='" . filter_number_format($_POST['PymtDiscount'])/100 . "', + creditlimit='" . filter_number_format($_POST['CreditLimit']) . "', salestype = '" . $_POST['SalesType'] . "', invaddrbranch='" . $_POST['AddrInvBranch'] . "', taxref='" . $_POST['TaxRef'] . "', @@ -266,10 +243,10 @@ '" . $SQL_ClientSince . "', '" . $_POST['HoldReason'] . "', '" . $_POST['PaymentTerms'] . "', - '" . ($_POST['Discount'])/100 . "', + '" . filter_number_format($_POST['Discount'])/100 . "', '" . $_POST['DiscountCode'] . "', - '" . ($_POST['PymtDiscount'])/100 . "', - '" . $_POST['CreditLimit'] . "', + '" . filter_number_format($_POST['PymtDiscount'])/100 . "', + '" . filter_number_format($_POST['CreditLimit']) . "', '" . $_POST['SalesType'] . "', '" . $_POST['AddrInvBranch'] . "', '" . $_POST['TaxRef'] . "', @@ -577,8 +554,9 @@ $myrow = DB_fetch_row($CurrResult); $_POST['CurrCode'] = $myrow[0]; } - echo '<tr><td>' . _('Customer Currency') . ':</td> - <td><select tabindex=17 name="CurrCode">'; + echo '<tr> + <td>' . _('Customer Currency') . ':</td> + <td><select tabindex="17" name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode']==$myrow['currabrev']){ echo '<option selected value='. $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; @@ -588,28 +566,34 @@ } //end while loop DB_data_seek($result,0); - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } - echo '<tr><td>' . _('Customer PO Line on SO') . ':</td> + echo '<tr> + <td>' . _('Customer PO Line on SO') . ':</td> <td><select tabindex="18" name="CustomerPOLine"> <option selected value=0>' . _('No') . '</option> <option value=1>' . _('Yes') . '</option> </select> </td> - </tr>'; - - echo '<tr><td>' . _('Invoice Addressing') . ':</td> + </tr> + <tr> + <td>' . _('Invoice Addressing') . ':</td> <td><select tabindex="19" name="AddrInvBranch"> <option selected value=0>' . _('Address to HO') . '</option> <option value=1>' . _('Address to Branch') . '</option> </select> </td> - </tr>'; - - echo'</table></td></tr></table>'; + </tr> + </table></td> + </tr> + </table>'; if ($DataError ==0){ - echo '<br /><div class="centre"><input tabindex=20 type="Submit" name="submit" value="' . _('Add New Customer') . '"> <input tabindex=21 type="submit" action="Reset" value="' . _('Reset') . '"></div>'; + echo '<br /> + <div class="centre"> + <input tabindex="20" type="submit" name="submit" value="' . _('Add New Customer') . '" /> <input tabindex="21" type="submit" action="Reset" value="' . _('Reset') . '" /> + </div>'; } echo '</form>'; @@ -620,34 +604,34 @@ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection cellspacing=4> - <tr><td valign=top><table class=selection>'; + echo '<table class="selection"> + <tr><td valign="top"><table class="selection">'; if (!isset($_POST['New'])) { $sql = "SELECT debtorsmaster.debtorno, - name, - address1, - address2, - address3, - address4, - address5, - address6, - currcode, - salestype, - clientsince, - holdreason, - paymentterms, - discount, - discountcode, - pymtdiscount, - creditlimit, - invaddrbranch, - taxref, - customerpoline, - typeid + name, + address1, + address2, + address3, + address4, + address5, + address6, + currcode, + salestype, + clientsince, + holdreason, + paymentterms, + discount, + discountcode, + pymtdiscount, + creditlimit, + invaddrbranch, + taxref, + customerpoline, + typeid FROM debtorsmaster - WHERE debtorsmaster.debtorno = '" . $DebtorNo . "'"; - + WHERE debtorsmaster.debtorno = '" . $DebtorNo . "'"; + $ErrMsg = _('The customer details could not be retrieved because'); $result = DB_query($sql,$db,$ErrMsg); @@ -672,10 +656,10 @@ $_POST['ClientSince'] = ConvertSQLDate($myrow['clientsince']); $_POST['HoldReason'] = $myrow['holdreason']; $_POST['PaymentTerms'] = $myrow['paymentterms']; - $_POST['Discount'] = $myrow['discount'] * 100; + $_POST['Discount'] = locale_number_format($myrow['discount'] * 100,2); $_POST['DiscountCode'] = $myrow['discountcode']; - $_POST['PymtDiscount'] = $myrow['pymtdiscount'] * 100; - $_POST['CreditLimit'] = $myrow['creditlimit']; + $_POST['PymtDiscount'] = locale_number_format($myrow['pymtdiscount'] * 100,2); + $_POST['CreditLimit'] = locale_number_format($myrow['creditlimit'],0); $_POST['InvAddrBranch'] = $myrow['invaddrbranch']; $_POST['TaxRef'] = $myrow['taxref']; $_POST['CustomerPOLine'] = $myrow['customerpoline']; @@ -690,34 +674,70 @@ /* if $AutoDebtorNo in config.php has not been set or if it has been set to a number less than one, then provide an input box for the DebtorNo to manually assigned */ if ($_SESSION['AutoDebtorNo']== 0 ) { - echo '<tr><td>' . _('Customer Code') . ':</td> - <td><input ' . (in_array('DebtorNo',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="DebtorNo" value="' . $DebtorNo . '" size=12 maxlength=10></td></tr>'; + echo '<tr> + <td>' . _('Customer Code') . ':</td> + <td><input ' . (in_array('DebtorNo',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="DebtorNo" value="' . $DebtorNo . '" size="12" maxlength="10" /></td></tr>'; } } if (isset($_GET['Modify'])) { - echo '<tr><td>' . _('Customer Name') . ':</td><td>' . $_POST['CustName'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td><td>' . $_POST['Address1'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td><td>' . $_POST['Address2'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td><td>' . $_POST['Address3'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td><td>' . $_POST['Address4'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 5') . ':</td><td>' . $_POST['Address5'] . '</td></tr>'; - echo '<tr><td>' . _('Address Line 6') . ':</td><td>' . $_POST['Address6'] . '</td></tr>'; + echo '<tr> + <td>' . _('Customer Name') . ':</td> + <td>' . $_POST['CustName'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 1 (Street)') . ':</td> + <td>' . $_POST['Address1'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td>' . $_POST['Address2'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 3 (State/Province)') . ':</td> + <td>' . $_POST['Address3'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td>' . $_POST['Address4'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 5') . ':</td> + <td>' . $_POST['Address5'] . '</td> + </tr> + <tr> + <td>' . _('Address Line 6') . ':</td> + <td>' . $_POST['Address6'] . '</td> + </tr>'; } else { - echo '<tr><td>' . _('Customer Name') . ':</td> - <td><input ' . (in_array('CustName',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="CustName" value="' . $_POST['CustName'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> - <td><input ' . (in_array('Address1',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> - <td><input ' . (in_array('Address2',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> - <td><input ' . (in_array('Address3',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address3" size=42 maxlength=40 value="' . $_POST['Address3'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> - <td><input ' . (in_array('Address4',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 5') . ':</td> - <td><input ' . (in_array('Address5',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 6') . ':</td> - <td><input ' . (in_array('Address6',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address6" size=42 maxlength=40 value="' . $_POST['Address6'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Customer Name') . ':</td> + <td><input ' . (in_array('CustName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CustName" value="' . $_POST['CustName'] . '" size="42" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Address Line 1 (Street)') . ':</td> + <td><input ' . (in_array('Address1',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address1" size="42" maxlength="40" value="' . $_POST['Address1'] . '" /></td> + </tr> + <tr> + <td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input ' . (in_array('Address2',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address2" size="42" maxlength="40" value="' . $_POST['Address2'] . '" /></td> + </tr> + <tr> + <td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input ' . (in_array('Address3',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address3" size="42" maxlength="40" value="' . $_POST['Address3'] . '" /></td> + </tr> + <tr> + <td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input ' . (in_array('Address4',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address4" size="42" maxlength="40" value="' . $_POST['Address4'] . '" /></td> + </tr> + <tr> + <td>' . _('Address Line 5') . ':</td> + <td><input ' . (in_array('Address5',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address5" size="42" maxlength="40" value="' . $_POST['Address5'] . '" /></td> + </tr> + <tr> + <td>' . _('Address Line 6') . ':</td> + <td><input ' . (in_array('Address6',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address6" size="42" maxlength="40" value="' . $_POST['Address6'] . '" /></td> + </tr>'; } // Select sales types for drop down list @@ -743,12 +763,14 @@ if (isset($_GET['Modify'])) { $result=DB_query("SELECT typename FROM debtortype WHERE typeid='".$_POST['typeid']."'",$db); $myrow=DB_fetch_array($result); - echo '<tr><td>' . _('Customer Type') . ':</td> + echo '<tr> + <td>' . _('Customer Type') . ':</td> <td>'.$myrow['typename'] . '</td> </tr>'; } else { $result=DB_query("SELECT typeid, typename FROM debtortype ORDER BY typename",$db); - echo '<tr><td>' . _('Customer Type') . ':</td> + echo '<tr> + <td>' . _('Customer Type') . ':</td> <td><select name="typeid">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['typeid']==$myrow['typeid']){ @@ -765,45 +787,73 @@ <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> <td>' . $_POST['ClientSince'] . '</td></tr>'; - echo '</table></td><td><table class=selection>'; + echo '</table></td> + <td><table class="selection">'; - echo '<tr><td>' . _('Discount Percent') . ':</td> - <td>' . $_POST['Discount'] . '</td></tr>'; - echo '<tr><td>' . _('Discount Code') . ':</td> - <td>' . $_POST['DiscountCode'] . '</td></tr>'; - echo '<tr><td>' . _('Payment Discount Percent') . ':</td> - <td>' . $_POST['PymtDiscount'] . '</td></tr>'; - echo '<tr><td>' . _('Credit Limit') . ':</td> - <td>' . locale_number_format($_POST['CreditLimit'],2) . '</td></tr>'; - echo '<tr><td>' . _('Tax Reference') . ':</td> - <td>' . $_POST['TaxRef'] . '</td></tr>'; + echo '<tr> + <td>' . _('Discount Percent') . ':</td> + <td>' . $_POST['Discount'] . '</td> + </tr> + <tr> + <td>' . _('Discount Code') . ':</td> + <td>' . $_POST['DiscountCode'] . '</td> + </tr> + <tr> + <td>' . _('Payment Discount Percent') . ':</td> + <td>' . $_POST['PymtDiscount'] . '</td> + </tr> + <tr> + <td>' . _('Credit Limit') . ':</td> + <td>' . $_POST['CreditLimit'] . '</td> + </tr> + <tr> + <td>' . _('Tax Reference') . ':</td> + <td>' . $_POST['TaxRef'] . '</td> + </tr>'; } else { - echo '</select></td></tr> - <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('ClientSince',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" size=11 maxlength=10 value=' . $_POST['ClientSince'] . '></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('ClientSince',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" size="11" maxlength="10" value="' . $_POST['ClientSince'] . '" /></td> + </tr> + </table></td> + <td><table class="selection">'; - echo '</table></td><td><table class="selection">'; - - echo '<tr><td>' . _('Discount Percent') . ':</td> - <td><input type="Text" name="Discount" class=number size=5 maxlength=4 value=' . $_POST['Discount'] . '></td></tr>'; - echo '<tr><td>' . _('Discount Code') . ':</td> - <td><input ' . (in_array('DiscountCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="DiscountCode" size=3 maxlength=2 value="' . $_POST['DiscountCode'] . '"></td></tr>'; - echo '<tr><td>' . _('Payment Discount Percent') . ':</td> - <td><input ' . (in_array('PymtDiscount',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class=number name="PymtDiscount" size=5 maxlength=4 value=' . $_POST['PymtDiscount'] . '></td></tr>'; - echo '<tr><td>' . _('Credit Limit') . ':</td> - <td><input ' . (in_array('CreditLimit',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class=number name="CreditLimit" size=16 maxlength=14 value=' . $_POST['CreditLimit'] . '></td></tr>'; - echo '<tr><td>' . _('Tax Reference') . ':</td> - <td><input type="Text" name="TaxRef" size=22 maxlength=20 value="' . $_POST['TaxRef'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Discount Percent') . ':</td> + <td><input type="text" name="Discount" class="number" size="5" maxlength="4" value="' . $_POST['Discount'] . '" /></td> + </tr> + <tr> + <td>' . _('Discount Code') . ':</td> + <td><input ' . (in_array('DiscountCode',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="DiscountCode" size="3" maxlength="2" value="' . $_POST['DiscountCode'] . '"></td> + </tr> + <tr> + <td>' . _('Payment Discount Percent') . ':</td> + <td><input ' . (in_array('PymtDiscount',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="number" name="PymtDiscount" size="5" maxlength="4" value="' . $_POST['PymtDiscount'] . '"></td> + </tr> + <tr> + <td>' . _('Credit Limit') . ':</td> + <td><input ' . (in_array('CreditLimit',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="number" name="CreditLimit" size="16" maxlength="14" value="' . $_POST['CreditLimit'] . '" /></td> + </tr> + <tr> + <td>' . _('Tax Reference') . ':</td> + <td><input type="text" name="TaxRef" size="22" maxlength="20" value="' . $_POST['TaxRef'] . '" /></td> + </tr>'; } if (isset($_GET['Modify'])) { $result=DB_query("SELECT terms FROM paymentterms WHERE termsindicator='".$_POST['PaymentTerms']."'",$db); $myrow=DB_fetch_array($result); - echo '<tr><td>' . _('Payment Terms') . ':</td><td>' . $myrow['terms'] . '</td></tr>'; + echo '<tr> + <td>' . _('Payment Terms') . ':</td> + <td>' . $myrow['terms'] . '</td> + </tr>'; } else { $result=DB_query("SELECT terms, termsindicator FROM paymentterms",$db); - echo '<tr><td>' . _('Payment Terms') . ':</td> - <td><select name="PaymentTerms">'; + echo '<tr> + <td>' . _('Payment Terms') . ':</td> + <td><select name="PaymentTerms">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['PaymentTerms']==$myrow['termsindicator']){ echo '<option selected value="'. $myrow['termsindicator'] . '">' . $myrow['terms'] . '</option>'; @@ -812,18 +862,22 @@ } } //end while loop DB_data_seek($result,0); - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } if (isset($_GET['Modify'])) { $result=DB_query("SELECT reasondescription FROM holdreasons WHERE reasoncode='".$_POST['HoldReason']."'",$db); $myrow=DB_fetch_array($result); - echo '<tr><td>' . _('Credit Status') . ':</td> - <td>'.$myrow['reasondescription'] . '</td></tr>'; + echo '<tr> + <td>' . _('Credit Status') . ':</td> + <td>'.$myrow['reasondescription'] . '</td> + </tr>'; } else { $result=DB_query("SELECT reasoncode, reasondescription FROM holdreasons",$db); - echo '<tr><td>' . _('Credit Status') . ':</td> - <td><select name="HoldReason">'; + echo '<tr> + <td>' . _('Credit Status') . ':</td> + <td><select name="HoldReason">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['HoldReason']==$myrow['reasoncode']){ echo '<option selected value="'. $myrow['reasoncode'] . '">' . $myrow['reasondescription'] . '</option>'; @@ -832,18 +886,21 @@ } } //end while loop DB_data_seek($result,0); - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } if (isset($_GET['Modify'])) { $result=DB_query("SELECT currency FROM currencies WHERE currabrev='".$_POST['CurrCode']."'",$db); $myrow=DB_fetch_array($result); - echo '<tr><td>' . _('Credit Status') . ':</td> + echo '<tr> + <td>' . _('Credit Status') . ':</td> <td>' . $myrow['currency'] . '</td></tr>'; } else { $result=DB_query("SELECT currency, currabrev FROM currencies",$db); - echo '<tr><td>' . _('Customers Currency') . ':</td> - <td><select name="CurrCode">'; + echo '<tr> + <td>' . _('Customers Currency') . ':</td> + <td><select name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode']==$myrow['currabrev']){ echo '<option selected value="'. $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; @@ -852,22 +909,26 @@ } } //end while loop DB_data_seek($result,0); - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } /*added lines 8/23/2007 by Morris Kelly to get po line parameter Y/N*/ if (isset($_GET['Modify'])) { if ($_POST['CustomerPOLine']==0){ - echo '<tr><td>' . _('Credit Status') . ':</td> + echo '<tr> + <td>' . _('Credit Status') . ':</td> <td>'._('No') . '</td> </tr>'; } else { - echo '<tr><td>' . _('Credit Status') . ':</td> + echo '<tr> + <td>' . _('Credit Status') . ':</td> <td>'._('Yes') . '</td> - </tr>'; + </tr>'; } } else { - echo '<tr><td>' . _('Require Customer PO Line on SO') . ':</td> - <td><select name="CustomerPOLine">'; + echo '<tr> + <td>' . _('Require Customer PO Line on SO') . ':</td> + <td><select name="CustomerPOLine">'; if ($_POST['CustomerPOLine']==0){ echo '<option selected value=0>' . _('No') . '</option>'; echo '<option value=1>' . _('Yes') . '</option>'; @@ -875,18 +936,26 @@ echo '<option value=0>' . _('No') . '</option>'; echo '<option selected value=1>' . _('Yes') . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } if (isset($_GET['Modify'])) { if ($_POST['CustomerPOLine']==0){ - echo '<tr><td>' . _('Invoice Addressing') . ':</td><td>'._('Address to HO').'</td></tr>'; + echo '<tr> + <td>' . _('Invoice Addressing') . ':</td> + <td>'._('Address to HO').'</td> + </tr>'; } else { - echo '<tr><td>' . _('Invoice Addressing') . ':</td><td>'._('Address to Branch').'</td></tr>'; + echo '<tr> + <td>' . _('Invoice Addressing') . ':</td> + <td>'._('Address to Branch').'</td> + </tr>'; } } else { - echo '<tr><td>' . _('Invoice Addressing') . ':</td> - <td><select name="AddrInvBranch">'; + echo '<tr> + <td>' . _('Invoice Addressing') . ':</td> + <td><select name="AddrInvBranch">'; if ($_POST['InvAddrBranch']==0){ echo '<option selected value=0>' . _('Address to HO') . '</option>'; echo '<option value=1>' . _('Address to Branch') . '</option>'; @@ -896,11 +965,12 @@ } } - echo '</select></td></tr> - </table></td></tr>'; - echo '<tr><td colspan=2>'; + echo '</select></td> + </tr> + </table></td> + </tr> + <tr><td colspan="2">'; - if (isset($_GET['delete'])) { //User hit delete link on customer contacts /*Process this first before showing remaining contacts */ $resultupcc = DB_query("DELETE FROM custcontacts @@ -925,20 +995,22 @@ echo '<table class=selection>'; if (isset($_GET['Modify'])) { echo '<tr> - <th>' . _('Name') . '</th> - <th>' . _('Role') . '</th> - <th>' . _('Phone Number') . '</th> - <th>' . _('Email') . '</th> - <th>' . _('Notes') . '</th></tr>'; + <th>' . _('Name') . '</th> + <th>' . _('Role') . '</th> + <th>' . _('Phone Number') . '</th> + <th>' . _('Email') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } else { echo '<tr> - <th>' . _('Name') . '</th> - <th>' . _('Role') . '</th> - <th>' . _('Phone Number') . '</th> - <th>' . _('Email') . '</th> - <th>' . _('Notes') . '</th> - <th>' . _('Edit') . '</th> - <th colspan=2><input type="Submit" name="AddContact" value="Add Contact"></th></tr>'; + <th>' . _('Name') . '</th> + <th>' . _('Role') . '</th> + <th>' . _('Phone Number') . '</th> + <th>' . _('Email') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Edit') . '</th> + <th colspan="2"><input type="Submit" name="AddContact" value="' . _('Add Contact') . '" /></th> + </tr>'; } $k=0; //row colour counter @@ -953,51 +1025,54 @@ if (isset($_GET['Modify'])) { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=mailto:%s>%s</a></td> - <td>%s</td> - </tr>', - $myrow['contactname'], - $myrow['role'], - $myrow['phoneno'], - $myrow['email'], - $myrow['email'], - $myrow['notes']); + <td>%s</td> + <td>%s</td> + <td><a href=mailto:%s>%s</a></td> + <td>%s</td> + </tr>', + $myrow['contactname'], + $myrow['role'], + $myrow['phoneno'], + $myrow['email'], + $myrow['email'], + $myrow['notes']); } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=mailto:%s>%s</a></td> - <td>%s</td> - <td><a href="AddCustomerContacts.php?Id=%s&DebtorNo=%s">'. _('Edit'). '</a></td> - <td><a href="%sID=%s&DebtorNo=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer contact?') . '\');">'. _('Delete'). '</a></td> - </tr>', - $myrow['contactname'], - $myrow['role'], - $myrow['phoneno'], - $myrow['email'], - $myrow['email'], - $myrow['notes'], - $myrow['contid'], - $myrow['debtorno'], - htmlspecialchars($_SERVER['PHP_SELF']) . '?', - $myrow['contid'], - $myrow['debtorno']); + <td>%s</td> + <td>%s</td> + <td><a href=mailto:%s>%s</a></td> + <td>%s</td> + <td><a href="AddCustomerContacts.php?Id=%s&DebtorNo=%s">'. _('Edit'). '</a></td> + <td><a href="%sID=%s&DebtorNo=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer contact?') . '\');">'. _('Delete'). '</a></td> + </tr>', + $myrow['contactname'], + $myrow['role'], + $myrow['phoneno'], + $myrow['email'], + $myrow['email'], + $myrow['notes'], + $myrow['contid'], + $myrow['debtorno'], + htmlspecialchars($_SERVER['PHP_SELF']) . '?', + $myrow['contid'], + $myrow['debtorno']); } }//END WHILE LIST LOOP echo '</table>'; - - echo'</td></tr></table>'; if (isset($_POST['New']) and $_POST['New']) { - echo '<div class="centre"><input type="submit" name="submit" value="' . _('Add New Customer') . - '"> <input type=submit name="Reset" value="' . _('Reset') . '"></div></form>'; - } else if (!isset($_GET['Modify'])){ - echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Update Customer') . '">'; - echo ' <input type="Submit" name="delete" value="' . _('Delete Customer') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">'; + echo '<div class="centre"> + <input type="submit" name="submit" value="' . _('Add New Customer') . '" /> + <input type=submit name="Reset" value="' . _('Reset') . '" /> + </div> + </form>'; + } elseif (!isset($_GET['Modify'])){ + echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Update Customer') . '" /> + <input type="Submit" name="delete" value="' . _('Delete Customer') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');" />'; } echo '</div>'; Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/DailyBankTransactions.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -6,14 +6,16 @@ $title = _('Bank Transactions Inquiry'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . - _('Search') . '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('Search') . '" alt="" />' . ' ' . $title.' + </p>'; if (!isset($_POST['Show'])) { echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection>'; + echo '<table class="selection">'; $SQL = "SELECT bankaccountname, bankaccounts.accountcode, @@ -26,7 +28,8 @@ $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); - echo '<tr><td>' . _('Bank Account') . ':</td> + echo '<tr> + <td>' . _('Bank Account') . ':</td> <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ @@ -49,18 +52,21 @@ } echo '</select></td></tr>'; } - echo '<tr><td>' . _('Transactions Dated From') . ':</td> - <td><input type="text" name="FromTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . - date($_SESSION['DefaultDateFormat']) . '"></td></tr> - <tr><td>' . _('Transactions Dated To') . ':</td> - <td><input type="text" name="ToTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 - onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . - date($_SESSION['DefaultDateFormat']) . '"></td> - </tr>'; - - echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="Show" value="' . _('Show transactions'). '"></div>'; - echo '</form>'; + echo '<tr> + <td>' . _('Transactions Dated From') . ':</td> + <td><input type="text" name="FromTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . + date($_SESSION['DefaultDateFormat']) . '" /></td> + </tr> + <tr> + <td>' . _('Transactions Dated To') . ':</td> + <td><input type="text" name="ToTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . date($_SESSION['DefaultDateFormat']) . '" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="Show" value="' . _('Show transactions'). '" /> + </div> + </form>'; } else { $SQL = "SELECT bankaccountname, bankaccounts.currcode, @@ -78,6 +84,7 @@ banktrans.exrate, banktrans.banktranstype, banktrans.transdate, + banktrans.ref, bankaccounts.bankaccountname, systypes.typename, systypes.typeid @@ -95,20 +102,20 @@ prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); } else { $BankDetailRow = DB_fetch_array($BankResult); - echo '<table class=selection> + echo '<table class="selection"> <tr> - <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> + <th colspan="8"><font size="3" color="blue">' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> + </tr> + <tr> + <th>' . ('Date') . '</th> + <th>'._('Transaction type').'</th> + <th>'._('Type').'</th> + <th>'._('Reference').'</th> + <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> </tr>'; - echo '<tr> - <th>' . ('Date') . '</th> - <th>'._('Transaction type').'</th> - <th>'._('Type').'</th> - <th>'._('Reference').'</th> - <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - </tr>'; $AccountCurrTotal=0; $LocalCurrTotal =0; @@ -123,10 +130,10 @@ <td>'.$myrow['typename'].'</td> <td>'.$myrow['banktranstype'].'</td> <td>'.$myrow['ref'].'</td> - <td class=number>'.locale_number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> - <td class=number>'.locale_number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> - <td class=number>'.locale_number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> - <td class=number>'.locale_number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> </tr>'; } echo '</table>'; Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/DailySalesInquiry.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -7,17 +7,21 @@ include('includes/header.inc'); include('includes/DefineCartClass.php'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="" />' . ' ' . _('Daily Sales') . '</p>'; -echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div><br />'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="" />' . ' ' . _('Daily Sales') . ' + </p>'; +echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div> + <br />'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table cellpadding=2 class=selection><tr>'; +echo '<table class="selection"> + <tr> + <td>' . _('Month to Show') . ':</td> + <td><select tabindex="1" name="MonthToShow">'; -echo '<td>' . _('Month to Show') . ':</td><td><select tabindex=1 name="MonthToShow">'; - if (!isset($_POST['MonthToShow'])){ $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); } @@ -29,11 +33,12 @@ echo '<option selected Value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; $EndDateSQL = $PeriodRow['lastdate_in_period']; } else { - echo '<option Value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; } } -echo '</select></td>'; -echo '<td>' . _('Salesperson') . ':</td><td><select tabindex=2 name="Salesperson">'; +echo '</select></td> + <td>' . _('Salesperson') . ':</td> + <td><select tabindex="2" name="Salesperson">'; $SalespeopleResult = DB_query("SELECT salesmancode, salesmanname FROM salesman",$db); if (!isset($_POST['Salesperson'])){ @@ -55,9 +60,11 @@ echo '</tr> </table> <br /> - <div class="centre"><input tabindex=4 type=submit name="ShowResults" value="' . _('Show Daily Sales For The Selected Month') . '">'; -echo '</form></div>'; -echo '<br />'; + <div class="centre"> + <input tabindex="4" type="submit" name="ShowResults" value="' . _('Show Daily Sales For The Selected Month') . '" /> + </div> + </form> + <br />'; /*Now get and display the sales data returned */ if (mb_strpos($EndDateSQL,'/')) { $Date_Array = explode('/',$EndDateSQL); @@ -92,9 +99,8 @@ $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); $SalesResult = DB_query($sql, $db,$ErrMsg); -echo '<table cellpadding=2 class=selection>'; - -echo'<tr> +echo '<table class="selection"> + <tr> <th>' . _('Sunday') . '</th> <th>' . _('Monday') . '</th> <th>' . _('Tuesday') . '</th> @@ -176,7 +182,7 @@ $AverageDailySales = 0; } -echo '<th colspan=7>' . _('Total Sales for month') . ': ' . locale_number_format($CumulativeTotalSales,0) . ' ' . _('GP%') . ': ' . locale_number_format($AverageGPPercent,1) . '% ' . _('Avg Daily Sales') . ': ' . locale_number_format($AverageDailySales,0) . '</th></tr>'; +echo '<th colspan="7">' . _('Total Sales for month') . ': ' . locale_number_format($CumulativeTotalSales,0) . ' ' . _('GP%') . ': ' . locale_number_format($AverageGPPercent,1) . '% ' . _('Avg Daily Sales') . ': ' . locale_number_format($AverageDailySales,0) . '</th></tr>'; echo '</table>'; Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/DebtorsAtPeriodEnd.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -125,7 +125,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - if (!isset($_POST['FromCriteria']) || !isset($_POST['ToCriteria'])) { + if (!isset($_POST['FromCriteria']) OR !isset($_POST['ToCriteria'])) { /*if $FromCriteria is not set then show a form to allow input */ @@ -134,13 +134,13 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('From Customer Code') .':</font></td> - <td><input tabindex=1 Type=text maxlength=6 size=7 name="FromCriteria" value="1"></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1" /></td> </tr>'; echo '<tr><td>' . _('To Customer Code') . ':</td> - <td><input tabindex=2 type="text" maxlength=6 size=7 name="ToCriteria" value="zzzzzz"></td></tr>'; + <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td></tr>'; echo '<tr><td>' . _('Balances As At') . ':</td> - <td><select tabindex=3 name="PeriodEnd">'; + <td><select tabindex="3" name="PeriodEnd">'; $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db,_('Could not retrieve period data because'),_('The SQL that failed to get the period data was')); Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/Stocks.php 2011-10-30 09:17:27 UTC (rev 4738) @@ -778,7 +778,10 @@ $_POST['TaxCat'] = $myrow['taxcatid']; $_POST['DecimalPlaces'] = $myrow['decimalplaces']; $_POST['NextSerialNo'] = $myrow['nextserialno']; + $_POST['Pansize'] = $myrow['pansize']; + $_POST['ShrinkFactor'] = $myrow['shrinkfactor']; + echo '<tr><td>' . _('Item Code') . ':</td> <td>'.$StockID.'</td> </tr>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-10-30 05:50:51 UTC (rev 4737) +++ trunk/doc/Change.log 2011-10-30 09:17:27 UTC (rev 4738) @@ -1,5 +1,6 @@ webERP Change Log +30/10/11 Exson: Modification to Stocks.php to avoid losing PanSize and ShrinkFactor 30/10/11 Phil: Made it so a saleman cannot be deleted if a user is setup referring only to this salesperson 29/10/11 High-Tech Bridge SA Security Research Lab <adv...@ht...> - sanitising $_SERVER['PHP_SELF'] and unquoted sql in reportwriter/FormMaker.php and reportwriter/ReportMaker.php 15/10/11 Phil: Tried to get correct characters for each language's thousands separator and decimal point in includes/LanguagesArray.php @@ -88,8 +89,8 @@ 28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing 27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost -26/6/11 Phil: Went back to no locale_number_formatting on PurchData.php -26/6/11 Phil: Went back to no locale_number_formatting on PO_Items.php price and quantity - Brian May still reporting issues +26/6/11 Phil: Went back to no number_formatting on PurchData.php +26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues 25/6/11 Phil: Made PO_PDFPurchOrder.php have the description of the order item run over several lines where it exceeds the width of the space allowed for it 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks @@ -143,7 +144,6 @@ 28/5/11 Phil: Reported by Daniel Brewer Fix SelectSalesOrder.php creation of PO with excluding redundant fields in purchorderdetails that were taken out. 28/5/11 Exson: UpdateCurrencyRateDaily was set to 1 when the option to enable it was clicked - should have been set to today's date in SystemParameters - fixed. Now no error reported bu ConvertSQLDate function when user enables update currencies daily. - 26/5/11 Version 4.04 Release 26/5/11 Ricard: require securitytoken 9 to allow user to see purchasing data in SelectProduct.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-30 05:51:00
|
Revision: 4737 http://web-erp.svn.sourceforge.net/web-erp/?rev=4737&view=rev Author: daintree Date: 2011-10-30 05:50:51 +0000 (Sun, 30 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BOMs.php trunk/ContractBOM.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/CreditStatus.php trunk/Currencies.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerAllocations.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/SalesPeople.php trunk/Stocks.php trunk/doc/Change.log trunk/includes/DefineCustAllocsClass.php Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/BOMs.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -9,7 +9,7 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -function display_children($parent, $level, &$BOMTree) { +function display_children($Parent, $Level, &$BOMTree) { global $db; global $i; @@ -17,25 +17,25 @@ // retrive all children of parent $c_result = DB_query("SELECT parent, component - FROM bom WHERE parent='" . $parent. "'" + FROM bom WHERE parent='" . $Parent. "'" ,$db); if (DB_num_rows($c_result) > 0) { while ($row = DB_fetch_array($c_result)) { - //echo '<br />Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br />'; - if ($parent != $row['component']) { + //echo '<br />Parent: ' . $Parent . ' Level: ' . $Level . ' row[component]: ' . $row['component'] .'<br />'; + if ($Parent != $row['component']) { // indent and display the title of this child - $BOMTree[$i]['Level'] = $level; // Level - if ($level > 15) { + $BOMTree[$i]['Level'] = $Level; // Level + if ($Level > 15) { prnMsg(_('A maximum of 15 levels of bill of materials only can be displayed'),'error'); exit; } - $BOMTree[$i]['Parent'] = $parent; // Assemble + $BOMTree[$i]['Parent'] = $Parent; // Assemble $BOMTree[$i]['Component'] = $row['component']; // Component // call this function again to display this // child's children $i++; - display_children($row['component'], $level + 1, $BOMTree); + display_children($row['component'], $Level + 1, $BOMTree); } } } @@ -53,11 +53,11 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)!=0) { - while ($myrow=DB_fetch_row($result)){ - if ($myrow[0]==$UltimateParent){ + while ($myrow=DB_fetch_array($result)){ + if ($myrow['component']==$UltimateParent){ return 1; } - if (CheckForRecursiveBOM($UltimateParent, $myrow[0],$db)){ + if (CheckForRecursiveBOM($UltimateParent, $myrow['component'],$db)){ return 1; } } //(while loop) @@ -70,11 +70,10 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { global $ParentMBflag; - // Modified by POPAD&T $sql = "SELECT bom.component, - stockmaster.description, + stockmaster.description as itemdescription, locations.locationname, - workcentres.description, + workcentres.description as workcentrename, bom.quantity, bom.effectiveafter, bom.effectiveto, @@ -83,19 +82,17 @@ 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"; + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + INNER JOIN locations ON + bom.loccode = locations.loccode + INNER JOIN workcentres + ON bom.workcentreadded=workcentres.code + INNER JOIN locstock + ON bom.loccode=locstock.loccode + AND bom.component = locstock.stockid + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."'"; $ErrMsg = _('Could not retrieve the BOM components because'); $DbgMsg = _('The SQL used to retrieve the components was'); @@ -104,33 +101,41 @@ //echo $TableHeader; $RowCounter =0; - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { $Level1 = str_repeat('- ',$Level-1).$Level; - if( $myrow[7]=='B' OR $myrow[7]=='K' OR $myrow[7]=='D') { + if( $myrow['mbflag']=='B' + OR $myrow['mbflag']=='K' + OR $myrow['mbflag']=='D') { + $DrillText = '%s%s'; $DrillLink = '<div class="centre">'._('No lower levels').'</div>'; $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); $DrillLink = htmlspecialchars($_SERVER['PHP_SELF']) . '?'; - $DrillID=$myrow[0]; + $DrillID=$myrow['component']; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ $AutoIssue = _('N/A'); - } elseif ($myrow[9]==0 AND $myrow[8]==1){//autoissue and not controlled + } elseif ($myrow['controlled']==0 AND $myrow['autoissue']==1){//autoissue and not controlled $AutoIssue = _('Yes'); - } elseif ($myrow[9]==0) { + } elseif ($myrow['controlled']==1) { $AutoIssue = _('No'); } else { $AutoIssue = _('N/A'); } - if ($myrow[7]=='D' OR $myrow[7]=='K' OR $myrow[7]=='A' OR $myrow[7]=='G'){ + if ($myrow['mbflag']=='D' //dummy orservice + OR $myrow['mbflag']=='K' //kit-set + OR $myrow['mbflag']=='A' // assembly + OR $myrow['mbflag']=='G') /* ghost */ { + $QuantityOnHand = _('N/A'); } else { - $QuantityOnHand = locale_number_format($myrow[10],$myrow[11]); - } + $QuantityOnHand = locale_number_format($myrow['qoh'],$myrow['decimalplaces']); + } + printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -146,23 +151,23 @@ <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]), + $myrow['component'], + $myrow['itemdescription'], + $myrow['locationname'], + $myrow['workcentrename'], + locale_number_format($myrow['quantity'],'Variable'), + ConvertSQLDate($myrow['effectiveafter']), + ConvertSQLDate($myrow['effectiveto']), $AutoIssue, $QuantityOnHand, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $DrillLink, $DrillID, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $UltimateParent); } //END WHILE LIST LOOP @@ -246,7 +251,7 @@ $Errors[$i] = 'EffectiveTo'; $i++; } - if($_POST['AutoIssue']==1 and isset($_POST['Component'])){ + if($_POST['AutoIssue']==1 AND isset($_POST['Component'])){ $sql = "SELECT controlled FROM stockmaster WHERE stockid='" . $_POST['Component'] . "'"; $CheckControlledResult = DB_query($sql,$db); $CheckControlledRow = DB_fetch_row($CheckControlledResult); Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractBOM.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -14,7 +14,7 @@ */ if (!isset($_SESSION['Contract'.$identifier])){ - header('Location:' . $rootpath . '/Contracts.php?' . SID); + header('Location:' . $rootpath . '/Contracts.php'); exit; } include('includes/header.inc'); @@ -22,11 +22,11 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['BackToHeader'])) { if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { - if ($_POST['Qty'.$ContractComponent->ComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponent->ComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractComponent($ContractComponent->ComponentID); } else { - $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=$_POST['Qty'.$ContractComponent->ComponentID]; + $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=filter_number_format($_POST['Qty'.$ContractComponent->ComponentID]); } } // end loop around the items on the contract BOM } // end if the contract is not currently committed to by the customer @@ -53,29 +53,29 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']){ @@ -84,55 +84,55 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } else { if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } @@ -160,52 +160,48 @@ } } - - if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected */ -/* take the form entries and enter the data from the form into the PurchOrder class variable */ - foreach ($_POST as $ItemCode => $Quantity) { - if (mb_substr($ItemCode, 0, 3)=='Qty') { - $ItemCode=mb_substr($ItemCode, 3, mb_strlen($ItemCode)-3); - $AlreadyOnThisBOM = 0; - + for ($i=0;$i < $_POST['CountOfItems'];$i++) { + $AlreadyOnThisBOM = 0; + if (filter_number_format($_POST['Qty'.$i])>0){ if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ - + foreach ($_SESSION['Contract'.$identifier]->ContractBOM AS $Component) { - + /* do a loop round the items on the order to see that the item is not already on this order */ - if ($Component->StockID == $ItemCode) { + if ($Component->StockID == trim($_POST['StockID'.$i])) { $AlreadyOnThisBOM = 1; - prnMsg( _('The item') . ' ' . $ItemCode . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); + prnMsg( _('The item') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); } } /* end of the foreach loop to look for preexisting items of the same code */ } - - if ($AlreadyOnThisBOM!=1 and $Quantity>0){ - + + if ($AlreadyOnThisBOM!=1){ + $sql = "SELECT stockmaster.description, stockmaster.stockid, stockmaster.units, stockmaster.decimalplaces, stockmaster.materialcost+labourcost+overheadcost AS unitcost FROM stockmaster - WHERE stockmaster.stockid = '". $ItemCode . "'"; - + WHERE stockmaster.stockid = '". trim($_POST['StockID'.$i]) . "'"; + $ErrMsg = _('The item details could not be retrieved'); $DbgMsg = _('The SQL used to retrieve the item details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - + if ($myrow = DB_fetch_array($result1)){ - - $_SESSION['Contract'.$identifier]->Add_To_ContractBOM ($ItemCode, + + $_SESSION['Contract'.$identifier]->Add_To_ContractBOM (trim($_POST['StockID'.$i]), $myrow['description'], - $DefaultWorkCentre, - $Quantity, /* Qty */ + '', + filter_number_format($_POST['Qty'.$i]), /* Qty */ $myrow['unitcost'], - $myrow['units']); + $myrow['units'], + $myrow['decimalplaces']); } else { - prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); + prnMsg (_('The item code') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ echo '<br />' . $sql; } @@ -213,7 +209,7 @@ exit; } } /* end of if not already on the contract BOM */ - } + } /* the quantity of the item is > 0 */ } } /* end of if its a new item */ @@ -223,21 +219,25 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (count($_SESSION['Contract'.$identifier]->ContractBOM)>0){ - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . ' + </p>'; - echo '<table cellpadding="2" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th></tr>'; + echo '<tr> + <th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th> + </tr>'; } echo '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('UOM') .'</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Sub-total') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('UOM') .'</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Sub-total') . '</th> </tr>'; $_SESSION['Contract'.$identifier]->total = 0; @@ -247,7 +247,7 @@ $LineTotal = $ContractComponent->Quantity * $ContractComponent->ItemCost; - $DisplayLineTotal = locale_number_format($LineTotal,2); + $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CompanyRecord']['decimalplaces']); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -259,17 +259,17 @@ echo '<td>' . $ContractComponent->StockID . '</td> <td>' . $ContractComponent->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> + <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . locale_number_format($ContractComponent->Quantity,$ContractComponent->DecimalPlaces) . '" /></td> <td>' . $ContractComponent->UOM . '</td> - <td class="number">' . $ContractComponent->ItemCost . '</td> + <td class="number">' . locale_number_format($ContractComponent->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the contract BOM?') . '\');">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } - $DisplayTotal = locale_number_format($TotalCost,2); + $DisplayTotal = locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']); echo '<tr> - <td colspan="6" class="number">' . _('Total Cost') . '</td> + <td colspan="5" class="number">' . _('Total Cost') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr> </table>'; @@ -281,11 +281,11 @@ if (!isset($_GET['Edit'])) { $sql="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype<>'L' - AND stocktype<>'D' - ORDER BY categorydescription"; + categorydescription + FROM stockcategory + WHERE stocktype<>'L' + AND stocktype<>'D' + ORDER BY categorydescription"; $ErrMsg = _('The supplier category details could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -316,21 +316,25 @@ } echo '</select></td> - <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> - <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr> - <tr><td></td> - <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . - ':</font></td> - <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td> </tr> - <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> - </table><br /> - <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> - </div><br />'; + <tr> + <td></td> + <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . ':</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="Search" value="' . _('Search Now') . '" /> + </div> + <br />'; - - $PartsDisplayed =0; } if (isset($SearchResult)) { @@ -338,17 +342,16 @@ echo '<table cellpadding="1" colspan="7">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Image') . '</th> + <th>' . _('Quantity') . '</th> </tr>'; echo $TableHeader; - $j = 1; $k=0; //row colour counter - + $i=0; while ($myrow=DB_fetch_array($SearchResult)) { if ($k==1){ @@ -366,31 +369,34 @@ } echo '<td>'.$myrow['stockid'].'</td> - <td>'.$myrow['description'].'</td> - <td>'.$myrow['units'] . '</td> - <td>'.$ImageSource.'</td> - <td><input class="number" type="text" size="6" value="0" name="Qty'.$myrow['stockid'].'" /></td> + <td>'.$myrow['description'].'</td> + <td>'.$myrow['units'] . '</td> + <td>'.$ImageSource.'</td> + <td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /> + <input type="hidden" name="StockID'.$i.'" value="' . $myrow['stockid'] . '" /> + </td> </tr>'; - - $PartsDisplayed++; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + $i++; + if ($i == $_SESSION['DisplayRecordsMax']){ break; } #end of page full new headings if } + #end of while loop - echo '</table>'; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + echo '</table> + <input type="hidden" name="CountOfItems" value="'. $i . '" />'; + if ($i == $_SESSION['DisplayRecordsMax']){ - - prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . - _('Please restrict your search to only the parts required'),'info'); + prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } - echo '<br /><div class="centre"><input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /> + </div>'; }#end if SearchResults to show -echo '<hr />'; - -echo '</form>'; +echo '<hr /> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractOtherReqts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -24,7 +24,7 @@ if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $ContractComponentID => $ContractRequirementItem) { - if ($_POST['Qty'.$ContractComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractRequirement($ContractComponentID); } else { @@ -81,10 +81,12 @@ if (count($_SESSION['Contract'.$identifier]->ContractReqts)>0){ - echo '<table cellpadding="2" colspan="7" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th></tr>'; + echo '<tr> + <th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th> + </tr>'; } echo '<tr> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Contracts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -276,7 +276,6 @@ $WorkCentre = $_SESSION['Contract'.$identifier]->LocCode; } /*The above is a bit of a hack to get a default workcentre for a location based on the users default location*/ - } $sql = "SELECT contractref, @@ -542,22 +541,22 @@ quotation) VALUES ( '". $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->DebtorNo) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->BranchCode) . "', - '". DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) ."', - '" . DB_escape_string(Date('Y-m-d H:i')) . "', - '" . DB_escape_string($CustomerDetailsRow['salestype']) . "', - '" . DB_escape_string($CustomerDetailsRow['defaultshipvia']) ."', - '". DB_escape_string($CustomerDetailsRow['brname']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress1']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress2']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress3']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress4']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress5']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress6']) . "', - '" . DB_escape_string($CustomerDetailsRow['phoneno']) . "', - '" . DB_escape_string($CustomerDetailsRow['email']) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->LocCode) ."', + '" . $_SESSION['Contract'.$identifier]->DebtorNo . "', + '" . $_SESSION['Contract'.$identifier]->BranchCode . "', + '". $_SESSION['Contract'.$identifier]->CustomerRef ."', + '" . Date('Y-m-d H:i') . "', + '" . $CustomerDetailsRow['salestype'] . "', + '" . $CustomerDetailsRow['defaultshipvia'] ."', + '". $CustomerDetailsRow['brname'] . "', + '" . $CustomerDetailsRow['braddress1'] . "', + '" . $CustomerDetailsRow['braddress2'] . "', + '" . $CustomerDetailsRow['braddress3'] . "', + '" . $CustomerDetailsRow['braddress4'] . "', + '" . $CustomerDetailsRow['braddress5'] . "', + '" . $CustomerDetailsRow['braddress6'] . "', + '" . $CustomerDetailsRow['phoneno'] . "', + '" . $CustomerDetailsRow['email'] . "', + '" . $_SESSION['Contract'.$identifier]->LocCode ."', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "', '" . Date('Y-m-d') . "', '1' )"; @@ -573,10 +572,10 @@ itemdue) VALUES ('0', '" . $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "', + '" . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . ($ContractPrice * $_SESSION['Contract'.$identifier]->ExRate) . "', '1', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) . "', + '" . $_SESSION['Contract'.$identifier]->CustomerRef . "', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "')"; $DbgMsg = _('The SQL that failed was'); $ErrMsg = _('Unable to add the quotation line'); @@ -586,7 +585,7 @@ //make the status of the contract 1 - to indicate that it is now quoted $sql = "UPDATE contracts SET orderno='" . $OrderNo . "', status='" . 1 . "' - WHERE contractref='" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "'"; + WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; $ErrMsg = _('Unable to update the contract status and order number because'); $UpdContractResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $Result = DB_Txn_Commit($db); @@ -597,7 +596,6 @@ } //end of if making a quotation - if (isset($_POST['SearchCustomers'])){ if (($_POST['CustKeywords']!='') AND (($_POST['CustCode']!='') OR ($_POST['CustPhone']!=''))) { @@ -624,7 +622,7 @@ FROM custbranch LEFT JOIN debtorsmaster ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.brname " . LIKE . " '$SearchString' + WHERE custbranch.brname " . LIKE . " '" . $SearchString . "' AND custbranch.disabletrans=0 ORDER BY custbranch.debtorno, custbranch.branchcode"; @@ -832,8 +830,10 @@ /*Set up form for entry of contract header stuff */ - echo '<table class="selection">'; - echo '<tr><td>' . _('Contract Reference') . ':</td><td>'; + echo '<table class="selection"> + <tr> + <td>' . _('Contract Reference') . ':</td> + <td>'; if ($_SESSION['Contract'.$identifier]->Status==0) { /*Then the contract has not become an order yet and we can allow changes to the ContractRef */ echo '<input type="text" name="ContractRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />'; @@ -875,27 +875,36 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Contract Description') . ':</td> + <td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td> + </tr><tr> + <td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td> + <td><input type="file" id="Drawing" name="Drawing" /></td> + </tr>'; - echo '<tr><td>' . _('Contract Description'); - echo ':</td><td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td></tr>'; - - echo '<tr><td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td><td><input type="file" id="Drawing" name="Drawing" /></td></tr>'; - if (!isset($_SESSION['Contract'.$identifier]->RequiredDate)) { $_SESSION['Contract'.$identifier]->RequiredDate = DateAdd(date($_SESSION['DefaultDateFormat']),'m',1); } - echo '<tr><td>' . _('Required Date') . ':</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td></tr>'; + echo '<tr> + <td>' . _('Required Date') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td> + </tr>'; - echo '<tr><td>' . _('Customer Reference') . ':</td> - <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td></tr>'; + echo '<tr> + <td>' . _('Customer Reference') . ':</td> + <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td> + </tr>'; if (!isset($_SESSION['Contract'.$identifier]->Margin)){ $_SESSION['Contract'.$identifier]->Margin =50; } - echo '<tr><td>' . _('Gross Profit') . ' %:</td> - <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td></tr>'; + echo '<tr> + <td>' . _('Gross Profit') . ' %:</td> + <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td> + </tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ echo '<tr> @@ -906,7 +915,9 @@ echo '<input type="hidden" name="ExRate" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" />'; } - echo '<tr><td>' . _('Contract Status') . ':</td><td>'; + echo '<tr> + <td>' . _('Contract Status') . ':</td> + <td>'; $StatusText = array(); $StatusText[0] = _('Setup'); @@ -920,19 +931,29 @@ echo _('Order Placed'); } echo '<input type="hidden" name="Status" value="'.$_SESSION['Contract'.$identifier]->Status.'" />'; - echo '</td></tr>'; + echo '</td> + </tr>'; if ($_SESSION['Contract'.$identifier]->Status >=1) { - echo '<tr><td>' . _('Quotation Reference/Sales Order No') . ':</td> - <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td></tr>'; + echo '<tr> + <td>' . _('Quotation Reference/Sales Order No') . ':</td> + <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td> + </tr>'; } if ($_SESSION['Contract'.$identifier]->Status!=2 and isset($_SESSION['Contract'.$identifier]->WO)) { - echo '<tr><td>' . _('Contract Work Order Ref') . ':</td> - <td>' . $_SESSION['Contract'.$identifier]->WO . '</td></tr>'; + echo '<tr> + <td>' . _('Contract Work Order Ref') . ':</td> + <td>' . $_SESSION['Contract'.$identifier]->WO . '</td> + </tr>'; } echo '</table><br />'; - echo '<table><tr><td> - <table class="selection"><tr><th colspan="6">' . _('Stock Items Required') . '</th></tr>'; + echo '<table> + <tr> + <td> + <table class="selection"> + <tr> + <th colspan="6">' . _('Stock Items Required') . '</th> + </tr>'; $ContractBOMCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ echo '<tr><th>' . _('Item Code') . '</th> @@ -944,29 +965,30 @@ </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { - echo '<tr><td>' . $Component->StockID . '</td> + echo '<tr> + <td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> + <td class="number">' . locale_number_format($Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->UOM . '</td> - <td class="number">' . locale_number_format($Component->ItemCost,2) . '</td> - <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); } echo '<tr> <th colspan="5"><b>' . _('Total stock cost') . '</b></th> - <th class="number"><b>' . locale_number_format($ContractBOMCost,2) . '</b></th> + <th class="number"><b>' . locale_number_format($ContractBOMCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> </tr>'; } else { //there are no items set up against this contract echo '<tr> <td colspan="6"><i>' . _('None Entered') . '</i></td> - </tr>'; + </tr>'; } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> <table class="selection"> <tr> - <th colspan="4">' . _('Other Requirements') . '</th> + <th colspan="4">' . _('Other Requirements') . '</th> </tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ @@ -979,28 +1001,35 @@ foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr> <td>' . $Requirement->Requirement . '</td> - <td class="number">' . $Requirement->Quantity . '</td> - <td class="number">' . $Requirement->CostPerUnit . '</td> - <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td> + <td class="number">' . locale_number_format($Requirement->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractReqtsCost += ($Requirement->CostPerUnit * $Requirement->Quantity); } - echo '<tr><th colspan="3"><b>' . _('Total other costs') . '</b></th><th class="number"><b>' . locale_number_format($ContractReqtsCost,2) . '</b></th></tr>'; + echo '<tr> + <th colspan="3"><b>' . _('Total other costs') . '</b></th> + <th class="number"><b>' . locale_number_format($ContractReqtsCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> + </tr>'; } else { //there are no items set up against this contract - echo '<tr><td colspan="4"><i>' . _('None Entered') . '</i></td></tr>'; + echo '<tr> + <td colspan="4"><i>' . _('None Entered') . '</i></td> + </tr>'; } echo '</table></td></tr></table>'; echo '<br />'; echo'<table class="selection"> - <tr><th>' . _('Total Contract Cost') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> - <th>' . _('Contract Price') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <tr> + <th>' . _('Total Contract Cost') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <th>' . _('Contract Price') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> </tr> - </table>'; + </table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> + echo '<div class="centre"> + <input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> <input type="submit" name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'" />'; if($_SESSION['Contract'.$identifier]->Status==0){ // not yet quoted echo '<input type="submit" name="CommitContract" value="' . _('Commit Changes') .'" />'; @@ -1008,12 +1037,17 @@ echo '<input type="submit" name="CommitContract" value="' . _('Update Quotation') .'" />'; } if($_SESSION['Contract'.$identifier]->Status==0){ //not yet quoted - echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /></div>'; + echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /> + </div>'; } else { echo '</div>'; } if ($_SESSION['Contract'.$identifier]->Status!=2) { - echo '<p><div class="centre"><input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /></div></p>'; + echo '<p> + <div class="centre"> + <input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /> + </div> + </p>'; } echo '</form>'; } /*end of if customer selected and entering contract header*/ Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CreditStatus.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -17,7 +17,9 @@ } $Errors = array(); $InputError = 0; -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> <br />'; if (isset($_POST['submit'])) { @@ -141,14 +143,14 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons'; + $sql = "SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons"; $result = DB_query($sql, $db); - echo '<table class=selection>'; - echo '<tr> - <th>'. _('Status Code') .'</th> - <th>'. _('Description') .'</th> - <th>'. _('Disallow Invoices') .'</th>'; + echo '<table class="selection"> + <tr> + <th>'. _('Status Code') .'</th> + <th>'. _('Description') .'</th> + <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter while ($myrow=DB_fetch_array($result)) { @@ -186,7 +188,9 @@ } //end of ifs and buts! if (isset($SelectedReason)) { - echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a> + </div>'; } if (!isset($_GET['delete'])) { @@ -210,8 +214,8 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; - echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '" />'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '" />'; echo '<table class="selection"> <tr> <td>'. _('Status Code') .':</td> @@ -226,7 +230,7 @@ <table class="selection"> <tr> <td>'. _('Status Code') .':</td> - <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="1" type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size="3" maxlength="2" /></td> </tr>'; } @@ -241,13 +245,17 @@ <tr> <td>'. _('Disallow Invoices') . '</td>'; if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']==1) { - echo '<td><input tabindex=3 type="checkbox" checked name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex="3" type="checkbox" checked name="DisallowInvoices" /></td> + </tr>'; } else { - echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices" /></td> + </tr>'; } echo '</table> <br /> - <div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div> + <div class="centre"> + <input tabindex="4" type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> </form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Currencies.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -40,7 +40,9 @@ $i=1; $sql="SELECT count(currabrev) - FROM currencies WHERE currabrev='".$_POST['Abbreviation']."'"; + FROM currencies + WHERE currabrev='".$_POST['Abbreviation']."'"; + $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -56,23 +58,23 @@ $Errors[$i] = 'Abbreviation'; $i++; } - if (!is_numeric($_POST['ExchangeRate'])){ + if (!is_numeric(filter_number_format($_POST['ExchangeRate']))){ $InputError = 1; prnMsg(_('The exchange rate must be numeric'),'error'); $Errors[$i] = 'ExchangeRate'; $i++; } - if (!is_numeric($_POST['DecimalPlaces'])){ + if (!is_numeric(filter_number_format($_POST['DecimalPlaces']))){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be numeric'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - }elseif ($_POST['DecimalPlaces']<=0){ + }elseif (filter_number_format($_POST['DecimalPlaces'])<=0){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be positive or zero'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - } elseif ($_POST['DecimalPlaces']>2){ + } elseif (filter_number_format($_POST['DecimalPlaces'])>2){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency is expected to be 2 or less'),'error'); $Errors[$i] = 'DecimalPlaces'; @@ -113,8 +115,8 @@ $sql = "UPDATE currencies SET currency='" . $_POST['CurrencyName'] . "', country='". $_POST['Country']. "', hundredsname='" . $_POST['HundredsName'] . "', - decimalplaces='" . $_POST['DecimalPlaces'] . "', - rate='" .$_POST['ExchangeRate'] . "' + decimalplaces='" . filter_number_format($_POST['DecimalPlaces']) . "', + rate='" .filter_number_format($_POST['ExchangeRate']) . "' WHERE currabrev = '" . $SelectedCurrency . "'"; $msg = _('The currency definition record has been updated'); @@ -131,8 +133,8 @@ '" . $_POST['Abbreviation'] . "', '" . $_POST['Country'] . "', '" . $_POST['HundredsName'] . "', - '" . $_POST['DecimalPlaces'] . "', - '" . $_POST['ExchangeRate'] . "')"; + '" . filter_number_format($_POST['DecimalPlaces']) . "', + '" . filter_number_format($_POST['ExchangeRate']) . "')"; $msg = _('The currency definition record has been added'); } @@ -208,7 +210,8 @@ $result = DB_query($sql, $db); echo '<table class="selection">'; - echo '<tr><td></td> + echo '<tr> + <td></td> <th>' . _('ISO4217 Code') . '</th> <th>' . _('Currency Name') . '</th> <th>' . _('Country') . '</th> @@ -216,7 +219,7 @@ <th>' . _('Decimal Places') . '</th> <th>' . _('Exchange Rate') . '</th> <th>' . _('Ex Rate - ECB') .'</th> - </tr>'; + </tr>'; $k=0; //row colour counter /*Get published currency rates from Eurpoean Central Bank */ @@ -249,9 +252,9 @@ <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 class="number">%s</td> <td><a href="%s&SelectedCurrency=%s">%s</a></td> <td><a href="%s&SelectedCurrency=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this currency?') . '\');">%s</a></td> <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> @@ -261,9 +264,9 @@ $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], - locale_number_format($myrow['rate'],5), - locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), + locale_number_format($myrow['decimalplaces'],0), + locale_number_format($myrow['rate'],6), + locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),6), htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Edit'), @@ -280,14 +283,14 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td colspan=4>%s</td> + <td colspan="4">%s</td> </tr>', $ImageFile, $myrow['currabrev'], $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], + locale_number_format($myrow['decimalplaces'],0), 1, _('Functional Currency')); } @@ -312,11 +315,11 @@ //editing an existing payment terms $sql = "SELECT currency, - currabrev, - country, - hundredsname, - decimalplaces, - rate + currabrev, + country, + hundredsname, + decimalplaces, + rate FROM currencies WHERE currabrev='" . $SelectedCurrency . "'"; @@ -329,71 +332,76 @@ $_POST['CurrencyName'] = $myrow['currency']; $_POST['Country'] = $myrow['country']; $_POST['HundredsName'] = $myrow['hundredsname']; - $_POST['ExchangeRate'] = $myrow['rate']; - $_POST['DecimalPlaces'] = $myrow['decimalplaces']; + $_POST['ExchangeRate'] = locale_number_format($myrow['rate'],6); + $_POST['DecimalPlaces'] = locale_number_format($myrow['decimalplaces'],0); - echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; - echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; + echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '" />'; + echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" />'; echo '<table class="selection"> <tr> - <td>' . _('ISO 4217 Currency Code').':</td> - <td>' . $_POST['Abbreviation'] . '</td> + <td>' . _('ISO 4217 Currency Code').':</td> + <td>' . $_POST['Abbreviation'] . '</td> </tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} echo '<table class="selection"> <tr> - <td>' ._('Currency Abbreviation') . ':</td> - <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size=4 maxlength=3></td></tr>'; + <td>' ._('Currency Abbreviation') . ':</td> + <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size="4" maxlength="3" /></td> + </tr>'; } - echo '<tr><td>'._('Currency Name').':</td>'; - echo '<td>'; + echo '<tr> + <td>'._('Currency Name').':</td> + <td>'; if (!isset($_POST['CurrencyName'])) { $_POST['CurrencyName']=''; } - echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 value="' . $_POST['CurrencyName'] . '">'; - echo '</td></tr>'; - echo '<tr><td>'._('Country').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size="20" maxlength="20" value="' . $_POST['CurrencyName'] . '" /></td> + </tr> + <tr> + <td>'._('Country').':</td> + <td>'; if (!isset($_POST['Country'])) { $_POST['Country']=''; } - echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 value="' . $_POST['Country'] . '">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Hundredths Name').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size="30" maxlength="50" value="' . $_POST['Country'] . '" /></td> + </tr> + <tr> + <td>'._('Hundredths Name').':</td> + <td>'; if (!isset($_POST['HundredsName'])) { $_POST['HundredsName']=''; } - echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Decimal Places to Display').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size="10" maxlength="15" value="'. $_POST['HundredsName'].'" /></td> + </tr> + <tr> + <td>'._('Decimal Places to Display').':</td> + <td>'; if (!isset($_POST['DecimalPlaces'])) { $_POST['DecimalPlaces']=''; } - echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Exchange Rate').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'" /></td> + </tr> + <tr> + <td>'._('Exchange Rate').':</td> + <td>'; if (!isset($_POST['ExchangeRate'])) { $_POST['ExchangeRate']=''; } - echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 value='. $_POST['ExchangeRate'].'>'; - echo '</td></tr>'; - echo '</table>'; + echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="number" name="ExchangeRate" size="10" maxlength="9" value="'. $_POST['ExchangeRate'].'"></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/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CustLoginSetup.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -134,22 +134,27 @@ $_POST['Email']=''; } -echo '<tr><td>' . _('Password') . ':</td> - <td><input type="password" name="Password" size=22 maxlength=20 value="' . $_POST['Password'] . '"></tr>'; -echo '<tr><td>' . _('Full Name') . ':</td> - <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size=36 maxlength=35></td></tr>'; -echo '<tr><td>' . _('Telephone No') . ':</td> - <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; -echo '<tr><td>' . _('Email Address') .':</td> - <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; -echo '<input type="hidden" name="Access" value="1">'; +echo '<tr> + <td>' . _('Password') . ':</td> + <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /> + </tr> + <tr> + <td>' . _('Full Name') . ':</td> + <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size="36" maxlength="35" /></td> + </tr> + <tr> + <td>' . _('Telephone No') . ':</td> + <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size="32" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Email Address') .':</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size="32" maxlength="55" /></td> + </tr> + <input type="hidden" name="Access" value="1" /> + <tr> + <td>' . _('Branch Code') . ':</td> + <td><select name="BranchCode">'; - -//Customer is fixed by selection of customer - -echo '<tr><td>' . _('Branch Code') . ':</td> - <td><select name="BranchCode">'; - $sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql,$db); @@ -163,7 +168,7 @@ if (isset($_POST['BranchCode']) and $myrow['branchcode'] == $_POST['BranchCode']){ echo '<option selected value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } else { - echo '<option Value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; + echo '<option value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } } @@ -211,15 +216,14 @@ echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Theme') . ':</td> + <td><select name="Theme">'; -echo '<tr> - <td>' . _('Theme') . ':</td> - <td><select name="Theme">'; - $ThemeDirectory = dir('css/'); - while (false != ($ThemeName = $ThemeDirectory->read())){ if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ @@ -234,13 +238,12 @@ } } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Language') . ':</td> + <td><select name="UserLanguage">'; - -echo '<tr> - <td>' . _('Language') . ':</td> - <td><select name="UserLanguage">'; - foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; @@ -250,11 +253,13 @@ echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; } } -echo '</select></td></tr>'; - - -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> +echo '</select></t... [truncated message content] |
From: <dai...@us...> - 2011-10-30 05:51:00
|
Revision: 4737 http://web-erp.svn.sourceforge.net/web-erp/?rev=4737&view=rev Author: daintree Date: 2011-10-30 05:50:51 +0000 (Sun, 30 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BOMs.php trunk/ContractBOM.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/CreditStatus.php trunk/Currencies.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerAllocations.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/SalesPeople.php trunk/Stocks.php trunk/doc/Change.log trunk/includes/DefineCustAllocsClass.php Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/BOMs.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -9,7 +9,7 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -function display_children($parent, $level, &$BOMTree) { +function display_children($Parent, $Level, &$BOMTree) { global $db; global $i; @@ -17,25 +17,25 @@ // retrive all children of parent $c_result = DB_query("SELECT parent, component - FROM bom WHERE parent='" . $parent. "'" + FROM bom WHERE parent='" . $Parent. "'" ,$db); if (DB_num_rows($c_result) > 0) { while ($row = DB_fetch_array($c_result)) { - //echo '<br />Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br />'; - if ($parent != $row['component']) { + //echo '<br />Parent: ' . $Parent . ' Level: ' . $Level . ' row[component]: ' . $row['component'] .'<br />'; + if ($Parent != $row['component']) { // indent and display the title of this child - $BOMTree[$i]['Level'] = $level; // Level - if ($level > 15) { + $BOMTree[$i]['Level'] = $Level; // Level + if ($Level > 15) { prnMsg(_('A maximum of 15 levels of bill of materials only can be displayed'),'error'); exit; } - $BOMTree[$i]['Parent'] = $parent; // Assemble + $BOMTree[$i]['Parent'] = $Parent; // Assemble $BOMTree[$i]['Component'] = $row['component']; // Component // call this function again to display this // child's children $i++; - display_children($row['component'], $level + 1, $BOMTree); + display_children($row['component'], $Level + 1, $BOMTree); } } } @@ -53,11 +53,11 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)!=0) { - while ($myrow=DB_fetch_row($result)){ - if ($myrow[0]==$UltimateParent){ + while ($myrow=DB_fetch_array($result)){ + if ($myrow['component']==$UltimateParent){ return 1; } - if (CheckForRecursiveBOM($UltimateParent, $myrow[0],$db)){ + if (CheckForRecursiveBOM($UltimateParent, $myrow['component'],$db)){ return 1; } } //(while loop) @@ -70,11 +70,10 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { global $ParentMBflag; - // Modified by POPAD&T $sql = "SELECT bom.component, - stockmaster.description, + stockmaster.description as itemdescription, locations.locationname, - workcentres.description, + workcentres.description as workcentrename, bom.quantity, bom.effectiveafter, bom.effectiveto, @@ -83,19 +82,17 @@ 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"; + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + INNER JOIN locations ON + bom.loccode = locations.loccode + INNER JOIN workcentres + ON bom.workcentreadded=workcentres.code + INNER JOIN locstock + ON bom.loccode=locstock.loccode + AND bom.component = locstock.stockid + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."'"; $ErrMsg = _('Could not retrieve the BOM components because'); $DbgMsg = _('The SQL used to retrieve the components was'); @@ -104,33 +101,41 @@ //echo $TableHeader; $RowCounter =0; - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { $Level1 = str_repeat('- ',$Level-1).$Level; - if( $myrow[7]=='B' OR $myrow[7]=='K' OR $myrow[7]=='D') { + if( $myrow['mbflag']=='B' + OR $myrow['mbflag']=='K' + OR $myrow['mbflag']=='D') { + $DrillText = '%s%s'; $DrillLink = '<div class="centre">'._('No lower levels').'</div>'; $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); $DrillLink = htmlspecialchars($_SERVER['PHP_SELF']) . '?'; - $DrillID=$myrow[0]; + $DrillID=$myrow['component']; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ $AutoIssue = _('N/A'); - } elseif ($myrow[9]==0 AND $myrow[8]==1){//autoissue and not controlled + } elseif ($myrow['controlled']==0 AND $myrow['autoissue']==1){//autoissue and not controlled $AutoIssue = _('Yes'); - } elseif ($myrow[9]==0) { + } elseif ($myrow['controlled']==1) { $AutoIssue = _('No'); } else { $AutoIssue = _('N/A'); } - if ($myrow[7]=='D' OR $myrow[7]=='K' OR $myrow[7]=='A' OR $myrow[7]=='G'){ + if ($myrow['mbflag']=='D' //dummy orservice + OR $myrow['mbflag']=='K' //kit-set + OR $myrow['mbflag']=='A' // assembly + OR $myrow['mbflag']=='G') /* ghost */ { + $QuantityOnHand = _('N/A'); } else { - $QuantityOnHand = locale_number_format($myrow[10],$myrow[11]); - } + $QuantityOnHand = locale_number_format($myrow['qoh'],$myrow['decimalplaces']); + } + printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -146,23 +151,23 @@ <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]), + $myrow['component'], + $myrow['itemdescription'], + $myrow['locationname'], + $myrow['workcentrename'], + locale_number_format($myrow['quantity'],'Variable'), + ConvertSQLDate($myrow['effectiveafter']), + ConvertSQLDate($myrow['effectiveto']), $AutoIssue, $QuantityOnHand, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $DrillLink, $DrillID, htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, - $myrow[0], + $myrow['component'], $UltimateParent); } //END WHILE LIST LOOP @@ -246,7 +251,7 @@ $Errors[$i] = 'EffectiveTo'; $i++; } - if($_POST['AutoIssue']==1 and isset($_POST['Component'])){ + if($_POST['AutoIssue']==1 AND isset($_POST['Component'])){ $sql = "SELECT controlled FROM stockmaster WHERE stockid='" . $_POST['Component'] . "'"; $CheckControlledResult = DB_query($sql,$db); $CheckControlledRow = DB_fetch_row($CheckControlledResult); Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractBOM.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -14,7 +14,7 @@ */ if (!isset($_SESSION['Contract'.$identifier])){ - header('Location:' . $rootpath . '/Contracts.php?' . SID); + header('Location:' . $rootpath . '/Contracts.php'); exit; } include('includes/header.inc'); @@ -22,11 +22,11 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['BackToHeader'])) { if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { - if ($_POST['Qty'.$ContractComponent->ComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponent->ComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractComponent($ContractComponent->ComponentID); } else { - $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=$_POST['Qty'.$ContractComponent->ComponentID]; + $_SESSION['Contract'.$identifier]->ContractBOM[$ContractComponent->ComponentID]->Quantity=filter_number_format($_POST['Qty'.$ContractComponent->ComponentID]); } } // end loop around the items on the contract BOM } // end if the contract is not currently committed to by the customer @@ -53,29 +53,29 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + and stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']){ @@ -84,55 +84,55 @@ if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } else { if ($_POST['StockCat']=='All'){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + ORDER BY stockmaster.stockid"; } else { $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - and stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.discontinued!=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid"; } } @@ -160,52 +160,48 @@ } } - - if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected */ -/* take the form entries and enter the data from the form into the PurchOrder class variable */ - foreach ($_POST as $ItemCode => $Quantity) { - if (mb_substr($ItemCode, 0, 3)=='Qty') { - $ItemCode=mb_substr($ItemCode, 3, mb_strlen($ItemCode)-3); - $AlreadyOnThisBOM = 0; - + for ($i=0;$i < $_POST['CountOfItems'];$i++) { + $AlreadyOnThisBOM = 0; + if (filter_number_format($_POST['Qty'.$i])>0){ if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ - + foreach ($_SESSION['Contract'.$identifier]->ContractBOM AS $Component) { - + /* do a loop round the items on the order to see that the item is not already on this order */ - if ($Component->StockID == $ItemCode) { + if ($Component->StockID == trim($_POST['StockID'.$i])) { $AlreadyOnThisBOM = 1; - prnMsg( _('The item') . ' ' . $ItemCode . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); + prnMsg( _('The item') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('is already in the bill of material for this contract. The system will not allow the same item on the contract more than once. However you can change the quantity required for the item.'),'error'); } } /* end of the foreach loop to look for preexisting items of the same code */ } - - if ($AlreadyOnThisBOM!=1 and $Quantity>0){ - + + if ($AlreadyOnThisBOM!=1){ + $sql = "SELECT stockmaster.description, stockmaster.stockid, stockmaster.units, stockmaster.decimalplaces, stockmaster.materialcost+labourcost+overheadcost AS unitcost FROM stockmaster - WHERE stockmaster.stockid = '". $ItemCode . "'"; - + WHERE stockmaster.stockid = '". trim($_POST['StockID'.$i]) . "'"; + $ErrMsg = _('The item details could not be retrieved'); $DbgMsg = _('The SQL used to retrieve the item details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - + if ($myrow = DB_fetch_array($result1)){ - - $_SESSION['Contract'.$identifier]->Add_To_ContractBOM ($ItemCode, + + $_SESSION['Contract'.$identifier]->Add_To_ContractBOM (trim($_POST['StockID'.$i]), $myrow['description'], - $DefaultWorkCentre, - $Quantity, /* Qty */ + '', + filter_number_format($_POST['Qty'.$i]), /* Qty */ $myrow['unitcost'], - $myrow['units']); + $myrow['units'], + $myrow['decimalplaces']); } else { - prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); + prnMsg (_('The item code') . ' ' . trim($_POST['StockID'.$i]) . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ echo '<br />' . $sql; } @@ -213,7 +209,7 @@ exit; } } /* end of if not already on the contract BOM */ - } + } /* the quantity of the item is > 0 */ } } /* end of if its a new item */ @@ -223,21 +219,25 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (count($_SESSION['Contract'.$identifier]->ContractBOM)>0){ - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Bill of Material') . '" alt="" /> '.$_SESSION['Contract'.$identifier]->CustomerName . ' + </p>'; - echo '<table cellpadding="2" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th></tr>'; + echo '<tr> + <th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th> + </tr>'; } echo '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('UOM') .'</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Sub-total') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('UOM') .'</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Sub-total') . '</th> </tr>'; $_SESSION['Contract'.$identifier]->total = 0; @@ -247,7 +247,7 @@ $LineTotal = $ContractComponent->Quantity * $ContractComponent->ItemCost; - $DisplayLineTotal = locale_number_format($LineTotal,2); + $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CompanyRecord']['decimalplaces']); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -259,17 +259,17 @@ echo '<td>' . $ContractComponent->StockID . '</td> <td>' . $ContractComponent->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> + <td><input type="text" class="number" name="Qty' . $ContractComponent->ComponentID . '" size="11" value="' . locale_number_format($ContractComponent->Quantity,$ContractComponent->DecimalPlaces) . '" /></td> <td>' . $ContractComponent->UOM . '</td> - <td class="number">' . $ContractComponent->ItemCost . '</td> + <td class="number">' . locale_number_format($ContractComponent->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the contract BOM?') . '\');">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } - $DisplayTotal = locale_number_format($TotalCost,2); + $DisplayTotal = locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']); echo '<tr> - <td colspan="6" class="number">' . _('Total Cost') . '</td> + <td colspan="5" class="number">' . _('Total Cost') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr> </table>'; @@ -281,11 +281,11 @@ if (!isset($_GET['Edit'])) { $sql="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype<>'L' - AND stocktype<>'D' - ORDER BY categorydescription"; + categorydescription + FROM stockcategory + WHERE stocktype<>'L' + AND stocktype<>'D' + ORDER BY categorydescription"; $ErrMsg = _('The supplier category details could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -316,21 +316,25 @@ } echo '</select></td> - <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> - <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr> - <tr><td></td> - <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . - ':</font></td> - <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + <td><font size="2">' . _('Enter text extracts in the description') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td> </tr> - <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> - </table><br /> - <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> - </div><br />'; + <tr> + <td></td> + <td><font size="3"> <b>' . _('OR') . ' </b></font><font size="2">' . _('Enter extract of the Stock Code') . ':</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="Search" value="' . _('Search Now') . '" /> + </div> + <br />'; - - $PartsDisplayed =0; } if (isset($SearchResult)) { @@ -338,17 +342,16 @@ echo '<table cellpadding="1" colspan="7">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Image') . '</th> + <th>' . _('Quantity') . '</th> </tr>'; echo $TableHeader; - $j = 1; $k=0; //row colour counter - + $i=0; while ($myrow=DB_fetch_array($SearchResult)) { if ($k==1){ @@ -366,31 +369,34 @@ } echo '<td>'.$myrow['stockid'].'</td> - <td>'.$myrow['description'].'</td> - <td>'.$myrow['units'] . '</td> - <td>'.$ImageSource.'</td> - <td><input class="number" type="text" size="6" value="0" name="Qty'.$myrow['stockid'].'" /></td> + <td>'.$myrow['description'].'</td> + <td>'.$myrow['units'] . '</td> + <td>'.$ImageSource.'</td> + <td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /> + <input type="hidden" name="StockID'.$i.'" value="' . $myrow['stockid'] . '" /> + </td> </tr>'; - - $PartsDisplayed++; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + $i++; + if ($i == $_SESSION['DisplayRecordsMax']){ break; } #end of page full new headings if } + #end of while loop - echo '</table>'; - if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ + echo '</table> + <input type="hidden" name="CountOfItems" value="'. $i . '" />'; + if ($i == $_SESSION['DisplayRecordsMax']){ - - prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . - _('Please restrict your search to only the parts required'),'info'); + prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } - echo '<br /><div class="centre"><input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /></div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /> + </div>'; }#end if SearchResults to show -echo '<hr />'; - -echo '</form>'; +echo '<hr /> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/ContractOtherReqts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -24,7 +24,7 @@ if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $ContractComponentID => $ContractRequirementItem) { - if ($_POST['Qty'.$ContractComponentID]==0){ + if (filter_number_format($_POST['Qty'.$ContractComponentID])==0){ //this is the same as deleting the line - so delete it $_SESSION['Contract'.$identifier]->Remove_ContractRequirement($ContractComponentID); } else { @@ -81,10 +81,12 @@ if (count($_SESSION['Contract'.$identifier]->ContractReqts)>0){ - echo '<table cellpadding="2" colspan="7" class="selection">'; + echo '<table class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo '<tr><th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th></tr>'; + echo '<tr> + <th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th> + </tr>'; } echo '<tr> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Contracts.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -276,7 +276,6 @@ $WorkCentre = $_SESSION['Contract'.$identifier]->LocCode; } /*The above is a bit of a hack to get a default workcentre for a location based on the users default location*/ - } $sql = "SELECT contractref, @@ -542,22 +541,22 @@ quotation) VALUES ( '". $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->DebtorNo) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->BranchCode) . "', - '". DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) ."', - '" . DB_escape_string(Date('Y-m-d H:i')) . "', - '" . DB_escape_string($CustomerDetailsRow['salestype']) . "', - '" . DB_escape_string($CustomerDetailsRow['defaultshipvia']) ."', - '". DB_escape_string($CustomerDetailsRow['brname']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress1']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress2']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress3']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress4']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress5']) . "', - '" . DB_escape_string($CustomerDetailsRow['braddress6']) . "', - '" . DB_escape_string($CustomerDetailsRow['phoneno']) . "', - '" . DB_escape_string($CustomerDetailsRow['email']) . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->LocCode) ."', + '" . $_SESSION['Contract'.$identifier]->DebtorNo . "', + '" . $_SESSION['Contract'.$identifier]->BranchCode . "', + '". $_SESSION['Contract'.$identifier]->CustomerRef ."', + '" . Date('Y-m-d H:i') . "', + '" . $CustomerDetailsRow['salestype'] . "', + '" . $CustomerDetailsRow['defaultshipvia'] ."', + '". $CustomerDetailsRow['brname'] . "', + '" . $CustomerDetailsRow['braddress1'] . "', + '" . $CustomerDetailsRow['braddress2'] . "', + '" . $CustomerDetailsRow['braddress3'] . "', + '" . $CustomerDetailsRow['braddress4'] . "', + '" . $CustomerDetailsRow['braddress5'] . "', + '" . $CustomerDetailsRow['braddress6'] . "', + '" . $CustomerDetailsRow['phoneno'] . "', + '" . $CustomerDetailsRow['email'] . "', + '" . $_SESSION['Contract'.$identifier]->LocCode ."', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "', '" . Date('Y-m-d') . "', '1' )"; @@ -573,10 +572,10 @@ itemdue) VALUES ('0', '" . $OrderNo . "', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "', + '" . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . ($ContractPrice * $_SESSION['Contract'.$identifier]->ExRate) . "', '1', - '" . DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) . "', + '" . $_SESSION['Contract'.$identifier]->CustomerRef . "', '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "')"; $DbgMsg = _('The SQL that failed was'); $ErrMsg = _('Unable to add the quotation line'); @@ -586,7 +585,7 @@ //make the status of the contract 1 - to indicate that it is now quoted $sql = "UPDATE contracts SET orderno='" . $OrderNo . "', status='" . 1 . "' - WHERE contractref='" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "'"; + WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; $ErrMsg = _('Unable to update the contract status and order number because'); $UpdContractResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $Result = DB_Txn_Commit($db); @@ -597,7 +596,6 @@ } //end of if making a quotation - if (isset($_POST['SearchCustomers'])){ if (($_POST['CustKeywords']!='') AND (($_POST['CustCode']!='') OR ($_POST['CustPhone']!=''))) { @@ -624,7 +622,7 @@ FROM custbranch LEFT JOIN debtorsmaster ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.brname " . LIKE . " '$SearchString' + WHERE custbranch.brname " . LIKE . " '" . $SearchString . "' AND custbranch.disabletrans=0 ORDER BY custbranch.debtorno, custbranch.branchcode"; @@ -832,8 +830,10 @@ /*Set up form for entry of contract header stuff */ - echo '<table class="selection">'; - echo '<tr><td>' . _('Contract Reference') . ':</td><td>'; + echo '<table class="selection"> + <tr> + <td>' . _('Contract Reference') . ':</td> + <td>'; if ($_SESSION['Contract'.$identifier]->Status==0) { /*Then the contract has not become an order yet and we can allow changes to the ContractRef */ echo '<input type="text" name="ContractRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />'; @@ -875,27 +875,36 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Contract Description') . ':</td> + <td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td> + </tr><tr> + <td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td> + <td><input type="file" id="Drawing" name="Drawing" /></td> + </tr>'; - echo '<tr><td>' . _('Contract Description'); - echo ':</td><td><textarea name="ContractDescription" style="width:100%" rows="5">' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td></tr>'; - - echo '<tr><td>'. _('Drawing File') . ' .jpg' . ' ' . _('format only') .':</td><td><input type="file" id="Drawing" name="Drawing" /></td></tr>'; - if (!isset($_SESSION['Contract'.$identifier]->RequiredDate)) { $_SESSION['Contract'.$identifier]->RequiredDate = DateAdd(date($_SESSION['DefaultDateFormat']),'m',1); } - echo '<tr><td>' . _('Required Date') . ':</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td></tr>'; + echo '<tr> + <td>' . _('Required Date') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract'.$identifier]->RequiredDate . '" /></td> + </tr>'; - echo '<tr><td>' . _('Customer Reference') . ':</td> - <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td></tr>'; + echo '<tr> + <td>' . _('Customer Reference') . ':</td> + <td><input type="text" name="CustomerRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->CustomerRef . '" /></td> + </tr>'; if (!isset($_SESSION['Contract'.$identifier]->Margin)){ $_SESSION['Contract'.$identifier]->Margin =50; } - echo '<tr><td>' . _('Gross Profit') . ' %:</td> - <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td></tr>'; + echo '<tr> + <td>' . _('Gross Profit') . ' %:</td> + <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td> + </tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ echo '<tr> @@ -906,7 +915,9 @@ echo '<input type="hidden" name="ExRate" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" />'; } - echo '<tr><td>' . _('Contract Status') . ':</td><td>'; + echo '<tr> + <td>' . _('Contract Status') . ':</td> + <td>'; $StatusText = array(); $StatusText[0] = _('Setup'); @@ -920,19 +931,29 @@ echo _('Order Placed'); } echo '<input type="hidden" name="Status" value="'.$_SESSION['Contract'.$identifier]->Status.'" />'; - echo '</td></tr>'; + echo '</td> + </tr>'; if ($_SESSION['Contract'.$identifier]->Status >=1) { - echo '<tr><td>' . _('Quotation Reference/Sales Order No') . ':</td> - <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td></tr>'; + echo '<tr> + <td>' . _('Quotation Reference/Sales Order No') . ':</td> + <td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td> + </tr>'; } if ($_SESSION['Contract'.$identifier]->Status!=2 and isset($_SESSION['Contract'.$identifier]->WO)) { - echo '<tr><td>' . _('Contract Work Order Ref') . ':</td> - <td>' . $_SESSION['Contract'.$identifier]->WO . '</td></tr>'; + echo '<tr> + <td>' . _('Contract Work Order Ref') . ':</td> + <td>' . $_SESSION['Contract'.$identifier]->WO . '</td> + </tr>'; } echo '</table><br />'; - echo '<table><tr><td> - <table class="selection"><tr><th colspan="6">' . _('Stock Items Required') . '</th></tr>'; + echo '<table> + <tr> + <td> + <table class="selection"> + <tr> + <th colspan="6">' . _('Stock Items Required') . '</th> + </tr>'; $ContractBOMCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractBOM)!=0){ echo '<tr><th>' . _('Item Code') . '</th> @@ -944,29 +965,30 @@ </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { - echo '<tr><td>' . $Component->StockID . '</td> + echo '<tr> + <td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> + <td class="number">' . locale_number_format($Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->UOM . '</td> - <td class="number">' . locale_number_format($Component->ItemCost,2) . '</td> - <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); } echo '<tr> <th colspan="5"><b>' . _('Total stock cost') . '</b></th> - <th class="number"><b>' . locale_number_format($ContractBOMCost,2) . '</b></th> + <th class="number"><b>' . locale_number_format($ContractBOMCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> </tr>'; } else { //there are no items set up against this contract echo '<tr> <td colspan="6"><i>' . _('None Entered') . '</i></td> - </tr>'; + </tr>'; } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> <table class="selection"> <tr> - <th colspan="4">' . _('Other Requirements') . '</th> + <th colspan="4">' . _('Other Requirements') . '</th> </tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ @@ -979,28 +1001,35 @@ foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr> <td>' . $Requirement->Requirement . '</td> - <td class="number">' . $Requirement->Quantity . '</td> - <td class="number">' . $Requirement->CostPerUnit . '</td> - <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> + <td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td> + <td class="number">' . locale_number_format($Requirement->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $ContractReqtsCost += ($Requirement->CostPerUnit * $Requirement->Quantity); } - echo '<tr><th colspan="3"><b>' . _('Total other costs') . '</b></th><th class="number"><b>' . locale_number_format($ContractReqtsCost,2) . '</b></th></tr>'; + echo '<tr> + <th colspan="3"><b>' . _('Total other costs') . '</b></th> + <th class="number"><b>' . locale_number_format($ContractReqtsCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> + </tr>'; } else { //there are no items set up against this contract - echo '<tr><td colspan="4"><i>' . _('None Entered') . '</i></td></tr>'; + echo '<tr> + <td colspan="4"><i>' . _('None Entered') . '</i></td> + </tr>'; } echo '</table></td></tr></table>'; echo '<br />'; echo'<table class="selection"> - <tr><th>' . _('Total Contract Cost') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> - <th>' . _('Contract Price') . '</th> - <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <tr> + <th>' . _('Total Contract Cost') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> + <th>' . _('Contract Price') . '</th> + <th class="number">' . locale_number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),$_SESSION['CompanyRecord']['decimalplaces']) . '</th> </tr> - </table>'; + </table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> + echo '<div class="centre"> + <input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '" /> <input type="submit" name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'" />'; if($_SESSION['Contract'.$identifier]->Status==0){ // not yet quoted echo '<input type="submit" name="CommitContract" value="' . _('Commit Changes') .'" />'; @@ -1008,12 +1037,17 @@ echo '<input type="submit" name="CommitContract" value="' . _('Update Quotation') .'" />'; } if($_SESSION['Contract'.$identifier]->Status==0){ //not yet quoted - echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /></div>'; + echo ' <input type="submit" name="CreateQuotation" value="' . _('Create Quotation') .'" /> + </div>'; } else { echo '</div>'; } if ($_SESSION['Contract'.$identifier]->Status!=2) { - echo '<p><div class="centre"><input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /></div></p>'; + echo '<p> + <div class="centre"> + <input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '" /> + </div> + </p>'; } echo '</form>'; } /*end of if customer selected and entering contract header*/ Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CreditStatus.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -17,7 +17,9 @@ } $Errors = array(); $InputError = 0; -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> <br />'; if (isset($_POST['submit'])) { @@ -141,14 +143,14 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons'; + $sql = "SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons"; $result = DB_query($sql, $db); - echo '<table class=selection>'; - echo '<tr> - <th>'. _('Status Code') .'</th> - <th>'. _('Description') .'</th> - <th>'. _('Disallow Invoices') .'</th>'; + echo '<table class="selection"> + <tr> + <th>'. _('Status Code') .'</th> + <th>'. _('Description') .'</th> + <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter while ($myrow=DB_fetch_array($result)) { @@ -186,7 +188,9 @@ } //end of ifs and buts! if (isset($SelectedReason)) { - echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a> + </div>'; } if (!isset($_GET['delete'])) { @@ -210,8 +214,8 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; - echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '" />'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '" />'; echo '<table class="selection"> <tr> <td>'. _('Status Code') .':</td> @@ -226,7 +230,7 @@ <table class="selection"> <tr> <td>'. _('Status Code') .':</td> - <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="1" type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size="3" maxlength="2" /></td> </tr>'; } @@ -241,13 +245,17 @@ <tr> <td>'. _('Disallow Invoices') . '</td>'; if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']==1) { - echo '<td><input tabindex=3 type="checkbox" checked name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex="3" type="checkbox" checked name="DisallowInvoices" /></td> + </tr>'; } else { - echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices"></td></tr>'; + echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices" /></td> + </tr>'; } echo '</table> <br /> - <div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div> + <div class="centre"> + <input tabindex="4" type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> </form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/Currencies.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -40,7 +40,9 @@ $i=1; $sql="SELECT count(currabrev) - FROM currencies WHERE currabrev='".$_POST['Abbreviation']."'"; + FROM currencies + WHERE currabrev='".$_POST['Abbreviation']."'"; + $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -56,23 +58,23 @@ $Errors[$i] = 'Abbreviation'; $i++; } - if (!is_numeric($_POST['ExchangeRate'])){ + if (!is_numeric(filter_number_format($_POST['ExchangeRate']))){ $InputError = 1; prnMsg(_('The exchange rate must be numeric'),'error'); $Errors[$i] = 'ExchangeRate'; $i++; } - if (!is_numeric($_POST['DecimalPlaces'])){ + if (!is_numeric(filter_number_format($_POST['DecimalPlaces']))){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be numeric'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - }elseif ($_POST['DecimalPlaces']<=0){ + }elseif (filter_number_format($_POST['DecimalPlaces'])<=0){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency must be positive or zero'),'error'); $Errors[$i] = 'DecimalPlaces'; $i++; - } elseif ($_POST['DecimalPlaces']>2){ + } elseif (filter_number_format($_POST['DecimalPlaces'])>2){ $InputError = 1; prnMsg(_('The number of decimal places to display for amounts in this currency is expected to be 2 or less'),'error'); $Errors[$i] = 'DecimalPlaces'; @@ -113,8 +115,8 @@ $sql = "UPDATE currencies SET currency='" . $_POST['CurrencyName'] . "', country='". $_POST['Country']. "', hundredsname='" . $_POST['HundredsName'] . "', - decimalplaces='" . $_POST['DecimalPlaces'] . "', - rate='" .$_POST['ExchangeRate'] . "' + decimalplaces='" . filter_number_format($_POST['DecimalPlaces']) . "', + rate='" .filter_number_format($_POST['ExchangeRate']) . "' WHERE currabrev = '" . $SelectedCurrency . "'"; $msg = _('The currency definition record has been updated'); @@ -131,8 +133,8 @@ '" . $_POST['Abbreviation'] . "', '" . $_POST['Country'] . "', '" . $_POST['HundredsName'] . "', - '" . $_POST['DecimalPlaces'] . "', - '" . $_POST['ExchangeRate'] . "')"; + '" . filter_number_format($_POST['DecimalPlaces']) . "', + '" . filter_number_format($_POST['ExchangeRate']) . "')"; $msg = _('The currency definition record has been added'); } @@ -208,7 +210,8 @@ $result = DB_query($sql, $db); echo '<table class="selection">'; - echo '<tr><td></td> + echo '<tr> + <td></td> <th>' . _('ISO4217 Code') . '</th> <th>' . _('Currency Name') . '</th> <th>' . _('Country') . '</th> @@ -216,7 +219,7 @@ <th>' . _('Decimal Places') . '</th> <th>' . _('Exchange Rate') . '</th> <th>' . _('Ex Rate - ECB') .'</th> - </tr>'; + </tr>'; $k=0; //row colour counter /*Get published currency rates from Eurpoean Central Bank */ @@ -249,9 +252,9 @@ <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 class="number">%s</td> <td><a href="%s&SelectedCurrency=%s">%s</a></td> <td><a href="%s&SelectedCurrency=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this currency?') . '\');">%s</a></td> <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> @@ -261,9 +264,9 @@ $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], - locale_number_format($myrow['rate'],5), - locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), + locale_number_format($myrow['decimalplaces'],0), + locale_number_format($myrow['rate'],6), + locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),6), htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Edit'), @@ -280,14 +283,14 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td colspan=4>%s</td> + <td colspan="4">%s</td> </tr>', $ImageFile, $myrow['currabrev'], $myrow['currency'], $myrow['country'], $myrow['hundredsname'], - $myrow['decimalplaces'], + locale_number_format($myrow['decimalplaces'],0), 1, _('Functional Currency')); } @@ -312,11 +315,11 @@ //editing an existing payment terms $sql = "SELECT currency, - currabrev, - country, - hundredsname, - decimalplaces, - rate + currabrev, + country, + hundredsname, + decimalplaces, + rate FROM currencies WHERE currabrev='" . $SelectedCurrency . "'"; @@ -329,71 +332,76 @@ $_POST['CurrencyName'] = $myrow['currency']; $_POST['Country'] = $myrow['country']; $_POST['HundredsName'] = $myrow['hundredsname']; - $_POST['ExchangeRate'] = $myrow['rate']; - $_POST['DecimalPlaces'] = $myrow['decimalplaces']; + $_POST['ExchangeRate'] = locale_number_format($myrow['rate'],6); + $_POST['DecimalPlaces'] = locale_number_format($myrow['decimalplaces'],0); - echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; - echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; + echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '" />'; + echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" />'; echo '<table class="selection"> <tr> - <td>' . _('ISO 4217 Currency Code').':</td> - <td>' . $_POST['Abbreviation'] . '</td> + <td>' . _('ISO 4217 Currency Code').':</td> + <td>' . $_POST['Abbreviation'] . '</td> </tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} echo '<table class="selection"> <tr> - <td>' ._('Currency Abbreviation') . ':</td> - <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size=4 maxlength=3></td></tr>'; + <td>' ._('Currency Abbreviation') . ':</td> + <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size="4" maxlength="3" /></td> + </tr>'; } - echo '<tr><td>'._('Currency Name').':</td>'; - echo '<td>'; + echo '<tr> + <td>'._('Currency Name').':</td> + <td>'; if (!isset($_POST['CurrencyName'])) { $_POST['CurrencyName']=''; } - echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 value="' . $_POST['CurrencyName'] . '">'; - echo '</td></tr>'; - echo '<tr><td>'._('Country').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size="20" maxlength="20" value="' . $_POST['CurrencyName'] . '" /></td> + </tr> + <tr> + <td>'._('Country').':</td> + <td>'; if (!isset($_POST['Country'])) { $_POST['Country']=''; } - echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 value="' . $_POST['Country'] . '">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Hundredths Name').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size="30" maxlength="50" value="' . $_POST['Country'] . '" /></td> + </tr> + <tr> + <td>'._('Hundredths Name').':</td> + <td>'; if (!isset($_POST['HundredsName'])) { $_POST['HundredsName']=''; } - echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Decimal Places to Display').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size="10" maxlength="15" value="'. $_POST['HundredsName'].'" /></td> + </tr> + <tr> + <td>'._('Decimal Places to Display').':</td> + <td>'; if (!isset($_POST['DecimalPlaces'])) { $_POST['DecimalPlaces']=''; } - echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'">'; - echo '</td></tr>'; - - echo '<tr><td>'._('Exchange Rate').':</td>'; - echo '<td>'; + echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'" /></td> + </tr> + <tr> + <td>'._('Exchange Rate').':</td> + <td>'; if (!isset($_POST['ExchangeRate'])) { $_POST['ExchangeRate']=''; } - echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 value='. $_POST['ExchangeRate'].'>'; - echo '</td></tr>'; - echo '</table>'; + echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class="number" name="ExchangeRate" size="10" maxlength="9" value="'. $_POST['ExchangeRate'].'"></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/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-10-29 09:51:53 UTC (rev 4736) +++ trunk/CustLoginSetup.php 2011-10-30 05:50:51 UTC (rev 4737) @@ -134,22 +134,27 @@ $_POST['Email']=''; } -echo '<tr><td>' . _('Password') . ':</td> - <td><input type="password" name="Password" size=22 maxlength=20 value="' . $_POST['Password'] . '"></tr>'; -echo '<tr><td>' . _('Full Name') . ':</td> - <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size=36 maxlength=35></td></tr>'; -echo '<tr><td>' . _('Telephone No') . ':</td> - <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; -echo '<tr><td>' . _('Email Address') .':</td> - <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; -echo '<input type="hidden" name="Access" value="1">'; +echo '<tr> + <td>' . _('Password') . ':</td> + <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /> + </tr> + <tr> + <td>' . _('Full Name') . ':</td> + <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size="36" maxlength="35" /></td> + </tr> + <tr> + <td>' . _('Telephone No') . ':</td> + <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size="32" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Email Address') .':</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size="32" maxlength="55" /></td> + </tr> + <input type="hidden" name="Access" value="1" /> + <tr> + <td>' . _('Branch Code') . ':</td> + <td><select name="BranchCode">'; - -//Customer is fixed by selection of customer - -echo '<tr><td>' . _('Branch Code') . ':</td> - <td><select name="BranchCode">'; - $sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql,$db); @@ -163,7 +168,7 @@ if (isset($_POST['BranchCode']) and $myrow['branchcode'] == $_POST['BranchCode']){ echo '<option selected value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } else { - echo '<option Value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; + echo '<option value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } } @@ -211,15 +216,14 @@ echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Theme') . ':</td> + <td><select name="Theme">'; -echo '<tr> - <td>' . _('Theme') . ':</td> - <td><select name="Theme">'; - $ThemeDirectory = dir('css/'); - while (false != ($ThemeName = $ThemeDirectory->read())){ if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ @@ -234,13 +238,12 @@ } } -echo '</select></td></tr>'; +echo '</select></td> + </tr> + <tr> + <td>' . _('Language') . ':</td> + <td><select name="UserLanguage">'; - -echo '<tr> - <td>' . _('Language') . ':</td> - <td><select name="UserLanguage">'; - foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; @@ -250,11 +253,13 @@ echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; } } -echo '</select></td></tr>'; - - -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> +echo '</select></t... [truncated message content] |
From: <dai...@us...> - 2011-10-29 09:52:00
|
Revision: 4736 http://web-erp.svn.sourceforge.net/web-erp/?rev=4736&view=rev Author: daintree Date: 2011-10-29 09:51:53 +0000 (Sat, 29 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/PO_PDFPurchOrder.php trunk/doc/Change.log trunk/doc/Manual/ManualContributors.html trunk/includes/Contract_Readin.php trunk/includes/DefineContractClass.php Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/ContractCosting.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -29,6 +29,7 @@ $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, SUM(stockmoves.qty) AS quantity, SUM(stockmoves.qty*stockmoves.standardcost) AS totalcost FROM stockmoves INNER JOIN stockmaster @@ -37,7 +38,8 @@ AND stockmoves.reference='" . $_SESSION['Contract'.$identifier]->WO . "' GROUP BY stockmoves.stockid, stockmaster.description, - stockmaster.units"; + stockmaster.units, + stockmaster.decimalplaces"; $ErrMsg = _('Could not get the inventory issues for this contract because'); $InventoryIssuesResult = DB_query($sql,$db,$ErrMsg); $InventoryIssues = array(); @@ -47,7 +49,9 @@ $InventoryIssues[$InventoryIssuesRow['stockid']]->Quantity = $InventoryIssuesRow['quantity']; $InventoryIssues[$InventoryIssuesRow['stockid']]->TotalCost = $InventoryIssuesRow['totalcost']; $InventoryIssues[$InventoryIssuesRow['stockid']]->Units = $InventoryIssuesRow['units']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->DecimalPlaces = $InventoryIssuesRow['decimalplaces']; $InventoryIssues[$InventoryIssuesRow['stockid']]->Matched = 0; + } echo '<p class="page_title_text"> @@ -92,7 +96,7 @@ echo '<tr> <td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> + <td class="number">' . locale_number_format($Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->UOM . '</td> <td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; @@ -102,7 +106,7 @@ if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> - <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> + <td class="number">' . locale_number_format(-$InventoryIssues[$Component->StockID]->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> <td class="number">' . locale_number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . locale_number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -120,7 +124,7 @@ <td colspan="6"></td> <td>' . $Component->StockID . '</td> <td>' . $Component->Description . '</td> - <td class="number">' . -$Component->Quantity . '</td> + <td class="number">' . locale_number_format(-$Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->Units . '</td> <td class="number">' . locale_number_format($Component->TotalCost/$Component->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -152,13 +156,13 @@ foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr><td>' . $Requirement->Requirement . '</td> - <td class="number">' . $Requirement->Quantity . '</td> - <td class="number">' . $Requirement->CostPerUnit . '</td> + <td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td> + <td class="number">' . locale_number_format($Requirement->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $OtherReqtsBudget += ($Requirement->CostPerUnit * $Requirement->Quantity); } -echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsBudget,2) . '</b></th></tr> +echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th></tr> </table></td>'; //Now other requirements actual in a sub table @@ -428,10 +432,13 @@ if ($_SESSION['Contract'.$identifier]->Status ==2){//the contract is an order being processed now - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<br /><div class="centre"><input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /></div>'; - echo '</form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /> + </div> + </form>'; } include('includes/footer.inc'); Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/ContractOtherReqts.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -88,10 +88,10 @@ } echo '<tr> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Sub-total') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Sub-total') . '</th> </tr>'; $_SESSION['Contract'.$identifier]->total = 0; @@ -111,17 +111,25 @@ } echo '<td><textarea name="Requirement' . $ContractReqtID . '" cols="30" rows="3">' . $ContractComponent->Requirement . '</textarea></td> - <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> - <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '" /></td> + <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . locale_number_format($ContractComponent->Quantity,'Variable') . '" /></td> + <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . locale_number_format($ContractComponent->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractReqtID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this contract requirement?') . '\');">' . _('Delete') . '</a></td> + </tr>'; $TotalCost += $LineTotal; } - $DisplayTotal = locale_number_format($TotalCost,2); - echo '<tr><td colspan="4" class="number">' . _('Total Other Requirements Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '" />'; - echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /></div>'; + $DisplayTotal = locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']); + echo '<tr> + <td colspan="4" class="number">' . _('Total Other Requirements Cost') . '</td> + <td class="number"><b>' . $DisplayTotal . '</b></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '" /> + <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /> + </div>'; } /*Only display the contract other requirements lines if there are any !! */ @@ -133,17 +141,30 @@ $_POST['CostPerUnit']=0; } echo '<table class="selection"> - <tr><th colspan="2">' . _('Enter New Requirements') . '</th></tr> - <tr><td>' . _('Requirement Description') . '</td> - <td><textarea name="RequirementDescription" cols="30" rows="3">' . $_POST['RequirementDescription'] . '</textarea></td></tr>'; -echo '<tr><td>' . _('Quantity Required') . ':</td> - <td><input type="text" class="number" name="Quantity" size="10" maxlength="10" value="' . $_POST['Quantity'] . '" /></td></tr>'; -echo '<tr><td>' . _('Cost Per Unit') . ':</td> - <td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td></tr>'; -echo '</table>'; - -echo '<br /><div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /></div>'; - -echo '</form>'; + <tr> + <th colspan="2">' . _('Enter New Requirements') . '</th> + </tr> + <tr> + <td>' . _('Requirement Description') . '</td> + <td><textarea name="RequirementDescription" cols="30" rows="3">' . $_POST['RequirementDescription'] . '</textarea></td> + </tr> + <tr> + <td>' . _('Quantity Required') . ':</td> + <td><input type="text" class="number" name="Quantity" size="10" maxlength="10" value="' . $_POST['Quantity'] . '" /></td> + </tr> + <tr> + <td>' . _('Cost Per Unit') . ':</td> + <td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td> + </tr> + + </table> + + <br /> + <div class="centre"> + <input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /> + </div> + + </form>'; + include('includes/footer.inc'); ?> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/Contracts.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -65,9 +65,9 @@ $_SESSION['Contract'.$identifier]->CategoryID = $_POST['CategoryID']; $_SESSION['Contract'.$identifier]->LocCode = $_POST['LocCode']; $_SESSION['Contract'.$identifier]->RequiredDate = $_POST['RequiredDate']; - $_SESSION['Contract'.$identifier]->Margin = $_POST['Margin']; + $_SESSION['Contract'.$identifier]->Margin = filter_number_format($_POST['Margin']); $_SESSION['Contract'.$identifier]->CustomerRef = $_POST['CustomerRef']; - $_SESSION['Contract'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['Contract'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); /*User hit the button to enter line items - @@ -254,10 +254,10 @@ $_SESSION['Contract'.$identifier]->CategoryID = $_POST['CategoryID']; $_SESSION['Contract'.$identifier]->LocCode = $_POST['LocCode']; $_SESSION['Contract'.$identifier]->RequiredDate = $_POST['RequiredDate']; - $_SESSION['Contract'.$identifier]->Margin = $_POST['Margin']; + $_SESSION['Contract'.$identifier]->Margin = filter_number_format($_POST['Margin']); $_SESSION['Contract'.$identifier]->Status = $_POST['Status']; $_SESSION['Contract'.$identifier]->CustomerRef = $_POST['CustomerRef']; - $_SESSION['Contract'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['Contract'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); /*Get the first work centre for the users location - until we set this up properly */ $result = DB_query("SELECT code FROM workcentres WHERE location='" . $_SESSION['Contract'.$identifier]->LocCode ."'",$db); @@ -305,9 +305,9 @@ $sql = "UPDATE contracts SET categoryid = '" . $_POST['CategoryID'] ."', requireddate = '" . FormatDateForSQL($_POST['RequiredDate']) . "', loccode='" . $_POST['LocCode'] . "', - margin = '" . $_POST['Margin'] . "', + margin = '" . filter_number_format($_POST['Margin']) . "', customerref = '" . $_POST['CustomerRef'] . "', - exrate = '" . $_POST['ExRate'] . "' + exrate = '" . filter_number_format($_POST['ExRate']) . "' WHERE contractref ='" . $_POST['ContractRef'] . "'"; $ErrMsg = _('Cannot update the contract because'); $result = DB_query($sql,$db,$ErrMsg); @@ -404,9 +404,9 @@ '" . $_POST['CategoryID'] . "', '" . $_POST['LocCode'] . "', '" . FormatDateForSQL($_POST['RequiredDate']) . "', - '" . $_POST['Margin'] . "', + '" . filter_number_format($_POST['Margin']) . "', '" . $_POST['CustomerRef'] . "', - '". $_POST['ExRate'] ."')"; + '". filter_number_format($_POST['ExRate']) ."')"; $ErrMsg = _('The new contract could not be added because'); $result = DB_query($sql,$db,$ErrMsg); @@ -895,13 +895,15 @@ $_SESSION['Contract'.$identifier]->Margin =50; } echo '<tr><td>' . _('Gross Profit') . ' %:</td> - <td><input type="text" name="Margin" size="4" maxlength="4" value="' . $_SESSION['Contract'.$identifier]->Margin . '" /></td></tr>'; + <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td></tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ - echo '<tr><td>' . $_SESSION['Contract'.$identifier]->CurrCode . ' ' . _('Exchange Rate') . ':</td> - <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" /></td></tr>'; + echo '<tr> + <td>' . $_SESSION['Contract'.$identifier]->CurrCode . ' ' . _('Exchange Rate') . ':</td> + <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" /></td> + </tr>'; } else { - echo '<input type="hidden" name="ExRate" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" />'; + echo '<input type="hidden" name="ExRate" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" />'; } echo '<tr><td>' . _('Contract Status') . ':</td><td>'; Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/PO_PDFPurchOrder.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -127,7 +127,7 @@ if ($POHeader['status'] != 'Authorised' AND $POHeader['status'] != 'Printed') { include('includes/header.inc'); - prnMsg( _('Purchase orders can only be printed once they have been authorised') . '. ' . _('This order is currently at a status of') . ' ' . _($OrderStatus),'warn'); + prnMsg( _('Purchase orders can only be printed once they have been authorised') . '. ' . _('This order is currently at a status of') . ' ' . _($POHeader['status']),'warn'); include('includes/footer.inc'); exit; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/doc/Change.log 2011-10-29 09:51:53 UTC (rev 4736) @@ -9,7 +9,7 @@ 22/9/11 Exson: fixed the bug in GLAccountReport.php for typename from the right table (systypes) in SQL and change locale_number_format for multinational. 17/9/11 Phil: Added WindowsLocale element to LanguagesArray.php and modified UserSettings.php and WWW_Users.php to use the new array definition. Also modified includes/LanguageSetup.php to use the windows locale string in the LanguagesArray as required for proper setting of the locale under windows. 17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) -12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale +12/9/11-31/10/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. 5/9/11 Phil: GLTransInquiry posted was not retrieved correctly - now fixed 4/9/11 Phil: Removed the stock code from form entities in SelectOrderItems.php and PO_Items.php to prevent issues with some characters in stock codes as suggested by Tim Modified: trunk/doc/Manual/ManualContributors.html =================================================================== --- trunk/doc/Manual/ManualContributors.html 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/doc/Manual/ManualContributors.html 2011-10-29 09:51:53 UTC (rev 4736) @@ -41,6 +41,8 @@ <br /><br /> Richard Heyes (html.mime.mail) <br /><br /> +High-Tech Bridge SA Security Research Lab +<br /><br /> Hindra Joshua <br /><br /> Alan Jones @@ -57,6 +59,8 @@ <br /><br /> Ditesh Kumar <br /><br /> +Felix Lim +<br /><br /> David Luo <br /><br /> Wayne McDougall @@ -103,6 +107,8 @@ <br /><br /> Jurgen Schopenhouer <br /><br /> +Fred Schuettler (aguapop - theme) +<br /><br /> Danilo Segan (php-gettext) <br /><br /> Gjergj Sheldija @@ -111,6 +117,8 @@ <br /><br /> Vitaliy Shevkunov <br /><br /> +Marcos Skambraks +<br /><br /> Jake Stride <br /><br /> Matt Taylor Modified: trunk/includes/Contract_Readin.php =================================================================== --- trunk/includes/Contract_Readin.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/includes/Contract_Readin.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -3,28 +3,28 @@ /*Contract_Readin.php is used by the modify existing Contract in Contracts.php and also by ContractCosting.php */ $ContractHeaderSQL = "SELECT contractdescription, - contracts.debtorno, - contracts.branchcode, - contracts.loccode, - status, - categoryid, - orderno, - margin, - wo, - requireddate, - drawing, - exrate, - debtorsmaster.name, - custbranch.brname, - debtorsmaster.currcode - FROM contracts INNER JOIN debtorsmaster - ON contracts.debtorno=debtorsmaster.debtorno - INNER JOIN currencies - ON debtorsmaster.currcode=currencies.currabrev - INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - AND contracts.branchcode=custbranch.branchcode - WHERE contractref= '" . $ContractRef . "'"; + contracts.debtorno, + contracts.branchcode, + contracts.loccode, + status, + categoryid, + orderno, + margin, + wo, + requireddate, + drawing, + exrate, + debtorsmaster.name, + custbranch.brname, + debtorsmaster.currcode + FROM contracts INNER JOIN debtorsmaster + ON contracts.debtorno=debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + AND contracts.branchcode=custbranch.branchcode + WHERE contractref= '" . $ContractRef . "'"; $ErrMsg = _('The contract cannot be retrieved because'); $DbgMsg = _('The SQL statement that was used and failed was'); @@ -55,14 +55,15 @@ /*now populate the contract BOM array with the items required for the contract */ $ContractBOMsql = "SELECT contractbom.stockid, - stockmaster.description, - contractbom.workcentreadded, - contractbom.quantity, - stockmaster.units, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost - FROM contractbom INNER JOIN stockmaster - ON contractbom.stockid=stockmaster.stockid - WHERE contractref ='" . $ContractRef . "'"; + stockmaster.description, + contractbom.workcentreadded, + contractbom.quantity, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost + FROM contractbom INNER JOIN stockmaster + ON contractbom.stockid=stockmaster.stockid + WHERE contractref ='" . $ContractRef . "'"; $ErrMsg = _('The bill of material cannot be retrieved because'); $DbgMsg = _('The SQL statement that was used to retrieve the contract bill of material was'); @@ -75,17 +76,18 @@ $myrow['workcentreadded'], $myrow['quantity'], $myrow['cost'], - $myrow['units']); + $myrow['units'], + $myrow['decimalplaces']); } /* add contract bill of materials BOM lines*/ } //end is there was a contract BOM to add //Now add the contract requirments $ContractReqtsSQL = "SELECT requirement, - quantity, - costperunit, - contractreqid - FROM contractreqts - WHERE contractref ='" . $ContractRef . "' - ORDER BY contractreqid"; + quantity, + costperunit, + contractreqid + FROM contractreqts + WHERE contractref ='" . $ContractRef . "' + ORDER BY contractreqid"; $ErrMsg = _('The other contract requirementscannot be retrieved because'); $DbgMsg = _('The SQL statement that was used to retrieve the other contract requirments was'); Modified: trunk/includes/DefineContractClass.php =================================================================== --- trunk/includes/DefineContractClass.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/includes/DefineContractClass.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -38,20 +38,22 @@ } function Add_To_ContractBOM($StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM){ + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces){ if (isset($StockID) AND $Quantity!=0){ $this->ContractBOM[$this->BOMComponentCounter] = new ContractComponent($this->BOMComponentCounter, - $StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM); + $StockID, + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces); $this->BOMComponentCounter++; Return 1; } @@ -70,7 +72,11 @@ /*Requirments Methods */ -function Add_To_ContractRequirements($Requirement, $Quantity, $CostPerUnit,$ContractReqID=0){ +function Add_To_ContractRequirements($Requirement, + $Quantity, + $CostPerUnit, + $ContractReqID=0){ + if (isset($Requirement) AND $Quantity!=0 AND $CostPerUnit!=0){ $this->ContractReqts[$this->RequirementsCounter] = new ContractRequirement($Requirement, $Quantity, $CostPerUnit,$ContractReqID); $this->RequirementsCounter++; @@ -95,15 +101,17 @@ var $Quantity; var $ItemCost; var $UOM; + var $DecimalPlaces; function ContractComponent ($ComponentID, - $StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM){ - + $StockID, + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces=0){ + /* Constructor function to add a new Contract Component object with passed params */ $this->ComponentID = $ComponentID; $this->StockID = $StockID; @@ -112,6 +120,7 @@ $this->Quantity = $Quantity; $this->ItemCost= $ItemCost; $this->UOM = $UOM; + $this->DecimalPlaces = $DecimalPlaces; } } @@ -123,9 +132,9 @@ var $CostPerUnit; function ContractRequirement ($Requirement, - $Quantity, - $CostPerUnit, - $ContractReqID=0){ + $Quantity, + $CostPerUnit, + $ContractReqID=0){ /* Constructor function to add a new Contract Component object with passed params */ $this->Requirement = $Requirement; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-29 09:52:00
|
Revision: 4736 http://web-erp.svn.sourceforge.net/web-erp/?rev=4736&view=rev Author: daintree Date: 2011-10-29 09:51:53 +0000 (Sat, 29 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/PO_PDFPurchOrder.php trunk/doc/Change.log trunk/doc/Manual/ManualContributors.html trunk/includes/Contract_Readin.php trunk/includes/DefineContractClass.php Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/ContractCosting.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -29,6 +29,7 @@ $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmaster.units, + stockmaster.decimalplaces, SUM(stockmoves.qty) AS quantity, SUM(stockmoves.qty*stockmoves.standardcost) AS totalcost FROM stockmoves INNER JOIN stockmaster @@ -37,7 +38,8 @@ AND stockmoves.reference='" . $_SESSION['Contract'.$identifier]->WO . "' GROUP BY stockmoves.stockid, stockmaster.description, - stockmaster.units"; + stockmaster.units, + stockmaster.decimalplaces"; $ErrMsg = _('Could not get the inventory issues for this contract because'); $InventoryIssuesResult = DB_query($sql,$db,$ErrMsg); $InventoryIssues = array(); @@ -47,7 +49,9 @@ $InventoryIssues[$InventoryIssuesRow['stockid']]->Quantity = $InventoryIssuesRow['quantity']; $InventoryIssues[$InventoryIssuesRow['stockid']]->TotalCost = $InventoryIssuesRow['totalcost']; $InventoryIssues[$InventoryIssuesRow['stockid']]->Units = $InventoryIssuesRow['units']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->DecimalPlaces = $InventoryIssuesRow['decimalplaces']; $InventoryIssues[$InventoryIssuesRow['stockid']]->Matched = 0; + } echo '<p class="page_title_text"> @@ -92,7 +96,7 @@ echo '<tr> <td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> + <td class="number">' . locale_number_format($Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->UOM . '</td> <td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; @@ -102,7 +106,7 @@ if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> - <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> + <td class="number">' . locale_number_format(-$InventoryIssues[$Component->StockID]->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> <td class="number">' . locale_number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . locale_number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -120,7 +124,7 @@ <td colspan="6"></td> <td>' . $Component->StockID . '</td> <td>' . $Component->Description . '</td> - <td class="number">' . -$Component->Quantity . '</td> + <td class="number">' . locale_number_format(-$Component->Quantity,$Component->DecimalPlaces) . '</td> <td>' . $Component->Units . '</td> <td class="number">' . locale_number_format($Component->TotalCost/$Component->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> @@ -152,13 +156,13 @@ foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr><td>' . $Requirement->Requirement . '</td> - <td class="number">' . $Requirement->Quantity . '</td> - <td class="number">' . $Requirement->CostPerUnit . '</td> + <td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td> + <td class="number">' . locale_number_format($Requirement->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($Requirement->CostPerUnit * $Requirement->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $OtherReqtsBudget += ($Requirement->CostPerUnit * $Requirement->Quantity); } -echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsBudget,2) . '</b></th></tr> +echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th></tr> </table></td>'; //Now other requirements actual in a sub table @@ -428,10 +432,13 @@ if ($_SESSION['Contract'.$identifier]->Status ==2){//the contract is an order being processed now - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<br /><div class="centre"><input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /></div>'; - echo '</form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /> + </div> + </form>'; } include('includes/footer.inc'); Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/ContractOtherReqts.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -88,10 +88,10 @@ } echo '<tr> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Sub-total') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Sub-total') . '</th> </tr>'; $_SESSION['Contract'.$identifier]->total = 0; @@ -111,17 +111,25 @@ } echo '<td><textarea name="Requirement' . $ContractReqtID . '" cols="30" rows="3">' . $ContractComponent->Requirement . '</textarea></td> - <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> - <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '" /></td> + <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . locale_number_format($ContractComponent->Quantity,'Variable') . '" /></td> + <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . locale_number_format($ContractComponent->CostPerUnit,$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractReqtID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this contract requirement?') . '\');">' . _('Delete') . '</a></td> + </tr>'; $TotalCost += $LineTotal; } - $DisplayTotal = locale_number_format($TotalCost,2); - echo '<tr><td colspan="4" class="number">' . _('Total Other Requirements Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '" />'; - echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /></div>'; + $DisplayTotal = locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']); + echo '<tr> + <td colspan="4" class="number">' . _('Total Other Requirements Cost') . '</td> + <td class="number"><b>' . $DisplayTotal . '</b></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="UpdateLines" value="' . _('Update Other Requirements Lines') . '" /> + <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /> + </div>'; } /*Only display the contract other requirements lines if there are any !! */ @@ -133,17 +141,30 @@ $_POST['CostPerUnit']=0; } echo '<table class="selection"> - <tr><th colspan="2">' . _('Enter New Requirements') . '</th></tr> - <tr><td>' . _('Requirement Description') . '</td> - <td><textarea name="RequirementDescription" cols="30" rows="3">' . $_POST['RequirementDescription'] . '</textarea></td></tr>'; -echo '<tr><td>' . _('Quantity Required') . ':</td> - <td><input type="text" class="number" name="Quantity" size="10" maxlength="10" value="' . $_POST['Quantity'] . '" /></td></tr>'; -echo '<tr><td>' . _('Cost Per Unit') . ':</td> - <td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td></tr>'; -echo '</table>'; - -echo '<br /><div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /></div>'; - -echo '</form>'; + <tr> + <th colspan="2">' . _('Enter New Requirements') . '</th> + </tr> + <tr> + <td>' . _('Requirement Description') . '</td> + <td><textarea name="RequirementDescription" cols="30" rows="3">' . $_POST['RequirementDescription'] . '</textarea></td> + </tr> + <tr> + <td>' . _('Quantity Required') . ':</td> + <td><input type="text" class="number" name="Quantity" size="10" maxlength="10" value="' . $_POST['Quantity'] . '" /></td> + </tr> + <tr> + <td>' . _('Cost Per Unit') . ':</td> + <td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td> + </tr> + + </table> + + <br /> + <div class="centre"> + <input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /> + </div> + + </form>'; + include('includes/footer.inc'); ?> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/Contracts.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -65,9 +65,9 @@ $_SESSION['Contract'.$identifier]->CategoryID = $_POST['CategoryID']; $_SESSION['Contract'.$identifier]->LocCode = $_POST['LocCode']; $_SESSION['Contract'.$identifier]->RequiredDate = $_POST['RequiredDate']; - $_SESSION['Contract'.$identifier]->Margin = $_POST['Margin']; + $_SESSION['Contract'.$identifier]->Margin = filter_number_format($_POST['Margin']); $_SESSION['Contract'.$identifier]->CustomerRef = $_POST['CustomerRef']; - $_SESSION['Contract'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['Contract'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); /*User hit the button to enter line items - @@ -254,10 +254,10 @@ $_SESSION['Contract'.$identifier]->CategoryID = $_POST['CategoryID']; $_SESSION['Contract'.$identifier]->LocCode = $_POST['LocCode']; $_SESSION['Contract'.$identifier]->RequiredDate = $_POST['RequiredDate']; - $_SESSION['Contract'.$identifier]->Margin = $_POST['Margin']; + $_SESSION['Contract'.$identifier]->Margin = filter_number_format($_POST['Margin']); $_SESSION['Contract'.$identifier]->Status = $_POST['Status']; $_SESSION['Contract'.$identifier]->CustomerRef = $_POST['CustomerRef']; - $_SESSION['Contract'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['Contract'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); /*Get the first work centre for the users location - until we set this up properly */ $result = DB_query("SELECT code FROM workcentres WHERE location='" . $_SESSION['Contract'.$identifier]->LocCode ."'",$db); @@ -305,9 +305,9 @@ $sql = "UPDATE contracts SET categoryid = '" . $_POST['CategoryID'] ."', requireddate = '" . FormatDateForSQL($_POST['RequiredDate']) . "', loccode='" . $_POST['LocCode'] . "', - margin = '" . $_POST['Margin'] . "', + margin = '" . filter_number_format($_POST['Margin']) . "', customerref = '" . $_POST['CustomerRef'] . "', - exrate = '" . $_POST['ExRate'] . "' + exrate = '" . filter_number_format($_POST['ExRate']) . "' WHERE contractref ='" . $_POST['ContractRef'] . "'"; $ErrMsg = _('Cannot update the contract because'); $result = DB_query($sql,$db,$ErrMsg); @@ -404,9 +404,9 @@ '" . $_POST['CategoryID'] . "', '" . $_POST['LocCode'] . "', '" . FormatDateForSQL($_POST['RequiredDate']) . "', - '" . $_POST['Margin'] . "', + '" . filter_number_format($_POST['Margin']) . "', '" . $_POST['CustomerRef'] . "', - '". $_POST['ExRate'] ."')"; + '". filter_number_format($_POST['ExRate']) ."')"; $ErrMsg = _('The new contract could not be added because'); $result = DB_query($sql,$db,$ErrMsg); @@ -895,13 +895,15 @@ $_SESSION['Contract'.$identifier]->Margin =50; } echo '<tr><td>' . _('Gross Profit') . ' %:</td> - <td><input type="text" name="Margin" size="4" maxlength="4" value="' . $_SESSION['Contract'.$identifier]->Margin . '" /></td></tr>'; + <td><input type="text" name="Margin" size="4" maxlength="4" value="' . locale_number_format($_SESSION['Contract'.$identifier]->Margin,2) . '" /></td></tr>'; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ - echo '<tr><td>' . $_SESSION['Contract'.$identifier]->CurrCode . ' ' . _('Exchange Rate') . ':</td> - <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" /></td></tr>'; + echo '<tr> + <td>' . $_SESSION['Contract'.$identifier]->CurrCode . ' ' . _('Exchange Rate') . ':</td> + <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" /></td> + </tr>'; } else { - echo '<input type="hidden" name="ExRate" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" />'; + echo '<input type="hidden" name="ExRate" value="' . locale_number_format($_SESSION['Contract'.$identifier]->ExRate,'Variable') . '" />'; } echo '<tr><td>' . _('Contract Status') . ':</td><td>'; Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/PO_PDFPurchOrder.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -127,7 +127,7 @@ if ($POHeader['status'] != 'Authorised' AND $POHeader['status'] != 'Printed') { include('includes/header.inc'); - prnMsg( _('Purchase orders can only be printed once they have been authorised') . '. ' . _('This order is currently at a status of') . ' ' . _($OrderStatus),'warn'); + prnMsg( _('Purchase orders can only be printed once they have been authorised') . '. ' . _('This order is currently at a status of') . ' ' . _($POHeader['status']),'warn'); include('includes/footer.inc'); exit; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/doc/Change.log 2011-10-29 09:51:53 UTC (rev 4736) @@ -9,7 +9,7 @@ 22/9/11 Exson: fixed the bug in GLAccountReport.php for typename from the right table (systypes) in SQL and change locale_number_format for multinational. 17/9/11 Phil: Added WindowsLocale element to LanguagesArray.php and modified UserSettings.php and WWW_Users.php to use the new array definition. Also modified includes/LanguageSetup.php to use the windows locale string in the LanguagesArray as required for proper setting of the locale under windows. 17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) -12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale +12/9/11-31/10/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. 5/9/11 Phil: GLTransInquiry posted was not retrieved correctly - now fixed 4/9/11 Phil: Removed the stock code from form entities in SelectOrderItems.php and PO_Items.php to prevent issues with some characters in stock codes as suggested by Tim Modified: trunk/doc/Manual/ManualContributors.html =================================================================== --- trunk/doc/Manual/ManualContributors.html 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/doc/Manual/ManualContributors.html 2011-10-29 09:51:53 UTC (rev 4736) @@ -41,6 +41,8 @@ <br /><br /> Richard Heyes (html.mime.mail) <br /><br /> +High-Tech Bridge SA Security Research Lab +<br /><br /> Hindra Joshua <br /><br /> Alan Jones @@ -57,6 +59,8 @@ <br /><br /> Ditesh Kumar <br /><br /> +Felix Lim +<br /><br /> David Luo <br /><br /> Wayne McDougall @@ -103,6 +107,8 @@ <br /><br /> Jurgen Schopenhouer <br /><br /> +Fred Schuettler (aguapop - theme) +<br /><br /> Danilo Segan (php-gettext) <br /><br /> Gjergj Sheldija @@ -111,6 +117,8 @@ <br /><br /> Vitaliy Shevkunov <br /><br /> +Marcos Skambraks +<br /><br /> Jake Stride <br /><br /> Matt Taylor Modified: trunk/includes/Contract_Readin.php =================================================================== --- trunk/includes/Contract_Readin.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/includes/Contract_Readin.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -3,28 +3,28 @@ /*Contract_Readin.php is used by the modify existing Contract in Contracts.php and also by ContractCosting.php */ $ContractHeaderSQL = "SELECT contractdescription, - contracts.debtorno, - contracts.branchcode, - contracts.loccode, - status, - categoryid, - orderno, - margin, - wo, - requireddate, - drawing, - exrate, - debtorsmaster.name, - custbranch.brname, - debtorsmaster.currcode - FROM contracts INNER JOIN debtorsmaster - ON contracts.debtorno=debtorsmaster.debtorno - INNER JOIN currencies - ON debtorsmaster.currcode=currencies.currabrev - INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - AND contracts.branchcode=custbranch.branchcode - WHERE contractref= '" . $ContractRef . "'"; + contracts.debtorno, + contracts.branchcode, + contracts.loccode, + status, + categoryid, + orderno, + margin, + wo, + requireddate, + drawing, + exrate, + debtorsmaster.name, + custbranch.brname, + debtorsmaster.currcode + FROM contracts INNER JOIN debtorsmaster + ON contracts.debtorno=debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + AND contracts.branchcode=custbranch.branchcode + WHERE contractref= '" . $ContractRef . "'"; $ErrMsg = _('The contract cannot be retrieved because'); $DbgMsg = _('The SQL statement that was used and failed was'); @@ -55,14 +55,15 @@ /*now populate the contract BOM array with the items required for the contract */ $ContractBOMsql = "SELECT contractbom.stockid, - stockmaster.description, - contractbom.workcentreadded, - contractbom.quantity, - stockmaster.units, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost - FROM contractbom INNER JOIN stockmaster - ON contractbom.stockid=stockmaster.stockid - WHERE contractref ='" . $ContractRef . "'"; + stockmaster.description, + contractbom.workcentreadded, + contractbom.quantity, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost + FROM contractbom INNER JOIN stockmaster + ON contractbom.stockid=stockmaster.stockid + WHERE contractref ='" . $ContractRef . "'"; $ErrMsg = _('The bill of material cannot be retrieved because'); $DbgMsg = _('The SQL statement that was used to retrieve the contract bill of material was'); @@ -75,17 +76,18 @@ $myrow['workcentreadded'], $myrow['quantity'], $myrow['cost'], - $myrow['units']); + $myrow['units'], + $myrow['decimalplaces']); } /* add contract bill of materials BOM lines*/ } //end is there was a contract BOM to add //Now add the contract requirments $ContractReqtsSQL = "SELECT requirement, - quantity, - costperunit, - contractreqid - FROM contractreqts - WHERE contractref ='" . $ContractRef . "' - ORDER BY contractreqid"; + quantity, + costperunit, + contractreqid + FROM contractreqts + WHERE contractref ='" . $ContractRef . "' + ORDER BY contractreqid"; $ErrMsg = _('The other contract requirementscannot be retrieved because'); $DbgMsg = _('The SQL statement that was used to retrieve the other contract requirments was'); Modified: trunk/includes/DefineContractClass.php =================================================================== --- trunk/includes/DefineContractClass.php 2011-10-29 05:59:53 UTC (rev 4735) +++ trunk/includes/DefineContractClass.php 2011-10-29 09:51:53 UTC (rev 4736) @@ -38,20 +38,22 @@ } function Add_To_ContractBOM($StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM){ + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces){ if (isset($StockID) AND $Quantity!=0){ $this->ContractBOM[$this->BOMComponentCounter] = new ContractComponent($this->BOMComponentCounter, - $StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM); + $StockID, + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces); $this->BOMComponentCounter++; Return 1; } @@ -70,7 +72,11 @@ /*Requirments Methods */ -function Add_To_ContractRequirements($Requirement, $Quantity, $CostPerUnit,$ContractReqID=0){ +function Add_To_ContractRequirements($Requirement, + $Quantity, + $CostPerUnit, + $ContractReqID=0){ + if (isset($Requirement) AND $Quantity!=0 AND $CostPerUnit!=0){ $this->ContractReqts[$this->RequirementsCounter] = new ContractRequirement($Requirement, $Quantity, $CostPerUnit,$ContractReqID); $this->RequirementsCounter++; @@ -95,15 +101,17 @@ var $Quantity; var $ItemCost; var $UOM; + var $DecimalPlaces; function ContractComponent ($ComponentID, - $StockID, - $ItemDescription, - $WorkCentre, - $Quantity, - $ItemCost, - $UOM){ - + $StockID, + $ItemDescription, + $WorkCentre, + $Quantity, + $ItemCost, + $UOM, + $DecimalPlaces=0){ + /* Constructor function to add a new Contract Component object with passed params */ $this->ComponentID = $ComponentID; $this->StockID = $StockID; @@ -112,6 +120,7 @@ $this->Quantity = $Quantity; $this->ItemCost= $ItemCost; $this->UOM = $UOM; + $this->DecimalPlaces = $DecimalPlaces; } } @@ -123,9 +132,9 @@ var $CostPerUnit; function ContractRequirement ($Requirement, - $Quantity, - $CostPerUnit, - $ContractReqID=0){ + $Quantity, + $CostPerUnit, + $ContractReqID=0){ /* Constructor function to add a new Contract Component object with passed params */ $this->Requirement = $Requirement; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-29 06:00:03
|
Revision: 4735 http://web-erp.svn.sourceforge.net/web-erp/?rev=4735&view=rev Author: daintree Date: 2011-10-29 05:59:53 +0000 (Sat, 29 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/AccountGroups.php trunk/AddCustomerContacts.php trunk/AddCustomerNotes.php trunk/AddCustomerTypeNotes.php trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMInquiry.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/COGSGLPostings.php trunk/CompanyPreferences.php trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/SelectCustomer.php trunk/doc/Change.log trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AccountGroups.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -72,6 +72,14 @@ $Errors[$i] = 'GroupName'; $i++; } + if (!is_numeric(filter_number_format($_POST['SequenceInTB']))){ + $InputError = 1; + prnMsg( _('The sequence that the account group is listed in the trial balance is expected to be numeric'),'error'); + $Errors[$i] = 'SequenceInTB'; + $i++; + } else { + $_POST['SequenceInTB'] = filter_number_format($_POST['SequenceInTB']); + } if (mb_strlen($_POST['GroupName'])==0){ $InputError = 1; prnMsg( _('The account group name must be at least one character long'),'error'); @@ -109,20 +117,8 @@ $Errors[$i] = 'SectionInAccounts'; $i++; } - if (!is_long((int) $_POST['SequenceInTB'])) { - $InputError = 1; - prnMsg( _('The sequence in the trial balance must be an integer'),'error'); - $Errors[$i] = 'SequenceInTB'; - $i++; - } - if (!is_numeric($_POST['SequenceInTB']) or $_POST['SequenceInTB'] > 10000) { - $InputError = 1; - prnMsg( _('The sequence in the TB must be numeric and less than') . ' 10,000','error'); - $Errors[$i] = 'SequenceInTB'; - $i++; - } + - if ($_POST['SelectedAccountGroup']!='' AND $InputError !=1) { /*SelectedAccountGroup 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*/ @@ -150,9 +146,9 @@ parentgroupname) VALUES ( '" . $_POST['GroupName'] . "', - " . $_POST['SectionInAccounts'] . ", - " . $_POST['SequenceInTB'] . ", - " . $_POST['PandL'] . ", + '" . $_POST['SectionInAccounts'] . "', + '" . $_POST['SequenceInTB'] . "', + '" . $_POST['PandL'] . "', '" . $_POST['ParentGroupName'] . "' )"; $ErrMsg = _('An error occurred in inserting the account group'); @@ -213,13 +209,13 @@ or deletion of the records*/ $sql = "SELECT groupname, - sectionname, - sequenceintb, - pandl, - parentgroupname - FROM accountgroups - LEFT JOIN accountsection ON sectionid = sectioninaccounts - ORDER BY sequenceintb"; + sectionname, + sequenceintb, + pandl, + parentgroupname + FROM accountgroups + LEFT JOIN accountsection ON sectionid = sectioninaccounts + ORDER BY sequenceintb"; $DbgMsg = _('The sql that was used to retrieve the account group information was '); $ErrMsg = _('Could not get account groups because'); @@ -236,7 +232,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -246,7 +242,7 @@ $k++; } - switch ($myrow[3]) { + switch ($myrow['pandl']) { case -1: $PandLText=_('Yes'); break; @@ -257,14 +253,14 @@ $PandLText=_('No'); break; } //end of switch statement - - echo '<td>' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '</td> - <td>' . $myrow[1] . '</td> - <td>' . $myrow[2] . '</td> + + echo '<td>' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '</td> + <td>' . $myrow['sectionname'] . '</td> + <td>' . $myrow['sequenceintb'] . '</td> <td>' . $PandLText . '</td> - <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; + <td>' . $myrow['parentgroupname'] . '</td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -285,12 +281,12 @@ //editing an existing account group $sql = "SELECT groupname, - sectioninaccounts, - sequenceintb, - pandl, - parentgroupname - FROM accountgroups - WHERE groupname='" . $_GET['SelectedAccountGroup'] ."'"; + sectioninaccounts, + sequenceintb, + pandl, + parentgroupname + FROM accountgroups + WHERE groupname='" . $_GET['SelectedAccountGroup'] ."'"; $ErrMsg = _('An error occurred in retrieving the account group information'); $DbgMsg = _('The SQL that was used to retrieve the account group and that failed in the process was'); Modified: trunk/AddCustomerContacts.php =================================================================== --- trunk/AddCustomerContacts.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerContacts.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -197,14 +197,14 @@ $_POST['ContactNotes'] = $myrow['notes']; $_POST['ContactEmail'] = $myrow['email']; $_POST['DebtorNo'] = $myrow['debtorno']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['Con_ID'] . '>'; - echo '<input type=hidden name="DebtorNo" value=' . $_POST['DebtorNo'] . '>'; + echo '<input type="hidden" name="Id" value="'. $Id .'" />'; + echo '<input type="hidden" name="Con_ID" value="' . $_POST['Con_ID'] . '" />'; + echo '<input type="hidden" name="DebtorNo" value="' . $_POST['DebtorNo'] . '" />'; echo '<br /> <table class="selection"> <tr> - <td>'. _('Contact Code').':</td> - <td>' . $_POST['Con_ID'] . '</td> + <td>'. _('Contact Code').':</td> + <td>' . $_POST['Con_ID'] . '</td> </tr>'; } else { echo '<br /> @@ -213,37 +213,54 @@ echo '<tr><td>'. _('Contact Name') . '</td>'; if (isset($_POST['ContactName'])) { - echo '<td><input type="text" name="ContactName" value="' . $_POST['ContactName']. '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactName" value="' . $_POST['ContactName']. '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactName" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactName" size="35" maxlength="40" /></td> + </tr>'; } - echo '<tr><td>' . _('Role') . '</td>'; + echo '<tr> + <td>' . _('Role') . '</td>'; if (isset($_POST['ContactRole'])) { - echo '<td><input type="text" name="ContactRole" value="'. $_POST['ContactRole']. '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactRole" value="'. $_POST['ContactRole']. '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactRole" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactRole" size="35" maxlength="40" /></td> + </tr>'; } echo '<tr><td>' . _('Phone') . '</td>'; if (isset($_POST['ContactPhone'])) { - echo '<td><input type="text" name="ContactPhone" value="' . $_POST['ContactPhone'] . '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactPhone" value="' . $_POST['ContactPhone'] . '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactPhone" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactPhone" size="35" maxlength="40" /></td> + </tr>'; } - echo '<tr><td>' . _('Email') . '</td>'; + echo '<tr> + <td>' . _('Email') . '</td>'; if (isset($_POST['ContactEmail'])) { - echo '<td><input type="text" name="ContactEmail" value="' . $_POST['ContactEmail'] . '" size=55 maxlength="55"></td></tr>'; + echo '<td><input type="text" name="ContactEmail" value="' . $_POST['ContactEmail'] . '" size="55" maxlength="55" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactEmail" size="55" maxlength="55"></td></tr>'; + echo '<td><input type="text" name="ContactEmail" size="55" maxlength="55" /></td> + </tr>'; } - echo '<tr><td>' . _('Notes') . '</td>'; + echo '<tr> + <td>' . _('Notes') . '</td>'; if (isset($_POST['ContactNotes'])) { echo '<td><textarea name="ContactNotes">'. $_POST['ContactNotes'] . '</textarea>'; } else { echo '<td><textarea name="ContactNotes"></textarea>'; } - echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information') . '"></div></td></tr>'; - echo '</table>'; - echo '</form>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input 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/AddCustomerNotes.php =================================================================== --- trunk/AddCustomerNotes.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerNotes.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -18,7 +18,9 @@ $DebtorNo = $_GET['DebtorNo']; } -echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorNo=' . $DebtorNo . '">' . _('Back to Select Customer') . '</a><br />'; +echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorNo=' . $DebtorNo . '">' . _('Back to Select Customer') . '</a> + <br />'; + if ( isset($_POST['submit']) ) { //initialise no input errors assumed initially before we test @@ -102,18 +104,25 @@ '" alt="" />' . _('Notes for Customer').': <b>' .$row['name'].'</b></p> <br />'; - $sql = "SELECT * FROM custnotes + $sql = "SELECT noteid, + debtorno, + href, + note, + date, + priority + FROM custnotes WHERE debtorno='".$DebtorNo."' ORDER BY date DESC"; $result = DB_query($sql,$db); //echo '<br />'.$sql; - echo '<table class=selection>'; - echo '<tr> + echo '<table class="selection"> + <tr> <th>' . _('Date') . '</th> <th>' . _('Note') . '</th> <th>' . _('WWW') . '</th> - <th>' . _('Priority') . '</th>'; + <th>' . _('Priority') . '</th> + </tr>'; $k=0; //row colour counter @@ -127,40 +136,50 @@ } printf('<td>%s</td> <td>%s</td> + <td><a href="%s">%s</a></td> <td>%s</td> - <td>%s</td> <td><a href="%sId=%s&DebtorNo=%s">'. _('Edit').' </td> - <td><a href="%sId=%s&DebtorNo=%s&delete=1">'. _('Delete'). '</td></tr>', - ConvertSQLDate($myrow[4]), - $myrow[3], - $myrow[2], - $myrow[5], + <td><a href="%sId=%s&DebtorNo=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer note?') . '\');">'. _('Delete'). '</td></tr>', + ConvertSQLDate($myrow['date']), + $myrow['note'], + $myrow['href'], + $myrow['href'], + $myrow['priority'], htmlspecialchars($_SERVER['PHP_SELF']) . '?', - $myrow[0], - $myrow[1], + $myrow['noteid'], + $myrow['debtorno'], htmlspecialchars($_SERVER['PHP_SELF']) . '?', - $myrow[0], - $myrow[1]); + $myrow['noteid'], + $myrow['priority']); } //END WHILE LIST LOOP echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; + echo '<div class="centre"> + <a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a> + </div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { //editing an existing - $sql = "SELECT * FROM custnotes WHERE noteid='".$Id."' - and debtorno='".$DebtorNo."'"; + $sql = "SELECT noteid, + debtorno, + href, + note, + date, + priority + FROM custnotes + WHERE noteid='".$Id."' + AND debtorno='".$DebtorNo."'"; $result = DB_query($sql, $db); @@ -172,47 +191,64 @@ $_POST['date'] = $myrow['date']; $_POST['priority'] = $myrow['priority']; $_POST['debtorno'] = $myrow['debtorno']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['noteid'] . '>'; - echo '<input type=hidden name="DebtorNo" value=' . $_POST['debtorno'] . '>'; + echo '<input type=hidden name="Id" value="'. $Id .'" />'; + echo '<input type=hidden name="Con_ID" value="' . $_POST['noteid'] . '" />'; + echo '<input type=hidden name="DebtorNo" value="' . $_POST['debtorno'] . '" />'; echo '<table class="selection"> - <tr> + <tr> <td>'. _('Note ID').':</td> <td>' . $_POST['noteid'] . '</td> - </tr>'; + </tr>'; } else { echo '<table class="selection">'; } - echo '<tr><td>' . _('Contact Note'). '</td>'; + echo '<tr> + <td>' . _('Contact Note'). '</td>'; if (isset($_POST['note'])) { - echo '<td><textarea name="note">' .$_POST['note'] . '</textarea></td></tr>'; + echo '<td><textarea name="note">' .$_POST['note'] . '</textarea></td> + </tr>'; } else { - echo '<td><textarea name="note"></textarea></td></tr>'; + echo '<td><textarea name="note"></textarea></td> + </tr>'; } - echo '<tr><td>'. _('WWW').'</td>'; + echo '<tr> + <td>'. _('WWW').'</td>'; if (isset($_POST['href'])) { - echo '<td><input type="Text" name="href" value="'.$_POST['href'].'" size=35 maxlength=100></td></tr>'; + echo '<td><input type="text" name="href" value="'.$_POST['href'].'" size="35" maxlength="100" /></td> + </tr>'; } else { - echo '<td><input type="Text" name="href" size=35 maxlength=100></td></tr>'; + echo '<td><input type="text" name="href" size="35" maxlength="100" /></td> + </tr>'; } - echo '<tr><td>' . _('Date') .'</td>'; + echo '<tr> + <td>' . _('Date') .'</td>'; if (isset($_POST['date'])) { - echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" value="'.ConvertSQLDate($_POST['date']).'" size=10 maxlength=10></td></tr>'; + echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" value="'.ConvertSQLDate($_POST['date']).'" size="10" maxlength="10" /></td> + </tr>'; } else { - echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" size=10 maxlength=10></td></tr>'; + echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" size="10" maxlength="10" /></td> + </tr>'; } - echo '<tr><td>'. _('Priority'). '</td>'; + echo '<tr> + <td>'. _('Priority'). '</td>'; if (isset($_POST['priority'])) { - echo '<td><input type="Text" name="priority" value="' .$_POST['priority']. '" size=1 maxlength=3></td></td>'; + echo '<td><input type="text" name="priority" value="' .$_POST['priority']. '" size="1" maxlength="3" /></td> + </tr>'; } else { - echo '<td><input type="text" name="priority" size=1 maxlength=3></td></td>'; + echo '<td><input type="text" name="priority" size="1" maxlength="3" /></td> + </tr>'; } - echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'._('Enter Information').'"></div></td></tr>'; - echo '</table>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input type="submit" name="submit" value="'._('Enter Information').'" /> + </div> + </td> + </tr> + </table> + </form>'; - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerTypeNotes.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -17,6 +17,7 @@ $DebtorType = $_GET['DebtorType']; } echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorType='.$DebtorType.'">' . _('Back to Select Customer') . '</a><br />'; + if (isset($_POST['submit']) ) { //initialise no input errors assumed initially before we test @@ -92,19 +93,23 @@ $SQLname="SELECT * from debtortype where typeid='".$DebtorType."'"; $Result = DB_query($SQLname,$db); $row = DB_fetch_array($Result); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . - '" alt="" />' . _('Notes for Customer Type').': <b>' .$row['typename'].'</b></p><br />'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . + '" alt="" />' . _('Notes for Customer Type').': <b>' .$row['typename'].'</b> + </p> + <br />'; $sql = "SELECT * FROM debtortypenotes where typeid='".$DebtorType."' ORDER BY date DESC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; - echo '<tr> + echo '<table class="selection"> + <tr> <th>' . _('Date') . '</th> <th>' . _('Note') . '</th> <th>' . _('href') . '</th> - <th>' . _('Priority') . '</th>'; + <th>' . _('Priority') . '</th> + </tr>'; $k=0; //row colour counter @@ -121,7 +126,8 @@ <td>%s</td> <td>%s</td> <td><a href="%sId=%s&DebtorType=%s">'. _('Edit').' </td> - <td><a href="%sId=%s&DebtorType=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer type note?') . '\');">'. _('Delete'). '</td></tr>', + <td><a href="%sId=%s&DebtorType=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer type note?') . '\');">'. _('Delete'). '</td> + </tr>', $myrow[4], $myrow[3], $myrow[2], @@ -137,12 +143,12 @@ //END WHILE LIST LOOP echo '</table>'; } -if (isset($Id)) { ?> - <div class="cantre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> -<?php } ?> -<p> +if (isset($Id)) { + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType=' . $DebtorType . '">' . _('Review all notes for this Customer Type') .'</a> + </div>'; +} -<?php if (!isset($_GET['delete'])) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType='.$DebtorType.'">'; @@ -164,12 +170,16 @@ $_POST['date'] = $myrow['date']; $_POST['priority'] = $myrow['priority']; $_POST['typeid'] = $myrow['typeid']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['noteid'] . '>'; - echo '<input type=hidden name="DebtorType" value=' . $_POST['typeid'] . '>'; - echo '<table class=selection><tr><td>'. _('Note ID').':</td><td>' . $_POST['noteid'] . '</td></tr>'; + echo '<input type="hidden" name="Id" value="'. $Id .'" />'; + echo '<input type="hidden" name="Con_ID" value="' . $_POST['noteid'] . '" />'; + echo '<input type="hidden" name="DebtorType" value="' . $_POST['typeid'] . '" />'; + echo '<table class="selection"> + <tr> + <td>'. _('Note ID').':</td> + <td>' . $_POST['noteid'] . '</td> + </tr>'; } else { - echo '<table class=selection>'; + echo '<table class="selection">'; $_POST['noteid'] = ''; $_POST['note'] = ''; $_POST['href'] = ''; @@ -178,20 +188,29 @@ $_POST['typeid'] = ''; } - echo '<tr><td>'._('Contact Group Note').':</td>'; - echo '<td><textarea name="note">'. $_POST['note'].'</textarea></td></tr>'; - echo '<tr><td>'. _('Web site').':</td>'; - echo '<td><input type="text" name="href" value="'. $_POST['href'].'" size=35 maxlength=100></td></tr> - <tr><td>'. _('Date').':</td>'; - echo '<td><input type="text" name="date" class=date alt="'.$_SESSION['DefaultDateFormat'].'" value="'. $_POST['date']. - '" size=10 maxlength=10></td></tr>'; - echo '<tr><td>'. _('Priority').':</td>'; - echo '<td><input type="Text" name="priority" value="'. $_POST['priority'].'" size=1 maxlength=3></td></td> - </table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div>'; + echo '<tr> + <td>'._('Contact Group Note').':</td> + <td><textarea name="note">'. $_POST['note'].'</textarea></td> + </tr> + <tr> + <td>'. _('Web site').':</td> + <td><input type="text" name="href" value="'. $_POST['href'].'" size="35" maxlength="100" /></td> + </tr> + <tr> + <td>'. _('Date').':</td> + <td><input type="text" name="date" class=date alt="'.$_SESSION['DefaultDateFormat'].'" value="'. $_POST['date']. '" size="10" maxlength="10" /></td> + </tr> + <tr> + <td>'. _('Priority').':</td> + <td><input type="text" name="priority" value="'. $_POST['priority'].'" size="1" maxlength="3" /></td> + </tr> + </table> + <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/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AgedDebtors.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -287,15 +287,15 @@ $TotOD2=0; $ListCount = DB_num_rows($CustomerResult); - $DecimalPlaces =2; //by default + $CurrDecimalPlaces =2; //by default while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ - $DecimalPlaces = $AgedAnalysis['decimalplaces']; - $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); - $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$DecimalPlaces); + $CurrDecimalPlaces = $AgedAnalysis['decimalplaces']; + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$CurrDecimalPlaces); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -384,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); - $DisplayBalance = locale_number_format($DetailTrans['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -418,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_number_format($TotBal,$DecimalPlaces); - $DisplayTotDue = locale_number_format($TotDue,$DecimalPlaces); - $DisplayTotCurrent = locale_number_format($TotCurr,$DecimalPlaces); - $DisplayTotOverdue1 = locale_number_format($TotOD1,$DecimalPlaces); - $DisplayTotOverdue2 = locale_number_format($TotOD2,$DecimalPlaces); + $DisplayTotBalance = locale_number_format($TotBal,$CurrDecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$CurrDecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$CurrDecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$CurrDecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -433,10 +433,7 @@ if ($ListCount == 0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); - prnMsg(_('There are no customers meeting the criteria specified to list'),'info'); - if ($debug==1){ - prnMsg($SQL,'info'); - } + prnMsg(_('There are no customers meeting the criteria specified with balances to list'),'info'); echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; @@ -458,26 +455,27 @@ /*if $FromCriteria is not set then show a form to allow input */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> - <table>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - - echo '<tr><td>' . _('From Customer Code') . ':' . '</font></td> - <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0"></td> - </tr>'; - echo '<tr><td>' . _('To Customer Code') . ':' . '</td> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <td>' . _('From Customer Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0" /></td> + </tr> + <tr> + <td>' . _('To Customer Code') . ':' . '</td> <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> - </tr>'; - - echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> + </tr> + <tr> + <td>' . _('All balances or overdues only') . ':' . '</td> <td><select tabindex="3" name="All_Or_Overdues"> <option selected value="All">' . _('All customers with balances') . '</option> <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> <option value="HeldOnly">' . _('Held accounts only') . '</option> </select> </td> - </tr>'; - - echo '<tr><td>' . _('Only Show Customers Of') . ':' . '</td> + </tr> + <tr> + <td>' . _('Only Show Customers Of') . ':' . '</td> <td><select tabindex="4" name="Salesman">'; $sql = "SELECT salesmancode, salesmanname FROM salesman"; @@ -487,9 +485,10 @@ while ($myrow=DB_fetch_array($result)){ echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Only show customers trading in') . ':' . '</td> + echo '</select></td> + </tr> + <tr> + <td>' . _('Only show customers trading in') . ':' . '</td> <td><select tabindex="5" name="Currency">'; $sql = "SELECT currency, currabrev FROM currencies"; @@ -502,18 +501,22 @@ echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Summary or detailed report') . ':' . '</td> + echo '</select></td> + </tr> + <tr> + <td>' . _('Summary or detailed report') . ':' . '</td> <td><select tabindex="6" name="DetailedReport"> <option selected value="No">' . _('Summary Report') . '</option> <option value="Yes">' . _('Detailed Report') . '</option> </select> </td> - </tr>'; - - echo '</table><br /><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '" /> + </div>'; } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AgedSuppliers.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -23,7 +23,8 @@ if ($_POST['All_Or_Overdues']=='All'){ $SQL = "SELECT suppliers.supplierid, suppliers.suppname, - currencies.currency, + currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms, SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) as balance, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN @@ -53,6 +54,7 @@ GROUP BY suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth @@ -63,6 +65,7 @@ $SQL = "SELECT suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms, SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) AS balance, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN @@ -92,6 +95,7 @@ GROUP BY suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth @@ -121,17 +125,20 @@ $TotCurr = 0; $TotOD1 = 0; $TotOD2 = 0; - + $CurrDecimalPlaces =0; + $ListCount = DB_num_rows($SupplierResult); // UldisN While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ + + $CurrDecimalPlaces = $AgedAnalysis['currdecimalplaces']; + + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$CurrDecimalPlaces); - $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); - $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); $TotCurr += ($AgedAnalysis['balance']-$AgedAnalysis['due']); @@ -198,17 +205,17 @@ } while ($DetailTrans = DB_fetch_array($DetailResult)){ - + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos,60,$FontSize,$DetailTrans['typename'],'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,50,$FontSize,$DetailTrans['suppreference'],'left'); $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+105,$YPos,70,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = locale_number_format($DetailTrans['balance'],2); - $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],2); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -238,11 +245,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_number_format($TotBal,2); - $DisplayTotDue = locale_number_format($TotDue,2); - $DisplayTotCurrent = locale_number_format($TotCurr,2); - $DisplayTotOverdue1 = locale_number_format($TotOD1,2); - $DisplayTotOverdue2 = locale_number_format($TotOD2,2); + $DisplayTotBalance = locale_number_format($TotBal,$CurrDecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$CurrDecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$CurrDecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$CurrDecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -254,7 +261,10 @@ $pdf->line($Page_Width-$Right_Margin, $YPos ,220, $YPos); if ($ListCount == 0) { + $title = _('Aged Supplier Analysis'); + include('includes/header.inc'); prnMsg('There are no results so the PDF is empty'); + include('includes/footer.inc'); } else { $pdf->OutputD($_SESSION['DatabaseName'] . '_AggedSupliers_' . date('Y-m-d').'.pdf'); } @@ -272,25 +282,27 @@ /*if $FromCriteria is not set then show a form to allow input */ echo '<form sction="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> + <td>' . _('From Supplier Code') . ':</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1" /></td> + </tr> + <tr> + <td>' . _('To Supplier Code') . ':</td> + <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> + </tr> + <tr> + <td>' . _('All balances or overdues only') . ':' . '</td> + <td><select tabindex="3" name="All_Or_Overdues"> + <option selected value="All">' . _('All suppliers with balances') . '</option> + <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> + </select></td> + </tr> + <tr> + <td>' . _('For suppliers trading in') . ':' . '</td> + <td><select tabindex="4" name="Currency">'; - echo '<tr><td>' . _('From Supplier Code') . ':</font></td> - <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1"></td> - </tr>'; - echo '<tr><td>' . _('To Supplier Code') . ':</td> - <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz"></td> - </tr>'; - - echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> - <td><select tabindex="3" name="All_Or_Overdues">'; - echo '<option selected value="All">' . _('All suppliers with balances') . '</option>'; - echo '<option value="OverduesOnly">' . _('Overdue accounts only') . '</option>'; - echo '</select></td></tr>'; - - echo '<tr><td>' . _('For suppliers trading in') . ':' . '</td> - <td><select tabindex="4" name="Currency">'; - $sql = "SELECT currency, currabrev FROM currencies"; $result=DB_query($sql,$db); @@ -301,15 +313,20 @@ echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Summary or Detailed Report') . ':' . '</td> - <td><select tabindex="5" name="DetailedReport">'; - echo '<option selected value="No">' . _('Summary Report') . '</option>'; - echo '<option value="Yes">' . _('Detailed Report') . '</option>'; - echo '</select></td></tr>'; - - echo '</table><br /><div class="centre"><input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Summary or Detailed Report') . ':' . '</td> + <td><select tabindex="5" name="DetailedReport"> + <option selected value="No">' . _('Summary Report') . '</option> + <option value="Yes">' . _('Detailed Report') . '</option> + </select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; } include('includes/footer.inc'); } /*end of else not PrintPDF */ Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMExtendedQty.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -259,37 +259,39 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<br /> - <br /> - <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr> + <br /> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> <td>' . _('Part') . ':</td> - <td><input type ="text" name="Part" size="20">'; - echo '<tr> + <td><input type ="text" name="Part" size="20" /></td> + </tr> + <tr> <td>' . _('Quantity') . ':</td> - <td><input type="text" class="number" name="Quantity" size="4" /></td></tr>'; - - echo '<tr> + <td><input type="text" class="number" name="Quantity" size="4" /></td> + </tr> + <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> + </tr> + <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>'; - echo '</table> + </tr> + </table> + <br /> + <br /> + <div class="centre"> <br /> - <br /> - <div class="centre"> - <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> - </div>'; + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; include('includes/footer.inc'); @@ -316,7 +318,7 @@ $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos,160,$FontSize,_('Printed') . ': ' . Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('Build Quantity: ') . $_POST['Quantity']); + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('Build Quantity: ') . locale_number_format($_POST['Quantity'],'Variable'); $YPos -=(2*$line_height); Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMIndented.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -208,7 +208,7 @@ $pdf->addTextWrap(180,$YPos,180,$FontSize,$myrow['description'],'',0,$fill); $pdf->addTextWrap(360,$YPos,30,$FontSize,$myrow['loccode'],'right',0,$fill); $pdf->addTextWrap(390,$YPos,25,$FontSize,$myrow['workcentreadded'],'right',0,$fill); - $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],2),'right',0,$fill); + $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],'Variable'),'right',0,$fill); $pdf->addTextWrap(460,$YPos,55,$FontSize,$FormatedEffectiveAfter,'right',0,$fill); $pdf->addTextWrap(515,$YPos,50,$FontSize,$FormatedEffectiveTo,'right',0,$fill); @@ -235,7 +235,7 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_Bill_Of_Material_Indented_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } @@ -250,26 +250,32 @@ <form action="' . htmlspecialchars($_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" /> </tr> - <tr><td>' . _('Levels') . ':</td> + <tr> + <td>' . _('Levels') . ':</td> <td><select name="Levels"> <option selected value="All">' . _('All Levels') . '</option> <option value="One">' . _('One Level') . '</option> </select> </td> - </tr>'; - - echo '<tr><td>' . _('Print Option') . ':</td> + </tr> + <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>'; - echo '</table> - <p><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div></p>'; + </tr> + </table> + <p> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </p>'; include('includes/footer.inc'); Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMIndentedReverse.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -86,29 +86,28 @@ $ComponentCounter = 1; while ($ComponentCounter > 0) { $LevelCounter++; - $sql = "INSERT INTO tempbom ( - parent, - component, - sortpart, - level, - workcentreadded, - loccode, - effectiveafter, - effectiveto, - quantity) - SELECT bom.parent, - bom.component, - CONCAT(passbom.sortpart,bom.parent) AS sortpart, - " . $LevelCounter . " AS level, - bom.workcentreadded, - bom.loccode, - bom.effectiveafter, - bom.effectiveto, - bom.quantity - FROM bom,passbom - WHERE bom.component = passbom.part - AND bom.effectiveto >= NOW() - AND bom.effectiveafter <= NOW()"; + $sql = "INSERT INTO tempbom (parent, + component, + sortpart, + level, + workcentreadded, + loccode, + effectiveafter, + effectiveto, + quantity) + SELECT bom.parent, + bom.component, + CONCAT(passbom.sortpart,bom.parent) AS sortpart, + " . $LevelCounter . " AS level, + bom.workcentreadded, + bom.loccode, + bom.effectiveafter, + bom.effectiveto, + bom.quantity + FROM bom,passbom + WHERE bom.component = passbom.part + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $result = DB_query("DROP TABLE IF EXISTS passbom2",$db); @@ -157,10 +156,10 @@ WHERE stockid = '" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); - $assembly = $_POST['Part']; - $assemblydesc = $myrow['description']; + $Assembly = $_POST['Part']; + $AssemblyDesc = $myrow['description']; - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin,$assemblydesc); + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin,$AssemblyDesc); $Tot_Val=0; $fill = false; @@ -168,13 +167,13 @@ $sql = "SELECT tempbom.*, stockmaster.description, stockmaster.mbflag - FROM tempbom,stockmaster - WHERE tempbom.parent = stockmaster.stockid + FROM tempbom INNER JOIN stockmaster + ON tempbom.parent = stockmaster.stockid ORDER BY sortpart"; $result = DB_query($sql,$db); - $ListCount = DB_num_rows($result); // UldisN - + $ListCount = DB_num_rows($result); + While ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; @@ -197,13 +196,13 @@ $pdf->addTextWrap(180,$YPos,180,$FontSize,$myrow['description'],'',0,$fill); $pdf->addTextWrap(360,$YPos,30,$FontSize,$myrow['loccode'],'right',0,$fill); $pdf->addTextWrap(390,$YPos,25,$FontSize,$myrow['workcentreadded'],'right',0,$fill); - $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],2),'right',0,$fill); + $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],'Variable'),'right',0,$fill); $pdf->addTextWrap(460,$YPos,55,$FontSize,$FormatedEffectiveAfter,'right',0,$fill); $pdf->addTextWrap(515,$YPos,50,$FontSize,$FormatedEffectiveTo,'right',0,$fill); if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$assemblydesc); + $Right_Margin,$AssemblyDesc); } } /*end while loop */ @@ -213,7 +212,7 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$assemblydesc); + $Right_Margin,$AssemblyDesc); } if ($ListCount == 0) { $title = _('Print Reverse Indented BOM Listing Error'); @@ -235,19 +234,27 @@ 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=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('Part') . ':</td> - <td><input type ="text" name="Part" size="20">'; - echo '<tr><td>' . _('Print Option') . ':</td> + <br /> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> + <td>' . _('Part') . ':</td> + <td><input type ="text" name="Part" size="20" /></td> + </tr> + <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>'; - echo '</table> - <p><div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div></p>'; + </select></td> + </tr> + </table> + <p> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </p>'; include('includes/footer.inc'); @@ -255,7 +262,7 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$assemblydesc) { + $Page_Width,$Right_Margin,$AssemblyDesc) { $line_height=12; @@ -292,7 +299,7 @@ $pdf->addTextWrap($Left_Margin+1,$YPos,60,$FontSize,_('Component:'),'',0); $pdf->addTextWrap(100,$YPos,100,$FontSize,mb_strtoupper($_POST['Part']),'',0); - $pdf->addTextWrap(200,$YPos,150,$FontSize,$assemblydesc,'',0); + $pdf->addTextWrap(200,$YPos,150,$FontSize,$AssemblyDesc,'',0); $YPos -=(2*$line_height); $Xpos = $Left_Margin+5; $FontSize=8; Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMInquiry.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -13,21 +13,31 @@ } if (!isset($_POST['StockID'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"><b><br /></b>'. - '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . - _('to view the costed bill of materials') . '<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> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> + <b> + <br /> + </b> + <div class="page_help_text"> + '. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to view the costed bill of materials') . ' + <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') . '</font> + </div> + <br /> + <table class="selection"> + <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="20"></td> - </tr></table> - <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value=' . _('Search Now') . '></div><br />'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="20" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /> + </div> + <br /> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; } if (isset($_POST['Search'])){ @@ -46,40 +56,41 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - SUM(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND 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.mbflag - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + SUM(locstock.quantity) as totalonhand + 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.mbflag + ORDER BY stockmaster.stockid"; } elseif (mb_strlen($_POST['StockCode'])>0){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - sum(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' - AND (stockmaster.mbflag='M' - OR stockmaster.mbflag='K' - OR stockmaster.mbflag='G' - OR stockmaster.mbflag='A') - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + sum(locstock.quantity) as totalonhand + 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' + OR stockmaster.mbflag='A') + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag + ORDER BY stockmaster.stockid"; } @@ -89,13 +100,16 @@ } //one of keywords or StockCode was more than a zero length string } //end of if search -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) + AND isset($result) + AND !isset($SelectedParent)) { echo '<br /> <hr> <br /> - <table class="selection" cellpadding="2" colspan="7">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> + <table class="selection">'; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('On Hand') . '</th> <th>' . _('Units') . '</th> @@ -121,8 +135,9 @@ $tabindex=$j+4; printf('<td><input tabindex="' .$tabindex . '" type="submit" name="StockID" value="%s"</td> <td>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', + <td class="number">%s</td> + <td>%s</td> + </tr>', $myrow['stockid'], $myrow['description'], $StockOnHand, @@ -149,17 +164,17 @@ $ParentOverheadCost = $myrow['overheadcost']; $sql = "SELECT bom.parent, - bom.component, - stockmaster.description, - stockmaster.decimalplaces, - stockmaster.materialcost+ stockmaster.labourcost+stockmaster.overheadcost as standardcost, - bom.quantity, - bom.quantity * (stockmaster.materialcost+ stockmaster.labourcost+ stockmaster.overheadcost) AS componentcost - FROM bom INNER JOIN stockmaster - ON bom.component = stockmaster.stockid - WHERE bom.parent = '" . $StockID . "' - AND bom.effectiveafter < Now() - AND bom.effectiveto > Now()"; + bom.component, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.materialcost+ stockmaster.labourcost+stockmaster.overheadcost as standardcost, + bom.quantity, + bom.quantity * (stockmaster.materialcost+ stockmaster.labourcost+ stockmaster.overheadcost) AS componentcost + FROM bom INNER JOIN stockmaster + ON bom.component = stockmaster.stockid + WHERE bom.parent = '" . $StockID . "' + AND bom.effectiveafter < Now() + AND bom.effectiveto > Now()"; $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sql,$db,$ErrMsg); @@ -168,16 +183,23 @@ prnMsg(_('The bill of material for this part is not set up') . ' - ' . _('there are no components defined for it'),'warn'); } else { echo '<a href="'.$rootpath.'/index.php">'._('Return to Main Menu').'</a>'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.' + </p> + <br />'; - echo '<table class="selection" cellpadding="2">'; - echo '<tr><th colspan=5><div class="centre"><font size=4><b>' . $myrow[0] . ' : ' . _('per') . ' ' . $myrow[1] . '</b></font></div></th></tr>'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="5"> + <div class="centre"><font size="4"><b>' . $myrow[0] . ' : ' . _('per') . ' ' . $myrow[1] . '</b></font> + </div></th> + </tr>'; $TableHeader = '<tr> - <th>' . _('Component') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th> + <th>' . _('Component') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> </tr>'; echo $TableHeader; @@ -201,9 +223,9 @@ /* Component Code Description Quantity Std Cost Total Cost */ printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%.2f</td> - <td class=number>%.2f</td> + <td class="number">%s</td> + <td class="number">%.2f</td> + <td class="number">%.2f</td> </tr>', $ComponentLink, $myrow['description'], @@ -219,15 +241,15 @@ $TotalCost += $ParentLabourCost; echo '<tr> <td colspan="4" class="number"><b>' . _('Labour Cost') . '</b></td> - <td class=number><b>' . locale_number_format($ParentLabourCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . locale_number_format($ParentLabourCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; $TotalCost += $ParentOverheadCost; echo '<tr><td colspan="4" class="number"><b>' . _('Overhead Cost') . '</b></td> - <td class=number><b>' . locale_number_format($ParentOverheadCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . locale_number_format($ParentOverheadCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; echo '<tr> - <td colspan=4 class=number><b>' . _('Total Cost') . '</b></td> - <td class=number><b>' . locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - </... [truncated message content] |
From: <dai...@us...> - 2011-10-29 06:00:02
|
Revision: 4735 http://web-erp.svn.sourceforge.net/web-erp/?rev=4735&view=rev Author: daintree Date: 2011-10-29 05:59:53 +0000 (Sat, 29 Oct 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/AccountGroups.php trunk/AddCustomerContacts.php trunk/AddCustomerNotes.php trunk/AddCustomerTypeNotes.php trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMInquiry.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/COGSGLPostings.php trunk/CompanyPreferences.php trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/SelectCustomer.php trunk/doc/Change.log trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AccountGroups.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -72,6 +72,14 @@ $Errors[$i] = 'GroupName'; $i++; } + if (!is_numeric(filter_number_format($_POST['SequenceInTB']))){ + $InputError = 1; + prnMsg( _('The sequence that the account group is listed in the trial balance is expected to be numeric'),'error'); + $Errors[$i] = 'SequenceInTB'; + $i++; + } else { + $_POST['SequenceInTB'] = filter_number_format($_POST['SequenceInTB']); + } if (mb_strlen($_POST['GroupName'])==0){ $InputError = 1; prnMsg( _('The account group name must be at least one character long'),'error'); @@ -109,20 +117,8 @@ $Errors[$i] = 'SectionInAccounts'; $i++; } - if (!is_long((int) $_POST['SequenceInTB'])) { - $InputError = 1; - prnMsg( _('The sequence in the trial balance must be an integer'),'error'); - $Errors[$i] = 'SequenceInTB'; - $i++; - } - if (!is_numeric($_POST['SequenceInTB']) or $_POST['SequenceInTB'] > 10000) { - $InputError = 1; - prnMsg( _('The sequence in the TB must be numeric and less than') . ' 10,000','error'); - $Errors[$i] = 'SequenceInTB'; - $i++; - } + - if ($_POST['SelectedAccountGroup']!='' AND $InputError !=1) { /*SelectedAccountGroup 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*/ @@ -150,9 +146,9 @@ parentgroupname) VALUES ( '" . $_POST['GroupName'] . "', - " . $_POST['SectionInAccounts'] . ", - " . $_POST['SequenceInTB'] . ", - " . $_POST['PandL'] . ", + '" . $_POST['SectionInAccounts'] . "', + '" . $_POST['SequenceInTB'] . "', + '" . $_POST['PandL'] . "', '" . $_POST['ParentGroupName'] . "' )"; $ErrMsg = _('An error occurred in inserting the account group'); @@ -213,13 +209,13 @@ or deletion of the records*/ $sql = "SELECT groupname, - sectionname, - sequenceintb, - pandl, - parentgroupname - FROM accountgroups - LEFT JOIN accountsection ON sectionid = sectioninaccounts - ORDER BY sequenceintb"; + sectionname, + sequenceintb, + pandl, + parentgroupname + FROM accountgroups + LEFT JOIN accountsection ON sectionid = sectioninaccounts + ORDER BY sequenceintb"; $DbgMsg = _('The sql that was used to retrieve the account group information was '); $ErrMsg = _('Could not get account groups because'); @@ -236,7 +232,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -246,7 +242,7 @@ $k++; } - switch ($myrow[3]) { + switch ($myrow['pandl']) { case -1: $PandLText=_('Yes'); break; @@ -257,14 +253,14 @@ $PandLText=_('No'); break; } //end of switch statement - - echo '<td>' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '</td> - <td>' . $myrow[1] . '</td> - <td>' . $myrow[2] . '</td> + + echo '<td>' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '</td> + <td>' . $myrow['sectionname'] . '</td> + <td>' . $myrow['sequenceintb'] . '</td> <td>' . $PandLText . '</td> - <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; + <td>' . $myrow['parentgroupname'] . '</td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -285,12 +281,12 @@ //editing an existing account group $sql = "SELECT groupname, - sectioninaccounts, - sequenceintb, - pandl, - parentgroupname - FROM accountgroups - WHERE groupname='" . $_GET['SelectedAccountGroup'] ."'"; + sectioninaccounts, + sequenceintb, + pandl, + parentgroupname + FROM accountgroups + WHERE groupname='" . $_GET['SelectedAccountGroup'] ."'"; $ErrMsg = _('An error occurred in retrieving the account group information'); $DbgMsg = _('The SQL that was used to retrieve the account group and that failed in the process was'); Modified: trunk/AddCustomerContacts.php =================================================================== --- trunk/AddCustomerContacts.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerContacts.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -197,14 +197,14 @@ $_POST['ContactNotes'] = $myrow['notes']; $_POST['ContactEmail'] = $myrow['email']; $_POST['DebtorNo'] = $myrow['debtorno']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['Con_ID'] . '>'; - echo '<input type=hidden name="DebtorNo" value=' . $_POST['DebtorNo'] . '>'; + echo '<input type="hidden" name="Id" value="'. $Id .'" />'; + echo '<input type="hidden" name="Con_ID" value="' . $_POST['Con_ID'] . '" />'; + echo '<input type="hidden" name="DebtorNo" value="' . $_POST['DebtorNo'] . '" />'; echo '<br /> <table class="selection"> <tr> - <td>'. _('Contact Code').':</td> - <td>' . $_POST['Con_ID'] . '</td> + <td>'. _('Contact Code').':</td> + <td>' . $_POST['Con_ID'] . '</td> </tr>'; } else { echo '<br /> @@ -213,37 +213,54 @@ echo '<tr><td>'. _('Contact Name') . '</td>'; if (isset($_POST['ContactName'])) { - echo '<td><input type="text" name="ContactName" value="' . $_POST['ContactName']. '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactName" value="' . $_POST['ContactName']. '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactName" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactName" size="35" maxlength="40" /></td> + </tr>'; } - echo '<tr><td>' . _('Role') . '</td>'; + echo '<tr> + <td>' . _('Role') . '</td>'; if (isset($_POST['ContactRole'])) { - echo '<td><input type="text" name="ContactRole" value="'. $_POST['ContactRole']. '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactRole" value="'. $_POST['ContactRole']. '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactRole" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactRole" size="35" maxlength="40" /></td> + </tr>'; } echo '<tr><td>' . _('Phone') . '</td>'; if (isset($_POST['ContactPhone'])) { - echo '<td><input type="text" name="ContactPhone" value="' . $_POST['ContactPhone'] . '" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactPhone" value="' . $_POST['ContactPhone'] . '" size="35" maxlength="40" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactPhone" size=35 maxlength=40></td></tr>'; + echo '<td><input type="text" name="ContactPhone" size="35" maxlength="40" /></td> + </tr>'; } - echo '<tr><td>' . _('Email') . '</td>'; + echo '<tr> + <td>' . _('Email') . '</td>'; if (isset($_POST['ContactEmail'])) { - echo '<td><input type="text" name="ContactEmail" value="' . $_POST['ContactEmail'] . '" size=55 maxlength="55"></td></tr>'; + echo '<td><input type="text" name="ContactEmail" value="' . $_POST['ContactEmail'] . '" size="55" maxlength="55" /></td> + </tr>'; } else { - echo '<td><input type="text" name="ContactEmail" size="55" maxlength="55"></td></tr>'; + echo '<td><input type="text" name="ContactEmail" size="55" maxlength="55" /></td> + </tr>'; } - echo '<tr><td>' . _('Notes') . '</td>'; + echo '<tr> + <td>' . _('Notes') . '</td>'; if (isset($_POST['ContactNotes'])) { echo '<td><textarea name="ContactNotes">'. $_POST['ContactNotes'] . '</textarea>'; } else { echo '<td><textarea name="ContactNotes"></textarea>'; } - echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information') . '"></div></td></tr>'; - echo '</table>'; - echo '</form>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input 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/AddCustomerNotes.php =================================================================== --- trunk/AddCustomerNotes.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerNotes.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -18,7 +18,9 @@ $DebtorNo = $_GET['DebtorNo']; } -echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorNo=' . $DebtorNo . '">' . _('Back to Select Customer') . '</a><br />'; +echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorNo=' . $DebtorNo . '">' . _('Back to Select Customer') . '</a> + <br />'; + if ( isset($_POST['submit']) ) { //initialise no input errors assumed initially before we test @@ -102,18 +104,25 @@ '" alt="" />' . _('Notes for Customer').': <b>' .$row['name'].'</b></p> <br />'; - $sql = "SELECT * FROM custnotes + $sql = "SELECT noteid, + debtorno, + href, + note, + date, + priority + FROM custnotes WHERE debtorno='".$DebtorNo."' ORDER BY date DESC"; $result = DB_query($sql,$db); //echo '<br />'.$sql; - echo '<table class=selection>'; - echo '<tr> + echo '<table class="selection"> + <tr> <th>' . _('Date') . '</th> <th>' . _('Note') . '</th> <th>' . _('WWW') . '</th> - <th>' . _('Priority') . '</th>'; + <th>' . _('Priority') . '</th> + </tr>'; $k=0; //row colour counter @@ -127,40 +136,50 @@ } printf('<td>%s</td> <td>%s</td> + <td><a href="%s">%s</a></td> <td>%s</td> - <td>%s</td> <td><a href="%sId=%s&DebtorNo=%s">'. _('Edit').' </td> - <td><a href="%sId=%s&DebtorNo=%s&delete=1">'. _('Delete'). '</td></tr>', - ConvertSQLDate($myrow[4]), - $myrow[3], - $myrow[2], - $myrow[5], + <td><a href="%sId=%s&DebtorNo=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer note?') . '\');">'. _('Delete'). '</td></tr>', + ConvertSQLDate($myrow['date']), + $myrow['note'], + $myrow['href'], + $myrow['href'], + $myrow['priority'], htmlspecialchars($_SERVER['PHP_SELF']) . '?', - $myrow[0], - $myrow[1], + $myrow['noteid'], + $myrow['debtorno'], htmlspecialchars($_SERVER['PHP_SELF']) . '?', - $myrow[0], - $myrow[1]); + $myrow['noteid'], + $myrow['priority']); } //END WHILE LIST LOOP echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; + echo '<div class="centre"> + <a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a> + </div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { //editing an existing - $sql = "SELECT * FROM custnotes WHERE noteid='".$Id."' - and debtorno='".$DebtorNo."'"; + $sql = "SELECT noteid, + debtorno, + href, + note, + date, + priority + FROM custnotes + WHERE noteid='".$Id."' + AND debtorno='".$DebtorNo."'"; $result = DB_query($sql, $db); @@ -172,47 +191,64 @@ $_POST['date'] = $myrow['date']; $_POST['priority'] = $myrow['priority']; $_POST['debtorno'] = $myrow['debtorno']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['noteid'] . '>'; - echo '<input type=hidden name="DebtorNo" value=' . $_POST['debtorno'] . '>'; + echo '<input type=hidden name="Id" value="'. $Id .'" />'; + echo '<input type=hidden name="Con_ID" value="' . $_POST['noteid'] . '" />'; + echo '<input type=hidden name="DebtorNo" value="' . $_POST['debtorno'] . '" />'; echo '<table class="selection"> - <tr> + <tr> <td>'. _('Note ID').':</td> <td>' . $_POST['noteid'] . '</td> - </tr>'; + </tr>'; } else { echo '<table class="selection">'; } - echo '<tr><td>' . _('Contact Note'). '</td>'; + echo '<tr> + <td>' . _('Contact Note'). '</td>'; if (isset($_POST['note'])) { - echo '<td><textarea name="note">' .$_POST['note'] . '</textarea></td></tr>'; + echo '<td><textarea name="note">' .$_POST['note'] . '</textarea></td> + </tr>'; } else { - echo '<td><textarea name="note"></textarea></td></tr>'; + echo '<td><textarea name="note"></textarea></td> + </tr>'; } - echo '<tr><td>'. _('WWW').'</td>'; + echo '<tr> + <td>'. _('WWW').'</td>'; if (isset($_POST['href'])) { - echo '<td><input type="Text" name="href" value="'.$_POST['href'].'" size=35 maxlength=100></td></tr>'; + echo '<td><input type="text" name="href" value="'.$_POST['href'].'" size="35" maxlength="100" /></td> + </tr>'; } else { - echo '<td><input type="Text" name="href" size=35 maxlength=100></td></tr>'; + echo '<td><input type="text" name="href" size="35" maxlength="100" /></td> + </tr>'; } - echo '<tr><td>' . _('Date') .'</td>'; + echo '<tr> + <td>' . _('Date') .'</td>'; if (isset($_POST['date'])) { - echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" value="'.ConvertSQLDate($_POST['date']).'" size=10 maxlength=10></td></tr>'; + echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" value="'.ConvertSQLDate($_POST['date']).'" size="10" maxlength="10" /></td> + </tr>'; } else { - echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" size=10 maxlength=10></td></tr>'; + echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" size="10" maxlength="10" /></td> + </tr>'; } - echo '<tr><td>'. _('Priority'). '</td>'; + echo '<tr> + <td>'. _('Priority'). '</td>'; if (isset($_POST['priority'])) { - echo '<td><input type="Text" name="priority" value="' .$_POST['priority']. '" size=1 maxlength=3></td></td>'; + echo '<td><input type="text" name="priority" value="' .$_POST['priority']. '" size="1" maxlength="3" /></td> + </tr>'; } else { - echo '<td><input type="text" name="priority" size=1 maxlength=3></td></td>'; + echo '<td><input type="text" name="priority" size="1" maxlength="3" /></td> + </tr>'; } - echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'._('Enter Information').'"></div></td></tr>'; - echo '</table>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input type="submit" name="submit" value="'._('Enter Information').'" /> + </div> + </td> + </tr> + </table> + </form>'; - echo '</form>'; - } //end if record deleted no point displaying form to add record include('includes/footer.inc'); Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AddCustomerTypeNotes.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -17,6 +17,7 @@ $DebtorType = $_GET['DebtorType']; } echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorType='.$DebtorType.'">' . _('Back to Select Customer') . '</a><br />'; + if (isset($_POST['submit']) ) { //initialise no input errors assumed initially before we test @@ -92,19 +93,23 @@ $SQLname="SELECT * from debtortype where typeid='".$DebtorType."'"; $Result = DB_query($SQLname,$db); $row = DB_fetch_array($Result); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . - '" alt="" />' . _('Notes for Customer Type').': <b>' .$row['typename'].'</b></p><br />'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . + '" alt="" />' . _('Notes for Customer Type').': <b>' .$row['typename'].'</b> + </p> + <br />'; $sql = "SELECT * FROM debtortypenotes where typeid='".$DebtorType."' ORDER BY date DESC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; - echo '<tr> + echo '<table class="selection"> + <tr> <th>' . _('Date') . '</th> <th>' . _('Note') . '</th> <th>' . _('href') . '</th> - <th>' . _('Priority') . '</th>'; + <th>' . _('Priority') . '</th> + </tr>'; $k=0; //row colour counter @@ -121,7 +126,8 @@ <td>%s</td> <td>%s</td> <td><a href="%sId=%s&DebtorType=%s">'. _('Edit').' </td> - <td><a href="%sId=%s&DebtorType=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer type note?') . '\');">'. _('Delete'). '</td></tr>', + <td><a href="%sId=%s&DebtorType=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer type note?') . '\');">'. _('Delete'). '</td> + </tr>', $myrow[4], $myrow[3], $myrow[2], @@ -137,12 +143,12 @@ //END WHILE LIST LOOP echo '</table>'; } -if (isset($Id)) { ?> - <div class="cantre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> -<?php } ?> -<p> +if (isset($Id)) { + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType=' . $DebtorType . '">' . _('Review all notes for this Customer Type') .'</a> + </div>'; +} -<?php if (!isset($_GET['delete'])) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType='.$DebtorType.'">'; @@ -164,12 +170,16 @@ $_POST['date'] = $myrow['date']; $_POST['priority'] = $myrow['priority']; $_POST['typeid'] = $myrow['typeid']; - echo '<input type=hidden name="Id" value='. $Id .'>'; - echo '<input type=hidden name="Con_ID" value=' . $_POST['noteid'] . '>'; - echo '<input type=hidden name="DebtorType" value=' . $_POST['typeid'] . '>'; - echo '<table class=selection><tr><td>'. _('Note ID').':</td><td>' . $_POST['noteid'] . '</td></tr>'; + echo '<input type="hidden" name="Id" value="'. $Id .'" />'; + echo '<input type="hidden" name="Con_ID" value="' . $_POST['noteid'] . '" />'; + echo '<input type="hidden" name="DebtorType" value="' . $_POST['typeid'] . '" />'; + echo '<table class="selection"> + <tr> + <td>'. _('Note ID').':</td> + <td>' . $_POST['noteid'] . '</td> + </tr>'; } else { - echo '<table class=selection>'; + echo '<table class="selection">'; $_POST['noteid'] = ''; $_POST['note'] = ''; $_POST['href'] = ''; @@ -178,20 +188,29 @@ $_POST['typeid'] = ''; } - echo '<tr><td>'._('Contact Group Note').':</td>'; - echo '<td><textarea name="note">'. $_POST['note'].'</textarea></td></tr>'; - echo '<tr><td>'. _('Web site').':</td>'; - echo '<td><input type="text" name="href" value="'. $_POST['href'].'" size=35 maxlength=100></td></tr> - <tr><td>'. _('Date').':</td>'; - echo '<td><input type="text" name="date" class=date alt="'.$_SESSION['DefaultDateFormat'].'" value="'. $_POST['date']. - '" size=10 maxlength=10></td></tr>'; - echo '<tr><td>'. _('Priority').':</td>'; - echo '<td><input type="Text" name="priority" value="'. $_POST['priority'].'" size=1 maxlength=3></td></td> - </table>'; - echo '<br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div>'; + echo '<tr> + <td>'._('Contact Group Note').':</td> + <td><textarea name="note">'. $_POST['note'].'</textarea></td> + </tr> + <tr> + <td>'. _('Web site').':</td> + <td><input type="text" name="href" value="'. $_POST['href'].'" size="35" maxlength="100" /></td> + </tr> + <tr> + <td>'. _('Date').':</td> + <td><input type="text" name="date" class=date alt="'.$_SESSION['DefaultDateFormat'].'" value="'. $_POST['date']. '" size="10" maxlength="10" /></td> + </tr> + <tr> + <td>'. _('Priority').':</td> + <td><input type="text" name="priority" value="'. $_POST['priority'].'" size="1" maxlength="3" /></td> + </tr> + </table> + <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/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AgedDebtors.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -287,15 +287,15 @@ $TotOD2=0; $ListCount = DB_num_rows($CustomerResult); - $DecimalPlaces =2; //by default + $CurrDecimalPlaces =2; //by default while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ - $DecimalPlaces = $AgedAnalysis['decimalplaces']; - $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); - $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$DecimalPlaces); + $CurrDecimalPlaces = $AgedAnalysis['decimalplaces']; + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$CurrDecimalPlaces); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -384,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); - $DisplayBalance = locale_number_format($DetailTrans['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -418,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_number_format($TotBal,$DecimalPlaces); - $DisplayTotDue = locale_number_format($TotDue,$DecimalPlaces); - $DisplayTotCurrent = locale_number_format($TotCurr,$DecimalPlaces); - $DisplayTotOverdue1 = locale_number_format($TotOD1,$DecimalPlaces); - $DisplayTotOverdue2 = locale_number_format($TotOD2,$DecimalPlaces); + $DisplayTotBalance = locale_number_format($TotBal,$CurrDecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$CurrDecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$CurrDecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$CurrDecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -433,10 +433,7 @@ if ($ListCount == 0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); - prnMsg(_('There are no customers meeting the criteria specified to list'),'info'); - if ($debug==1){ - prnMsg($SQL,'info'); - } + prnMsg(_('There are no customers meeting the criteria specified with balances to list'),'info'); echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; @@ -458,26 +455,27 @@ /*if $FromCriteria is not set then show a form to allow input */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> - <table>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - - echo '<tr><td>' . _('From Customer Code') . ':' . '</font></td> - <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0"></td> - </tr>'; - echo '<tr><td>' . _('To Customer Code') . ':' . '</td> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <td>' . _('From Customer Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0" /></td> + </tr> + <tr> + <td>' . _('To Customer Code') . ':' . '</td> <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> - </tr>'; - - echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> + </tr> + <tr> + <td>' . _('All balances or overdues only') . ':' . '</td> <td><select tabindex="3" name="All_Or_Overdues"> <option selected value="All">' . _('All customers with balances') . '</option> <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> <option value="HeldOnly">' . _('Held accounts only') . '</option> </select> </td> - </tr>'; - - echo '<tr><td>' . _('Only Show Customers Of') . ':' . '</td> + </tr> + <tr> + <td>' . _('Only Show Customers Of') . ':' . '</td> <td><select tabindex="4" name="Salesman">'; $sql = "SELECT salesmancode, salesmanname FROM salesman"; @@ -487,9 +485,10 @@ while ($myrow=DB_fetch_array($result)){ echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Only show customers trading in') . ':' . '</td> + echo '</select></td> + </tr> + <tr> + <td>' . _('Only show customers trading in') . ':' . '</td> <td><select tabindex="5" name="Currency">'; $sql = "SELECT currency, currabrev FROM currencies"; @@ -502,18 +501,22 @@ echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Summary or detailed report') . ':' . '</td> + echo '</select></td> + </tr> + <tr> + <td>' . _('Summary or detailed report') . ':' . '</td> <td><select tabindex="6" name="DetailedReport"> <option selected value="No">' . _('Summary Report') . '</option> <option value="Yes">' . _('Detailed Report') . '</option> </select> </td> - </tr>'; - - echo '</table><br /><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '" /> + </div>'; } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/AgedSuppliers.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -23,7 +23,8 @@ if ($_POST['All_Or_Overdues']=='All'){ $SQL = "SELECT suppliers.supplierid, suppliers.suppname, - currencies.currency, + currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms, SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) as balance, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN @@ -53,6 +54,7 @@ GROUP BY suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth @@ -63,6 +65,7 @@ $SQL = "SELECT suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms, SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) AS balance, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN @@ -92,6 +95,7 @@ GROUP BY suppliers.supplierid, suppliers.suppname, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth @@ -121,17 +125,20 @@ $TotCurr = 0; $TotOD1 = 0; $TotOD2 = 0; - + $CurrDecimalPlaces =0; + $ListCount = DB_num_rows($SupplierResult); // UldisN While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ + + $CurrDecimalPlaces = $AgedAnalysis['currdecimalplaces']; + + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$CurrDecimalPlaces); - $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); - $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); $TotCurr += ($AgedAnalysis['balance']-$AgedAnalysis['due']); @@ -198,17 +205,17 @@ } while ($DetailTrans = DB_fetch_array($DetailResult)){ - + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos,60,$FontSize,$DetailTrans['typename'],'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,50,$FontSize,$DetailTrans['suppreference'],'left'); $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+105,$YPos,70,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = locale_number_format($DetailTrans['balance'],2); - $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],2); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$CurrDecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$CurrDecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$CurrDecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$CurrDecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -238,11 +245,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_number_format($TotBal,2); - $DisplayTotDue = locale_number_format($TotDue,2); - $DisplayTotCurrent = locale_number_format($TotCurr,2); - $DisplayTotOverdue1 = locale_number_format($TotOD1,2); - $DisplayTotOverdue2 = locale_number_format($TotOD2,2); + $DisplayTotBalance = locale_number_format($TotBal,$CurrDecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$CurrDecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$CurrDecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$CurrDecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$CurrDecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -254,7 +261,10 @@ $pdf->line($Page_Width-$Right_Margin, $YPos ,220, $YPos); if ($ListCount == 0) { + $title = _('Aged Supplier Analysis'); + include('includes/header.inc'); prnMsg('There are no results so the PDF is empty'); + include('includes/footer.inc'); } else { $pdf->OutputD($_SESSION['DatabaseName'] . '_AggedSupliers_' . date('Y-m-d').'.pdf'); } @@ -272,25 +282,27 @@ /*if $FromCriteria is not set then show a form to allow input */ echo '<form sction="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> + <td>' . _('From Supplier Code') . ':</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1" /></td> + </tr> + <tr> + <td>' . _('To Supplier Code') . ':</td> + <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> + </tr> + <tr> + <td>' . _('All balances or overdues only') . ':' . '</td> + <td><select tabindex="3" name="All_Or_Overdues"> + <option selected value="All">' . _('All suppliers with balances') . '</option> + <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> + </select></td> + </tr> + <tr> + <td>' . _('For suppliers trading in') . ':' . '</td> + <td><select tabindex="4" name="Currency">'; - echo '<tr><td>' . _('From Supplier Code') . ':</font></td> - <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1"></td> - </tr>'; - echo '<tr><td>' . _('To Supplier Code') . ':</td> - <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz"></td> - </tr>'; - - echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> - <td><select tabindex="3" name="All_Or_Overdues">'; - echo '<option selected value="All">' . _('All suppliers with balances') . '</option>'; - echo '<option value="OverduesOnly">' . _('Overdue accounts only') . '</option>'; - echo '</select></td></tr>'; - - echo '<tr><td>' . _('For suppliers trading in') . ':' . '</td> - <td><select tabindex="4" name="Currency">'; - $sql = "SELECT currency, currabrev FROM currencies"; $result=DB_query($sql,$db); @@ -301,15 +313,20 @@ echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } } - echo '</select></td></tr>'; - - echo '<tr><td>' . _('Summary or Detailed Report') . ':' . '</td> - <td><select tabindex="5" name="DetailedReport">'; - echo '<option selected value="No">' . _('Summary Report') . '</option>'; - echo '<option value="Yes">' . _('Detailed Report') . '</option>'; - echo '</select></td></tr>'; - - echo '</table><br /><div class="centre"><input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Summary or Detailed Report') . ':' . '</td> + <td><select tabindex="5" name="DetailedReport"> + <option selected value="No">' . _('Summary Report') . '</option> + <option value="Yes">' . _('Detailed Report') . '</option> + </select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; } include('includes/footer.inc'); } /*end of else not PrintPDF */ Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMExtendedQty.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -259,37 +259,39 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<br /> - <br /> - <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr> + <br /> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> <td>' . _('Part') . ':</td> - <td><input type ="text" name="Part" size="20">'; - echo '<tr> + <td><input type ="text" name="Part" size="20" /></td> + </tr> + <tr> <td>' . _('Quantity') . ':</td> - <td><input type="text" class="number" name="Quantity" size="4" /></td></tr>'; - - echo '<tr> + <td><input type="text" class="number" name="Quantity" size="4" /></td> + </tr> + <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> + </tr> + <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>'; - echo '</table> + </tr> + </table> + <br /> + <br /> + <div class="centre"> <br /> - <br /> - <div class="centre"> - <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> - </div>'; + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div>'; include('includes/footer.inc'); @@ -316,7 +318,7 @@ $pdf->addTextWrap($Page_Width-$Right_Margin-140,$YPos,160,$FontSize,_('Printed') . ': ' . Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('Build Quantity: ') . $_POST['Quantity']); + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('Build Quantity: ') . locale_number_format($_POST['Quantity'],'Variable'); $YPos -=(2*$line_height); Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMIndented.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -208,7 +208,7 @@ $pdf->addTextWrap(180,$YPos,180,$FontSize,$myrow['description'],'',0,$fill); $pdf->addTextWrap(360,$YPos,30,$FontSize,$myrow['loccode'],'right',0,$fill); $pdf->addTextWrap(390,$YPos,25,$FontSize,$myrow['workcentreadded'],'right',0,$fill); - $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],2),'right',0,$fill); + $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],'Variable'),'right',0,$fill); $pdf->addTextWrap(460,$YPos,55,$FontSize,$FormatedEffectiveAfter,'right',0,$fill); $pdf->addTextWrap(515,$YPos,50,$FontSize,$FormatedEffectiveTo,'right',0,$fill); @@ -235,7 +235,7 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_Bill_Of_Material_Indented_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } @@ -250,26 +250,32 @@ <form action="' . htmlspecialchars($_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" /> </tr> - <tr><td>' . _('Levels') . ':</td> + <tr> + <td>' . _('Levels') . ':</td> <td><select name="Levels"> <option selected value="All">' . _('All Levels') . '</option> <option value="One">' . _('One Level') . '</option> </select> </td> - </tr>'; - - echo '<tr><td>' . _('Print Option') . ':</td> + </tr> + <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>'; - echo '</table> - <p><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div></p>'; + </tr> + </table> + <p> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </p>'; include('includes/footer.inc'); Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMIndentedReverse.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -86,29 +86,28 @@ $ComponentCounter = 1; while ($ComponentCounter > 0) { $LevelCounter++; - $sql = "INSERT INTO tempbom ( - parent, - component, - sortpart, - level, - workcentreadded, - loccode, - effectiveafter, - effectiveto, - quantity) - SELECT bom.parent, - bom.component, - CONCAT(passbom.sortpart,bom.parent) AS sortpart, - " . $LevelCounter . " AS level, - bom.workcentreadded, - bom.loccode, - bom.effectiveafter, - bom.effectiveto, - bom.quantity - FROM bom,passbom - WHERE bom.component = passbom.part - AND bom.effectiveto >= NOW() - AND bom.effectiveafter <= NOW()"; + $sql = "INSERT INTO tempbom (parent, + component, + sortpart, + level, + workcentreadded, + loccode, + effectiveafter, + effectiveto, + quantity) + SELECT bom.parent, + bom.component, + CONCAT(passbom.sortpart,bom.parent) AS sortpart, + " . $LevelCounter . " AS level, + bom.workcentreadded, + bom.loccode, + bom.effectiveafter, + bom.effectiveto, + bom.quantity + FROM bom,passbom + WHERE bom.component = passbom.part + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $result = DB_query("DROP TABLE IF EXISTS passbom2",$db); @@ -157,10 +156,10 @@ WHERE stockid = '" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); - $assembly = $_POST['Part']; - $assemblydesc = $myrow['description']; + $Assembly = $_POST['Part']; + $AssemblyDesc = $myrow['description']; - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin,$assemblydesc); + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin,$AssemblyDesc); $Tot_Val=0; $fill = false; @@ -168,13 +167,13 @@ $sql = "SELECT tempbom.*, stockmaster.description, stockmaster.mbflag - FROM tempbom,stockmaster - WHERE tempbom.parent = stockmaster.stockid + FROM tempbom INNER JOIN stockmaster + ON tempbom.parent = stockmaster.stockid ORDER BY sortpart"; $result = DB_query($sql,$db); - $ListCount = DB_num_rows($result); // UldisN - + $ListCount = DB_num_rows($result); + While ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; @@ -197,13 +196,13 @@ $pdf->addTextWrap(180,$YPos,180,$FontSize,$myrow['description'],'',0,$fill); $pdf->addTextWrap(360,$YPos,30,$FontSize,$myrow['loccode'],'right',0,$fill); $pdf->addTextWrap(390,$YPos,25,$FontSize,$myrow['workcentreadded'],'right',0,$fill); - $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],2),'right',0,$fill); + $pdf->addTextWrap(415,$YPos,45,$FontSize,locale_number_format($myrow['quantity'],'Variable'),'right',0,$fill); $pdf->addTextWrap(460,$YPos,55,$FontSize,$FormatedEffectiveAfter,'right',0,$fill); $pdf->addTextWrap(515,$YPos,50,$FontSize,$FormatedEffectiveTo,'right',0,$fill); if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$assemblydesc); + $Right_Margin,$AssemblyDesc); } } /*end while loop */ @@ -213,7 +212,7 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$assemblydesc); + $Right_Margin,$AssemblyDesc); } if ($ListCount == 0) { $title = _('Print Reverse Indented BOM Listing Error'); @@ -235,19 +234,27 @@ 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=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('Part') . ':</td> - <td><input type ="text" name="Part" size="20">'; - echo '<tr><td>' . _('Print Option') . ':</td> + <br /> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <tr> + <td>' . _('Part') . ':</td> + <td><input type ="text" name="Part" size="20" /></td> + </tr> + <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>'; - echo '</table> - <p><div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div></p>'; + </select></td> + </tr> + </table> + <p> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </p>'; include('includes/footer.inc'); @@ -255,7 +262,7 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$assemblydesc) { + $Page_Width,$Right_Margin,$AssemblyDesc) { $line_height=12; @@ -292,7 +299,7 @@ $pdf->addTextWrap($Left_Margin+1,$YPos,60,$FontSize,_('Component:'),'',0); $pdf->addTextWrap(100,$YPos,100,$FontSize,mb_strtoupper($_POST['Part']),'',0); - $pdf->addTextWrap(200,$YPos,150,$FontSize,$assemblydesc,'',0); + $pdf->addTextWrap(200,$YPos,150,$FontSize,$AssemblyDesc,'',0); $YPos -=(2*$line_height); $Xpos = $Left_Margin+5; $FontSize=8; Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) +++ trunk/BOMInquiry.php 2011-10-29 05:59:53 UTC (rev 4735) @@ -13,21 +13,31 @@ } if (!isset($_POST['StockID'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"><b><br /></b>'. - '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . - _('to view the costed bill of materials') . '<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> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> + <b> + <br /> + </b> + <div class="page_help_text"> + '. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to view the costed bill of materials') . ' + <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') . '</font> + </div> + <br /> + <table class="selection"> + <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="20"></td> - </tr></table> - <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value=' . _('Search Now') . '></div><br />'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="20" /></td> + </tr> + </table> + <br /> + <div class="centre"> + <input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /> + </div> + <br /> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; } if (isset($_POST['Search'])){ @@ -46,40 +56,41 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - SUM(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND 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.mbflag - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + SUM(locstock.quantity) as totalonhand + 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.mbflag + ORDER BY stockmaster.stockid"; } elseif (mb_strlen($_POST['StockCode'])>0){ $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - sum(locstock.quantity) as totalonhand - FROM stockmaster, - locstock - WHERE stockmaster.stockid = locstock.stockid - AND stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' - AND (stockmaster.mbflag='M' - OR stockmaster.mbflag='K' - OR stockmaster.mbflag='G' - OR stockmaster.mbflag='A') - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + sum(locstock.quantity) as totalonhand + 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' + OR stockmaster.mbflag='A') + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag + ORDER BY stockmaster.stockid"; } @@ -89,13 +100,16 @@ } //one of keywords or StockCode was more than a zero length string } //end of if search -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) + AND isset($result) + AND !isset($SelectedParent)) { echo '<br /> <hr> <br /> - <table class="selection" cellpadding="2" colspan="7">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> + <table class="selection">'; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('On Hand') . '</th> <th>' . _('Units') . '</th> @@ -121,8 +135,9 @@ $tabindex=$j+4; printf('<td><input tabindex="' .$tabindex . '" type="submit" name="StockID" value="%s"</td> <td>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', + <td class="number">%s</td> + <td>%s</td> + </tr>', $myrow['stockid'], $myrow['description'], $StockOnHand, @@ -149,17 +164,17 @@ $ParentOverheadCost = $myrow['overheadcost']; $sql = "SELECT bom.parent, - bom.component, - stockmaster.description, - stockmaster.decimalplaces, - stockmaster.materialcost+ stockmaster.labourcost+stockmaster.overheadcost as standardcost, - bom.quantity, - bom.quantity * (stockmaster.materialcost+ stockmaster.labourcost+ stockmaster.overheadcost) AS componentcost - FROM bom INNER JOIN stockmaster - ON bom.component = stockmaster.stockid - WHERE bom.parent = '" . $StockID . "' - AND bom.effectiveafter < Now() - AND bom.effectiveto > Now()"; + bom.component, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.materialcost+ stockmaster.labourcost+stockmaster.overheadcost as standardcost, + bom.quantity, + bom.quantity * (stockmaster.materialcost+ stockmaster.labourcost+ stockmaster.overheadcost) AS componentcost + FROM bom INNER JOIN stockmaster + ON bom.component = stockmaster.stockid + WHERE bom.parent = '" . $StockID . "' + AND bom.effectiveafter < Now() + AND bom.effectiveto > Now()"; $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sql,$db,$ErrMsg); @@ -168,16 +183,23 @@ prnMsg(_('The bill of material for this part is not set up') . ' - ' . _('there are no components defined for it'),'warn'); } else { echo '<a href="'.$rootpath.'/index.php">'._('Return to Main Menu').'</a>'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.' + </p> + <br />'; - echo '<table class="selection" cellpadding="2">'; - echo '<tr><th colspan=5><div class="centre"><font size=4><b>' . $myrow[0] . ' : ' . _('per') . ' ' . $myrow[1] . '</b></font></div></th></tr>'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="5"> + <div class="centre"><font size="4"><b>' . $myrow[0] . ' : ' . _('per') . ' ' . $myrow[1] . '</b></font> + </div></th> + </tr>'; $TableHeader = '<tr> - <th>' . _('Component') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th> + <th>' . _('Component') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> </tr>'; echo $TableHeader; @@ -201,9 +223,9 @@ /* Component Code Description Quantity Std Cost Total Cost */ printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%.2f</td> - <td class=number>%.2f</td> + <td class="number">%s</td> + <td class="number">%.2f</td> + <td class="number">%.2f</td> </tr>', $ComponentLink, $myrow['description'], @@ -219,15 +241,15 @@ $TotalCost += $ParentLabourCost; echo '<tr> <td colspan="4" class="number"><b>' . _('Labour Cost') . '</b></td> - <td class=number><b>' . locale_number_format($ParentLabourCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . locale_number_format($ParentLabourCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; $TotalCost += $ParentOverheadCost; echo '<tr><td colspan="4" class="number"><b>' . _('Overhead Cost') . '</b></td> - <td class=number><b>' . locale_number_format($ParentOverheadCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . locale_number_format($ParentOverheadCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; echo '<tr> - <td colspan=4 class=number><b>' . _('Total Cost') . '</b></td> - <td class=number><b>' . locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - </... [truncated message content] |
From: <dai...@us...> - 2011-10-29 03:26:39
|
Revision: 4734 http://web-erp.svn.sourceforge.net/web-erp/?rev=4734&view=rev Author: daintree Date: 2011-10-29 03:26:27 +0000 (Sat, 29 Oct 2011) Log Message: ----------- security fixes per adv...@ht... Modified Paths: -------------- trunk/AccountGroups.php trunk/AccountSections.php trunk/AddCustomerContacts.php trunk/AddCustomerNotes.php trunk/AddCustomerTypeNotes.php trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/Areas.php trunk/AuditTrail.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMInquiry.php trunk/BOMListing.php trunk/BOMs.php trunk/BackupDatabase.php trunk/BankAccounts.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/COGSGLPostings.php trunk/CompanyPreferences.php trunk/ConfirmDispatch_Invoice.php trunk/ContractBOM.php trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/CounterSales.php trunk/CreditStatus.php trunk/Credit_Invoice.php trunk/Currencies.php trunk/CustEDISetup.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerAllocations.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/CustomerTransInquiry.php trunk/CustomerTypes.php trunk/Customers.php trunk/DailyBankTransactions.php trunk/DailySalesInquiry.php trunk/DebtorsAtPeriodEnd.php trunk/DeliveryDetails.php trunk/DiscountCategories.php trunk/DiscountMatrix.php trunk/EDIMessageFormat.php trunk/EmailCustTrans.php trunk/ExchangeRateTrend.php trunk/FTP_RadioBeacon.php trunk/Factors.php trunk/FixedAssetCategories.php trunk/FixedAssetDepreciation.php trunk/FixedAssetItems.php trunk/FixedAssetLocations.php trunk/FixedAssetRegister.php trunk/FixedAssetTransfer.php trunk/FormDesigner.php trunk/FreightCosts.php trunk/GLAccountCSV.php trunk/GLAccountInquiry.php trunk/GLAccountReport.php trunk/GLAccounts.php trunk/GLBalanceSheet.php trunk/GLBudgets.php trunk/GLJournal.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTags.php trunk/GLTrialBalance.php trunk/GLTrialBalance_csv.php trunk/GeocodeSetup.php trunk/GoodsReceived.php trunk/InventoryPlanning.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/Labels.php trunk/Locations.php trunk/MRP.php trunk/MRPCalendar.php trunk/MRPCreateDemands.php trunk/MRPDemandTypes.php trunk/MRPDemands.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReport.php trunk/MRPReschedules.php trunk/MRPShortages.php trunk/OffersReceived.php trunk/OutstandingGRNs.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFDIFOT.php trunk/PDFDeliveryDifferences.php trunk/PDFLowGP.php trunk/PDFOrderStatus.php trunk/PDFOrdersInvoiced.php trunk/PDFPeriodStockTransListing.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFRemittanceAdvice.php trunk/PDFStockCheckComparison.php trunk/PDFStockLocTransfer.php trunk/PDFStockTransfer.php trunk/PDFSuppTransListing.php trunk/POReport.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PageSecurity.php trunk/PaymentMethods.php trunk/PaymentTerms.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/Prices.php trunk/PricesBasedOnMarkUp.php trunk/PricesByCost.php trunk/Prices_Customer.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SMTPServer.php trunk/SalesAnalReptCols.php trunk/SalesAnalRepts.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategories.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesGLPostings.php trunk/SalesGraph.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SalesTypes.php trunk/SecurityTokens.php trunk/SelectCompletedOrder.php trunk/SelectContract.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectGLAccount.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SelectSupplier.php trunk/SelectWorkOrder.php trunk/ShipmentCosting.php trunk/Shipments.php trunk/Shippers.php trunk/Shipt_Select.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/StockCategories.php trunk/StockCheck.php trunk/StockCostUpdate.php trunk/StockCounts.php trunk/StockDispatch.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/StockReorderLevel.php trunk/StockSerialItemResearch.php trunk/StockStatus.php trunk/StockTransfers.php trunk/StockUsage.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/SupplierAllocations.php trunk/SupplierBalsAtPeriodEnd.php trunk/SupplierContacts.php trunk/SupplierCredit.php trunk/SupplierInquiry.php trunk/SupplierInvoice.php trunk/SupplierTenders.php trunk/SupplierTransInquiry.php trunk/SupplierTypes.php trunk/Suppliers.php trunk/SystemParameters.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php trunk/UserSettings.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/Z_BottomUpCosts.php trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/Z_ChangeStockCategory.php trunk/Z_ChangeStockCode.php trunk/Z_CheckDebtorsControl.php trunk/Z_CreateCompanyTemplateFile.php trunk/Z_DataExport.php trunk/Z_DeleteSalesTransActions.php trunk/Z_ImportChartOfAccounts.php trunk/Z_ImportGLAccountGroups.php trunk/Z_ImportGLAccountSections.php trunk/Z_ImportPartCodes.php trunk/Z_MakeNewCompany.php trunk/Z_ReApplyCostToSA.php trunk/Z_RePostGLFromPeriod.php trunk/Z_ReverseSuppPaymentRun.php trunk/Z_UpdateChartDetailsBFwd.php trunk/Z_Upgrade3.10.php trunk/Z_Upgrade_3.04-3.05.php trunk/Z_Upgrade_3.05-3.06.php trunk/Z_Upgrade_3.07-3.08.php trunk/Z_Upgrade_3.08-3.09.php trunk/Z_Upgrade_3.09-3.10.php trunk/Z_Upgrade_3.10-3.11.php trunk/Z_Upgrade_3.11-4.00.php trunk/Z_poAddLanguage.php trunk/Z_poEditLangHeader.php trunk/Z_poEditLangModule.php trunk/Z_poEditLangRemaining.php trunk/Z_poRebuildDefault.php trunk/api/api_session.inc trunk/config.distrib.php trunk/doc/Manual/ManualContents.php trunk/doc/Manual/ManualGettingStarted.html trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsExisting.php trunk/includes/InputSerialItemsKeyed.php trunk/includes/InputSerialItemsSequential.php trunk/includes/Login.php trunk/includes/OutputSerialItems.php trunk/includes/header.inc trunk/includes/session.inc trunk/includes/tcpdf/config/tcpdf_config.php trunk/includes/tcpdf/config/tcpdf_config_alt.php trunk/index.php trunk/install/save.php trunk/locale/de_DE.utf8/Manual/ManualContents.php trunk/locale/de_DE.utf8/Manual/ManualGettingStarted.html trunk/locale/zh_CN.utf8/Manual/ManualContents.php trunk/locale/zh_CN.utf8/Manual/ManualGettingStarted.html trunk/locale/zh_HK.utf8/Manual/ManualContents.php trunk/locale/zh_HK.utf8/Manual/ManualGettingStarted.html trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php Removed Paths: ------------- trunk/phpinfo.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AccountGroups.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -263,8 +263,8 @@ <td>' . $myrow[2] . '</td> <td>' . $PandLText . '</td> <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -272,12 +272,12 @@ if (isset($_POST['SelectedAccountGroup']) OR isset($_GET['SelectedAccountGroup'])) { - echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Account Groups') . '</a></div>'; + echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Review Account Groups') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<br /><form method="post" id="AccountGroups" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AccountSections.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -193,11 +193,11 @@ } echo '<td>' . $myrow[0] . '</td><td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; if ( $myrow[0] == '1' || $myrow[0] == '2' ) { echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; } echo '</tr>'; } //END WHILE LIST LOOP @@ -206,12 +206,12 @@ if (isset($_POST['SelectedSectionID']) or isset($_GET['SelectedSectionID'])) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Account Sections') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Review Account Sections') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<form method="post" name="AccountSections" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" name="AccountSections" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedSectionID'])) { Modified: trunk/AddCustomerContacts.php =================================================================== --- trunk/AddCustomerContacts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerContacts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -154,10 +154,10 @@ $myrow['email'], $myrow['email'], $myrow['notes'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno']); @@ -166,12 +166,12 @@ echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo .'">' . _('Review all contacts for this Customer') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo .'">' . _('Review all contacts for this Customer') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AddCustomerNotes.php =================================================================== --- trunk/AddCustomerNotes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerNotes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -135,10 +135,10 @@ $myrow[3], $myrow[2], $myrow[5], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1]); @@ -147,13 +147,13 @@ echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; + echo '<div class="centre"><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerTypeNotes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -126,10 +126,10 @@ $myrow[3], $myrow[2], $myrow[5], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1]); @@ -138,14 +138,14 @@ echo '</table>'; } if (isset($Id)) { ?> - <div class="cantre"><a href="<?php echo $_SERVER['PHP_SELF'] . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> + <div class="cantre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> <?php } ?> <p> <?php if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorType='.$DebtorType.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType='.$DebtorType.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AgedDebtors.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -457,7 +457,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AgedSuppliers.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -271,7 +271,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form sction="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form sction="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Areas.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -161,8 +161,8 @@ } echo '<td>' . $myrow[0] . '</td> <td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP @@ -172,13 +172,13 @@ //end of ifs and buts! if (isset($SelectedArea)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Areas Defined') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Review Areas Defined') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"><br />'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '"><br />'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedArea)) { Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AuditTrail.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -34,7 +34,7 @@ // Get list of users $UserResult = DB_query("SELECT userid FROM www_users",$db); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMExtendedQty.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -260,7 +260,7 @@ echo '<br /> <br /> - <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr> Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMIndented.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -247,7 +247,7 @@ echo '<br /> <br /> - <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Part') . ':</td> Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMIndentedReverse.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -236,7 +236,7 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<br /> <br /> - <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Part') . ':</td> Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -13,7 +13,7 @@ } if (!isset($_POST['StockID'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><b><br /></b>'. + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"><b><br /></b>'. '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to view the costed bill of materials') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . Modified: trunk/BOMListing.php =================================================================== --- trunk/BOMListing.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMListing.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -112,7 +112,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="POST"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMs.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -113,7 +113,7 @@ $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); - $DrillLink = $_SERVER['PHP_SELF'] . '?'; + $DrillLink = htmlspecialchars($_SERVER['PHP_SELF']) . '?'; $DrillID=$myrow[0]; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ @@ -155,12 +155,12 @@ ConvertSQLDate($myrow[6]), $AutoIssue, $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, $myrow[0], $DrillLink, $DrillID, - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, $myrow[0], $UltimateParent); @@ -413,7 +413,7 @@ break; } - echo '<br /><div class=centre><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select a Different BOM') . '</a></div><br />'; + echo '<br /><div class=centre><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Select a Different BOM') . '</a></div><br />'; echo '<table class="selection">'; // Display Manufatured Parent Items $sql = "SELECT bom.parent, @@ -432,7 +432,7 @@ if( DB_num_rows($result) > 0 ) { echo '<tr><td><div class="centre">'._('Manufactured parent items').' : '; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -455,7 +455,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -477,7 +477,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Kit sets').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -499,7 +499,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Phantom').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -559,7 +559,7 @@ if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?Select=' . $SelectedParent .'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Select=' . $SelectedParent .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedComponent']) and $InputError !=1) { @@ -825,7 +825,7 @@ if (!isset($SelectedParent)) { 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">' . + echo '<form action="' . htmlspecialchars($_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> <br /> <table class="selection" cellpadding="3" colspan="4"> Modified: trunk/BackupDatabase.php =================================================================== --- trunk/BackupDatabase.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BackupDatabase.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -44,7 +44,7 @@ prnMsg(_('Once you have downloaded the database backup file to your local machine you should use the link below to delete it - backup files can consume a lot of space on your hosting account and will accumulate if not deleted - they also contain sensitive information which would otherwise be available for others to download!'),'info'); echo '<br /> <br /> - <a href="'. $_SERVER['PHP_SELF'] . '?BackupFile=' .$BackupFile .'">' . _('Delete the backup file off the server') . '</a>'; + <a href="'. htmlspecialchars($_SERVER['PHP_SELF']) . '?BackupFile=' .$BackupFile .'">' . _('Delete the backup file off the server') . '</a>'; } else { prnMsg(_('There was some problem producing a backup using mysqldump. Normally this relates to a permissions issue - the web-server user must have permission to write to the companies directory'),'error'); } Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankAccounts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -231,9 +231,9 @@ $myrow['bankaddress'], $myrow['currcode'], $DefaultBankAccount, - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['accountcode'], - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['accountcode']); } @@ -245,11 +245,11 @@ if (isset($SelectedBankAccount)) { echo '<br />'; - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Bank Accounts Defined') . '</a></div>'; + echo '<div class="centre"><p><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show All Bank Accounts Defined') . '</a></div>'; echo '<br />'; } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedBankAccount) AND !isset($_GET['delete'])) { Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankMatching.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -77,7 +77,7 @@ echo '<div class="page_help_text">' . _('Use this screen to match webERP Receipts and Payments to your Bank Statement. Check your bank statement and click the check-box when you find the matching transaction.') . '</div><br />'; -echo '<form action="'. $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="Type" value="' . $Type . '">'; Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankReconciliation.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -8,7 +8,7 @@ include('includes/header.inc'); -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/COGSGLPostings.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -110,9 +110,9 @@ $myrow['stkcat'], $myrow['salestype'], $myrow['accountname'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id'], - $_SERVER['PHP_SELF']. '?', + htmlspecialchars($_SERVER['PHP_SELF']). '?', $myrow['id']); }//end while echo '</table>'; @@ -208,9 +208,9 @@ $myrow['stkcat'], $myrow['salestype'], $myrow['salestype'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id']); }//END WHILE LIST LOOP @@ -220,12 +220,12 @@ //end of ifs and buts! if (isset($SelectedCOGSPostingID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Show all cost of sales posting records') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Show all cost of sales posting records') . '</a></div>'; } echo '<br />'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedCOGSPostingID)) { Modified: trunk/CompanyPreferences.php =================================================================== --- trunk/CompanyPreferences.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CompanyPreferences.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -153,7 +153,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ConfirmDispatch_Invoice.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -252,7 +252,7 @@ </table> <br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*************************************************************** Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractBOM.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -219,7 +219,7 @@ /* This is where the order as selected should be displayed reflecting any deletions or insertions*/ -echo '<form name="ContractBOMForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '" method="post">'; +echo '<form name="ContractBOMForm" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (count($_SESSION['Contract'.$identifier]->ContractBOM)>0){ @@ -263,7 +263,7 @@ <td>' . $ContractComponent->UOM . '</td> <td class="number">' . $ContractComponent->ItemCost . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractCosting.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -428,7 +428,7 @@ if ($_SESSION['Contract'.$identifier]->Status ==2){//the contract is an order being processed now - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><div class="centre"><input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /></div>'; echo '</form>'; Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractOtherReqts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -75,7 +75,7 @@ /* This is where the other requirement as entered/modified should be displayed reflecting any deletions or insertions*/ -echo '<form name="ContractReqtsForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '" method="post">'; +echo '<form name="ContractReqtsForm" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Other Requirements') . '" alt="" /> ' . _('Contract Other Requirements') . ' - ' . $_SESSION['Contract'.$identifier]->CustomerName.'</p>'; @@ -114,7 +114,7 @@ <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '" /></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Contracts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -748,7 +748,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />' . ' ' . _('Contract: Select Customer') . '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier .'" name="CustomerSelection" method="post">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier=' . $identifier .'" name="CustomerSelection" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding="3" colspan="4" class="selection"> @@ -816,7 +816,7 @@ //end if RequireCustomerSelection } else { /*A customer is already selected so get into the contract setup proper */ - echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post">'; + echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier=' . $identifier . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"> Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CounterSales.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -213,7 +213,7 @@ echo '<br /><br />'; prnMsg(_('This sale has been cancelled as requested'),'success'); - echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a>'; + echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Start a new Counter Sale') . '</a>'; include('includes/footer.inc'); exit; @@ -362,7 +362,7 @@ /* Always do the stuff below */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" name="SelectParts" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '" name="SelectParts" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; //Get The exchange rate used for GPPercent calculations on adding or amending items @@ -809,7 +809,7 @@ $_SESSION['Items'.$identifier]->TaxGLCodes=$TaxGLCodes; echo '<td class="number">' . locale_number_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; echo '<td class="number">' . locale_number_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ echo $RowStarter; @@ -1970,7 +1970,7 @@ } else { echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />'; } - echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a></div>'; + echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Start a new Counter Sale') . '</a></div>'; } // There were input errors so don't process nuffin @@ -2186,7 +2186,7 @@ if (isset($SearchResult)) { $j = 1; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '" method="post" name="orderform">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'identifier='.$identifier . '" method="post" name="orderform">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="table1">'; echo '<tr><td><input type="hidden" name="previous" value="'.strval($Offset-1).'" /><input tabindex="'.strval($j+7).'" type="submit" name="Prev" value="'._('Prev').'" /></td>'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CreditStatus.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -175,9 +175,9 @@ $myrow['reasoncode'], $myrow['reasondescription'], $DissallowText, - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['reasoncode'], - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['reasoncode']); } //END WHILE LIST LOOP @@ -186,12 +186,12 @@ } //end of ifs and buts! if (isset($SelectedReason)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedReason) and ($InputError!=1)) { Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Credit_Invoice.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -256,7 +256,7 @@ if (!isset($_POST['ProcessCredit'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -378,7 +378,7 @@ echo '<td class="number">' . $DisplayTaxAmount . '</td> <td class="number">' . $DisplayGrossLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the credit?') . '\');">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $LnItm->LineNumber . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the credit?') . '\');">' . _('Delete') . '</a></td></tr>'; echo '<tr' . $RowStarter . '><td colspan="12"><textarea tabindex=' . $j .' name="Narrative_' . $LnItm->LineNumber . '" cols=100% rows=1>' . $LnItm->Narrative . '</textarea><br /><hr></td></tr>'; $j++; Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Currencies.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -264,10 +264,10 @@ $myrow['decimalplaces'], locale_number_format($myrow['rate'],5), locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Edit'), - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Delete'), $rootpath, @@ -298,14 +298,14 @@ if (isset($SelectedCurrency)) { - echo '<div class="centre"><a href="' .$_SERVER['PHP_SELF'] . '">'._('Show all currency definitions').'</a></div>'; + echo '<div class="centre"><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">'._('Show all currency definitions').'</a></div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedCurrency) AND $SelectedCurrency!='') { Modified: trunk/CustEDISetup.php =================================================================== --- trunk/CustEDISetup.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustEDISetup.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -69,7 +69,7 @@ } } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustLoginSetup.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -112,7 +112,7 @@ } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"> Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustWhereAlloc.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -6,7 +6,7 @@ $title = _('Customer How Paid Inquiry'); include('includes/header.inc'); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . htmlspecialchars($_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/money_add.png" title="' . Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerAllocations.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -336,7 +336,7 @@ if (isset($_POST['AllocTrans'])) { // Page called with trans number - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type=hidden name="AllocTrans" value="' . $_POST['AllocTrans'] . '" />'; @@ -473,7 +473,7 @@ <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class=number>' . locale_number_format($myrow['total'],2) . '</td> <td class=number>' . locale_number_format($myrow['total']-$myrow['alloc'],2) . '</td>'; - echo '<td><a href=' . $_SERVER['PHP_SELF']. '?AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a></td></tr>'; + echo '<td><a href=' . htmlspecialchars($_SERVER['PHP_SELF']). '?AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a></td></tr>'; } DB_free_result($result); echo '</table><p>'; @@ -511,7 +511,7 @@ $k=0; while ($myrow = DB_fetch_array($result)) { - $allocate = '<a href=' . $_SERVER['PHP_SELF']. '?' . SID . '&AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a>'; + $allocate = '<a href=' . htmlspecialchars($_SERVER['PHP_SELF']). '?' . SID . '&AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a>'; if ( $curDebtor != $myrow['debtorno'] ) { if ( $curTrans > 1 ) { Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerBranches.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -408,11 +408,11 @@ $myrow[8], $myrow[9], ($myrow[11]?_('No'):_('Yes')), - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $DebtorNo, urlencode($myrow[1]), _('Edit'), - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); @@ -456,7 +456,7 @@ } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedBranch)) { @@ -532,7 +532,7 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Change Details for Branch'). ' '. $SelectedBranch . '</p>'; if (isset($SelectedBranch)) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; + echo '<div class="centre"><a href=' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; } echo '<br /><table class="selection">'; echo '<tr><th colspan=2><div class="centre"><b>'._('Change Branch').'</b></th></tr>'; Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -147,7 +147,7 @@ </tr> </table>'; -echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<br /><div class="centre"><form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Show all transactions after') . ': <input tabindex=1 type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div> </form> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerReceipt.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -702,7 +702,7 @@ /*set up the form whatever */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ @@ -862,7 +862,7 @@ <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>'.$ReceiptItem->GLCode.' - '.$myrow['accountname'].'</td> <td>'.$ReceiptItem->Narrative . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> </tr>'; $BatchTotal= $BatchTotal + $ReceiptItem->Amount; } Modified: trunk/CustomerTransInquiry.php =================================================================== --- trunk/CustomerTransInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerTransInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ echo '<div class="page_help_text">' . _('Choose which type of transaction to report on.') . '</div> <br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class=selection><tr>'; Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerTypes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -204,9 +204,9 @@ </tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -216,11 +216,11 @@ //end of ifs and buts! if (isset($SelectedType)) { - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Types Defined') . '</a></div><p>'; + echo '<div class="centre"><p><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show All Types Defined') . '</a></div><p>'; } if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class=selection>'; //Main table Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Customers.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -443,11 +443,11 @@ } if ($SetupErrors>0) { - echo '<br /><div class=centre><a href="'.$_SERVER['PHP_SELF'] .'" >'._('Click here to continue').'</a></div>'; + echo '<br /><div class=centre><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) .'" >'._('Click here to continue').'</a></div>'; include('includes/footer.inc'); exit; } - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="New" value="Yes" />'; @@ -618,7 +618,7 @@ //DebtorNo exists - either passed when calling the form or from the form itself - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection cellspacing=4> <tr><td valign=top><table class=selection>'; @@ -981,7 +981,7 @@ $myrow['notes'], $myrow['contid'], $myrow['debtorno'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno']); } Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DailyBankTransactions.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; @@ -132,7 +132,7 @@ echo '</table>'; } //end if no bank trans in the range to show - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DailySalesInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="" />' . ' ' . _('Daily Sales') . '</p>'; echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div><br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class=selection><tr>'; Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DebtorsAtPeriodEnd.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -129,7 +129,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/DeliveryDetails.php =================================================================== --- ... [truncated message content] |
From: <dai...@us...> - 2011-10-29 03:26:38
|
Revision: 4734 http://web-erp.svn.sourceforge.net/web-erp/?rev=4734&view=rev Author: daintree Date: 2011-10-29 03:26:27 +0000 (Sat, 29 Oct 2011) Log Message: ----------- security fixes per adv...@ht... Modified Paths: -------------- trunk/AccountGroups.php trunk/AccountSections.php trunk/AddCustomerContacts.php trunk/AddCustomerNotes.php trunk/AddCustomerTypeNotes.php trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/Areas.php trunk/AuditTrail.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMInquiry.php trunk/BOMListing.php trunk/BOMs.php trunk/BackupDatabase.php trunk/BankAccounts.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/COGSGLPostings.php trunk/CompanyPreferences.php trunk/ConfirmDispatch_Invoice.php trunk/ContractBOM.php trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/CounterSales.php trunk/CreditStatus.php trunk/Credit_Invoice.php trunk/Currencies.php trunk/CustEDISetup.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerAllocations.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/CustomerTransInquiry.php trunk/CustomerTypes.php trunk/Customers.php trunk/DailyBankTransactions.php trunk/DailySalesInquiry.php trunk/DebtorsAtPeriodEnd.php trunk/DeliveryDetails.php trunk/DiscountCategories.php trunk/DiscountMatrix.php trunk/EDIMessageFormat.php trunk/EmailCustTrans.php trunk/ExchangeRateTrend.php trunk/FTP_RadioBeacon.php trunk/Factors.php trunk/FixedAssetCategories.php trunk/FixedAssetDepreciation.php trunk/FixedAssetItems.php trunk/FixedAssetLocations.php trunk/FixedAssetRegister.php trunk/FixedAssetTransfer.php trunk/FormDesigner.php trunk/FreightCosts.php trunk/GLAccountCSV.php trunk/GLAccountInquiry.php trunk/GLAccountReport.php trunk/GLAccounts.php trunk/GLBalanceSheet.php trunk/GLBudgets.php trunk/GLJournal.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTags.php trunk/GLTrialBalance.php trunk/GLTrialBalance_csv.php trunk/GeocodeSetup.php trunk/GoodsReceived.php trunk/InventoryPlanning.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/Labels.php trunk/Locations.php trunk/MRP.php trunk/MRPCalendar.php trunk/MRPCreateDemands.php trunk/MRPDemandTypes.php trunk/MRPDemands.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReport.php trunk/MRPReschedules.php trunk/MRPShortages.php trunk/OffersReceived.php trunk/OutstandingGRNs.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFDIFOT.php trunk/PDFDeliveryDifferences.php trunk/PDFLowGP.php trunk/PDFOrderStatus.php trunk/PDFOrdersInvoiced.php trunk/PDFPeriodStockTransListing.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFRemittanceAdvice.php trunk/PDFStockCheckComparison.php trunk/PDFStockLocTransfer.php trunk/PDFStockTransfer.php trunk/PDFSuppTransListing.php trunk/POReport.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PageSecurity.php trunk/PaymentMethods.php trunk/PaymentTerms.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/Prices.php trunk/PricesBasedOnMarkUp.php trunk/PricesByCost.php trunk/Prices_Customer.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SMTPServer.php trunk/SalesAnalReptCols.php trunk/SalesAnalRepts.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategories.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesGLPostings.php trunk/SalesGraph.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SalesTypes.php trunk/SecurityTokens.php trunk/SelectCompletedOrder.php trunk/SelectContract.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectGLAccount.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SelectSupplier.php trunk/SelectWorkOrder.php trunk/ShipmentCosting.php trunk/Shipments.php trunk/Shippers.php trunk/Shipt_Select.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/StockCategories.php trunk/StockCheck.php trunk/StockCostUpdate.php trunk/StockCounts.php trunk/StockDispatch.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/StockReorderLevel.php trunk/StockSerialItemResearch.php trunk/StockStatus.php trunk/StockTransfers.php trunk/StockUsage.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/SupplierAllocations.php trunk/SupplierBalsAtPeriodEnd.php trunk/SupplierContacts.php trunk/SupplierCredit.php trunk/SupplierInquiry.php trunk/SupplierInvoice.php trunk/SupplierTenders.php trunk/SupplierTransInquiry.php trunk/SupplierTypes.php trunk/Suppliers.php trunk/SystemParameters.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php trunk/UserSettings.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/Z_BottomUpCosts.php trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/Z_ChangeStockCategory.php trunk/Z_ChangeStockCode.php trunk/Z_CheckDebtorsControl.php trunk/Z_CreateCompanyTemplateFile.php trunk/Z_DataExport.php trunk/Z_DeleteSalesTransActions.php trunk/Z_ImportChartOfAccounts.php trunk/Z_ImportGLAccountGroups.php trunk/Z_ImportGLAccountSections.php trunk/Z_ImportPartCodes.php trunk/Z_MakeNewCompany.php trunk/Z_ReApplyCostToSA.php trunk/Z_RePostGLFromPeriod.php trunk/Z_ReverseSuppPaymentRun.php trunk/Z_UpdateChartDetailsBFwd.php trunk/Z_Upgrade3.10.php trunk/Z_Upgrade_3.04-3.05.php trunk/Z_Upgrade_3.05-3.06.php trunk/Z_Upgrade_3.07-3.08.php trunk/Z_Upgrade_3.08-3.09.php trunk/Z_Upgrade_3.09-3.10.php trunk/Z_Upgrade_3.10-3.11.php trunk/Z_Upgrade_3.11-4.00.php trunk/Z_poAddLanguage.php trunk/Z_poEditLangHeader.php trunk/Z_poEditLangModule.php trunk/Z_poEditLangRemaining.php trunk/Z_poRebuildDefault.php trunk/api/api_session.inc trunk/config.distrib.php trunk/doc/Manual/ManualContents.php trunk/doc/Manual/ManualGettingStarted.html trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsExisting.php trunk/includes/InputSerialItemsKeyed.php trunk/includes/InputSerialItemsSequential.php trunk/includes/Login.php trunk/includes/OutputSerialItems.php trunk/includes/header.inc trunk/includes/session.inc trunk/includes/tcpdf/config/tcpdf_config.php trunk/includes/tcpdf/config/tcpdf_config_alt.php trunk/index.php trunk/install/save.php trunk/locale/de_DE.utf8/Manual/ManualContents.php trunk/locale/de_DE.utf8/Manual/ManualGettingStarted.html trunk/locale/zh_CN.utf8/Manual/ManualContents.php trunk/locale/zh_CN.utf8/Manual/ManualGettingStarted.html trunk/locale/zh_HK.utf8/Manual/ManualContents.php trunk/locale/zh_HK.utf8/Manual/ManualGettingStarted.html trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php Removed Paths: ------------- trunk/phpinfo.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AccountGroups.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -263,8 +263,8 @@ <td>' . $myrow[2] . '</td> <td>' . $PandLText . '</td> <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -272,12 +272,12 @@ if (isset($_POST['SelectedAccountGroup']) OR isset($_GET['SelectedAccountGroup'])) { - echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Account Groups') . '</a></div>'; + echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Review Account Groups') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<br /><form method="post" id="AccountGroups" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AccountSections.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -193,11 +193,11 @@ } echo '<td>' . $myrow[0] . '</td><td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; if ( $myrow[0] == '1' || $myrow[0] == '2' ) { echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; } echo '</tr>'; } //END WHILE LIST LOOP @@ -206,12 +206,12 @@ if (isset($_POST['SelectedSectionID']) or isset($_GET['SelectedSectionID'])) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Account Sections') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Review Account Sections') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<form method="post" name="AccountSections" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" name="AccountSections" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedSectionID'])) { Modified: trunk/AddCustomerContacts.php =================================================================== --- trunk/AddCustomerContacts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerContacts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -154,10 +154,10 @@ $myrow['email'], $myrow['email'], $myrow['notes'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno']); @@ -166,12 +166,12 @@ echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo .'">' . _('Review all contacts for this Customer') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo .'">' . _('Review all contacts for this Customer') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AddCustomerNotes.php =================================================================== --- trunk/AddCustomerNotes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerNotes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -135,10 +135,10 @@ $myrow[3], $myrow[2], $myrow[5], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1]); @@ -147,13 +147,13 @@ echo '</table>'; } if (isset($Id)) { - echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; + echo '<div class="centre"><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . '&DebtorNo='.$DebtorNo.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AddCustomerTypeNotes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -126,10 +126,10 @@ $myrow[3], $myrow[2], $myrow[5], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], $myrow[1]); @@ -138,14 +138,14 @@ echo '</table>'; } if (isset($Id)) { ?> - <div class="cantre"><a href="<?php echo $_SERVER['PHP_SELF'] . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> + <div class="cantre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'&DebtorType='.$DebtorType;?>"><?=_('Review all notes for this Customer Type')?></a></div> <?php } ?> <p> <?php if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorType='.$DebtorType.'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorType='.$DebtorType.'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($Id)) { Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AgedDebtors.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -457,7 +457,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AgedSuppliers.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -271,7 +271,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form sction="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form sction="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Areas.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -161,8 +161,8 @@ } echo '<td>' . $myrow[0] . '</td> <td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP @@ -172,13 +172,13 @@ //end of ifs and buts! if (isset($SelectedArea)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Areas Defined') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Review Areas Defined') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"><br />'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '"><br />'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedArea)) { Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/AuditTrail.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -34,7 +34,7 @@ // Get list of users $UserResult = DB_query("SELECT userid FROM www_users",$db); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMExtendedQty.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -260,7 +260,7 @@ echo '<br /> <br /> - <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr> Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMIndented.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -247,7 +247,7 @@ echo '<br /> <br /> - <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Part') . ':</td> Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMIndentedReverse.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -236,7 +236,7 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<br /> <br /> - <form action=' . $_SERVER['PHP_SELF'] . ' method="post"> + <form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Part') . ':</td> Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -13,7 +13,7 @@ } if (!isset($_POST['StockID'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><b><br /></b>'. + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"><b><br /></b>'. '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to view the costed bill of materials') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . Modified: trunk/BOMListing.php =================================================================== --- trunk/BOMListing.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMListing.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -112,7 +112,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="POST"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BOMs.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -113,7 +113,7 @@ $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); - $DrillLink = $_SERVER['PHP_SELF'] . '?'; + $DrillLink = htmlspecialchars($_SERVER['PHP_SELF']) . '?'; $DrillID=$myrow[0]; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ @@ -155,12 +155,12 @@ ConvertSQLDate($myrow[6]), $AutoIssue, $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, $myrow[0], $DrillLink, $DrillID, - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $Parent, $myrow[0], $UltimateParent); @@ -413,7 +413,7 @@ break; } - echo '<br /><div class=centre><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select a Different BOM') . '</a></div><br />'; + echo '<br /><div class=centre><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Select a Different BOM') . '</a></div><br />'; echo '<table class="selection">'; // Display Manufatured Parent Items $sql = "SELECT bom.parent, @@ -432,7 +432,7 @@ if( DB_num_rows($result) > 0 ) { echo '<tr><td><div class="centre">'._('Manufactured parent items').' : '; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -455,7 +455,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -477,7 +477,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Kit sets').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -499,7 +499,7 @@ echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Phantom').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ - echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?Select='.$myrow['parent'].'">'. + echo (($ix)?', ':'').'<a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?Select='.$myrow['parent'].'">'. $myrow['description'].' ('.$myrow['parent'].')</a>'; $ix++; } //end while loop @@ -559,7 +559,7 @@ if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?Select=' . $SelectedParent .'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Select=' . $SelectedParent .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedComponent']) and $InputError !=1) { @@ -825,7 +825,7 @@ if (!isset($SelectedParent)) { 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">' . + echo '<form action="' . htmlspecialchars($_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> <br /> <table class="selection" cellpadding="3" colspan="4"> Modified: trunk/BackupDatabase.php =================================================================== --- trunk/BackupDatabase.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BackupDatabase.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -44,7 +44,7 @@ prnMsg(_('Once you have downloaded the database backup file to your local machine you should use the link below to delete it - backup files can consume a lot of space on your hosting account and will accumulate if not deleted - they also contain sensitive information which would otherwise be available for others to download!'),'info'); echo '<br /> <br /> - <a href="'. $_SERVER['PHP_SELF'] . '?BackupFile=' .$BackupFile .'">' . _('Delete the backup file off the server') . '</a>'; + <a href="'. htmlspecialchars($_SERVER['PHP_SELF']) . '?BackupFile=' .$BackupFile .'">' . _('Delete the backup file off the server') . '</a>'; } else { prnMsg(_('There was some problem producing a backup using mysqldump. Normally this relates to a permissions issue - the web-server user must have permission to write to the companies directory'),'error'); } Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankAccounts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -231,9 +231,9 @@ $myrow['bankaddress'], $myrow['currcode'], $DefaultBankAccount, - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['accountcode'], - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['accountcode']); } @@ -245,11 +245,11 @@ if (isset($SelectedBankAccount)) { echo '<br />'; - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Bank Accounts Defined') . '</a></div>'; + echo '<div class="centre"><p><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show All Bank Accounts Defined') . '</a></div>'; echo '<br />'; } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedBankAccount) AND !isset($_GET['delete'])) { Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankMatching.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -77,7 +77,7 @@ echo '<div class="page_help_text">' . _('Use this screen to match webERP Receipts and Payments to your Bank Statement. Check your bank statement and click the check-box when you find the matching transaction.') . '</div><br />'; -echo '<form action="'. $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="Type" value="' . $Type . '">'; Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/BankReconciliation.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -8,7 +8,7 @@ include('includes/header.inc'); -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/COGSGLPostings.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -110,9 +110,9 @@ $myrow['stkcat'], $myrow['salestype'], $myrow['accountname'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id'], - $_SERVER['PHP_SELF']. '?', + htmlspecialchars($_SERVER['PHP_SELF']). '?', $myrow['id']); }//end while echo '</table>'; @@ -208,9 +208,9 @@ $myrow['stkcat'], $myrow['salestype'], $myrow['salestype'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['id']); }//END WHILE LIST LOOP @@ -220,12 +220,12 @@ //end of ifs and buts! if (isset($SelectedCOGSPostingID)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Show all cost of sales posting records') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Show all cost of sales posting records') . '</a></div>'; } echo '<br />'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedCOGSPostingID)) { Modified: trunk/CompanyPreferences.php =================================================================== --- trunk/CompanyPreferences.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CompanyPreferences.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -153,7 +153,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ConfirmDispatch_Invoice.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -252,7 +252,7 @@ </table> <br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*************************************************************** Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractBOM.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -219,7 +219,7 @@ /* This is where the order as selected should be displayed reflecting any deletions or insertions*/ -echo '<form name="ContractBOMForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '" method="post">'; +echo '<form name="ContractBOMForm" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (count($_SESSION['Contract'.$identifier]->ContractBOM)>0){ @@ -263,7 +263,7 @@ <td>' . $ContractComponent->UOM . '</td> <td class="number">' . $ContractComponent->ItemCost . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractCosting.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -428,7 +428,7 @@ if ($_SESSION['Contract'.$identifier]->Status ==2){//the contract is an order being processed now - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' .SID .'&SelectedContract=' . $_SESSION['Contract'.$identifier]->ContractRef . '&identifier=' . $identifier . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><div class="centre"><input type="submit" name="CloseContract" value="' . _('Close Contract') . '" onclick="return confirm(\'' . _('Closing the contract will prevent further stock being issued to it and charges being made against it. Variances will be taken to the profit and loss account. Are You Sure?') . '\');" /></div>'; echo '</form>'; Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/ContractOtherReqts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -75,7 +75,7 @@ /* This is where the other requirement as entered/modified should be displayed reflecting any deletions or insertions*/ -echo '<form name="ContractReqtsForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '" method="post">'; +echo '<form name="ContractReqtsForm" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier. '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract Other Requirements') . '" alt="" /> ' . _('Contract Other Requirements') . ' - ' . $_SESSION['Contract'.$identifier]->CustomerName.'</p>'; @@ -114,7 +114,7 @@ <td><input type="text" class="number" name="Qty' . $ContractReqtID . '" size="11" value="' . $ContractComponent->Quantity . '" /></td> <td><input type="text" class="number" name="CostPerUnit' . $ContractReqtID . '" size="11" value="' . $ContractComponent->CostPerUnit . '" /></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Contracts.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -748,7 +748,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />' . ' ' . _('Contract: Select Customer') . '</p>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier .'" name="CustomerSelection" method="post">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier=' . $identifier .'" name="CustomerSelection" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding="3" colspan="4" class="selection"> @@ -816,7 +816,7 @@ //end if RequireCustomerSelection } else { /*A customer is already selected so get into the contract setup proper */ - echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post">'; + echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier=' . $identifier . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"> Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CounterSales.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -213,7 +213,7 @@ echo '<br /><br />'; prnMsg(_('This sale has been cancelled as requested'),'success'); - echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a>'; + echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Start a new Counter Sale') . '</a>'; include('includes/footer.inc'); exit; @@ -362,7 +362,7 @@ /* Always do the stuff below */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" name="SelectParts" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '" name="SelectParts" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; //Get The exchange rate used for GPPercent calculations on adding or amending items @@ -809,7 +809,7 @@ $_SESSION['Items'.$identifier]->TaxGLCodes=$TaxGLCodes; echo '<td class="number">' . locale_number_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; echo '<td class="number">' . locale_number_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ echo $RowStarter; @@ -1970,7 +1970,7 @@ } else { echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />'; } - echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a></div>'; + echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Start a new Counter Sale') . '</a></div>'; } // There were input errors so don't process nuffin @@ -2186,7 +2186,7 @@ if (isset($SearchResult)) { $j = 1; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '" method="post" name="orderform">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID .'identifier='.$identifier . '" method="post" name="orderform">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="table1">'; echo '<tr><td><input type="hidden" name="previous" value="'.strval($Offset-1).'" /><input tabindex="'.strval($j+7).'" type="submit" name="Prev" value="'._('Prev').'" /></td>'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CreditStatus.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -175,9 +175,9 @@ $myrow['reasoncode'], $myrow['reasondescription'], $DissallowText, - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['reasoncode'], - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $myrow['reasoncode']); } //END WHILE LIST LOOP @@ -186,12 +186,12 @@ } //end of ifs and buts! if (isset($SelectedReason)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; + echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show Defined Credit Status Codes') . '</a></div>'; } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedReason) and ($InputError!=1)) { Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Credit_Invoice.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -256,7 +256,7 @@ if (!isset($_POST['ProcessCredit'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -378,7 +378,7 @@ echo '<td class="number">' . $DisplayTaxAmount . '</td> <td class="number">' . $DisplayGrossLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the credit?') . '\');">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $LnItm->LineNumber . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the credit?') . '\');">' . _('Delete') . '</a></td></tr>'; echo '<tr' . $RowStarter . '><td colspan="12"><textarea tabindex=' . $j .' name="Narrative_' . $LnItm->LineNumber . '" cols=100% rows=1>' . $LnItm->Narrative . '</textarea><br /><hr></td></tr>'; $j++; Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Currencies.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -264,10 +264,10 @@ $myrow['decimalplaces'], locale_number_format($myrow['rate'],5), locale_number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Edit'), - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['currabrev'], _('Delete'), $rootpath, @@ -298,14 +298,14 @@ if (isset($SelectedCurrency)) { - echo '<div class="centre"><a href="' .$_SERVER['PHP_SELF'] . '">'._('Show all currency definitions').'</a></div>'; + echo '<div class="centre"><a href="' .htmlspecialchars($_SERVER['PHP_SELF']) . '">'._('Show all currency definitions').'</a></div>'; } echo '<br />'; if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedCurrency) AND $SelectedCurrency!='') { Modified: trunk/CustEDISetup.php =================================================================== --- trunk/CustEDISetup.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustEDISetup.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -69,7 +69,7 @@ } } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustLoginSetup.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -112,7 +112,7 @@ } -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"> Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustWhereAlloc.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -6,7 +6,7 @@ $title = _('Customer How Paid Inquiry'); include('includes/header.inc'); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . htmlspecialchars($_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/money_add.png" title="' . Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerAllocations.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -336,7 +336,7 @@ if (isset($_POST['AllocTrans'])) { // Page called with trans number - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type=hidden name="AllocTrans" value="' . $_POST['AllocTrans'] . '" />'; @@ -473,7 +473,7 @@ <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class=number>' . locale_number_format($myrow['total'],2) . '</td> <td class=number>' . locale_number_format($myrow['total']-$myrow['alloc'],2) . '</td>'; - echo '<td><a href=' . $_SERVER['PHP_SELF']. '?AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a></td></tr>'; + echo '<td><a href=' . htmlspecialchars($_SERVER['PHP_SELF']). '?AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a></td></tr>'; } DB_free_result($result); echo '</table><p>'; @@ -511,7 +511,7 @@ $k=0; while ($myrow = DB_fetch_array($result)) { - $allocate = '<a href=' . $_SERVER['PHP_SELF']. '?' . SID . '&AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a>'; + $allocate = '<a href=' . htmlspecialchars($_SERVER['PHP_SELF']). '?' . SID . '&AllocTrans=' . $myrow['id'] . '>' . _('Allocate') . '</a>'; if ( $curDebtor != $myrow['debtorno'] ) { if ( $curTrans > 1 ) { Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerBranches.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -408,11 +408,11 @@ $myrow[8], $myrow[9], ($myrow[11]?_('No'):_('Yes')), - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $DebtorNo, urlencode($myrow[1]), _('Edit'), - $_SERVER['PHP_SELF'], + htmlspecialchars($_SERVER['PHP_SELF']), $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); @@ -456,7 +456,7 @@ } if (!isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedBranch)) { @@ -532,7 +532,7 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Change Details for Branch'). ' '. $SelectedBranch . '</p>'; if (isset($SelectedBranch)) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; + echo '<div class="centre"><a href=' . htmlspecialchars($_SERVER['PHP_SELF']) . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; } echo '<br /><table class="selection">'; echo '<tr><th colspan=2><div class="centre"><b>'._('Change Branch').'</b></th></tr>'; Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -147,7 +147,7 @@ </tr> </table>'; -echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<br /><div class="centre"><form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Show all transactions after') . ': <input tabindex=1 type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div> </form> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerReceipt.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -702,7 +702,7 @@ /*set up the form whatever */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ @@ -862,7 +862,7 @@ <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>'.$ReceiptItem->GLCode.' - '.$myrow['accountname'].'</td> <td>'.$ReceiptItem->Narrative . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> </tr>'; $BatchTotal= $BatchTotal + $ReceiptItem->Amount; } Modified: trunk/CustomerTransInquiry.php =================================================================== --- trunk/CustomerTransInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerTransInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ echo '<div class="page_help_text">' . _('Choose which type of transaction to report on.') . '</div> <br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class=selection><tr>'; Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/CustomerTypes.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -204,9 +204,9 @@ </tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -216,11 +216,11 @@ //end of ifs and buts! if (isset($SelectedType)) { - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Types Defined') . '</a></div><p>'; + echo '<div class="centre"><p><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Show All Types Defined') . '</a></div><p>'; } if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class=selection>'; //Main table Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/Customers.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -443,11 +443,11 @@ } if ($SetupErrors>0) { - echo '<br /><div class=centre><a href="'.$_SERVER['PHP_SELF'] .'" >'._('Click here to continue').'</a></div>'; + echo '<br /><div class=centre><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) .'" >'._('Click here to continue').'</a></div>'; include('includes/footer.inc'); exit; } - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="New" value="Yes" />'; @@ -618,7 +618,7 @@ //DebtorNo exists - either passed when calling the form or from the form itself - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection cellspacing=4> <tr><td valign=top><table class=selection>'; @@ -981,7 +981,7 @@ $myrow['notes'], $myrow['contid'], $myrow['debtorno'], - $_SERVER['PHP_SELF'] . '?', + htmlspecialchars($_SERVER['PHP_SELF']) . '?', $myrow['contid'], $myrow['debtorno']); } Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DailyBankTransactions.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; @@ -132,7 +132,7 @@ echo '</table>'; } //end if no bank trans in the range to show - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DailySalesInquiry.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -10,7 +10,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="" />' . ' ' . _('Daily Sales') . '</p>'; echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div><br />'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class=selection><tr>'; Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2011-10-28 05:07:04 UTC (rev 4733) +++ trunk/DebtorsAtPeriodEnd.php 2011-10-29 03:26:27 UTC (rev 4734) @@ -129,7 +129,7 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/DeliveryDetails.php =================================================================== --- ... [truncated message content] |
From: <dai...@us...> - 2011-10-28 05:07:11
|
Revision: 4733 http://web-erp.svn.sourceforge.net/web-erp/?rev=4733&view=rev Author: daintree Date: 2011-10-28 05:07:04 +0000 (Fri, 28 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/OrderDetails.php trunk/OutstandingGRNs.php trunk/Payments.php Modified: trunk/OrderDetails.php =================================================================== --- trunk/OrderDetails.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/OrderDetails.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -52,67 +52,74 @@ $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg, $DbgMsg); if (DB_num_rows($GetOrdHdrResult)==1) { - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Order Details') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Order Details') . '" alt="" />' . ' ' . $title . ' + </p>'; $myrow = DB_fetch_array($GetOrdHdrResult); $CurrDecimalPlaces = $myrow['decimalplaces']; - echo '<table class="selection">'; - echo '<tr><th colspan=4><font color=blue>'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; - echo '<tr> - <th style="text-align: left">' . _('Customer Code') . ':</th> - <td class="OddTableRows"><font><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></td> - <th style="text-align: left">' . _('Customer Name') . ':</th><td><font>' . $myrow['name'] . '</td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Customer Reference') . ':</th> - <td class="OddTableRows"><font>' . $myrow['customerref'] . '</font></td> - <th style="text-align: left">' . _('Deliver To') . ':</th><td><font>' . $myrow['deliverto'] . '</td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Ordered On') . ':</th> - <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['orddate']) . '</font></td> - <th style="text-align: left">' . _('Delivery Address 1') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd1'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Requested Delivery') . ':</th> - <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['deliverydate']) . '</font></td> - <th style="text-align: left">' . _('Delivery Address 2') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd2'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left"h>' . _('Order Currency') . ':</th> - <td class="OddTableRows"><font>' . $myrow['currcode'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 3') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd3'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Deliver From Location') . ':</th> - <td class="OddTableRows"><font>' . $myrow['fromstkloc'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 4') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd4'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Telephone') . ':</th> - <td class="OddTableRows"><font>' . $myrow['contactphone'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 5') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd5'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Email') . ':</th> - <td class="OddTableRows"><font><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></font></td> - <th style="text-align: left">' . _('Delivery Address 6') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd6'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Freight Cost') . ':</th> - <td class="OddTableRows"><font>' . $myrow['freightcost'] . '</font></td> - </tr>'; - echo '<tr><th style="text-align: left">'._('Comments'). ': '; - echo '</th><td colspan=3>'.$myrow['comments'] . '</td></tr>'; - echo '</table>'; + echo '<table class="selection"> + <tr> + <th colspan="4"><font color="blue">'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th> + </tr> + <tr> + <th style="text-align: left">' . _('Customer Code') . ':</th> + <td class="OddTableRows"><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></td> + <th style="text-align: left">' . _('Customer Name') . ':</th> + <th>' . $myrow['name'] . '</th> + </tr> + <tr> + <th style="text-align: left">' . _('Customer Reference') . ':</th> + <td class="OddTableRows">' . $myrow['customerref'] . '</td> + <th style="text-align: left">' . _('Deliver To') . ':</th> + <th>' . $myrow['deliverto'] . '</th> + </tr> + <tr> + <th style="text-align: left">' . _('Ordered On') . ':</th> + <td class="OddTableRows">' . ConvertSQLDate($myrow['orddate']) . '</td> + <th style="text-align: left">' . _('Delivery Address 1') . ':</th> + <td class="OddTableRows">' . $myrow['deladd1'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Requested Delivery') . ':</th> + <td class="OddTableRows">' . ConvertSQLDate($myrow['deliverydate']) . '</td> + <th style="text-align: left">' . _('Delivery Address 2') . ':</th> + <td class="OddTableRows">' . $myrow['deladd2'] . '</td> + </tr> + <tr> + <th style="text-align: left"h>' . _('Order Currency') . ':</th> + <td class="OddTableRows">' . $myrow['currcode'] . '</td> + <th style="text-align: left">' . _('Delivery Address 3') . ':</th> + <td class="OddTableRows">' . $myrow['deladd3'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Deliver From Location') . ':</th> + <td class="OddTableRows">' . $myrow['fromstkloc'] . '</td> + <th style="text-align: left">' . _('Delivery Address 4') . ':</th> + <td class="OddTableRows">' . $myrow['deladd4'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Telephone') . ':</th> + <td class="OddTableRows">' . $myrow['contactphone'] . '</td> + <th style="text-align: left">' . _('Delivery Address 5') . ':</th> + <td class="OddTableRows">' . $myrow['deladd5'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Email') . ':</th> + <td class="OddTableRows"><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></td> + <th style="text-align: left">' . _('Delivery Address 6') . ':</th> + <td class="OddTableRows">' . $myrow['deladd6'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Freight Cost') . ':</th> + <td class="OddTableRows">' . $myrow['freightcost'] . '</td> + </tr> + <tr> + <th style="text-align: left">'._('Comments'). ': </th> + <td colspan="3">'.$myrow['comments'] . '</td> + </tr> + </table>'; } /*Now get the line items */ @@ -146,9 +153,12 @@ $OrderTotalVolume = 0; $OrderTotalWeight = 0; - echo '<br /><table cellpadding=2 colspan=9 class=selection>'; - echo '<tr><th colspan=9><font color=blue>'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> + <th colspan="9"><font color="blue">'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th> + </tr> + <tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -178,18 +188,18 @@ echo '<td>' . $myrow['stkcode'] . '</td> <td>' . $myrow['description'] . '</td> - <td class=number>' . $myrow['quantity'] . '</td> + <td class="number">' . $myrow['quantity'] . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . locale_number_format($myrow['unitprice'],$CurrDecimalPlaces) . '</td> - <td class=number>' . locale_number_format(($myrow['discountpercent'] * 100),2) . '%' . '</td> - <td class=number>' . locale_number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),$CurrDecimalPlaces) . '</td> - <td class=number>' . locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['unitprice'],$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($myrow['discountpercent'] * 100),2) . '%' . '</td> + <td class="number">' . locale_number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']) . '</td> <td>' . $DisplayActualDeliveryDate . '</td> </tr>'; - $OrderTotal = $OrderTotal + $myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']); - $OrderTotalVolume = $OrderTotalVolume + $myrow['quantity'] * $myrow['volume']; - $OrderTotalWeight = $OrderTotalWeight + $myrow['quantity'] * $myrow['kgs']; + $OrderTotal += ($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent'])); + $OrderTotalVolume += ($myrow['quantity'] * $myrow['volume']); + $OrderTotalWeight += ($myrow['quantity'] * $myrow['kgs']); } $DisplayTotal = locale_number_format($OrderTotal,$CurrDecimalPlaces); @@ -197,12 +207,13 @@ $DisplayWeight = locale_number_format($OrderTotalWeight,2); echo '<tr> - <td colspan=5 class=number><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> - <td colspan=2 class=number>' . $DisplayTotal . '</td> + <td colspan="5" class="number"><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> + <td colspan="2" class="number">' . $DisplayTotal . '</td> </tr> - </table>'; + </table>'; - echo '<br /><table class=selection> + echo '<br /> + <table class="selection"> <tr> <td>' . _('Total Weight') . ':</td> <td>' . $DisplayWeight . '</td> Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/OutstandingGRNs.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -160,22 +160,22 @@ 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"> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr> <td>' . _('From Supplier Code') . ':</td> - <td><input type="text" name="FromCriteria" value="0"></td> + <td><input type="text" name="FromCriteria" value="0" /></td> </tr> <tr> <td>' . _('To Supplier Code'). ':</td> - <td><input type="text" name="ToCriteria" value="zzzzzzz"></td> + <td><input type="text" name="ToCriteria" value="zzzzzzz" /></td> </tr> </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/Payments.php =================================================================== --- trunk/Payments.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/Payments.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -36,11 +36,13 @@ $BankAccountEmpty=FALSE; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Payment Entry') - . '" alt="" />' . ' ' . _('Payment Entry') . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Payment Entry') +. '" alt="" />' . ' ' . _('Payment Entry') . ' + </p>'; echo '<div class="page_help_text">' . _('Use this screen to enter payments FROM your bank account. <br />Note: To enter a payment FROM a supplier, first select the Supplier, click Enter a Payment to, or Receipt from the Supplier, and use a negative Payment amount on this form.') . '</div> - <br /> - <div class="centre">'; + <br /> + <div class="centre">'; if (isset($_GET['SupplierID'])){ /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ @@ -94,7 +96,7 @@ $FactorResult = DB_query($factorsql, $db); $myfactorrow = DB_fetch_array($FactorResult); - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . _(' care of ') . $myfactorrow['coyname']; + $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; $_SESSION['PaymentDetail']->Address1 = $myfactorrow['address1']; $_SESSION['PaymentDetail']->Address2 = $myfactorrow['address2']; $_SESSION['PaymentDetail']->Address3 = $myfactorrow['address3']; @@ -150,12 +152,12 @@ if ($_POST['Currency']==$_SESSION['PaymentDetail']->AccountCurrency){ $_POST['ExRate']=1; - $_SESSION['PaymentDetail']->ExRate=$_POST['ExRate']; //ex rate between payment currency and account currency + $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency $SuggestedExRate=1; } if ($_SESSION['PaymentDetail']->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ $_POST['FunctionalExRate']=1; - $_SESSION['PaymentDetail']->FunctionalExRate=$_POST['FunctionalExRate']; + $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); $SuggestedFunctionalExRate =1; $SuggestedExRate = $tableExRate; @@ -196,7 +198,7 @@ } } if (isset($_POST['Discount']) AND $_POST['Discount']!=''){ - $_SESSION['PaymentDetail']->Discount=$_POST['Discount']; + $_SESSION['PaymentDetail']->Discount=filter_number_format($_POST['Discount']); } else { if (!isset($_SESSION['PaymentDetail']->Discount)) { $_SESSION['PaymentDetail']->Discount=0; @@ -450,7 +452,7 @@ $DbgMsg = _('Cannot update the supplier record for the date of the last payment made using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . "-" . $_SESSION['PaymentDetail']->Narrative; + $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . '-' . $_SESSION['PaymentDetail']->Narrative; if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the supplier control GLTrans */ /* Now debit creditors account with payment + discount */ @@ -507,14 +509,14 @@ periodno, account, narrative, - amount) "; - $SQL = $SQL . "VALUES ('" . $Transtype . "', - '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $PeriodNo . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; + amount) + VALUES ('" . $Transtype . "', + '" . $TransNo . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $PeriodNo . "', + '" . $_SESSION['PaymentDetail']->Account . "', + '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; $ErrMsg = _('Cannot insert a GL transaction for the bank account credit because'); $DbgMsg = _('Cannot insert a GL transaction for the bank account credit using the SQL'); @@ -534,8 +536,8 @@ transdate, banktranstype, amount, - currcode) "; - $SQL= $SQL . "VALUES ('" . $TransNo . "', + currcode) + VALUES ('" . $TransNo . "', '" . $Transtype . "', '" . $_SESSION['PaymentDetail']->Account . "', '" . $_SESSION['PaymentDetail']->Narrative . "', @@ -561,18 +563,17 @@ transdate, banktranstype, amount, - currcode) "; - $SQL= $SQL . "VALUES ('" . $TransNo . "', - '" . $Transtype . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . -$PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' - )"; + currcode) + VALUES ('" . $TransNo . "', + '" . $Transtype . "', + '" . $_SESSION['PaymentDetail']->Account . "', + '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . $_SESSION['PaymentDetail']->ExRate . "', + '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . -$PaymentItem->Amount . "', + '" . $_SESSION['PaymentDetail']->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); @@ -635,7 +636,7 @@ prnMsg( _('The Cheque/Voucher number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); } else { $myrow = DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], + $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], @@ -651,7 +652,7 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], + $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], @@ -675,7 +676,10 @@ $_POST['DatePaid'] = ''; } -if (isset($_POST['DatePaid']) AND ($_POST['DatePaid']=='' OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ +if (isset($_POST['DatePaid']) + AND ($_POST['DatePaid']=='' + OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ + $_POST['DatePaid']= Date($_SESSION['DefaultDateFormat']); $_SESSION['PaymentDetail']->DatePaid = $_POST['DatePaid']; } @@ -706,8 +710,7 @@ } } - -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><table class="selection">'; @@ -734,11 +737,15 @@ $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td> +echo '<tr> + <td>' . _('Bank Account') . ':</td> <td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>'; + echo '</select></td> + </tr> + </table> + <p />'; prnMsg( _('Bank Accounts have not yet been defined. You must first') . ' <a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a> ' . _('and general ledger accounts to be affected'),'warn'); include('includes/footer.inc'); exit; @@ -752,11 +759,13 @@ echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } -echo '<tr><td>' . _('Date Paid') . ':</td> - <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '"></td> +echo '<tr> + <td>' . _('Date Paid') . ':</td> + <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '" /></td> </tr>'; @@ -767,7 +776,8 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg( _('No currencies are defined yet. Payments cannot be entered until a currency is defined'),'error'); } else { while ($myrow=DB_fetch_array($result)){ @@ -777,17 +787,22 @@ echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } } - echo '</select></td><td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td></tr>'; + echo '</select></td> + <td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td> + </tr>'; } } else { /*its a supplier payment so it must be in the suppliers currency */ - echo '<tr><td>' . _('Supplier Currency') . ':</td><td>' . $_SESSION['PaymentDetail']->Currency . '</td></tr>'; - echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '">'; + echo '<tr> + <td>' . _('Supplier Currency') . ':</td> + <td>' . $_SESSION['PaymentDetail']->Currency . '</td> + </tr>'; + echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '" />'; /*get the default rate from the currency table if it has not been set */ if (!isset($_POST['ExRate']) OR $_POST['ExRate']==''){ $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency ."'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_row($Result); - $_POST['ExRate']=$myrow[0]; + $_POST['ExRate']=locale_number_format($myrow[0],'Variable'); } } @@ -801,33 +816,38 @@ } if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['PaymentDetail']->Currency AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ if (isset($SuggestedExRate)){ - $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,4) . '</b>'; + $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,6) . '</b>'; } else { $SuggestedExRateText =''; } if ($_POST['ExRate']==1 AND isset($SuggestedExRate)){ $_POST['ExRate'] = $SuggestedExRate; } - echo '<tr><td>' . _('Payment Exchange Rate') . ':</td> - <td><input class=number type="text" name="ExRate" maxlength=10 size=12 value="' . $_POST['ExRate'] . '"></td> - <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td></tr>'; + echo '<tr> + <td>' . _('Payment Exchange Rate') . ':</td> + <td><input class="number" type="text" name="ExRate" maxlength="10" size="12" value="' . $_POST['ExRate'] . '" /></td> + <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td> + </tr>'; } if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ if (isset($SuggestedFunctionalExRate)){ - $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,4) . '</b>'; + $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,6) . '</b>'; } else { $SuggestedFunctionalExRateText =''; } if ($_POST['FunctionalExRate']==1 AND isset($SuggestedFunctionalExRate)){ - $_POST['FunctionalExRate'] = $SuggestedFunctionalExRate; + $_POST['FunctionalExRate'] = locale_number_format($SuggestedFunctionalExRate,'Variable'); } - echo '<tr><td>' . _('Functional Exchange Rate') . ':</td> - <td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '" /></td> - <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td></tr>'; + echo '<tr> + <td>' . _('Functional Exchange Rate') . ':</td> + <td><input type="text" name="FunctionalExRate" maxlength="10" size="12" value="' . $_POST['FunctionalExRate'] . '" /></td> + <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td> + </tr>'; } -echo '<tr><td>' . _('Payment type') . ':</td> +echo '<tr> + <td>' . _('Payment type') . ':</td> <td><select name="Paymenttype">'; include('includes/GetPaymentMethods.php'); @@ -842,13 +862,15 @@ echo '<option value="' . $PaytType . '">' . $PaytType . '</option>'; } } //end foreach -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; if (!isset($_POST['ChequeNum'])) { $_POST['ChequeNum']=''; } -echo '<tr><td>' . _('Cheque Number') . ':</td> +echo '<tr> + <td>' . _('Cheque Number') . ':</td> <td><input type="text" name="ChequeNum" maxlength="8" size="10" value="' . $_POST['ChequeNum'] . '" /> ' . _('(if using pre-printed stationery)') . '</td> </tr>'; @@ -856,10 +878,13 @@ $_POST['Narrative']=''; } -echo '<tr><td>' . _('Reference / Narrative') . ':</td> - <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '" /> ' . _('(Max. length 80 characters)') . '</td> - </tr>'; -echo '<tr><td colspan=3><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '" /></td></tr>'; +echo '<tr> + <td>' . _('Reference / Narrative') . ':</td> + <td colspan="2"><input type="text" name="Narrative" maxlength="80" size="82" value="' . $_POST['Narrative'] . '" /> ' . _('(Max. length 80 characters)') . '</td> + </tr>'; +echo '<tr> + <td colspan="3"><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '" /></td> + </tr>'; echo '</table><br />'; @@ -872,7 +897,9 @@ echo '<tr><th colspan="2"><font size="3" color="blue">' . _('General Ledger Payment Analysis Entry') . '</font></th></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 @@ -888,20 +915,25 @@ echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; // End select tag /*now set up a GLCode field to select from avaialble GL accounts */ if (isset($_POST['GLManualCode'])) { - echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text class="number" Name="GLManualCode" maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value='. $_POST['GLManualCode'] .' ></td></tr>'; + echo '<tr> + <td>' . _('Enter GL Account Manually') . ':</td> + <td><input type="text" class="number" name="GLManualCode" maxlength="12" size="12" onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value='. $_POST['GLManualCode'] .' ></td> + </tr>'; } else { - echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; + echo '<tr> + <td>' . _('Enter GL Account Manually') . ':</td> + <td><input type="text" class="number" Name="GLManualCode" maxlength="12" size="12" onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; } - echo '<tr><td>' . _('Select GL Group') . ':</td> - <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; + echo '<tr> + <td>' . _('Select GL Group') . ':</td> + <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; $SQL = "SELECT groupname FROM accountgroups @@ -909,7 +941,8 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg(_('No General ledger account groups have been set up yet') . ' - ' . _('payments cannot be analysed against GL accounts until the GL accounts are set up'),'error'); } else { echo '<option value=""></option>'; @@ -920,7 +953,9 @@ echo '<option value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; } } - echo '</select><input type="submit" name="UpdateCodes" value="Select" /></td></tr>'; + echo '</select> + <input type="submit" name="UpdateCodes" value="Select" /></td> + </tr>'; } if (isset($_POST['GLGroup']) AND $_POST['GLGroup']!='') { @@ -937,8 +972,9 @@ } - echo '<tr><td>' . _('Select GL Account') . ':</td> - <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; + echo '<tr> + <td>' . _('Select GL Account') . ':</td> + <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -956,27 +992,31 @@ echo '</select></td></tr>'; } - echo '<tr><td>'. _('Cheque/Voucher Number') .'</td> - <td><input type="text" name="cheque" maxlength="12" size="12"></td> + echo '<tr> + <td>'. _('Cheque/Voucher Number') .'</td> + <td><input type="text" name="cheque" maxlength="12" size="12" /></td> </tr>'; if (isset($_POST['GLNarrative'])) { - echo '<tr><td>' . _('GL Narrative') . ':</td> + echo '<tr> + <td>' . _('GL Narrative') . ':</td> <td><input type="text" name="GLNarrative" maxlength="50" size="52" value="' . $_POST['GLNarrative'] . '" /></td> </tr>'; } else { - echo '<tr><td>' . _('GL Narrative') . ':</td> + echo '<tr> + <td>' . _('GL Narrative') . ':</td> <td><input type="text" name="GLNarrative" maxlength="50" size="52" /></td> </tr>'; } if (isset($_POST['GLAmount'])) { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> - <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value=' . $_POST['GLAmount'] . '></td> + echo '<tr> + <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value="' . $_POST['GLAmount'] . '" /></td> </tr>'; } else { echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> - <td><input type="text" name="GLAmount" Maxlength="12" size="12" class="number"></td> + <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" /></td> </tr>'; } @@ -1010,7 +1050,7 @@ echo '<tr> <td align=left>' . $PaymentItem->cheque . '</td> - <td class=number>' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->tag . ' - ' . $TagName . '</td> @@ -1018,20 +1058,33 @@ </tr>'; $PaymentTotal += $PaymentItem->Amount; } - echo '<tr><td></td><td class=number><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td><td></td><td></td><td></td></tr></table><br />'; - echo '<input type=submit name="CommitBatch" value="' . _('Accept and Process Payment') . '">'; + echo '<tr> + <td></td> + <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td> + <td></td> + <td></td> + <td></td> + </tr> + </table> + <br />'; + echo '<input type="submit" name="CommitBatch" value="' . _('Accept and Process Payment') . '" />'; } } else { /*a supplier is selected or the GL link is not active then set out the fields for entry of receipt amt and disc */ - echo '<table class=selection><tr><td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> - <td><input class=number type="text" name="Amount" maxlength=12 size=13 value=' . $_SESSION['PaymentDetail']->Amount . '></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> + <td><input class="number" type="text" name="Amount" maxlength=12 size=13 value=' . $_SESSION['PaymentDetail']->Amount . '></td> + </tr>'; if (isset($_SESSION['PaymentDetail']->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ - echo '<tr><td>' . _('Amount of Discount') . ':</td> - <td><input class=number type="text" name="Discount" maxlength=12 size=13 value="' . $_SESSION['PaymentDetail']->Discount . '" /></td></tr>'; + echo '<tr> + <td>' . _('Amount of Discount') . ':</td> + <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Discount . '" /></td> + </tr>'; echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail']->SuppName . '" />'; } else { echo '<input type="hidden" name="discount" Value="0" />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-28 05:07:11
|
Revision: 4733 http://web-erp.svn.sourceforge.net/web-erp/?rev=4733&view=rev Author: daintree Date: 2011-10-28 05:07:04 +0000 (Fri, 28 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/OrderDetails.php trunk/OutstandingGRNs.php trunk/Payments.php Modified: trunk/OrderDetails.php =================================================================== --- trunk/OrderDetails.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/OrderDetails.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -52,67 +52,74 @@ $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg, $DbgMsg); if (DB_num_rows($GetOrdHdrResult)==1) { - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Order Details') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Order Details') . '" alt="" />' . ' ' . $title . ' + </p>'; $myrow = DB_fetch_array($GetOrdHdrResult); $CurrDecimalPlaces = $myrow['decimalplaces']; - echo '<table class="selection">'; - echo '<tr><th colspan=4><font color=blue>'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; - echo '<tr> - <th style="text-align: left">' . _('Customer Code') . ':</th> - <td class="OddTableRows"><font><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></td> - <th style="text-align: left">' . _('Customer Name') . ':</th><td><font>' . $myrow['name'] . '</td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Customer Reference') . ':</th> - <td class="OddTableRows"><font>' . $myrow['customerref'] . '</font></td> - <th style="text-align: left">' . _('Deliver To') . ':</th><td><font>' . $myrow['deliverto'] . '</td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Ordered On') . ':</th> - <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['orddate']) . '</font></td> - <th style="text-align: left">' . _('Delivery Address 1') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd1'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Requested Delivery') . ':</th> - <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['deliverydate']) . '</font></td> - <th style="text-align: left">' . _('Delivery Address 2') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd2'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left"h>' . _('Order Currency') . ':</th> - <td class="OddTableRows"><font>' . $myrow['currcode'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 3') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd3'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Deliver From Location') . ':</th> - <td class="OddTableRows"><font>' . $myrow['fromstkloc'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 4') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd4'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Telephone') . ':</th> - <td class="OddTableRows"><font>' . $myrow['contactphone'] . '</font></td> - <th style="text-align: left">' . _('Delivery Address 5') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd5'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Email') . ':</th> - <td class="OddTableRows"><font><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></font></td> - <th style="text-align: left">' . _('Delivery Address 6') . ':</th> - <td class="OddTableRows"><font>' . $myrow['deladd6'] . '</font></td> - </tr>'; - echo '<tr> - <th style="text-align: left">' . _('Freight Cost') . ':</th> - <td class="OddTableRows"><font>' . $myrow['freightcost'] . '</font></td> - </tr>'; - echo '<tr><th style="text-align: left">'._('Comments'). ': '; - echo '</th><td colspan=3>'.$myrow['comments'] . '</td></tr>'; - echo '</table>'; + echo '<table class="selection"> + <tr> + <th colspan="4"><font color="blue">'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th> + </tr> + <tr> + <th style="text-align: left">' . _('Customer Code') . ':</th> + <td class="OddTableRows"><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></td> + <th style="text-align: left">' . _('Customer Name') . ':</th> + <th>' . $myrow['name'] . '</th> + </tr> + <tr> + <th style="text-align: left">' . _('Customer Reference') . ':</th> + <td class="OddTableRows">' . $myrow['customerref'] . '</td> + <th style="text-align: left">' . _('Deliver To') . ':</th> + <th>' . $myrow['deliverto'] . '</th> + </tr> + <tr> + <th style="text-align: left">' . _('Ordered On') . ':</th> + <td class="OddTableRows">' . ConvertSQLDate($myrow['orddate']) . '</td> + <th style="text-align: left">' . _('Delivery Address 1') . ':</th> + <td class="OddTableRows">' . $myrow['deladd1'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Requested Delivery') . ':</th> + <td class="OddTableRows">' . ConvertSQLDate($myrow['deliverydate']) . '</td> + <th style="text-align: left">' . _('Delivery Address 2') . ':</th> + <td class="OddTableRows">' . $myrow['deladd2'] . '</td> + </tr> + <tr> + <th style="text-align: left"h>' . _('Order Currency') . ':</th> + <td class="OddTableRows">' . $myrow['currcode'] . '</td> + <th style="text-align: left">' . _('Delivery Address 3') . ':</th> + <td class="OddTableRows">' . $myrow['deladd3'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Deliver From Location') . ':</th> + <td class="OddTableRows">' . $myrow['fromstkloc'] . '</td> + <th style="text-align: left">' . _('Delivery Address 4') . ':</th> + <td class="OddTableRows">' . $myrow['deladd4'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Telephone') . ':</th> + <td class="OddTableRows">' . $myrow['contactphone'] . '</td> + <th style="text-align: left">' . _('Delivery Address 5') . ':</th> + <td class="OddTableRows">' . $myrow['deladd5'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Email') . ':</th> + <td class="OddTableRows"><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></td> + <th style="text-align: left">' . _('Delivery Address 6') . ':</th> + <td class="OddTableRows">' . $myrow['deladd6'] . '</td> + </tr> + <tr> + <th style="text-align: left">' . _('Freight Cost') . ':</th> + <td class="OddTableRows">' . $myrow['freightcost'] . '</td> + </tr> + <tr> + <th style="text-align: left">'._('Comments'). ': </th> + <td colspan="3">'.$myrow['comments'] . '</td> + </tr> + </table>'; } /*Now get the line items */ @@ -146,9 +153,12 @@ $OrderTotalVolume = 0; $OrderTotalWeight = 0; - echo '<br /><table cellpadding=2 colspan=9 class=selection>'; - echo '<tr><th colspan=9><font color=blue>'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> + <th colspan="9"><font color="blue">'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th> + </tr> + <tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -178,18 +188,18 @@ echo '<td>' . $myrow['stkcode'] . '</td> <td>' . $myrow['description'] . '</td> - <td class=number>' . $myrow['quantity'] . '</td> + <td class="number">' . $myrow['quantity'] . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . locale_number_format($myrow['unitprice'],$CurrDecimalPlaces) . '</td> - <td class=number>' . locale_number_format(($myrow['discountpercent'] * 100),2) . '%' . '</td> - <td class=number>' . locale_number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),$CurrDecimalPlaces) . '</td> - <td class=number>' . locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['unitprice'],$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($myrow['discountpercent'] * 100),2) . '%' . '</td> + <td class="number">' . locale_number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']) . '</td> <td>' . $DisplayActualDeliveryDate . '</td> </tr>'; - $OrderTotal = $OrderTotal + $myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']); - $OrderTotalVolume = $OrderTotalVolume + $myrow['quantity'] * $myrow['volume']; - $OrderTotalWeight = $OrderTotalWeight + $myrow['quantity'] * $myrow['kgs']; + $OrderTotal += ($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent'])); + $OrderTotalVolume += ($myrow['quantity'] * $myrow['volume']); + $OrderTotalWeight += ($myrow['quantity'] * $myrow['kgs']); } $DisplayTotal = locale_number_format($OrderTotal,$CurrDecimalPlaces); @@ -197,12 +207,13 @@ $DisplayWeight = locale_number_format($OrderTotalWeight,2); echo '<tr> - <td colspan=5 class=number><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> - <td colspan=2 class=number>' . $DisplayTotal . '</td> + <td colspan="5" class="number"><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> + <td colspan="2" class="number">' . $DisplayTotal . '</td> </tr> - </table>'; + </table>'; - echo '<br /><table class=selection> + echo '<br /> + <table class="selection"> <tr> <td>' . _('Total Weight') . ':</td> <td>' . $DisplayWeight . '</td> Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/OutstandingGRNs.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -160,22 +160,22 @@ 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"> + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr> <td>' . _('From Supplier Code') . ':</td> - <td><input type="text" name="FromCriteria" value="0"></td> + <td><input type="text" name="FromCriteria" value="0" /></td> </tr> <tr> <td>' . _('To Supplier Code'). ':</td> - <td><input type="text" name="ToCriteria" value="zzzzzzz"></td> + <td><input type="text" name="ToCriteria" value="zzzzzzz" /></td> </tr> </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/Payments.php =================================================================== --- trunk/Payments.php 2011-10-25 07:54:55 UTC (rev 4732) +++ trunk/Payments.php 2011-10-28 05:07:04 UTC (rev 4733) @@ -36,11 +36,13 @@ $BankAccountEmpty=FALSE; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Payment Entry') - . '" alt="" />' . ' ' . _('Payment Entry') . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Payment Entry') +. '" alt="" />' . ' ' . _('Payment Entry') . ' + </p>'; echo '<div class="page_help_text">' . _('Use this screen to enter payments FROM your bank account. <br />Note: To enter a payment FROM a supplier, first select the Supplier, click Enter a Payment to, or Receipt from the Supplier, and use a negative Payment amount on this form.') . '</div> - <br /> - <div class="centre">'; + <br /> + <div class="centre">'; if (isset($_GET['SupplierID'])){ /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ @@ -94,7 +96,7 @@ $FactorResult = DB_query($factorsql, $db); $myfactorrow = DB_fetch_array($FactorResult); - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . _(' care of ') . $myfactorrow['coyname']; + $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; $_SESSION['PaymentDetail']->Address1 = $myfactorrow['address1']; $_SESSION['PaymentDetail']->Address2 = $myfactorrow['address2']; $_SESSION['PaymentDetail']->Address3 = $myfactorrow['address3']; @@ -150,12 +152,12 @@ if ($_POST['Currency']==$_SESSION['PaymentDetail']->AccountCurrency){ $_POST['ExRate']=1; - $_SESSION['PaymentDetail']->ExRate=$_POST['ExRate']; //ex rate between payment currency and account currency + $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency $SuggestedExRate=1; } if ($_SESSION['PaymentDetail']->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ $_POST['FunctionalExRate']=1; - $_SESSION['PaymentDetail']->FunctionalExRate=$_POST['FunctionalExRate']; + $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); $SuggestedFunctionalExRate =1; $SuggestedExRate = $tableExRate; @@ -196,7 +198,7 @@ } } if (isset($_POST['Discount']) AND $_POST['Discount']!=''){ - $_SESSION['PaymentDetail']->Discount=$_POST['Discount']; + $_SESSION['PaymentDetail']->Discount=filter_number_format($_POST['Discount']); } else { if (!isset($_SESSION['PaymentDetail']->Discount)) { $_SESSION['PaymentDetail']->Discount=0; @@ -450,7 +452,7 @@ $DbgMsg = _('Cannot update the supplier record for the date of the last payment made using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . "-" . $_SESSION['PaymentDetail']->Narrative; + $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . '-' . $_SESSION['PaymentDetail']->Narrative; if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the supplier control GLTrans */ /* Now debit creditors account with payment + discount */ @@ -507,14 +509,14 @@ periodno, account, narrative, - amount) "; - $SQL = $SQL . "VALUES ('" . $Transtype . "', - '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $PeriodNo . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; + amount) + VALUES ('" . $Transtype . "', + '" . $TransNo . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $PeriodNo . "', + '" . $_SESSION['PaymentDetail']->Account . "', + '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; $ErrMsg = _('Cannot insert a GL transaction for the bank account credit because'); $DbgMsg = _('Cannot insert a GL transaction for the bank account credit using the SQL'); @@ -534,8 +536,8 @@ transdate, banktranstype, amount, - currcode) "; - $SQL= $SQL . "VALUES ('" . $TransNo . "', + currcode) + VALUES ('" . $TransNo . "', '" . $Transtype . "', '" . $_SESSION['PaymentDetail']->Account . "', '" . $_SESSION['PaymentDetail']->Narrative . "', @@ -561,18 +563,17 @@ transdate, banktranstype, amount, - currcode) "; - $SQL= $SQL . "VALUES ('" . $TransNo . "', - '" . $Transtype . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . -$PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' - )"; + currcode) + VALUES ('" . $TransNo . "', + '" . $Transtype . "', + '" . $_SESSION['PaymentDetail']->Account . "', + '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . $_SESSION['PaymentDetail']->ExRate . "', + '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . -$PaymentItem->Amount . "', + '" . $_SESSION['PaymentDetail']->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); @@ -635,7 +636,7 @@ prnMsg( _('The Cheque/Voucher number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); } else { $myrow = DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], + $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], @@ -651,7 +652,7 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], + $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], @@ -675,7 +676,10 @@ $_POST['DatePaid'] = ''; } -if (isset($_POST['DatePaid']) AND ($_POST['DatePaid']=='' OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ +if (isset($_POST['DatePaid']) + AND ($_POST['DatePaid']=='' + OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ + $_POST['DatePaid']= Date($_SESSION['DefaultDateFormat']); $_SESSION['PaymentDetail']->DatePaid = $_POST['DatePaid']; } @@ -706,8 +710,7 @@ } } - -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><table class="selection">'; @@ -734,11 +737,15 @@ $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td> +echo '<tr> + <td>' . _('Bank Account') . ':</td> <td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>'; + echo '</select></td> + </tr> + </table> + <p />'; prnMsg( _('Bank Accounts have not yet been defined. You must first') . ' <a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a> ' . _('and general ledger accounts to be affected'),'warn'); include('includes/footer.inc'); exit; @@ -752,11 +759,13 @@ echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } -echo '<tr><td>' . _('Date Paid') . ':</td> - <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '"></td> +echo '<tr> + <td>' . _('Date Paid') . ':</td> + <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '" /></td> </tr>'; @@ -767,7 +776,8 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg( _('No currencies are defined yet. Payments cannot be entered until a currency is defined'),'error'); } else { while ($myrow=DB_fetch_array($result)){ @@ -777,17 +787,22 @@ echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } } - echo '</select></td><td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td></tr>'; + echo '</select></td> + <td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td> + </tr>'; } } else { /*its a supplier payment so it must be in the suppliers currency */ - echo '<tr><td>' . _('Supplier Currency') . ':</td><td>' . $_SESSION['PaymentDetail']->Currency . '</td></tr>'; - echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '">'; + echo '<tr> + <td>' . _('Supplier Currency') . ':</td> + <td>' . $_SESSION['PaymentDetail']->Currency . '</td> + </tr>'; + echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '" />'; /*get the default rate from the currency table if it has not been set */ if (!isset($_POST['ExRate']) OR $_POST['ExRate']==''){ $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency ."'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_row($Result); - $_POST['ExRate']=$myrow[0]; + $_POST['ExRate']=locale_number_format($myrow[0],'Variable'); } } @@ -801,33 +816,38 @@ } if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['PaymentDetail']->Currency AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ if (isset($SuggestedExRate)){ - $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,4) . '</b>'; + $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,6) . '</b>'; } else { $SuggestedExRateText =''; } if ($_POST['ExRate']==1 AND isset($SuggestedExRate)){ $_POST['ExRate'] = $SuggestedExRate; } - echo '<tr><td>' . _('Payment Exchange Rate') . ':</td> - <td><input class=number type="text" name="ExRate" maxlength=10 size=12 value="' . $_POST['ExRate'] . '"></td> - <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td></tr>'; + echo '<tr> + <td>' . _('Payment Exchange Rate') . ':</td> + <td><input class="number" type="text" name="ExRate" maxlength="10" size="12" value="' . $_POST['ExRate'] . '" /></td> + <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td> + </tr>'; } if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ if (isset($SuggestedFunctionalExRate)){ - $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,4) . '</b>'; + $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,6) . '</b>'; } else { $SuggestedFunctionalExRateText =''; } if ($_POST['FunctionalExRate']==1 AND isset($SuggestedFunctionalExRate)){ - $_POST['FunctionalExRate'] = $SuggestedFunctionalExRate; + $_POST['FunctionalExRate'] = locale_number_format($SuggestedFunctionalExRate,'Variable'); } - echo '<tr><td>' . _('Functional Exchange Rate') . ':</td> - <td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '" /></td> - <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td></tr>'; + echo '<tr> + <td>' . _('Functional Exchange Rate') . ':</td> + <td><input type="text" name="FunctionalExRate" maxlength="10" size="12" value="' . $_POST['FunctionalExRate'] . '" /></td> + <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td> + </tr>'; } -echo '<tr><td>' . _('Payment type') . ':</td> +echo '<tr> + <td>' . _('Payment type') . ':</td> <td><select name="Paymenttype">'; include('includes/GetPaymentMethods.php'); @@ -842,13 +862,15 @@ echo '<option value="' . $PaytType . '">' . $PaytType . '</option>'; } } //end foreach -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; if (!isset($_POST['ChequeNum'])) { $_POST['ChequeNum']=''; } -echo '<tr><td>' . _('Cheque Number') . ':</td> +echo '<tr> + <td>' . _('Cheque Number') . ':</td> <td><input type="text" name="ChequeNum" maxlength="8" size="10" value="' . $_POST['ChequeNum'] . '" /> ' . _('(if using pre-printed stationery)') . '</td> </tr>'; @@ -856,10 +878,13 @@ $_POST['Narrative']=''; } -echo '<tr><td>' . _('Reference / Narrative') . ':</td> - <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '" /> ' . _('(Max. length 80 characters)') . '</td> - </tr>'; -echo '<tr><td colspan=3><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '" /></td></tr>'; +echo '<tr> + <td>' . _('Reference / Narrative') . ':</td> + <td colspan="2"><input type="text" name="Narrative" maxlength="80" size="82" value="' . $_POST['Narrative'] . '" /> ' . _('(Max. length 80 characters)') . '</td> + </tr>'; +echo '<tr> + <td colspan="3"><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '" /></td> + </tr>'; echo '</table><br />'; @@ -872,7 +897,9 @@ echo '<tr><th colspan="2"><font size="3" color="blue">' . _('General Ledger Payment Analysis Entry') . '</font></th></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 @@ -888,20 +915,25 @@ echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; // End select tag /*now set up a GLCode field to select from avaialble GL accounts */ if (isset($_POST['GLManualCode'])) { - echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text class="number" Name="GLManualCode" maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value='. $_POST['GLManualCode'] .' ></td></tr>'; + echo '<tr> + <td>' . _('Enter GL Account Manually') . ':</td> + <td><input type="text" class="number" name="GLManualCode" maxlength="12" size="12" onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value='. $_POST['GLManualCode'] .' ></td> + </tr>'; } else { - echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> - <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; + echo '<tr> + <td>' . _('Enter GL Account Manually') . ':</td> + <td><input type="text" class="number" Name="GLManualCode" maxlength="12" size="12" onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; } - echo '<tr><td>' . _('Select GL Group') . ':</td> - <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; + echo '<tr> + <td>' . _('Select GL Group') . ':</td> + <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; $SQL = "SELECT groupname FROM accountgroups @@ -909,7 +941,8 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg(_('No General ledger account groups have been set up yet') . ' - ' . _('payments cannot be analysed against GL accounts until the GL accounts are set up'),'error'); } else { echo '<option value=""></option>'; @@ -920,7 +953,9 @@ echo '<option value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; } } - echo '</select><input type="submit" name="UpdateCodes" value="Select" /></td></tr>'; + echo '</select> + <input type="submit" name="UpdateCodes" value="Select" /></td> + </tr>'; } if (isset($_POST['GLGroup']) AND $_POST['GLGroup']!='') { @@ -937,8 +972,9 @@ } - echo '<tr><td>' . _('Select GL Account') . ':</td> - <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; + echo '<tr> + <td>' . _('Select GL Account') . ':</td> + <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -956,27 +992,31 @@ echo '</select></td></tr>'; } - echo '<tr><td>'. _('Cheque/Voucher Number') .'</td> - <td><input type="text" name="cheque" maxlength="12" size="12"></td> + echo '<tr> + <td>'. _('Cheque/Voucher Number') .'</td> + <td><input type="text" name="cheque" maxlength="12" size="12" /></td> </tr>'; if (isset($_POST['GLNarrative'])) { - echo '<tr><td>' . _('GL Narrative') . ':</td> + echo '<tr> + <td>' . _('GL Narrative') . ':</td> <td><input type="text" name="GLNarrative" maxlength="50" size="52" value="' . $_POST['GLNarrative'] . '" /></td> </tr>'; } else { - echo '<tr><td>' . _('GL Narrative') . ':</td> + echo '<tr> + <td>' . _('GL Narrative') . ':</td> <td><input type="text" name="GLNarrative" maxlength="50" size="52" /></td> </tr>'; } if (isset($_POST['GLAmount'])) { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> - <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value=' . $_POST['GLAmount'] . '></td> + echo '<tr> + <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value="' . $_POST['GLAmount'] . '" /></td> </tr>'; } else { echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> - <td><input type="text" name="GLAmount" Maxlength="12" size="12" class="number"></td> + <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" /></td> </tr>'; } @@ -1010,7 +1050,7 @@ echo '<tr> <td align=left>' . $PaymentItem->cheque . '</td> - <td class=number>' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->tag . ' - ' . $TagName . '</td> @@ -1018,20 +1058,33 @@ </tr>'; $PaymentTotal += $PaymentItem->Amount; } - echo '<tr><td></td><td class=number><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td><td></td><td></td><td></td></tr></table><br />'; - echo '<input type=submit name="CommitBatch" value="' . _('Accept and Process Payment') . '">'; + echo '<tr> + <td></td> + <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td> + <td></td> + <td></td> + <td></td> + </tr> + </table> + <br />'; + echo '<input type="submit" name="CommitBatch" value="' . _('Accept and Process Payment') . '" />'; } } else { /*a supplier is selected or the GL link is not active then set out the fields for entry of receipt amt and disc */ - echo '<table class=selection><tr><td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> - <td><input class=number type="text" name="Amount" maxlength=12 size=13 value=' . $_SESSION['PaymentDetail']->Amount . '></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> + <td><input class="number" type="text" name="Amount" maxlength=12 size=13 value=' . $_SESSION['PaymentDetail']->Amount . '></td> + </tr>'; if (isset($_SESSION['PaymentDetail']->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ - echo '<tr><td>' . _('Amount of Discount') . ':</td> - <td><input class=number type="text" name="Discount" maxlength=12 size=13 value="' . $_SESSION['PaymentDetail']->Discount . '" /></td></tr>'; + echo '<tr> + <td>' . _('Amount of Discount') . ':</td> + <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Discount . '" /></td> + </tr>'; echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail']->SuppName . '" />'; } else { echo '<input type="hidden" name="discount" Value="0" />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-25 07:55:01
|
Revision: 4732 http://web-erp.svn.sourceforge.net/web-erp/?rev=4732&view=rev Author: daintree Date: 2011-10-25 07:54:55 +0000 (Tue, 25 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/MRPReschedules.php trunk/MRPShortages.php trunk/OffersReceived.php trunk/OutstandingGRNs.php Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/MRPReschedules.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -121,23 +121,36 @@ $title=_('MRP Reschedule Reporting'); include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' - . _('Stock') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' + . _('Stock') . '" alt="" />' . ' ' . $title . ' + </p>'; - 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>' . _('Print Option') . ':</td><td><select name="Fill">'; - echo '<option selected value="yes">' . _('Print With Alternating Highlighted Lines'); - echo '<option value="no">' . _('Plain Print'); - echo '</select></td></tr>'; - echo '<tr><td>' . _('Selection') . ':</td><td><select name="Selection">'; - echo '<option selected value="All">' . _('All').'</option>'; - echo '<option value="WO">' . _('Work Orders Only').'</option>'; - echo '<option value="PO">' . _('Purchase Orders Only').'</option>'; - echo '</select></td></tr>'; - echo '</table><br />'; - echo '<div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<br /> + <br /> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <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> + <tr> + <td>' . _('Selection') . ':</td> + <td><select name="Selection"> + <option selected value="All">' . _('All').'</option> + <option value="WO">' . _('Work Orders Only').'</option> + <option value="PO">' . _('Purchase Orders Only').'</option> + </select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '"> + </div>'; include('includes/footer.inc'); Modified: trunk/MRPShortages.php =================================================================== --- trunk/MRPShortages.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/MRPShortages.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -323,7 +323,7 @@ $YPos -=$line_height; if ($_POST['ReportType'] == 'Shortage'){ -$pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Shortages Report')); + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Shortages Report')); }else{ $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Excess Report')); } @@ -350,8 +350,8 @@ $pdf->addTextWrap(360,$YPos,50,$FontSize,_('Supply'), 'right'); $pdf->addTextWrap(410,$YPos,50,$FontSize,_('Demand'), 'right'); if ($_POST['ReportType'] == 'Shortage'){ -$pdf->addTextWrap(460,$YPos,50,$FontSize,_('Shortage'), 'right'); -$pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Shortage'), 'right'); + $pdf->addTextWrap(460,$YPos,50,$FontSize,_('Shortage'), 'right'); + $pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Shortage'), 'right'); }else{ $pdf->addTextWrap(460,$YPos,50,$FontSize,_('Excess'), 'right'); $pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Excess'), 'right'); Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/OffersReceived.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -42,52 +42,62 @@ _('Select Supplier') . '" alt="" />' . ' ' . _('Select Supplier') . '</p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection>'; - echo '<tr><td>'._('Select Supplier').'</td>'; - echo '<td><select name=supplierid>'; + echo '<table class="selection"> + <tr> + <td>'._('Select Supplier').'</td> + <td><select name=supplierid>'; while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['supplierid'].'">'.$myrow['suppname'].'</option>'; } - echo '</select></td></tr>'; - echo '<tr><td colspan=12><div class="centre"><input type=submit name=select value=' . _('Enter Information') . '></div></td></tr>'; - echo '</table>'; - echo '</form>'; + echo '</select></td> + </tr> + <tr><td colspan="12"> + <div class="centre"> + <input type=submit name=select value=' . _('Enter Information') . '> + </div> + </td> + </tr> + </table> + </form>'; } } if (!isset($_POST['submit']) and isset($_POST['supplierid'])) { $sql = "SELECT offers.offerid, - offers.tenderid, - offers.supplierid, - suppliers.suppname, - offers.stockid, - stockmaster.description, - offers.quantity, - offers.uom, - offers.price, - offers.expirydate, - offers.currcode, - stockmaster.decimalplaces - FROM offers - LEFT JOIN purchorderauth - ON offers.currcode=purchorderauth.currabrev - LEFT JOIN suppliers - ON suppliers.supplierid=offers.supplierid - LEFT JOIN stockmaster - ON stockmaster.stockid=offers.stockid - WHERE purchorderauth.userid='".$_SESSION['UserID']."' - AND offers.expirydate>'".date('Y-m-d')."' - AND offers.supplierid='".$_POST['supplierid']."' - ORDER BY offerid"; + offers.tenderid, + offers.supplierid, + suppliers.suppname, + offers.stockid, + stockmaster.description, + offers.quantity, + offers.uom, + offers.price, + offers.expirydate, + offers.currcode, + stockmaster.decimalplaces, + currencies.decimalplaces AS currdecimalplaces + FROM offers INNER JOIN purchorderauth + ON offers.currcode=purchorderauth.currabrev + INNER JOIN suppliers + ON suppliers.supplierid=offers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + LEFT JOIN stockmaster + ON stockmaster.stockid=offers.stockid + WHERE purchorderauth.userid='" . $_SESSION['UserID'] . "' + AND offers.expirydate>'" . date('Y-m-d') . "' + AND offers.supplierid='" . $_POST['supplierid'] . "' + ORDER BY offerid"; $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . ' + </p>'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <th>'._('Offer ID').'</th> <th>'._('Supplier').'</th> @@ -100,7 +110,8 @@ <th>'._('Offer Expires').'</th> <th>'._('Accept').'</th> <th>'._('Reject').'</th> - <th>'._('Defer').'</th></tr>'; + <th>'._('Defer').'</th> + </tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -114,20 +125,27 @@ echo '<td>'.$myrow['offerid'].'</td> <td>'.$myrow['suppname'].'</td> <td>'.$myrow['description'].'</td> - <td class=number>'.locale_number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> <td>'.$myrow['uom'].'</td> - <td class=number>'.locale_number_format($myrow['price'],2).'</td> - <td class=number>'.locale_number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td class="number">'.locale_number_format($myrow['price'],$myrow['currdecimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['price']*$myrow['quantity'],$myrow['currdecimalplaces']).'</td> <td>'.$myrow['currcode'].'</td> <td>'.$myrow['expirydate'].'</td> - <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> - <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> - <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> - <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1" /></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2" /></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3" /></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'" /></td> </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; - echo '</form></table>'; + echo '<tr> + <td colspan="12"> + <div class="centre"> + <input type="submit" name="submit" value=' . _('Enter Information') . '> + </div> + </td> + </tr> + </form> + </table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); $accepts=array(); @@ -196,24 +214,22 @@ $myrow=DB_fetch_array($result); $MailText.=$myrow['description']."\t"._('Quantity').' '.$myrow['quantity']."\t"._('Price').' '. locale_number_format($myrow['price'])."\n"; - $sql="INSERT INTO purchorderdetails ( - orderno, - itemcode, - deliverydate, - itemdescription, - unitprice, - actprice, - quantityord, - suppliersunit) - VALUES ( - '".$OrderNo."', - '".$myrow['stockid']."', - '".date('Y-m-d')."', - '".$myrow['description']."', - '".$myrow['price']."', - '".$myrow['price']."', - '".$myrow['quantity']."', - '".$myrow['uom']."')"; + $sql="INSERT INTO purchorderdetails (orderno, + itemcode, + deliverydate, + itemdescription, + unitprice, + actprice, + quantityord, + suppliersunit) + VALUES ('".$OrderNo."', + '".$myrow['stockid']."', + '".date('Y-m-d')."', + '".$myrow['description']."', + '".$myrow['price']."', + '".$myrow['price']."', + '".$myrow['quantity']."', + '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; $result=DB_query($sql, $db); Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/OutstandingGRNs.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -164,13 +164,20 @@ <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Supplier Code') . ':</td> - <td><input type="text" name="FromCriteria" value="0"></td></tr>'; - echo '<tr><td>' . _('To Supplier Code'). ':</td> - <td><input type="text" name="ToCriteria" value="zzzzzzz"></td></tr>'; + echo '<tr> + <td>' . _('From Supplier Code') . ':</td> + <td><input type="text" name="FromCriteria" value="0"></td> + </tr> + <tr> + <td>' . _('To Supplier Code'). ':</td> + <td><input type="text" name="ToCriteria" value="zzzzzzz"></td> + </tr> + </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 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-25 07:55:01
|
Revision: 4732 http://web-erp.svn.sourceforge.net/web-erp/?rev=4732&view=rev Author: daintree Date: 2011-10-25 07:54:55 +0000 (Tue, 25 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/MRPReschedules.php trunk/MRPShortages.php trunk/OffersReceived.php trunk/OutstandingGRNs.php Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/MRPReschedules.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -121,23 +121,36 @@ $title=_('MRP Reschedule Reporting'); include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' - . _('Stock') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' + . _('Stock') . '" alt="" />' . ' ' . $title . ' + </p>'; - 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>' . _('Print Option') . ':</td><td><select name="Fill">'; - echo '<option selected value="yes">' . _('Print With Alternating Highlighted Lines'); - echo '<option value="no">' . _('Plain Print'); - echo '</select></td></tr>'; - echo '<tr><td>' . _('Selection') . ':</td><td><select name="Selection">'; - echo '<option selected value="All">' . _('All').'</option>'; - echo '<option value="WO">' . _('Work Orders Only').'</option>'; - echo '<option value="PO">' . _('Purchase Orders Only').'</option>'; - echo '</select></td></tr>'; - echo '</table><br />'; - echo '<div class="centre"><input type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<br /> + <br /> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <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> + <tr> + <td>' . _('Selection') . ':</td> + <td><select name="Selection"> + <option selected value="All">' . _('All').'</option> + <option value="WO">' . _('Work Orders Only').'</option> + <option value="PO">' . _('Purchase Orders Only').'</option> + </select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type=submit name="PrintPDF" value="' . _('Print PDF') . '"> + </div>'; include('includes/footer.inc'); Modified: trunk/MRPShortages.php =================================================================== --- trunk/MRPShortages.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/MRPShortages.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -323,7 +323,7 @@ $YPos -=$line_height; if ($_POST['ReportType'] == 'Shortage'){ -$pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Shortages Report')); + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Shortages Report')); }else{ $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Excess Report')); } @@ -350,8 +350,8 @@ $pdf->addTextWrap(360,$YPos,50,$FontSize,_('Supply'), 'right'); $pdf->addTextWrap(410,$YPos,50,$FontSize,_('Demand'), 'right'); if ($_POST['ReportType'] == 'Shortage'){ -$pdf->addTextWrap(460,$YPos,50,$FontSize,_('Shortage'), 'right'); -$pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Shortage'), 'right'); + $pdf->addTextWrap(460,$YPos,50,$FontSize,_('Shortage'), 'right'); + $pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Shortage'), 'right'); }else{ $pdf->addTextWrap(460,$YPos,50,$FontSize,_('Excess'), 'right'); $pdf->addTextWrap(510,$YPos,60,$FontSize,_('Ext. Excess'), 'right'); Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/OffersReceived.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -42,52 +42,62 @@ _('Select Supplier') . '" alt="" />' . ' ' . _('Select Supplier') . '</p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection>'; - echo '<tr><td>'._('Select Supplier').'</td>'; - echo '<td><select name=supplierid>'; + echo '<table class="selection"> + <tr> + <td>'._('Select Supplier').'</td> + <td><select name=supplierid>'; while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['supplierid'].'">'.$myrow['suppname'].'</option>'; } - echo '</select></td></tr>'; - echo '<tr><td colspan=12><div class="centre"><input type=submit name=select value=' . _('Enter Information') . '></div></td></tr>'; - echo '</table>'; - echo '</form>'; + echo '</select></td> + </tr> + <tr><td colspan="12"> + <div class="centre"> + <input type=submit name=select value=' . _('Enter Information') . '> + </div> + </td> + </tr> + </table> + </form>'; } } if (!isset($_POST['submit']) and isset($_POST['supplierid'])) { $sql = "SELECT offers.offerid, - offers.tenderid, - offers.supplierid, - suppliers.suppname, - offers.stockid, - stockmaster.description, - offers.quantity, - offers.uom, - offers.price, - offers.expirydate, - offers.currcode, - stockmaster.decimalplaces - FROM offers - LEFT JOIN purchorderauth - ON offers.currcode=purchorderauth.currabrev - LEFT JOIN suppliers - ON suppliers.supplierid=offers.supplierid - LEFT JOIN stockmaster - ON stockmaster.stockid=offers.stockid - WHERE purchorderauth.userid='".$_SESSION['UserID']."' - AND offers.expirydate>'".date('Y-m-d')."' - AND offers.supplierid='".$_POST['supplierid']."' - ORDER BY offerid"; + offers.tenderid, + offers.supplierid, + suppliers.suppname, + offers.stockid, + stockmaster.description, + offers.quantity, + offers.uom, + offers.price, + offers.expirydate, + offers.currcode, + stockmaster.decimalplaces, + currencies.decimalplaces AS currdecimalplaces + FROM offers INNER JOIN purchorderauth + ON offers.currcode=purchorderauth.currabrev + INNER JOIN suppliers + ON suppliers.supplierid=offers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + LEFT JOIN stockmaster + ON stockmaster.stockid=offers.stockid + WHERE purchorderauth.userid='" . $_SESSION['UserID'] . "' + AND offers.expirydate>'" . date('Y-m-d') . "' + AND offers.supplierid='" . $_POST['supplierid'] . "' + ORDER BY offerid"; $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . ' + </p>'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <th>'._('Offer ID').'</th> <th>'._('Supplier').'</th> @@ -100,7 +110,8 @@ <th>'._('Offer Expires').'</th> <th>'._('Accept').'</th> <th>'._('Reject').'</th> - <th>'._('Defer').'</th></tr>'; + <th>'._('Defer').'</th> + </tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -114,20 +125,27 @@ echo '<td>'.$myrow['offerid'].'</td> <td>'.$myrow['suppname'].'</td> <td>'.$myrow['description'].'</td> - <td class=number>'.locale_number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> <td>'.$myrow['uom'].'</td> - <td class=number>'.locale_number_format($myrow['price'],2).'</td> - <td class=number>'.locale_number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td class="number">'.locale_number_format($myrow['price'],$myrow['currdecimalplaces']).'</td> + <td class="number">'.locale_number_format($myrow['price']*$myrow['quantity'],$myrow['currdecimalplaces']).'</td> <td>'.$myrow['currcode'].'</td> <td>'.$myrow['expirydate'].'</td> - <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> - <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> - <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> - <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1" /></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2" /></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3" /></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'" /></td> </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; - echo '</form></table>'; + echo '<tr> + <td colspan="12"> + <div class="centre"> + <input type="submit" name="submit" value=' . _('Enter Information') . '> + </div> + </td> + </tr> + </form> + </table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); $accepts=array(); @@ -196,24 +214,22 @@ $myrow=DB_fetch_array($result); $MailText.=$myrow['description']."\t"._('Quantity').' '.$myrow['quantity']."\t"._('Price').' '. locale_number_format($myrow['price'])."\n"; - $sql="INSERT INTO purchorderdetails ( - orderno, - itemcode, - deliverydate, - itemdescription, - unitprice, - actprice, - quantityord, - suppliersunit) - VALUES ( - '".$OrderNo."', - '".$myrow['stockid']."', - '".date('Y-m-d')."', - '".$myrow['description']."', - '".$myrow['price']."', - '".$myrow['price']."', - '".$myrow['quantity']."', - '".$myrow['uom']."')"; + $sql="INSERT INTO purchorderdetails (orderno, + itemcode, + deliverydate, + itemdescription, + unitprice, + actprice, + quantityord, + suppliersunit) + VALUES ('".$OrderNo."', + '".$myrow['stockid']."', + '".date('Y-m-d')."', + '".$myrow['description']."', + '".$myrow['price']."', + '".$myrow['price']."', + '".$myrow['quantity']."', + '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; $result=DB_query($sql, $db); Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2011-10-25 07:38:22 UTC (rev 4731) +++ trunk/OutstandingGRNs.php 2011-10-25 07:54:55 UTC (rev 4732) @@ -164,13 +164,20 @@ <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Supplier Code') . ':</td> - <td><input type="text" name="FromCriteria" value="0"></td></tr>'; - echo '<tr><td>' . _('To Supplier Code'). ':</td> - <td><input type="text" name="ToCriteria" value="zzzzzzz"></td></tr>'; + echo '<tr> + <td>' . _('From Supplier Code') . ':</td> + <td><input type="text" name="FromCriteria" value="0"></td> + </tr> + <tr> + <td>' . _('To Supplier Code'). ':</td> + <td><input type="text" name="ToCriteria" value="zzzzzzz"></td> + </tr> + </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 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-25 07:38:33
|
Revision: 4731 http://web-erp.svn.sourceforge.net/web-erp/?rev=4731&view=rev Author: daintree Date: 2011-10-25 07:38:22 +0000 (Tue, 25 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Locations.php trunk/MRP.php trunk/MRPCalendar.php trunk/MRPCreateDemands.php trunk/MRPDemandTypes.php trunk/MRPDemands.php Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/Locations.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -55,17 +55,17 @@ } $sql = "UPDATE locations SET loccode='" . $_POST['LocCode'] . "', - locationname='" . $_POST['LocationName'] . "', - deladd1='" . $_POST['DelAdd1'] . "', - deladd2='" . $_POST['DelAdd2'] . "', - deladd3='" . $_POST['DelAdd3'] . "', - deladd4='" . $_POST['DelAdd4'] . "', - deladd5='" . $_POST['DelAdd5'] . "', - deladd6='" . $_POST['DelAdd6'] . "', - tel='" . $_POST['Tel'] . "', - fax='" . $_POST['Fax'] . "', - email='" . $_POST['Email'] . "', - contact='" . $_POST['Contact'] . "', + locationname='" . DB_escape_string($_POST['LocationName']) . "', + deladd1='" . DB_escape_string($_POST['DelAdd1']) . "', + deladd2='" . DB_escape_string($_POST['DelAdd2']) . "', + deladd3='" . DB_escape_string($_POST['DelAdd3']) . "', + deladd4='" . DB_escape_string($_POST['DelAdd4']) . "', + deladd5='" . DB_escape_string($_POST['DelAdd5']) . "', + deladd6='" . DB_escape_string($_POST['DelAdd6']) . "', + tel='" . DB_escape_string($_POST['Tel']) . "', + fax='" . DB_escape_string($_POST['Fax']) . "', + email='" . DB_escape_string($_POST['Email']) . "', + contact='" . DB_escape_string($_POST['Contact']) . "', taxprovinceid = '" . $_POST['TaxProvince'] . "', cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "', cashsalebranch ='" . $_POST['CashSaleBranch'] . "', @@ -124,18 +124,18 @@ cashsalecustomer, cashsalebranch, managed ) - VALUES ('" . $_POST['LocCode'] . "', - '" . $_POST['LocationName'] . "', - '" . $_POST['DelAdd1'] ."', - '" . $_POST['DelAdd2'] ."', - '" . $_POST['DelAdd3'] . "', - '" . $_POST['DelAdd4'] . "', - '" . $_POST['DelAdd5'] . "', - '" . $_POST['DelAdd6'] . "', - '" . $_POST['Tel'] . "', - '" . $_POST['Fax'] . "', - '" . $_POST['Email'] . "', - '" . $_POST['Contact'] . "', + VALUES ('" . DB_escape_string($_POST['LocCode']) . "', + '" . DB_escape_string($_POST['LocationName']) . "', + '" . DB_escape_string($_POST['DelAdd1']) ."', + '" . DB_escape_string($_POST['DelAdd2']) ."', + '" . DB_escape_string($_POST['DelAdd3']) . "', + '" . DB_escape_string($_POST['DelAdd4']) . "', + '" . DB_escape_string($_POST['DelAdd5']) . "', + '" . DB_escape_string($_POST['DelAdd6']) . "', + '" . DB_escape_string($_POST['Tel']) . "', + '" . DB_escape_string($_POST['Fax']) . "', + '" . DB_escape_string($_POST['Email']) . "', + '" . DB_escape_string($_POST['Contact']) . "', '" . $_POST['TaxProvince'] . "', '" . $_POST['CashSaleCustomer'] . "', '" . $_POST['CashSaleBranch'] . "', @@ -353,8 +353,9 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>' . _('Location Code') . '</th> + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Location Code') . '</th> <th>' . _('Location Name') . '</th> <th>' . _('Tax Province') . '</th> </tr>'; @@ -458,19 +459,21 @@ echo '<tr> <th colspan=2><font size=3 color=blue>'._('Amend Location details').'</font></th> </tr>'; - echo '<tr><td>' . _('Location Code') . ':</td><td>'; - echo $_POST['LocCode'] . '</td></tr>'; + echo '<tr> + <td>' . _('Location Code') . ':</td> + <td>' . $_POST['LocCode'] . '</td> + </tr>'; } else { //end of if $SelectedLocation only do the else when a new record is being entered if (!isset($_POST['LocCode'])) { $_POST['LocCode'] = ''; } echo '<table class="selection"> <tr> - <th colspan=2><font size=3 color=blue>'._('New Location details').'</font></th> + <th colspan="2"><font size="3" color="blue">'._('New Location details').'</font></th> </tr>'; echo '<tr> <td>' . _('Location Code') . ':</td> - <td><input type="Text" name="LocCode" value="' . $_POST['LocCode'] . '" size=5 maxlength=5></td> + <td><input type="text" name="LocCode" value="' . $_POST['LocCode'] . '" size="5" maxlength="5" /></td> </tr>'; } if (!isset($_POST['LocationName'])) { @@ -516,31 +519,54 @@ $_POST['Managed'] = 0; } - echo '<tr><td>' . _('Location Name') . ':' . '</td>'; - echo '<td><input type="text" name="LocationName" value="'. $_POST['LocationName'] . '" size=51 maxlength="50" /></td></tr>'; - echo '<tr><td>' . _('Contact for deliveries') . ':' . '</td>'; - echo '<td><input type="text" name="Contact" value="' . $_POST['Contact'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 1') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd1" value="' . $_POST['DelAdd1'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 2') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd2" value="' . $_POST['DelAdd2'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 3') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd3" value="' . $_POST['DelAdd3'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 4') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd4" value="' . $_POST['DelAdd4'] . '" size="41" maxlength=40 /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 5') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd5" value="' . $_POST['DelAdd5'] . '" size="21" maxlength="20" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 6') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd6" value="' . $_POST['DelAdd6'] . '" size="16" maxlength="15" /></td></tr>'; - echo '<tr><td>' . _('Telephone No') . ':' . '</td>'; - echo '<td><input type="text" name="Tel" value="' . $_POST['Tel'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Facsimile No') . ':' . '</td>'; - echo '<td><input type="text" name="Fax" value="' . $_POST['Fax'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Email') . ':' . '</td>'; - echo '<td><input type="text" name="Email" value="' . $_POST['Email'] . '" size="31" maxlength="55" /></td></tr>'; + echo '<tr> + <td>' . _('Location Name') . ':' . '</td> + <td><input type="text" name="LocationName" value="'. $_POST['LocationName'] . '" size="51" maxlength="50" /></td> + </tr> + <tr> + <td>' . _('Contact for deliveries') . ':' . '</td> + <td><input type="text" name="Contact" value="' . $_POST['Contact'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 1') . ':' . '</td> + <td><input type="text" name="DelAdd1" value="' . $_POST['DelAdd1'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 2') . ':' . '</td> + <td><input type="text" name="DelAdd2" value="' . $_POST['DelAdd2'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 3') . ':' . '</td> + <td><input type="text" name="DelAdd3" value="' . $_POST['DelAdd3'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 4') . ':' . '</td> + <td><input type="text" name="DelAdd4" value="' . $_POST['DelAdd4'] . '" size="41" maxlength=40 /></td> + </tr> + <tr> + <td>' . _('Delivery Address 5') . ':' . '</td> + <td><input type="text" name="DelAdd5" value="' . $_POST['DelAdd5'] . '" size="21" maxlength="20" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 6') . ':' . '</td> + <td><input type="text" name="DelAdd6" value="' . $_POST['DelAdd6'] . '" size="16" maxlength="15" /></td> + </tr> + <tr> + <td>' . _('Telephone No') . ':' . '</td> + <td><input type="text" name="Tel" value="' . $_POST['Tel'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Facsimile No') . ':' . '</td> + <td><input type="text" name="Fax" value="' . $_POST['Fax'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Email') . ':' . '</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] . '" size="31" maxlength="55" /></td> + </tr> + <tr> + <td>' . _('Tax Province') . ':' . '</td> + <td><select name="TaxProvince">'; - echo '<td>' . _('Tax Province') . ':' . '</td><td><select name="TaxProvince">'; - $TaxProvinceResult = DB_query("SELECT taxprovinceid, taxprovincename FROM taxprovinces",$db); while ($myrow=DB_fetch_array($TaxProvinceResult)){ if ($_POST['TaxProvince']==$myrow['taxprovinceid']){ @@ -550,24 +576,28 @@ } } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Default Counter Sales Customer Code') . ':' . '</td>'; - echo '<td><input type="text" name="CashSaleCustomer" value="' . $_POST['CashSaleCustomer'] . - '" size="11" maxlength="10" /></td></tr>'; - echo '<tr><td>' . _('Counter Sales Branch Code') . ':' . '</td>'; - echo '<td><input type="text" name="CashSaleBranch" value="' . $_POST['CashSaleBranch'] . - '" size="11" maxlength="10" /></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Default Counter Sales Customer Code') . ':' . '</td> + <td><input type="text" name="CashSaleCustomer" value="' . $_POST['CashSaleCustomer'] . '" size="11" maxlength="10" /></td> + </tr> + <tr> + <td>' . _('Counter Sales Branch Code') . ':' . '</td> + <td><input type="text" name="CashSaleBranch" value="' . $_POST['CashSaleBranch'] . '" size="11" maxlength="10" /></td> + </tr>'; /* This functionality is not written yet ... <tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td> <td><input type='checkbox' name='Managed'<?php if($_POST['Managed'] == 1) echo ' checked';?>></td></tr> */ - echo '</table><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="Submit" name="submit" value="' . _('Enter Information') . '"> + </div> + </form>'; - echo '<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/MRP.php =================================================================== --- trunk/MRP.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRP.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -8,7 +8,7 @@ if (isset($_POST['submit'])) { - if (!$_POST['Leeway'] || !is_numeric($_POST['Leeway'])) { + if (!isset($_POST['Leeway']) OR !is_numeric(filter_number_format($_POST['Leeway']))) { $_POST['Leeway'] = 0; } @@ -508,7 +508,7 @@ '" . $_POST['shrinkageflag'] . "', '" . $_POST['eoqflag'] . "', '" . $_POST['usemrpdemands'] . "', - '" . $_POST['Leeway'] . "')"; + '" . filter_number_format($_POST['Leeway']) . "')"; $result = DB_query($sql,$db); } else { // End of if submit isset @@ -540,28 +540,49 @@ if ($myrow['shrinkageflag'] == 'y') { $useshrinkage = _('Yes'); } - echo '<table cellpadding=5><tr><td valign=top>'; - echo '<table class=selection>'; - echo '<tr><th colspan=3><font color=blue size=3>'._('Last Run Details').'</font></th></tr>'; - echo '<tr>'; - echo '<td>' . _('Last Run Time') . ':  </td><td>' . $myrow['runtime'] . '</td></tr>'; - echo '<td>' . _('Location') . ':  </td><td>' . $myrow['location'] . '</td></tr>'; - echo '<td>' . _('Days Leeway') . ':  </td><td>' . $leeway . '</td></tr>'; - echo '<td>' . _('Use MRP Demands') . ':  </td><td>' . $usemrpdemands . '</td></tr>'; - echo '<td>' . _('Use EOQ') . ':  </td><td>' . $useeoq . '</td></tr>'; - echo '<td>' . _('Use Pan Size') . ':  </td><td>' . $usepansize . '</td></tr>'; - echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; - echo '</table></td>'; + echo '<table class="selection"> + <tr> + <th colspan="3"><font color="blue" size="3">'._('Last Run Details').'</font></th> + </tr> + <tr> + <td>' . _('Last Run Time') . ':</td><td>' . $myrow['runtime'] . '</td> + </tr> + <tr> + <td>' . _('Location') . ':</td> + <td>' . $myrow['location'] . '</td> + </tr> + <tr> + <td>' . _('Days Leeway') . ':</td> + <td>' . $leeway . '</td> + </tr> + <tr> + <td>' . _('Use MRP Demands') . ':</td> + <td>' . $usemrpdemands . '</td> + </tr> + <tr> + <td>' . _('Use EOQ') . ':</td> + <td>' . $useeoq . '</td> + </tr> + <tr> + <td>' . _('Use Pan Size') . ':</td> + <td>' . $usepansize . '</td> + </tr> + <tr> + <td>' . _('Use Shrinkage') . ':</td> + <td>' . $useshrinkage . '</td> + </tr> + </table>'; } echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - // Generate selections for Location - echo '<tr><th colspan="3"><font color=blue size=3>'._('This Run Details').'</font></th></tr>'; - echo '<tr> - <td>' . _('Location') . '</td> - <td><select name="location[]" multiple> - <option value="All" selected>' . _('All') . '</option>'; + echo '<table class="selection"> + <tr> + <th colspan="3"><font color="blue" size="3">'._('This Run Details').'</font></th> + </tr> + <tr> + <td>' . _('Location') . '</td> + <td><select name="location[]" multiple> + <option value="All" selected>' . _('All') . '</option>'; $sql = "SELECT loccode, locationname FROM locations"; @@ -575,17 +596,33 @@ $leeway =0; } - echo '<tr><td>' . _('Days Leeway') . ':</td><td><input type="text" name="Leeway" class=number size="4" value=' . $leeway . '>'; - echo '<tr><td>' ._('Use MRP Demands?') . ':</td>'; - echo '<td><input type="checkbox" name="usemrpdemands" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use EOQ?') . ':</td>'; - echo '<td><input type="checkbox" name="eoqflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Pan Size?') . ':</td>'; - echo '<td><input type="checkbox" name="pansizeflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Shrinkage?') . ':</td>'; - echo '<td><input type="checkbox" name="shrinkageflag" value="y" checked></td></tr>'; - echo '</table></td></tr></table><div class="centre"><br /><br /><input type="submit" name="submit" value="' . _('Run MRP') . '"></div>'; - echo '</form>'; + echo '<tr> + <td>' . _('Days Leeway') . ':</td> + <td><input type="text" name="Leeway" class=number size="4" value="' . $leeway . '" /> + </tr> + <tr> + <td>' ._('Use MRP Demands?') . ':</td> + <td><input type="checkbox" name="usemrpdemands" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use EOQ?') . ':</td> + <td><input type="checkbox" name="eoqflag" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use Pan Size?') . ':</td> + <td><input type="checkbox" name="pansizeflag" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use Shrinkage?') . ':</td> + <td><input type="checkbox" name="shrinkageflag" value="y" checked /></td> + </tr> + </table> + <div class="centre"> + <br /> + <br /> + <input type="submit" name="submit" value="' . _('Run MRP') . '" /> + </div> + </form>'; } // End of Main program logic ------------------------------------------------------- @@ -640,7 +677,7 @@ $ReqDate = ConvertSQLDate($Requirements[$reqi]['daterequired']); $DateDiff = DateDiff($DueDate,$ReqDate,'d'); //if ($Supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) { - if ($DateDiff > abs($_POST['Leeway'])) { + if ($DateDiff > abs(filter_number_format($_POST['Leeway']))) { $sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $Supplies[$supi]['id'] . "' AND duedate = mrpdate"; $result = DB_query($sql,$db); Modified: trunk/MRPCalendar.php =================================================================== --- trunk/MRPCalendar.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPCalendar.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -16,8 +16,10 @@ $ChangeDate =trim(mb_strtoupper($_GET['ChangeDate'])); } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . - _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($_POST['submit'])) { submit($db,$ChangeDate); @@ -60,12 +62,11 @@ $ConvertToDate = ConvertSQLDate($FormatToDate); $DateGreater = Date1GreaterThanDate2($_POST['ToDate'],$_POST['FromDate']); - $DateDiff = DateDiff($ConvertToDate,$ConvertFromDate,"d"); // Date1 minus Date2 + $DateDiff = DateDiff($ConvertToDate,$ConvertFromDate,'d'); // Date1 minus Date2 if ($DateDiff < 1) { $InputError = 1; prnMsg(_('To Date Must Be Greater Than From Date'),'error'); - } if ($InputError == 1) { @@ -87,9 +88,10 @@ $i = 0; - // $DaysTextArray used so can get text of day based on the value get from DayOfWeekFromSQLDate of - // the calendar date. See if that text is in the ExcludeDays array - $DaysTextArray = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); + /* $DaysTextArray used so can get text of day based on the value get from DayOfWeekFromSQLDate of + the calendar date. See if that text is in the ExcludeDays array note no gettext here hard coded english days from $_POST + * $DaysTextArray = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); + */ $ExcludeDays = array($_POST['Sunday'],$_POST['Monday'],$_POST['Tuesday'],$_POST['Wednesday'], $_POST['Thursday'],$_POST['Friday'],$_POST['Saturday']); @@ -132,7 +134,7 @@ WHERE calendardate = '" . $CalDate . "'"; $resultupdate = DB_query($sql,$db,$ErrMsg); } - prnMsg(_("The MRP Calendar has been created"),'succes'); + prnMsg(_('The MRP Calendar has been created'),'success'); display($db,$ChangeDate); } // End of function submit() @@ -168,10 +170,10 @@ $newmanufacturingflag = 1; } $sql = "UPDATE mrpcalendar SET manufacturingflag = '".$newmanufacturingflag."' - WHERE calendardate = '".$CalDate."'"; + WHERE calendardate = '".$CalDate."'"; $ErrMsg = _('Cannot update the MRP Calendar'); $resultupdate = DB_query($sql,$db,$ErrMsg); - prnMsg(_("The MRP calendar record for $ChangeDate has been updated"),'success'); + prnMsg(_('The MRP calendar record for') . ' ' . $ChangeDate . ' ' . _('has been updated'),'success'); unset ($ChangeDate); display($db,$ChangeDate); @@ -204,14 +206,15 @@ daynumber, manufacturingflag, DAYNAME(calendardate) as dayname - FROM mrpcalendar - WHERE calendardate >='" . $FromDate . "' - AND calendardate <='" . $ToDate . "'"; + FROM mrpcalendar + WHERE calendardate >='" . $FromDate . "' + AND calendardate <='" . $ToDate . "'"; $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo '<br /><table class="selection"> + echo '<br /> + <table class="selection"> <tr bgcolor ="#800000"> <th>' . _('Date') . '</th> <th>' . _('Manufacturing Date') . '</th> @@ -258,57 +261,62 @@ echo '<tr> <td>' . _('From Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="FromDate" size="10" maxlength="10" value="' . $_POST['FromDate'] . '"></td></tr> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="FromDate" size="10" maxlength="10" value="' . $_POST['FromDate'] . '" /></td></tr> <tr></tr><td>' . _('To Date') . ':</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> <tr><td></td></tr> <tr><td></td></tr> <tr><td>'._('Exclude The Following Days').'</td></tr> <tr> <td>' . _('Saturday') . ':</td> - <td><input type="checkbox" name="Saturday" value="Saturday"></td> + <td><input type="checkbox" name="Saturday" value="Saturday" /></td> </tr> <tr> <td>' . _('Sunday') . ':</td> - <td><input type="checkbox" name="Sunday" value="Sunday"></td> + <td><input type="checkbox" name="Sunday" value="Sunday" /></td> </tr> <tr> <td>' . _('Monday') . ':</td> - <td><input type="checkbox" name="Monday" value="Monday"></td> + <td><input type="checkbox" name="Monday" value="Monday" /></td> </tr> <tr> <td>' . _('Tuesday') . ':</td> - <td><input type="checkbox" name="Tuesday" value="Tuesday"></td> + <td><input type="checkbox" name="Tuesday" value="Tuesday" /></td> </tr> <tr> <td>' . _('Wednesday') . ':</td> - <td><input type="checkbox" name="Wednesday" value="Wednesday"></td> + <td><input type="checkbox" name="Wednesday" value="Wednesday" /></td> </tr> <tr> <td>' . _('Thursday') . ':</td> - <td><input type="checkbox" name="Thursday" value="Thursday"></td> + <td><input type="checkbox" name="Thursday" value="Thursday" /></td> </tr> <tr> <td>' . _('Friday') . ':</td> - <td><input type="checkbox" name="Friday" value="Friday"></td> + <td><input type="checkbox" name="Friday" value="Friday" /></td> </tr> </table><br /> - <div class=centre><input type="submit" name="submit" value="' . _('Create Calendar') . '"> - <input type="submit" name="listall" value="' . _('List Date Range') . '"></div>'; + <div class="centre"> + <input type="submit" name="submit" value="' . _('Create Calendar') . '" /> + <input type="submit" name="listall" value="' . _('List Date Range') . '"> + </div>'; if (!isset($_POST['ChangeDate'])) { $_POST['ChangeDate']=date($_SESSION['DefaultDateFormat']); } - echo '<br /><table class="selection">'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> <td>' . _('Change Date Status') . ':</td> - <td><input type="text" name="ChangeDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . - '" size="12" maxlength="12" value="' . $_POST['ChangeDate'] . '"></td> - <td><input type="submit" name="update" value="' . _('Update') . '"></td></tr></table>'; - echo '<br /><br /><div class="centre"></div>'; - echo '</form>'; + <td><input type="text" name="ChangeDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="12" maxlength="12" value="' . $_POST['ChangeDate'] . '" /></td> + <td><input type="submit" name="update" value="' . _('Update') . '" /></td> + </tr> + </table> + <br /> + <br /> + </form>'; } // End of function display() Modified: trunk/MRPCreateDemands.php =================================================================== --- trunk/MRPCreateDemands.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPCreateDemands.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -33,6 +33,14 @@ $InputError=1; unset($_POST['DistDate']); } + if (!is_numeric(filter_number_format($_POST['ExcludeQuantity']))){ + $msg = _('The quantity below which no demand will be created must be numeric'); + $InputError=1; + } + if (!is_numeric(filter_number_format($_POST['Multiplier']))){ + $msg = _('The multiplier is expected to be a positive number'); + $InputError=1; + } if ($InputError==1){ prnMsg($msg,'error'); @@ -68,17 +76,23 @@ // number quantity into each entry of the periodqty array, and add 1 to the periodqty array // until the remainder number is used up. Then create an mrpdemands records for everything // in the array - $multiplier = $_POST['Multiplier']; - if ($_POST['Multiplier'] < 1) { - $multiplier = 1; + + if (filter_number_format($_POST['Multiplier']) < 1) { + $Multiplier = 1; + } else { + $Multiplier = filter_number_format($_POST['Multiplier']); } - $excludeqty = $_POST['Excludeqty']; - if ($_POST['Excludeqty'] < 1) { - $excludeqty = 1; + + if ($_POST['ExcludeQuantity'] < 1) { + $ExcludeQty = 1; + } else { + $ExcludeQty = filter_number_format($_POST['ExcludeQuantity']); } - $excludeamt = $_POST['Excludeamt']; - if ($_POST['Excludeamt'] < 1) { - $excludeamt = 0; + + if ($_POST['ExcludeAmount'] < 1) { + $ExcludeAmount = 0; + } else { + $ExcludeAmount = filter_number_format($_POST['ExcludeAmount']); } // Create array of dates based on DistDate and adding either weeks or months @@ -137,10 +151,10 @@ $TotalRecords = 0; while ($myrow = DB_fetch_array($result)) { - if (($myrow['totqty'] >= $excludeqty) and ($myrow['totextqty'] >= $excludeamt)) { + if (($myrow['totqty'] >= $ExcludeQty) AND ($myrow['totextqty'] >= $ExcludeAmount)) { unset($PeriodQty); $PeriodQty[] = ' '; - $TotalQty = $myrow['totqtyinvoiced'] * $multiplier; + $TotalQty = $myrow['totqtyinvoiced'] * $Multiplier; $WholeNumber = floor($TotalQty / $_POST['PeriodNumber']); $Remainder = ($TotalQty % $_POST['PeriodNumber']); if ($WholeNumber > 0) { @@ -169,7 +183,7 @@ $TotalRecords++; } // end of foreach for INSERT - } // end of if that checks exludeqty, excludeamt + } // end of if that checks exludeqty, ExcludeAmount } //end while loop @@ -179,10 +193,12 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><b><br /></b>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection>'; -echo '<tr><td>' . _('Demand Type') . ':</td><td><select name="MRPDemandtype">'; +echo '<table class="selection"> + <tr> + <td>' . _('Demand Type') . ':</td> + <td><select name="MRPDemandtype">'; $sql = "SELECT mrpdemandtype, description FROM mrpdemandtypes"; @@ -223,36 +239,42 @@ if (!isset($_POST['DistDate'])) { $_POST['DistDate']=date($_SESSION['DefaultDateFormat']); } -echo '<tr><td>' . _('From Sales Date') . ':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="10" value="' . $_POST['FromDate'] . '" />'; -echo ' '. _('To Sales Date') . ':<input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ToDate" size="10" value="' . $_POST['ToDate'] . '" /></td> - </tr>'; -echo '<tr><td>' . _('Start Date For Distribution') . ':</td> +echo '<tr> + <td>' . _('From Sales Date') . ':</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="10" value="' . $_POST['FromDate'] . '" /> '. _('To Sales Date') . ':<input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ToDate" size="10" value="' . $_POST['ToDate'] . '" /></td> + </tr> + <tr> + <td>' . _('Start Date For Distribution') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="DistDate" size="10" value="' . $_POST['DistDate'] . '" /></td> - </tr>'; -echo '<tr><td>' . _('Distribution Period') . ':</td> - <td><select name="Period">'; -echo '<option selected value="weekly">' . _('Weekly') . '</option> - <option value="monthly">' . _('Monthly') .'</option> - </select></td> - </tr>'; -echo '<tr><td>' . _('Number of Periods') .':</td> + </tr> + <tr> + <td>' . _('Distribution Period') . ':</td> + <td><select name="Period"> + <option selected value="weekly">' . _('Weekly') . '</option> + <option value="monthly">' . _('Monthly') .'</option> + </select></td> + </tr> + <tr> + <td>' . _('Number of Periods') .':</td> <td><input type ="text" class="number" name="PeriodNumber" size="4" value="1" /></td> - </tr>'; -echo '<tr><td>' . _('Exclude Total Quantity Less Than') . ':</td> - <td><input type ="text" class="number" name="Excludeqty" size="4" value="1">'; -echo '<tr><td>' . _('Exclude Total Dollars Less Than') . ':</td> - <td><input type ="text" class="number" name="Excludeamt" size="8" value="0"></td> - </tr>'; -echo '<tr><td>' . _('Multiplier') .':</td> + </tr> + <tr> + <td>' . _('Exclude Total Quantity Less Than') . ':</td> + <td><input type ="text" class="number" name="ExcludeQuantity" size="4" value="1" /> + <tr> + <td>' . _('Exclude Total Dollars Less Than') . ':</td> + <td><input type ="text" class="number" name="ExcludeAmount" size="8" value="0" /></td> + </tr> + <tr> + <td>' . _('Multiplier') .':</td> <td><input type="text" class="number" name="Multiplier" size="2" value="1" /></td> - </tr> - <tr> + </tr> + <tr> <td></td> - </tr> - </table>'; -echo '<br /> - <div class=centre> + </tr> + </table> + <br /> + <div class="centre"> <input type="submit" name="submit" value="' . _('Submit') . '" /> </div>'; Modified: trunk/MRPDemandTypes.php =================================================================== --- trunk/MRPDemandTypes.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPDemandTypes.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -58,7 +58,7 @@ $sql = "INSERT INTO mrpdemandtypes (mrpdemandtype, description) VALUES ('" . trim(mb_strtoupper($_POST['MRPDemandType'])) . "', - '" . $_POST['Description'] . "' + '" . DB_escape_string($_POST['Description']) . "' )"; $msg = _('The new demand type has been added to the database'); } @@ -169,7 +169,7 @@ echo '<table class="selection"> <tr> <td>' . _('Demand Type') . ':</td> - <td><input type="text" name="MRPDemandType" size="6" maxlength="5" value="' . $_POST['MRPDemandType'] . '"></td> + <td><input type="text" name="MRPDemandType" size="6" maxlength="5" value="' . $_POST['MRPDemandType'] . '" /></td> </tr>' ; } @@ -177,13 +177,16 @@ $_POST['Description'] = ''; } -echo '<tr><td>' . _('Demand Type Description') . ':</td> - <td><input type="text" name="Description" size="31" maxlength="30" value="' . $_POST['Description'] . '"></td> - </tr> - </table>'; - -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - -echo '</form>'; +echo '<tr> + <td>' . _('Demand Type Description') . ':</td> + <td><input type="text" name="Description" size="31" maxlength="30" value="' . $_POST['Description'] . '" /></td> + </tr> + </table> + <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/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPDemands.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -136,11 +136,11 @@ //first off validate inputs sensible - if (!is_numeric($_POST['Quantity'])) { + if (!is_numeric(filter_number_format($_POST['Quantity']))) { $InputError = 1; prnMsg(_('Quantity must be numeric'),'error'); } - if ($_POST['Quantity'] <= 0) { + if (filter_number_format($_POST['Quantity']) <= 0) { $InputError = 1; prnMsg(_('Quantity must be greater than 0'),'error'); } @@ -190,7 +190,7 @@ if ($myrow[0]>0) { //If $myrow[0] > 0, it means this is an edit, so do an update - $sql = "UPDATE mrpdemands SET quantity = '" . $_POST['Quantity'] . "', + $sql = "UPDATE mrpdemands SET quantity = '" . filter_number_format($_POST['Quantity']) . "', mrpdemandtype = '" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "', duedate = '" . $FormatedDuedate . "' WHERE demandid = '" . $DemandID . "'"; @@ -204,7 +204,7 @@ duedate) VALUES ('" . $StockID . "', '" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "', - '" . $_POST['Quantity'] . "', + '" . filter_number_format($_POST['Quantity']) . "', '" . $FormatedDuedate . "' )"; $msg = _('A new MRP demand record has been added to the database for') . ' ' . $StockID; @@ -277,7 +277,8 @@ mrpdemands.mrpdemandtype, mrpdemands.quantity, mrpdemands.duedate, - stockmaster.description + stockmaster.description, + stockmaster.decimalplaces FROM mrpdemands LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid" . $where . " ORDER BY mrpdemands.stockid, mrpdemands.duedate"; @@ -294,16 +295,16 @@ <th>' . _('Due Date') . '</th> </tr>'; $ctr = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { $displaydate = ConvertSQLDate($myrow[4]); $ctr++; - echo '<tr><td>' . $myrow[1] . '</td> - <td>' . $myrow[5] . '</td> - <td>' . $myrow[2] . '</td> - <td>' . $myrow[3] . '</td> + echo '<tr><td>' . $myrow['stockid'] . '</td> + <td>' . $myrow['description'] . '</td> + <td>' . $myrow['mrpdemandtype'] . '</td> + <td>' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '</td> <td>' . $displaydate . '</td> - <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> + <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow['demandid'] . '&StockID=' . $myrow['stockid'] . '">' . _('Edit') . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow['demandid'] . '&StockID=' . $myrow['stockid'].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> </tr>'; } @@ -354,21 +355,27 @@ $_POST['DemandID'] = $myrow['demandid']; $_POST['StockID'] = $myrow['stockid']; $_POST['MRPDemandtype'] = $myrow['mrpdemandtype']; - $_POST['Quantity'] = $myrow['quantity']; + $_POST['Quantity'] = locale_number_format($myrow['quantity'],'Variable'); $_POST['Duedate'] = ConvertSQLDate($myrow['duedate']); } - echo '<input type="hidden" name="DemandID" value=' . $_POST['DemandID'] . '>'; - echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '">'; - echo '<table class=selection><tr><td>' ._('Part Number') . ':</td><td>' . $_POST['StockID'] . '</td></tr>'; + echo '<input type="hidden" name="DemandID" value="' . $_POST['DemandID'] . '" />'; + echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' ._('Part Number') . ':</td> + <td>' . $_POST['StockID'] . '</td> + </tr>'; } else { if (!isset($_POST['StockID'])) { $_POST['StockID'] = ''; } - echo '<table class=selection><tr> - <td>' . _('Part Number') . ':</td> - <td><input type="Text" name="StockID" size=21 maxlength=20 value="' . $_POST['StockID'] . '"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Part Number') . ':</td> + <td><input type="text" name="StockID" size="21" maxlength="20" value="' . $_POST['StockID'] . '" /></td> + </tr>'; } @@ -381,11 +388,11 @@ } echo '<tr><td>' . _('Quantity') . ':</td> - <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value=' . $_POST['Quantity'] . '></td> + <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value="' . $_POST['Quantity'] . '" /></td> </tr> <tr> <td>' . _('Due Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '" /></td> </tr>'; // Generate selections for Demand Type echo '<tr> @@ -404,19 +411,21 @@ } echo $myrow['mrpdemandtype'] . '">' . $myrow['mrpdemandtype'] . ' - ' .$myrow['description'] . '</option>'; } //end while loop - echo '</select></td></tr>'; - - echo '</table>'; - echo '<br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '" />  '; - echo '<input type="submit" name="listsome" value="' . _('List Selection') . '" />  '; - echo '<input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '" />'; + echo '</select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" />   + <input type="submit" name="listsome" value="' . _('List Selection') . '" />   + <input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '" />'; // If mrpdemand record exists, display option to delete it if ((isset($DemandID)) AND (DB_num_rows($result) > 0)) { echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Or Delete Record') ; } } - echo '</form>'; + echo '</div> + </form>'; } // End of function display() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-25 07:38:29
|
Revision: 4731 http://web-erp.svn.sourceforge.net/web-erp/?rev=4731&view=rev Author: daintree Date: 2011-10-25 07:38:22 +0000 (Tue, 25 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Locations.php trunk/MRP.php trunk/MRPCalendar.php trunk/MRPCreateDemands.php trunk/MRPDemandTypes.php trunk/MRPDemands.php Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/Locations.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -55,17 +55,17 @@ } $sql = "UPDATE locations SET loccode='" . $_POST['LocCode'] . "', - locationname='" . $_POST['LocationName'] . "', - deladd1='" . $_POST['DelAdd1'] . "', - deladd2='" . $_POST['DelAdd2'] . "', - deladd3='" . $_POST['DelAdd3'] . "', - deladd4='" . $_POST['DelAdd4'] . "', - deladd5='" . $_POST['DelAdd5'] . "', - deladd6='" . $_POST['DelAdd6'] . "', - tel='" . $_POST['Tel'] . "', - fax='" . $_POST['Fax'] . "', - email='" . $_POST['Email'] . "', - contact='" . $_POST['Contact'] . "', + locationname='" . DB_escape_string($_POST['LocationName']) . "', + deladd1='" . DB_escape_string($_POST['DelAdd1']) . "', + deladd2='" . DB_escape_string($_POST['DelAdd2']) . "', + deladd3='" . DB_escape_string($_POST['DelAdd3']) . "', + deladd4='" . DB_escape_string($_POST['DelAdd4']) . "', + deladd5='" . DB_escape_string($_POST['DelAdd5']) . "', + deladd6='" . DB_escape_string($_POST['DelAdd6']) . "', + tel='" . DB_escape_string($_POST['Tel']) . "', + fax='" . DB_escape_string($_POST['Fax']) . "', + email='" . DB_escape_string($_POST['Email']) . "', + contact='" . DB_escape_string($_POST['Contact']) . "', taxprovinceid = '" . $_POST['TaxProvince'] . "', cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "', cashsalebranch ='" . $_POST['CashSaleBranch'] . "', @@ -124,18 +124,18 @@ cashsalecustomer, cashsalebranch, managed ) - VALUES ('" . $_POST['LocCode'] . "', - '" . $_POST['LocationName'] . "', - '" . $_POST['DelAdd1'] ."', - '" . $_POST['DelAdd2'] ."', - '" . $_POST['DelAdd3'] . "', - '" . $_POST['DelAdd4'] . "', - '" . $_POST['DelAdd5'] . "', - '" . $_POST['DelAdd6'] . "', - '" . $_POST['Tel'] . "', - '" . $_POST['Fax'] . "', - '" . $_POST['Email'] . "', - '" . $_POST['Contact'] . "', + VALUES ('" . DB_escape_string($_POST['LocCode']) . "', + '" . DB_escape_string($_POST['LocationName']) . "', + '" . DB_escape_string($_POST['DelAdd1']) ."', + '" . DB_escape_string($_POST['DelAdd2']) ."', + '" . DB_escape_string($_POST['DelAdd3']) . "', + '" . DB_escape_string($_POST['DelAdd4']) . "', + '" . DB_escape_string($_POST['DelAdd5']) . "', + '" . DB_escape_string($_POST['DelAdd6']) . "', + '" . DB_escape_string($_POST['Tel']) . "', + '" . DB_escape_string($_POST['Fax']) . "', + '" . DB_escape_string($_POST['Email']) . "', + '" . DB_escape_string($_POST['Contact']) . "', '" . $_POST['TaxProvince'] . "', '" . $_POST['CashSaleCustomer'] . "', '" . $_POST['CashSaleBranch'] . "', @@ -353,8 +353,9 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>' . _('Location Code') . '</th> + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Location Code') . '</th> <th>' . _('Location Name') . '</th> <th>' . _('Tax Province') . '</th> </tr>'; @@ -458,19 +459,21 @@ echo '<tr> <th colspan=2><font size=3 color=blue>'._('Amend Location details').'</font></th> </tr>'; - echo '<tr><td>' . _('Location Code') . ':</td><td>'; - echo $_POST['LocCode'] . '</td></tr>'; + echo '<tr> + <td>' . _('Location Code') . ':</td> + <td>' . $_POST['LocCode'] . '</td> + </tr>'; } else { //end of if $SelectedLocation only do the else when a new record is being entered if (!isset($_POST['LocCode'])) { $_POST['LocCode'] = ''; } echo '<table class="selection"> <tr> - <th colspan=2><font size=3 color=blue>'._('New Location details').'</font></th> + <th colspan="2"><font size="3" color="blue">'._('New Location details').'</font></th> </tr>'; echo '<tr> <td>' . _('Location Code') . ':</td> - <td><input type="Text" name="LocCode" value="' . $_POST['LocCode'] . '" size=5 maxlength=5></td> + <td><input type="text" name="LocCode" value="' . $_POST['LocCode'] . '" size="5" maxlength="5" /></td> </tr>'; } if (!isset($_POST['LocationName'])) { @@ -516,31 +519,54 @@ $_POST['Managed'] = 0; } - echo '<tr><td>' . _('Location Name') . ':' . '</td>'; - echo '<td><input type="text" name="LocationName" value="'. $_POST['LocationName'] . '" size=51 maxlength="50" /></td></tr>'; - echo '<tr><td>' . _('Contact for deliveries') . ':' . '</td>'; - echo '<td><input type="text" name="Contact" value="' . $_POST['Contact'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 1') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd1" value="' . $_POST['DelAdd1'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 2') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd2" value="' . $_POST['DelAdd2'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 3') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd3" value="' . $_POST['DelAdd3'] . '" size="41" maxlength="40" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 4') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd4" value="' . $_POST['DelAdd4'] . '" size="41" maxlength=40 /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 5') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd5" value="' . $_POST['DelAdd5'] . '" size="21" maxlength="20" /></td></tr>'; - echo '<tr><td>' . _('Delivery Address 6') . ':' . '</td>'; - echo '<td><input type="text" name="DelAdd6" value="' . $_POST['DelAdd6'] . '" size="16" maxlength="15" /></td></tr>'; - echo '<tr><td>' . _('Telephone No') . ':' . '</td>'; - echo '<td><input type="text" name="Tel" value="' . $_POST['Tel'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Facsimile No') . ':' . '</td>'; - echo '<td><input type="text" name="Fax" value="' . $_POST['Fax'] . '" size="31" maxlength="30" /></td></tr>'; - echo '<tr><td>' . _('Email') . ':' . '</td>'; - echo '<td><input type="text" name="Email" value="' . $_POST['Email'] . '" size="31" maxlength="55" /></td></tr>'; + echo '<tr> + <td>' . _('Location Name') . ':' . '</td> + <td><input type="text" name="LocationName" value="'. $_POST['LocationName'] . '" size="51" maxlength="50" /></td> + </tr> + <tr> + <td>' . _('Contact for deliveries') . ':' . '</td> + <td><input type="text" name="Contact" value="' . $_POST['Contact'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 1') . ':' . '</td> + <td><input type="text" name="DelAdd1" value="' . $_POST['DelAdd1'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 2') . ':' . '</td> + <td><input type="text" name="DelAdd2" value="' . $_POST['DelAdd2'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 3') . ':' . '</td> + <td><input type="text" name="DelAdd3" value="' . $_POST['DelAdd3'] . '" size="41" maxlength="40" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 4') . ':' . '</td> + <td><input type="text" name="DelAdd4" value="' . $_POST['DelAdd4'] . '" size="41" maxlength=40 /></td> + </tr> + <tr> + <td>' . _('Delivery Address 5') . ':' . '</td> + <td><input type="text" name="DelAdd5" value="' . $_POST['DelAdd5'] . '" size="21" maxlength="20" /></td> + </tr> + <tr> + <td>' . _('Delivery Address 6') . ':' . '</td> + <td><input type="text" name="DelAdd6" value="' . $_POST['DelAdd6'] . '" size="16" maxlength="15" /></td> + </tr> + <tr> + <td>' . _('Telephone No') . ':' . '</td> + <td><input type="text" name="Tel" value="' . $_POST['Tel'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Facsimile No') . ':' . '</td> + <td><input type="text" name="Fax" value="' . $_POST['Fax'] . '" size="31" maxlength="30" /></td> + </tr> + <tr> + <td>' . _('Email') . ':' . '</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] . '" size="31" maxlength="55" /></td> + </tr> + <tr> + <td>' . _('Tax Province') . ':' . '</td> + <td><select name="TaxProvince">'; - echo '<td>' . _('Tax Province') . ':' . '</td><td><select name="TaxProvince">'; - $TaxProvinceResult = DB_query("SELECT taxprovinceid, taxprovincename FROM taxprovinces",$db); while ($myrow=DB_fetch_array($TaxProvinceResult)){ if ($_POST['TaxProvince']==$myrow['taxprovinceid']){ @@ -550,24 +576,28 @@ } } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Default Counter Sales Customer Code') . ':' . '</td>'; - echo '<td><input type="text" name="CashSaleCustomer" value="' . $_POST['CashSaleCustomer'] . - '" size="11" maxlength="10" /></td></tr>'; - echo '<tr><td>' . _('Counter Sales Branch Code') . ':' . '</td>'; - echo '<td><input type="text" name="CashSaleBranch" value="' . $_POST['CashSaleBranch'] . - '" size="11" maxlength="10" /></td></tr>'; + echo '</select></td> + </tr> + <tr> + <td>' . _('Default Counter Sales Customer Code') . ':' . '</td> + <td><input type="text" name="CashSaleCustomer" value="' . $_POST['CashSaleCustomer'] . '" size="11" maxlength="10" /></td> + </tr> + <tr> + <td>' . _('Counter Sales Branch Code') . ':' . '</td> + <td><input type="text" name="CashSaleBranch" value="' . $_POST['CashSaleBranch'] . '" size="11" maxlength="10" /></td> + </tr>'; /* This functionality is not written yet ... <tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td> <td><input type='checkbox' name='Managed'<?php if($_POST['Managed'] == 1) echo ' checked';?>></td></tr> */ - echo '</table><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="Submit" name="submit" value="' . _('Enter Information') . '"> + </div> + </form>'; - echo '<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/MRP.php =================================================================== --- trunk/MRP.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRP.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -8,7 +8,7 @@ if (isset($_POST['submit'])) { - if (!$_POST['Leeway'] || !is_numeric($_POST['Leeway'])) { + if (!isset($_POST['Leeway']) OR !is_numeric(filter_number_format($_POST['Leeway']))) { $_POST['Leeway'] = 0; } @@ -508,7 +508,7 @@ '" . $_POST['shrinkageflag'] . "', '" . $_POST['eoqflag'] . "', '" . $_POST['usemrpdemands'] . "', - '" . $_POST['Leeway'] . "')"; + '" . filter_number_format($_POST['Leeway']) . "')"; $result = DB_query($sql,$db); } else { // End of if submit isset @@ -540,28 +540,49 @@ if ($myrow['shrinkageflag'] == 'y') { $useshrinkage = _('Yes'); } - echo '<table cellpadding=5><tr><td valign=top>'; - echo '<table class=selection>'; - echo '<tr><th colspan=3><font color=blue size=3>'._('Last Run Details').'</font></th></tr>'; - echo '<tr>'; - echo '<td>' . _('Last Run Time') . ':  </td><td>' . $myrow['runtime'] . '</td></tr>'; - echo '<td>' . _('Location') . ':  </td><td>' . $myrow['location'] . '</td></tr>'; - echo '<td>' . _('Days Leeway') . ':  </td><td>' . $leeway . '</td></tr>'; - echo '<td>' . _('Use MRP Demands') . ':  </td><td>' . $usemrpdemands . '</td></tr>'; - echo '<td>' . _('Use EOQ') . ':  </td><td>' . $useeoq . '</td></tr>'; - echo '<td>' . _('Use Pan Size') . ':  </td><td>' . $usepansize . '</td></tr>'; - echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; - echo '</table></td>'; + echo '<table class="selection"> + <tr> + <th colspan="3"><font color="blue" size="3">'._('Last Run Details').'</font></th> + </tr> + <tr> + <td>' . _('Last Run Time') . ':</td><td>' . $myrow['runtime'] . '</td> + </tr> + <tr> + <td>' . _('Location') . ':</td> + <td>' . $myrow['location'] . '</td> + </tr> + <tr> + <td>' . _('Days Leeway') . ':</td> + <td>' . $leeway . '</td> + </tr> + <tr> + <td>' . _('Use MRP Demands') . ':</td> + <td>' . $usemrpdemands . '</td> + </tr> + <tr> + <td>' . _('Use EOQ') . ':</td> + <td>' . $useeoq . '</td> + </tr> + <tr> + <td>' . _('Use Pan Size') . ':</td> + <td>' . $usepansize . '</td> + </tr> + <tr> + <td>' . _('Use Shrinkage') . ':</td> + <td>' . $useshrinkage . '</td> + </tr> + </table>'; } echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - // Generate selections for Location - echo '<tr><th colspan="3"><font color=blue size=3>'._('This Run Details').'</font></th></tr>'; - echo '<tr> - <td>' . _('Location') . '</td> - <td><select name="location[]" multiple> - <option value="All" selected>' . _('All') . '</option>'; + echo '<table class="selection"> + <tr> + <th colspan="3"><font color="blue" size="3">'._('This Run Details').'</font></th> + </tr> + <tr> + <td>' . _('Location') . '</td> + <td><select name="location[]" multiple> + <option value="All" selected>' . _('All') . '</option>'; $sql = "SELECT loccode, locationname FROM locations"; @@ -575,17 +596,33 @@ $leeway =0; } - echo '<tr><td>' . _('Days Leeway') . ':</td><td><input type="text" name="Leeway" class=number size="4" value=' . $leeway . '>'; - echo '<tr><td>' ._('Use MRP Demands?') . ':</td>'; - echo '<td><input type="checkbox" name="usemrpdemands" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use EOQ?') . ':</td>'; - echo '<td><input type="checkbox" name="eoqflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Pan Size?') . ':</td>'; - echo '<td><input type="checkbox" name="pansizeflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Shrinkage?') . ':</td>'; - echo '<td><input type="checkbox" name="shrinkageflag" value="y" checked></td></tr>'; - echo '</table></td></tr></table><div class="centre"><br /><br /><input type="submit" name="submit" value="' . _('Run MRP') . '"></div>'; - echo '</form>'; + echo '<tr> + <td>' . _('Days Leeway') . ':</td> + <td><input type="text" name="Leeway" class=number size="4" value="' . $leeway . '" /> + </tr> + <tr> + <td>' ._('Use MRP Demands?') . ':</td> + <td><input type="checkbox" name="usemrpdemands" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use EOQ?') . ':</td> + <td><input type="checkbox" name="eoqflag" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use Pan Size?') . ':</td> + <td><input type="checkbox" name="pansizeflag" value="y" checked /></td> + </tr> + <tr> + <td>' ._('Use Shrinkage?') . ':</td> + <td><input type="checkbox" name="shrinkageflag" value="y" checked /></td> + </tr> + </table> + <div class="centre"> + <br /> + <br /> + <input type="submit" name="submit" value="' . _('Run MRP') . '" /> + </div> + </form>'; } // End of Main program logic ------------------------------------------------------- @@ -640,7 +677,7 @@ $ReqDate = ConvertSQLDate($Requirements[$reqi]['daterequired']); $DateDiff = DateDiff($DueDate,$ReqDate,'d'); //if ($Supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) { - if ($DateDiff > abs($_POST['Leeway'])) { + if ($DateDiff > abs(filter_number_format($_POST['Leeway']))) { $sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $Supplies[$supi]['id'] . "' AND duedate = mrpdate"; $result = DB_query($sql,$db); Modified: trunk/MRPCalendar.php =================================================================== --- trunk/MRPCalendar.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPCalendar.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -16,8 +16,10 @@ $ChangeDate =trim(mb_strtoupper($_GET['ChangeDate'])); } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . - _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($_POST['submit'])) { submit($db,$ChangeDate); @@ -60,12 +62,11 @@ $ConvertToDate = ConvertSQLDate($FormatToDate); $DateGreater = Date1GreaterThanDate2($_POST['ToDate'],$_POST['FromDate']); - $DateDiff = DateDiff($ConvertToDate,$ConvertFromDate,"d"); // Date1 minus Date2 + $DateDiff = DateDiff($ConvertToDate,$ConvertFromDate,'d'); // Date1 minus Date2 if ($DateDiff < 1) { $InputError = 1; prnMsg(_('To Date Must Be Greater Than From Date'),'error'); - } if ($InputError == 1) { @@ -87,9 +88,10 @@ $i = 0; - // $DaysTextArray used so can get text of day based on the value get from DayOfWeekFromSQLDate of - // the calendar date. See if that text is in the ExcludeDays array - $DaysTextArray = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); + /* $DaysTextArray used so can get text of day based on the value get from DayOfWeekFromSQLDate of + the calendar date. See if that text is in the ExcludeDays array note no gettext here hard coded english days from $_POST + * $DaysTextArray = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); + */ $ExcludeDays = array($_POST['Sunday'],$_POST['Monday'],$_POST['Tuesday'],$_POST['Wednesday'], $_POST['Thursday'],$_POST['Friday'],$_POST['Saturday']); @@ -132,7 +134,7 @@ WHERE calendardate = '" . $CalDate . "'"; $resultupdate = DB_query($sql,$db,$ErrMsg); } - prnMsg(_("The MRP Calendar has been created"),'succes'); + prnMsg(_('The MRP Calendar has been created'),'success'); display($db,$ChangeDate); } // End of function submit() @@ -168,10 +170,10 @@ $newmanufacturingflag = 1; } $sql = "UPDATE mrpcalendar SET manufacturingflag = '".$newmanufacturingflag."' - WHERE calendardate = '".$CalDate."'"; + WHERE calendardate = '".$CalDate."'"; $ErrMsg = _('Cannot update the MRP Calendar'); $resultupdate = DB_query($sql,$db,$ErrMsg); - prnMsg(_("The MRP calendar record for $ChangeDate has been updated"),'success'); + prnMsg(_('The MRP calendar record for') . ' ' . $ChangeDate . ' ' . _('has been updated'),'success'); unset ($ChangeDate); display($db,$ChangeDate); @@ -204,14 +206,15 @@ daynumber, manufacturingflag, DAYNAME(calendardate) as dayname - FROM mrpcalendar - WHERE calendardate >='" . $FromDate . "' - AND calendardate <='" . $ToDate . "'"; + FROM mrpcalendar + WHERE calendardate >='" . $FromDate . "' + AND calendardate <='" . $ToDate . "'"; $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo '<br /><table class="selection"> + echo '<br /> + <table class="selection"> <tr bgcolor ="#800000"> <th>' . _('Date') . '</th> <th>' . _('Manufacturing Date') . '</th> @@ -258,57 +261,62 @@ echo '<tr> <td>' . _('From Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="FromDate" size="10" maxlength="10" value="' . $_POST['FromDate'] . '"></td></tr> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="FromDate" size="10" maxlength="10" value="' . $_POST['FromDate'] . '" /></td></tr> <tr></tr><td>' . _('To Date') . ':</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> <tr><td></td></tr> <tr><td></td></tr> <tr><td>'._('Exclude The Following Days').'</td></tr> <tr> <td>' . _('Saturday') . ':</td> - <td><input type="checkbox" name="Saturday" value="Saturday"></td> + <td><input type="checkbox" name="Saturday" value="Saturday" /></td> </tr> <tr> <td>' . _('Sunday') . ':</td> - <td><input type="checkbox" name="Sunday" value="Sunday"></td> + <td><input type="checkbox" name="Sunday" value="Sunday" /></td> </tr> <tr> <td>' . _('Monday') . ':</td> - <td><input type="checkbox" name="Monday" value="Monday"></td> + <td><input type="checkbox" name="Monday" value="Monday" /></td> </tr> <tr> <td>' . _('Tuesday') . ':</td> - <td><input type="checkbox" name="Tuesday" value="Tuesday"></td> + <td><input type="checkbox" name="Tuesday" value="Tuesday" /></td> </tr> <tr> <td>' . _('Wednesday') . ':</td> - <td><input type="checkbox" name="Wednesday" value="Wednesday"></td> + <td><input type="checkbox" name="Wednesday" value="Wednesday" /></td> </tr> <tr> <td>' . _('Thursday') . ':</td> - <td><input type="checkbox" name="Thursday" value="Thursday"></td> + <td><input type="checkbox" name="Thursday" value="Thursday" /></td> </tr> <tr> <td>' . _('Friday') . ':</td> - <td><input type="checkbox" name="Friday" value="Friday"></td> + <td><input type="checkbox" name="Friday" value="Friday" /></td> </tr> </table><br /> - <div class=centre><input type="submit" name="submit" value="' . _('Create Calendar') . '"> - <input type="submit" name="listall" value="' . _('List Date Range') . '"></div>'; + <div class="centre"> + <input type="submit" name="submit" value="' . _('Create Calendar') . '" /> + <input type="submit" name="listall" value="' . _('List Date Range') . '"> + </div>'; if (!isset($_POST['ChangeDate'])) { $_POST['ChangeDate']=date($_SESSION['DefaultDateFormat']); } - echo '<br /><table class="selection">'; - echo '<tr> + echo '<br /> + <table class="selection"> + <tr> <td>' . _('Change Date Status') . ':</td> - <td><input type="text" name="ChangeDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . - '" size="12" maxlength="12" value="' . $_POST['ChangeDate'] . '"></td> - <td><input type="submit" name="update" value="' . _('Update') . '"></td></tr></table>'; - echo '<br /><br /><div class="centre"></div>'; - echo '</form>'; + <td><input type="text" name="ChangeDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="12" maxlength="12" value="' . $_POST['ChangeDate'] . '" /></td> + <td><input type="submit" name="update" value="' . _('Update') . '" /></td> + </tr> + </table> + <br /> + <br /> + </form>'; } // End of function display() Modified: trunk/MRPCreateDemands.php =================================================================== --- trunk/MRPCreateDemands.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPCreateDemands.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -33,6 +33,14 @@ $InputError=1; unset($_POST['DistDate']); } + if (!is_numeric(filter_number_format($_POST['ExcludeQuantity']))){ + $msg = _('The quantity below which no demand will be created must be numeric'); + $InputError=1; + } + if (!is_numeric(filter_number_format($_POST['Multiplier']))){ + $msg = _('The multiplier is expected to be a positive number'); + $InputError=1; + } if ($InputError==1){ prnMsg($msg,'error'); @@ -68,17 +76,23 @@ // number quantity into each entry of the periodqty array, and add 1 to the periodqty array // until the remainder number is used up. Then create an mrpdemands records for everything // in the array - $multiplier = $_POST['Multiplier']; - if ($_POST['Multiplier'] < 1) { - $multiplier = 1; + + if (filter_number_format($_POST['Multiplier']) < 1) { + $Multiplier = 1; + } else { + $Multiplier = filter_number_format($_POST['Multiplier']); } - $excludeqty = $_POST['Excludeqty']; - if ($_POST['Excludeqty'] < 1) { - $excludeqty = 1; + + if ($_POST['ExcludeQuantity'] < 1) { + $ExcludeQty = 1; + } else { + $ExcludeQty = filter_number_format($_POST['ExcludeQuantity']); } - $excludeamt = $_POST['Excludeamt']; - if ($_POST['Excludeamt'] < 1) { - $excludeamt = 0; + + if ($_POST['ExcludeAmount'] < 1) { + $ExcludeAmount = 0; + } else { + $ExcludeAmount = filter_number_format($_POST['ExcludeAmount']); } // Create array of dates based on DistDate and adding either weeks or months @@ -137,10 +151,10 @@ $TotalRecords = 0; while ($myrow = DB_fetch_array($result)) { - if (($myrow['totqty'] >= $excludeqty) and ($myrow['totextqty'] >= $excludeamt)) { + if (($myrow['totqty'] >= $ExcludeQty) AND ($myrow['totextqty'] >= $ExcludeAmount)) { unset($PeriodQty); $PeriodQty[] = ' '; - $TotalQty = $myrow['totqtyinvoiced'] * $multiplier; + $TotalQty = $myrow['totqtyinvoiced'] * $Multiplier; $WholeNumber = floor($TotalQty / $_POST['PeriodNumber']); $Remainder = ($TotalQty % $_POST['PeriodNumber']); if ($WholeNumber > 0) { @@ -169,7 +183,7 @@ $TotalRecords++; } // end of foreach for INSERT - } // end of if that checks exludeqty, excludeamt + } // end of if that checks exludeqty, ExcludeAmount } //end while loop @@ -179,10 +193,12 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><b><br /></b>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection>'; -echo '<tr><td>' . _('Demand Type') . ':</td><td><select name="MRPDemandtype">'; +echo '<table class="selection"> + <tr> + <td>' . _('Demand Type') . ':</td> + <td><select name="MRPDemandtype">'; $sql = "SELECT mrpdemandtype, description FROM mrpdemandtypes"; @@ -223,36 +239,42 @@ if (!isset($_POST['DistDate'])) { $_POST['DistDate']=date($_SESSION['DefaultDateFormat']); } -echo '<tr><td>' . _('From Sales Date') . ':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="10" value="' . $_POST['FromDate'] . '" />'; -echo ' '. _('To Sales Date') . ':<input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ToDate" size="10" value="' . $_POST['ToDate'] . '" /></td> - </tr>'; -echo '<tr><td>' . _('Start Date For Distribution') . ':</td> +echo '<tr> + <td>' . _('From Sales Date') . ':</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="10" value="' . $_POST['FromDate'] . '" /> '. _('To Sales Date') . ':<input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ToDate" size="10" value="' . $_POST['ToDate'] . '" /></td> + </tr> + <tr> + <td>' . _('Start Date For Distribution') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="DistDate" size="10" value="' . $_POST['DistDate'] . '" /></td> - </tr>'; -echo '<tr><td>' . _('Distribution Period') . ':</td> - <td><select name="Period">'; -echo '<option selected value="weekly">' . _('Weekly') . '</option> - <option value="monthly">' . _('Monthly') .'</option> - </select></td> - </tr>'; -echo '<tr><td>' . _('Number of Periods') .':</td> + </tr> + <tr> + <td>' . _('Distribution Period') . ':</td> + <td><select name="Period"> + <option selected value="weekly">' . _('Weekly') . '</option> + <option value="monthly">' . _('Monthly') .'</option> + </select></td> + </tr> + <tr> + <td>' . _('Number of Periods') .':</td> <td><input type ="text" class="number" name="PeriodNumber" size="4" value="1" /></td> - </tr>'; -echo '<tr><td>' . _('Exclude Total Quantity Less Than') . ':</td> - <td><input type ="text" class="number" name="Excludeqty" size="4" value="1">'; -echo '<tr><td>' . _('Exclude Total Dollars Less Than') . ':</td> - <td><input type ="text" class="number" name="Excludeamt" size="8" value="0"></td> - </tr>'; -echo '<tr><td>' . _('Multiplier') .':</td> + </tr> + <tr> + <td>' . _('Exclude Total Quantity Less Than') . ':</td> + <td><input type ="text" class="number" name="ExcludeQuantity" size="4" value="1" /> + <tr> + <td>' . _('Exclude Total Dollars Less Than') . ':</td> + <td><input type ="text" class="number" name="ExcludeAmount" size="8" value="0" /></td> + </tr> + <tr> + <td>' . _('Multiplier') .':</td> <td><input type="text" class="number" name="Multiplier" size="2" value="1" /></td> - </tr> - <tr> + </tr> + <tr> <td></td> - </tr> - </table>'; -echo '<br /> - <div class=centre> + </tr> + </table> + <br /> + <div class="centre"> <input type="submit" name="submit" value="' . _('Submit') . '" /> </div>'; Modified: trunk/MRPDemandTypes.php =================================================================== --- trunk/MRPDemandTypes.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPDemandTypes.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -58,7 +58,7 @@ $sql = "INSERT INTO mrpdemandtypes (mrpdemandtype, description) VALUES ('" . trim(mb_strtoupper($_POST['MRPDemandType'])) . "', - '" . $_POST['Description'] . "' + '" . DB_escape_string($_POST['Description']) . "' )"; $msg = _('The new demand type has been added to the database'); } @@ -169,7 +169,7 @@ echo '<table class="selection"> <tr> <td>' . _('Demand Type') . ':</td> - <td><input type="text" name="MRPDemandType" size="6" maxlength="5" value="' . $_POST['MRPDemandType'] . '"></td> + <td><input type="text" name="MRPDemandType" size="6" maxlength="5" value="' . $_POST['MRPDemandType'] . '" /></td> </tr>' ; } @@ -177,13 +177,16 @@ $_POST['Description'] = ''; } -echo '<tr><td>' . _('Demand Type Description') . ':</td> - <td><input type="text" name="Description" size="31" maxlength="30" value="' . $_POST['Description'] . '"></td> - </tr> - </table>'; - -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - -echo '</form>'; +echo '<tr> + <td>' . _('Demand Type Description') . ':</td> + <td><input type="text" name="Description" size="31" maxlength="30" value="' . $_POST['Description'] . '" /></td> + </tr> + </table> + <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/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-10-23 05:41:35 UTC (rev 4730) +++ trunk/MRPDemands.php 2011-10-25 07:38:22 UTC (rev 4731) @@ -136,11 +136,11 @@ //first off validate inputs sensible - if (!is_numeric($_POST['Quantity'])) { + if (!is_numeric(filter_number_format($_POST['Quantity']))) { $InputError = 1; prnMsg(_('Quantity must be numeric'),'error'); } - if ($_POST['Quantity'] <= 0) { + if (filter_number_format($_POST['Quantity']) <= 0) { $InputError = 1; prnMsg(_('Quantity must be greater than 0'),'error'); } @@ -190,7 +190,7 @@ if ($myrow[0]>0) { //If $myrow[0] > 0, it means this is an edit, so do an update - $sql = "UPDATE mrpdemands SET quantity = '" . $_POST['Quantity'] . "', + $sql = "UPDATE mrpdemands SET quantity = '" . filter_number_format($_POST['Quantity']) . "', mrpdemandtype = '" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "', duedate = '" . $FormatedDuedate . "' WHERE demandid = '" . $DemandID . "'"; @@ -204,7 +204,7 @@ duedate) VALUES ('" . $StockID . "', '" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "', - '" . $_POST['Quantity'] . "', + '" . filter_number_format($_POST['Quantity']) . "', '" . $FormatedDuedate . "' )"; $msg = _('A new MRP demand record has been added to the database for') . ' ' . $StockID; @@ -277,7 +277,8 @@ mrpdemands.mrpdemandtype, mrpdemands.quantity, mrpdemands.duedate, - stockmaster.description + stockmaster.description, + stockmaster.decimalplaces FROM mrpdemands LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid" . $where . " ORDER BY mrpdemands.stockid, mrpdemands.duedate"; @@ -294,16 +295,16 @@ <th>' . _('Due Date') . '</th> </tr>'; $ctr = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { $displaydate = ConvertSQLDate($myrow[4]); $ctr++; - echo '<tr><td>' . $myrow[1] . '</td> - <td>' . $myrow[5] . '</td> - <td>' . $myrow[2] . '</td> - <td>' . $myrow[3] . '</td> + echo '<tr><td>' . $myrow['stockid'] . '</td> + <td>' . $myrow['description'] . '</td> + <td>' . $myrow['mrpdemandtype'] . '</td> + <td>' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '</td> <td>' . $displaydate . '</td> - <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> + <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow['demandid'] . '&StockID=' . $myrow['stockid'] . '">' . _('Edit') . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow['demandid'] . '&StockID=' . $myrow['stockid'].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> </tr>'; } @@ -354,21 +355,27 @@ $_POST['DemandID'] = $myrow['demandid']; $_POST['StockID'] = $myrow['stockid']; $_POST['MRPDemandtype'] = $myrow['mrpdemandtype']; - $_POST['Quantity'] = $myrow['quantity']; + $_POST['Quantity'] = locale_number_format($myrow['quantity'],'Variable'); $_POST['Duedate'] = ConvertSQLDate($myrow['duedate']); } - echo '<input type="hidden" name="DemandID" value=' . $_POST['DemandID'] . '>'; - echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '">'; - echo '<table class=selection><tr><td>' ._('Part Number') . ':</td><td>' . $_POST['StockID'] . '</td></tr>'; + echo '<input type="hidden" name="DemandID" value="' . $_POST['DemandID'] . '" />'; + echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' ._('Part Number') . ':</td> + <td>' . $_POST['StockID'] . '</td> + </tr>'; } else { if (!isset($_POST['StockID'])) { $_POST['StockID'] = ''; } - echo '<table class=selection><tr> - <td>' . _('Part Number') . ':</td> - <td><input type="Text" name="StockID" size=21 maxlength=20 value="' . $_POST['StockID'] . '"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Part Number') . ':</td> + <td><input type="text" name="StockID" size="21" maxlength="20" value="' . $_POST['StockID'] . '" /></td> + </tr>'; } @@ -381,11 +388,11 @@ } echo '<tr><td>' . _('Quantity') . ':</td> - <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value=' . $_POST['Quantity'] . '></td> + <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value="' . $_POST['Quantity'] . '" /></td> </tr> <tr> <td>' . _('Due Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '" /></td> </tr>'; // Generate selections for Demand Type echo '<tr> @@ -404,19 +411,21 @@ } echo $myrow['mrpdemandtype'] . '">' . $myrow['mrpdemandtype'] . ' - ' .$myrow['description'] . '</option>'; } //end while loop - echo '</select></td></tr>'; - - echo '</table>'; - echo '<br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '" />  '; - echo '<input type="submit" name="listsome" value="' . _('List Selection') . '" />  '; - echo '<input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '" />'; + echo '</select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" />   + <input type="submit" name="listsome" value="' . _('List Selection') . '" />   + <input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '" />'; // If mrpdemand record exists, display option to delete it if ((isset($DemandID)) AND (DB_num_rows($result) > 0)) { echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Or Delete Record') ; } } - echo '</form>'; + echo '</div> + </form>'; } // End of function display() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-23 05:41:44
|
Revision: 4730 http://web-erp.svn.sourceforge.net/web-erp/?rev=4730&view=rev Author: daintree Date: 2011-10-23 05:41:35 +0000 (Sun, 23 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLBudgets.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTags.php trunk/GLTransInquiry.php trunk/GLTrialBalance.php trunk/GoodsReceived.php trunk/GoodsReceivedControlled.php trunk/InventoryPlanning.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/MRP.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReport.php trunk/MailInventoryValuation.php trunk/includes/DefineStockAdjustment.php Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLBudgets.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -184,7 +184,7 @@ for ($i=1; $i<=12; $i++) { echo '<tr>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(24-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($Budget[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'" /></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -12,15 +12,21 @@ $_POST['SelectADifferentPeriod']='Select A Different Period'; } -if ((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((!isset($_POST['FromPeriod']) + AND !isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . '</p>'; -echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . '<br />' -. _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' -. _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<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 '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . ' + </p>'; + echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . + '<br />' + . _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' + . _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<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 '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -37,7 +43,7 @@ /*Show a form to allow input of criteria for profit and loss to show */ echo '<p><table class="selection"> <tr><td>' . _('Select Period From') . ':</td> - <td><select Name="FromPeriod">'; + <td><select name="FromPeriod">'; $sql = "SELECT periodno, lastdate_in_period @@ -49,20 +55,21 @@ while ($myrow=DB_fetch_array($Periods,$db)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ - echo '<option selected value=' . $myrow['periodno'] . '>' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } else { if($myrow['lastdate_in_period']==$DefaultFromDate){ - echo '<option selected value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; @@ -90,19 +97,24 @@ } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td> - <td><select name="Detail"> + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select name="Detail"> <option selected value="Summary">'._('Summary') . '</option> <option selected value="Detailed">'._('All Accounts') . '</option> </select> - </td> - </tr>'; + </td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '" /> + </div> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'" /> + </div>'; - echo '</table>'; - - echo '<br /><div class="centre"><input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '"></div>'; - echo '<br /><div class="centre"><input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"></div>'; - /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -344,7 +356,7 @@ if ($myrow['groupname'] != $ActGrp){ if ($myrow['parentgroupname']==$ActGrp AND $ActGrp !=''){ //adding another level of nesting - $Level++; + $Level++; } $ActGrp = $myrow['groupname']; $ParentGroups[$Level]=$ActGrp; @@ -537,10 +549,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '"> - <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -556,7 +568,6 @@ $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); - $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, @@ -568,20 +579,18 @@ SUM(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, SUM(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, SUM(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails - ON chartmaster.accountcode= chartdetails.accountcode - WHERE accountgroups.pandl=1 - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails + ON chartmaster.accountcode= chartdetails.accountcode + WHERE accountgroups.pandl=1 + GROUP BY accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, chartdetails.accountcode, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - accountgroups.sequenceintb, chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because'),_('The SQL that failed was')); @@ -591,22 +600,22 @@ /*show a table of the accounts info returned by the SQL Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */ - echo '<table cellpadding=2 class=selection>'; + echo '<table class="selection">'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>'._('Account Name') .'</th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') .'</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') .'</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') . '</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') . '</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } @@ -643,8 +652,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -652,13 +661,13 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -666,12 +675,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></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>', $ActGrpLabel, @@ -688,8 +697,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -698,13 +707,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size=2><i>%s </i></font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -712,12 +721,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></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>', $ActGrpLabel, @@ -740,21 +749,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -765,21 +774,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -788,17 +797,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"><font size=4>'._('Gross Profit').'</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -820,18 +829,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -846,7 +855,7 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -908,11 +917,11 @@ printf('<td>%s</td> <td>%s</td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActEnquiryURL, $myrow['accountname'], @@ -922,11 +931,11 @@ } else { 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> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> </tr>', $ActEnquiryURL, @@ -947,8 +956,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -956,32 +965,32 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -992,8 +1001,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -1002,13 +1011,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1016,13 +1025,13 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1043,21 +1052,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1068,21 +1077,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1091,17 +1100,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1123,18 +1132,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -1149,7 +1158,7 @@ if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -1158,23 +1167,22 @@ } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> - <td colspan=2><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format(-$PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format(-$PeriodBudgetProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) - ); + locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) ); if ($TotalIncome !=0){ $PrdNPPercent = 100*(-$PeriodProfitLoss)/$TotalIncome; @@ -1193,18 +1201,18 @@ } echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan="2"><font size="2"><I>'._('Net Profit Percent').'</I></font></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan="6"> </td> + <td colspan="2"><font size="2"><i>'._('Net Profit Percent').'</i></font></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td> </tr>', locale_number_format($PrdNPPercent,1) . '%', locale_number_format($BudgetNPPercent,1) . '%', Modified: trunk/GLTagProfit_Loss.php =================================================================== --- trunk/GLTagProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTagProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -8,7 +8,7 @@ include('includes/AccountSectionsDef.inc'); // This loads the $Sections variable -if (isset($_POST['FromPeriod']) and ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ +if (isset($_POST['FromPeriod']) AND ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ prnMsg(_('The selected period from is actually after the period to') . '! ' . _('Please reselect the reporting period'),'error'); $_POST['SelectADifferentPeriod']='Select A Different Period'; } @@ -18,8 +18,9 @@ include('includes/header.inc'); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; 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="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . ' + </p>'; if (Date('m') > $_SESSION['YearEnd']){ /*Dates in SQL format */ @@ -60,10 +61,11 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ - $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); - $sql = "SELECT periodno FROM periods where lastdate_in_period = '$lastDate'"; + $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); + $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; $MaxPrd = DB_query($sql,$db); $MaxPrdrow = DB_fetch_row($MaxPrd); $DefaultToPeriod = (int) ($MaxPrdrow[0]); @@ -88,7 +90,9 @@ } echo '</select></td></tr>'; //Select the tag - echo '<tr><td>'._('Select tag').'<td><select name="tag">'; + echo '<tr> + <td>'._('Select tag').'</td> + <td><select name="tag">'; $SQL = "SELECT tagref, tagdescription @@ -114,14 +118,15 @@ <option selected value="Detailed">'._('All Accounts') . '</option> </select> </td> - </tr>'; - - echo '</table><br />'; - - echo '<div class="centre"><input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'"> + </tr> + </table> <br /> - <br /> - <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /></div>'; + <div class="centre"> + <input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'" /> + <br /> + <br /> + <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /> + </div>'; /*Now do the posting while the user is thinking about the period to select */ @@ -164,18 +169,18 @@ chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' and gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, chartmaster.accountname, accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -458,10 +463,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> - <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -483,22 +488,21 @@ $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, - gltrans.account , + gltrans.account, chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' AND gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -515,18 +519,24 @@ . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; echo '<table cellpadding="2" class="selection">'; - echo '<tr><th colspan=9><div class="centre"><font size=3 color=blue><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font></div></th></tr>'; + echo '<tr> + <th colspan="9"> + <div class="centre"> + <font size="3" color="blue"><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>' . _('Account Name') . '</th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } @@ -551,8 +561,8 @@ $GrpPrdActual = array(0); $GrpPrdLY = array(0); $GrpPrdBudget = array(0); + $TotalIncome =0; - while ($myrow=DB_fetch_array($AccountsResult)) { @@ -561,8 +571,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -571,20 +581,20 @@ if ($Section ==3){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -595,8 +605,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -605,17 +615,17 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan="2"><font size="2"><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); @@ -632,47 +642,42 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="2"></td> + <td><hr /></td> + <td></td> + <td><hr /></td> + </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = -$SectionPrdActual; + $TotalIncome -= $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="5"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -682,14 +687,14 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%'); $j++; } @@ -700,9 +705,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']]); } $j++; @@ -718,10 +723,11 @@ $ActGrp = $myrow['groupname']; if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); - echo $TableHeader; + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); + + echo $TableHeader; } } @@ -780,33 +786,24 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level]; } if ($Section ==4){ /*Income */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } else { /*Costs */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> + <td class="number">' . locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } $GrpPrdActual[$Level] = 0; $ParentGroups[$Level] =''; @@ -816,7 +813,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -825,7 +822,7 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></td> <td class="number">%s</td> </tr>', @@ -833,7 +830,7 @@ locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> <td class="number">%s</td> <td></td> </tr>', @@ -851,54 +848,36 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = $SectionPrdActual; + $TotalIncome = $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; if ($TotalIncome !=0){ $PrdGPPercent = 100*($TotalIncome - $SectionPrdActual)/$TotalIncome; @@ -906,19 +885,16 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> + <td class="number"><i>' . locale_number_format($PrdGPPercent,1) . '%</i></td> <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', - locale_number_format($PrdGPPercent,1) . '%'); + </tr>'; + $j++; } @@ -926,19 +902,18 @@ $Section = $myrow['sectioninaccounts']; - if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ - printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + if ($_POST['Detail']=='Detailed' AND isset($Sections[$myrow['sectioninaccounts']])){ + echo '<tr> + <td colspan="6"><font size="4" color="blue"><b>' . $Sections[$myrow['sectioninaccounts']] . '</b></font></td> + </tr>'; } $j++; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr /></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> @@ -949,12 +924,13 @@ locale_number_format($PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - - echo '</table>'; - echo '<div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'"></div>'; + <td colspan="2"></td> + <td colspan="4"><hr /></td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'" /> + </div>'; } echo '</form>'; include('includes/footer.inc'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTags.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -11,24 +11,25 @@ if($_GET['Action']=='delete'){ //first off test there are no transactions created with this tag $Result = DB_query("SELECT counterindex - FROM gltrans - WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); if (DB_num_rows($Result)>0){ prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); } else { $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); prnMsg(_('The selected tag has been deleted'),'success'); } + $Description=''; } else { $sql="SELECT tagref, - tagdescription - FROM tags - WHERE tagref='".$_GET['SelectedTag']."'"; + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; $result= DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $ref=$myrow['tagref']; - $Description=$myrow['tagdescription']; + $Description = $myrow['tagdescription']; } } else { $Description=''; @@ -36,50 +37,57 @@ } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; + $sql = "INSERT INTO tags values(NULL, '" . DB_escape_string($_POST['Description']) . "')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + $sql = "UPDATE tags SET tagdescription='".DB_escape_string($_POST['Description']). "' WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . - _('Print') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . + _('Print') . '" alt="" />' . ' ' . $title . ' + </p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> - <table><tr>'; + <table> + <tr> + <td>'. _('Description') . '</td> + <td><input type="text" size="30" maxlength="30" name="Description" value="'.$Description.'"></td> + <td><input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; - -echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td> - <td><input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; - if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name="update" value="' . _('Update') . '" />'; } else { echo '<input type="submit" name="submit" value="' . _('Insert') . '" />'; } -echo '</td></tr></table><p></p>'; - -echo '</form>'; - -echo '<table class="selection">'; -echo '<tr> +echo '</td> + </tr> + </table> + <p /> + </form> + <table class="selection"> + <tr> <th>'. _('Tag ID') .'</th> <th>'. _('Description'). '</th> - </tr>'; + </tr>'; -$sql="SELECT tagref, tagdescription FROM tags order by tagref"; +$sql="SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>' . $myrow['tagref'].'</td> - <td>' . $myrow['tagdescription'].'</td> + echo '<tr> + <td>' . $myrow['tagref'] . '</td> + <td>' . $myrow['tagdescription'] . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTransInquiry.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -34,9 +34,11 @@ // echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<table class=selection>'; //Main table - echo '<tr><th colspan=7><font size=3 color=blue><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th></tr>'; + echo '<table class="selection">'; //Main table echo '<tr> + <th colspan="7"><font size="3" color="blue"><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th> + </tr> + <tr> <th>' . _('Date') . '</th> <th>' . _('Period') .'</th> <th>'. _('GL Account') .'</th> @@ -88,14 +90,13 @@ $date = '&TransAfterDate=' . $TranDate; $DetailSQL = "SELECT debtortrans.debtorno, - debtortrans.ovamount, - debtortrans.ovgst, - debtortrans.rate, - debtorsmaster.name - FROM debtortrans, - debtorsmaster - WHERE debtortrans.debtorno = debtorsmaster.debtorno - AND debtortrans.type = '" . $TransRow['type'] . "' + debtortrans.ovamount, + debtortrans.ovgst, + debtortrans.rate, + debtorsmaster.name + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno = debtorsmaster.debtorno + WHERE debtortrans.type = '" . $TransRow['type'] . "' AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { @@ -103,14 +104,13 @@ $date = '&FromDate=' . $TranDate; $DetailSQL = "SELECT supptrans.supplierno, - supptrans.ovamount, - supptrans.ovgst, - supptrans.rate, - suppliers.suppname - FROM supptrans, - suppliers - WHERE supptrans.supplierno = suppliers.supplierid - AND supptrans.type = '" . $TransRow['type'] . "' + supptrans.ovamount, + supptrans.ovgst, + supptrans.rate, + suppliers.suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierid + WHERE supptrans.type = '" . $TransRow['type'] . "' AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { @@ -120,7 +120,6 @@ $TransRow['narrative'] = ' '; } - if ($j==1) { echo '<tr class="OddTableRows">'; $j=0; @@ -180,17 +179,20 @@ DB_free_result($TransResult); echo '<tr bgcolor="#FFFFFF"> - <td class="number" colspan=3><b>' . _('Total') . '</b></td> + <td class="number" colspan="3"><b>' . _('Total') . '</b></td> <td class="number">' . locale_number_format(($DebitTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format((-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td colspan=2> </td> + <td colspan="2"> </td> </tr>'; echo '</table><p>'; } } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTrialBalance.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -13,15 +13,22 @@ include('includes/AccountSectionsDef.inc'); //this reads in the Accounts Sections array -if (isset($_POST['FromPeriod']) and isset($_POST['ToPeriod']) and $_POST['FromPeriod'] > $_POST['ToPeriod']){ +if (isset($_POST['FromPeriod']) + AND isset($_POST['ToPeriod']) + AND $_POST['FromPeriod'] > $_POST['ToPeriod']){ + prnMsg(_('The selected period from is actually after the period to! Please re-select the reporting period'),'error'); $_POST['SelectADifferentPeriod']=_('Select A Different Period'); } -if ((! isset($_POST['FromPeriod']) AND ! isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((! isset($_POST['FromPeriod']) + AND ! isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include ('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . ' + </p>'; echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -65,7 +72,8 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno @@ -98,8 +106,10 @@ </table> <br />'; - echo '<div class="centre"><input type=submit Name="ShowTB" Value="' . _('Show Trial Balance') .'">'; - echo '<input type="submit" name="PrintPDF" value="'._('PrintPDF').'"></div>'; + echo '<div class="centre"> + <input type="submit" Name="ShowTB" value="' . _('Show Trial Balance') .'" /> + <input type="submit" name="PrintPDF" val... [truncated message content] |
From: <dai...@us...> - 2011-10-23 05:41:44
|
Revision: 4730 http://web-erp.svn.sourceforge.net/web-erp/?rev=4730&view=rev Author: daintree Date: 2011-10-23 05:41:35 +0000 (Sun, 23 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLBudgets.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTags.php trunk/GLTransInquiry.php trunk/GLTrialBalance.php trunk/GoodsReceived.php trunk/GoodsReceivedControlled.php trunk/InventoryPlanning.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/MRP.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReport.php trunk/MailInventoryValuation.php trunk/includes/DefineStockAdjustment.php Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLBudgets.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -184,7 +184,7 @@ for ($i=1; $i<=12; $i++) { echo '<tr>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(24-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($Budget[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'" /></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -12,15 +12,21 @@ $_POST['SelectADifferentPeriod']='Select A Different Period'; } -if ((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((!isset($_POST['FromPeriod']) + AND !isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . '</p>'; -echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . '<br />' -. _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' -. _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<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 '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . ' + </p>'; + echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . + '<br />' + . _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' + . _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<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 '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -37,7 +43,7 @@ /*Show a form to allow input of criteria for profit and loss to show */ echo '<p><table class="selection"> <tr><td>' . _('Select Period From') . ':</td> - <td><select Name="FromPeriod">'; + <td><select name="FromPeriod">'; $sql = "SELECT periodno, lastdate_in_period @@ -49,20 +55,21 @@ while ($myrow=DB_fetch_array($Periods,$db)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ - echo '<option selected value=' . $myrow['periodno'] . '>' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } else { if($myrow['lastdate_in_period']==$DefaultFromDate){ - echo '<option selected value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; @@ -90,19 +97,24 @@ } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td> - <td><select name="Detail"> + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select name="Detail"> <option selected value="Summary">'._('Summary') . '</option> <option selected value="Detailed">'._('All Accounts') . '</option> </select> - </td> - </tr>'; + </td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '" /> + </div> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'" /> + </div>'; - echo '</table>'; - - echo '<br /><div class="centre"><input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '"></div>'; - echo '<br /><div class="centre"><input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"></div>'; - /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -344,7 +356,7 @@ if ($myrow['groupname'] != $ActGrp){ if ($myrow['parentgroupname']==$ActGrp AND $ActGrp !=''){ //adding another level of nesting - $Level++; + $Level++; } $ActGrp = $myrow['groupname']; $ParentGroups[$Level]=$ActGrp; @@ -537,10 +549,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '"> - <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -556,7 +568,6 @@ $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); - $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, @@ -568,20 +579,18 @@ SUM(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, SUM(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, SUM(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails - ON chartmaster.accountcode= chartdetails.accountcode - WHERE accountgroups.pandl=1 - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails + ON chartmaster.accountcode= chartdetails.accountcode + WHERE accountgroups.pandl=1 + GROUP BY accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, chartdetails.accountcode, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - accountgroups.sequenceintb, chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because'),_('The SQL that failed was')); @@ -591,22 +600,22 @@ /*show a table of the accounts info returned by the SQL Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */ - echo '<table cellpadding=2 class=selection>'; + echo '<table class="selection">'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>'._('Account Name') .'</th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') .'</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') .'</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') . '</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') . '</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } @@ -643,8 +652,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -652,13 +661,13 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -666,12 +675,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></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>', $ActGrpLabel, @@ -688,8 +697,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -698,13 +707,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size=2><i>%s </i></font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -712,12 +721,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></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>', $ActGrpLabel, @@ -740,21 +749,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -765,21 +774,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -788,17 +797,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"><font size=4>'._('Gross Profit').'</font></td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -820,18 +829,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -846,7 +855,7 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -908,11 +917,11 @@ printf('<td>%s</td> <td>%s</td> <td></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> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActEnquiryURL, $myrow['accountname'], @@ -922,11 +931,11 @@ } else { 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> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> </tr>', $ActEnquiryURL, @@ -947,8 +956,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -956,32 +965,32 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -992,8 +1001,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -1002,13 +1011,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1016,13 +1025,13 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1043,21 +1052,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1068,21 +1077,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1091,17 +1100,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1123,18 +1132,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -1149,7 +1158,7 @@ if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -1158,23 +1167,22 @@ } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> - <td colspan=2><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format(-$PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format(-$PeriodBudgetProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) - ); + locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) ); if ($TotalIncome !=0){ $PrdNPPercent = 100*(-$PeriodProfitLoss)/$TotalIncome; @@ -1193,18 +1201,18 @@ } echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan="2"><font size="2"><I>'._('Net Profit Percent').'</I></font></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan="6"> </td> + <td colspan="2"><font size="2"><i>'._('Net Profit Percent').'</i></font></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td> </tr>', locale_number_format($PrdNPPercent,1) . '%', locale_number_format($BudgetNPPercent,1) . '%', Modified: trunk/GLTagProfit_Loss.php =================================================================== --- trunk/GLTagProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTagProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -8,7 +8,7 @@ include('includes/AccountSectionsDef.inc'); // This loads the $Sections variable -if (isset($_POST['FromPeriod']) and ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ +if (isset($_POST['FromPeriod']) AND ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ prnMsg(_('The selected period from is actually after the period to') . '! ' . _('Please reselect the reporting period'),'error'); $_POST['SelectADifferentPeriod']='Select A Different Period'; } @@ -18,8 +18,9 @@ include('includes/header.inc'); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; 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="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . ' + </p>'; if (Date('m') > $_SESSION['YearEnd']){ /*Dates in SQL format */ @@ -60,10 +61,11 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ - $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); - $sql = "SELECT periodno FROM periods where lastdate_in_period = '$lastDate'"; + $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); + $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; $MaxPrd = DB_query($sql,$db); $MaxPrdrow = DB_fetch_row($MaxPrd); $DefaultToPeriod = (int) ($MaxPrdrow[0]); @@ -88,7 +90,9 @@ } echo '</select></td></tr>'; //Select the tag - echo '<tr><td>'._('Select tag').'<td><select name="tag">'; + echo '<tr> + <td>'._('Select tag').'</td> + <td><select name="tag">'; $SQL = "SELECT tagref, tagdescription @@ -114,14 +118,15 @@ <option selected value="Detailed">'._('All Accounts') . '</option> </select> </td> - </tr>'; - - echo '</table><br />'; - - echo '<div class="centre"><input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'"> + </tr> + </table> <br /> - <br /> - <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /></div>'; + <div class="centre"> + <input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'" /> + <br /> + <br /> + <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /> + </div>'; /*Now do the posting while the user is thinking about the period to select */ @@ -164,18 +169,18 @@ chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' and gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, chartmaster.accountname, accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -458,10 +463,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> - <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -483,22 +488,21 @@ $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, - gltrans.account , + gltrans.account, chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' AND gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -515,18 +519,24 @@ . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; echo '<table cellpadding="2" class="selection">'; - echo '<tr><th colspan=9><div class="centre"><font size=3 color=blue><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font></div></th></tr>'; + echo '<tr> + <th colspan="9"> + <div class="centre"> + <font size="3" color="blue"><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>' . _('Account Name') . '</th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } @@ -551,8 +561,8 @@ $GrpPrdActual = array(0); $GrpPrdLY = array(0); $GrpPrdBudget = array(0); + $TotalIncome =0; - while ($myrow=DB_fetch_array($AccountsResult)) { @@ -561,8 +571,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -571,20 +581,20 @@ if ($Section ==3){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -595,8 +605,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -605,17 +615,17 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan="2"><font size="2"><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); @@ -632,47 +642,42 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="2"></td> + <td><hr /></td> + <td></td> + <td><hr /></td> + </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = -$SectionPrdActual; + $TotalIncome -= $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="5"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -682,14 +687,14 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%'); $j++; } @@ -700,9 +705,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']]); } $j++; @@ -718,10 +723,11 @@ $ActGrp = $myrow['groupname']; if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); - echo $TableHeader; + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); + + echo $TableHeader; } } @@ -780,33 +786,24 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level]; } if ($Section ==4){ /*Income */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } else { /*Costs */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> + <td class="number">' . locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } $GrpPrdActual[$Level] = 0; $ParentGroups[$Level] =''; @@ -816,7 +813,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -825,7 +822,7 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></td> <td class="number">%s</td> </tr>', @@ -833,7 +830,7 @@ locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> <td class="number">%s</td> <td></td> </tr>', @@ -851,54 +848,36 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = $SectionPrdActual; + $TotalIncome = $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; if ($TotalIncome !=0){ $PrdGPPercent = 100*($TotalIncome - $SectionPrdActual)/$TotalIncome; @@ -906,19 +885,16 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> + <td class="number"><i>' . locale_number_format($PrdGPPercent,1) . '%</i></td> <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', - locale_number_format($PrdGPPercent,1) . '%'); + </tr>'; + $j++; } @@ -926,19 +902,18 @@ $Section = $myrow['sectioninaccounts']; - if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ - printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + if ($_POST['Detail']=='Detailed' AND isset($Sections[$myrow['sectioninaccounts']])){ + echo '<tr> + <td colspan="6"><font size="4" color="blue"><b>' . $Sections[$myrow['sectioninaccounts']] . '</b></font></td> + </tr>'; } $j++; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr /></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> @@ -949,12 +924,13 @@ locale_number_format($PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - - echo '</table>'; - echo '<div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'"></div>'; + <td colspan="2"></td> + <td colspan="4"><hr /></td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'" /> + </div>'; } echo '</form>'; include('includes/footer.inc'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTags.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -11,24 +11,25 @@ if($_GET['Action']=='delete'){ //first off test there are no transactions created with this tag $Result = DB_query("SELECT counterindex - FROM gltrans - WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); if (DB_num_rows($Result)>0){ prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); } else { $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); prnMsg(_('The selected tag has been deleted'),'success'); } + $Description=''; } else { $sql="SELECT tagref, - tagdescription - FROM tags - WHERE tagref='".$_GET['SelectedTag']."'"; + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; $result= DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $ref=$myrow['tagref']; - $Description=$myrow['tagdescription']; + $Description = $myrow['tagdescription']; } } else { $Description=''; @@ -36,50 +37,57 @@ } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; + $sql = "INSERT INTO tags values(NULL, '" . DB_escape_string($_POST['Description']) . "')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + $sql = "UPDATE tags SET tagdescription='".DB_escape_string($_POST['Description']). "' WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . - _('Print') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . + _('Print') . '" alt="" />' . ' ' . $title . ' + </p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> - <table><tr>'; + <table> + <tr> + <td>'. _('Description') . '</td> + <td><input type="text" size="30" maxlength="30" name="Description" value="'.$Description.'"></td> + <td><input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; - -echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td> - <td><input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; - if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name="update" value="' . _('Update') . '" />'; } else { echo '<input type="submit" name="submit" value="' . _('Insert') . '" />'; } -echo '</td></tr></table><p></p>'; - -echo '</form>'; - -echo '<table class="selection">'; -echo '<tr> +echo '</td> + </tr> + </table> + <p /> + </form> + <table class="selection"> + <tr> <th>'. _('Tag ID') .'</th> <th>'. _('Description'). '</th> - </tr>'; + </tr>'; -$sql="SELECT tagref, tagdescription FROM tags order by tagref"; +$sql="SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>' . $myrow['tagref'].'</td> - <td>' . $myrow['tagdescription'].'</td> + echo '<tr> + <td>' . $myrow['tagref'] . '</td> + <td>' . $myrow['tagdescription'] . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTransInquiry.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -34,9 +34,11 @@ // echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<table class=selection>'; //Main table - echo '<tr><th colspan=7><font size=3 color=blue><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th></tr>'; + echo '<table class="selection">'; //Main table echo '<tr> + <th colspan="7"><font size="3" color="blue"><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th> + </tr> + <tr> <th>' . _('Date') . '</th> <th>' . _('Period') .'</th> <th>'. _('GL Account') .'</th> @@ -88,14 +90,13 @@ $date = '&TransAfterDate=' . $TranDate; $DetailSQL = "SELECT debtortrans.debtorno, - debtortrans.ovamount, - debtortrans.ovgst, - debtortrans.rate, - debtorsmaster.name - FROM debtortrans, - debtorsmaster - WHERE debtortrans.debtorno = debtorsmaster.debtorno - AND debtortrans.type = '" . $TransRow['type'] . "' + debtortrans.ovamount, + debtortrans.ovgst, + debtortrans.rate, + debtorsmaster.name + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno = debtorsmaster.debtorno + WHERE debtortrans.type = '" . $TransRow['type'] . "' AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { @@ -103,14 +104,13 @@ $date = '&FromDate=' . $TranDate; $DetailSQL = "SELECT supptrans.supplierno, - supptrans.ovamount, - supptrans.ovgst, - supptrans.rate, - suppliers.suppname - FROM supptrans, - suppliers - WHERE supptrans.supplierno = suppliers.supplierid - AND supptrans.type = '" . $TransRow['type'] . "' + supptrans.ovamount, + supptrans.ovgst, + supptrans.rate, + suppliers.suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierid + WHERE supptrans.type = '" . $TransRow['type'] . "' AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { @@ -120,7 +120,6 @@ $TransRow['narrative'] = ' '; } - if ($j==1) { echo '<tr class="OddTableRows">'; $j=0; @@ -180,17 +179,20 @@ DB_free_result($TransResult); echo '<tr bgcolor="#FFFFFF"> - <td class="number" colspan=3><b>' . _('Total') . '</b></td> + <td class="number" colspan="3"><b>' . _('Total') . '</b></td> <td class="number">' . locale_number_format(($DebitTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format((-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td colspan=2> </td> + <td colspan="2"> </td> </tr>'; echo '</table><p>'; } } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTrialBalance.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -13,15 +13,22 @@ include('includes/AccountSectionsDef.inc'); //this reads in the Accounts Sections array -if (isset($_POST['FromPeriod']) and isset($_POST['ToPeriod']) and $_POST['FromPeriod'] > $_POST['ToPeriod']){ +if (isset($_POST['FromPeriod']) + AND isset($_POST['ToPeriod']) + AND $_POST['FromPeriod'] > $_POST['ToPeriod']){ + prnMsg(_('The selected period from is actually after the period to! Please re-select the reporting period'),'error'); $_POST['SelectADifferentPeriod']=_('Select A Different Period'); } -if ((! isset($_POST['FromPeriod']) AND ! isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((! isset($_POST['FromPeriod']) + AND ! isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include ('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . ' + </p>'; echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -65,7 +72,8 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno @@ -98,8 +106,10 @@ </table> <br />'; - echo '<div class="centre"><input type=submit Name="ShowTB" Value="' . _('Show Trial Balance') .'">'; - echo '<input type="submit" name="PrintPDF" value="'._('PrintPDF').'"></div>'; + echo '<div class="centre"> + <input type="submit" Name="ShowTB" value="' . _('Show Trial Balance') .'" /> + <input type="submit" name="PrintPDF" val... [truncated message content] |
From: <dai...@us...> - 2011-10-22 05:19:54
|
Revision: 4729 http://web-erp.svn.sourceforge.net/web-erp/?rev=4729&view=rev Author: daintree Date: 2011-10-22 05:19:43 +0000 (Sat, 22 Oct 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/GLJournal.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/WorkOrderStatus.php Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/GLJournal.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -10,9 +10,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -if (isset($_GET['NewJournal']) and $_GET['NewJournal'] == 'Yes' AND isset($_SESSION['JournalDetail'])){ +if (isset($_GET['NewJournal']) + AND $_GET['NewJournal'] == 'Yes' + AND isset($_SESSION['JournalDetail'])){ + unset($_SESSION['JournalDetail']->GLEntries); unset($_SESSION['JournalDetail']); + } if (!isset($_SESSION['JournalDetail'])){ @@ -44,7 +48,7 @@ $_SESSION['JournalDetail']->JournalType = $_POST['JournalType']; } -if (isset($_POST['CommitBatch']) and $_POST['CommitBatch']==_('Accept and Process Journal')){ +if (isset($_POST['CommitBatch']) AND $_POST['CommitBatch']==_('Accept and Process Journal')){ /* once the GL analysis of the journal is entered process all the data in the session cookie into the DB @@ -60,19 +64,19 @@ foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . $PeriodNo . "', '" . $JournalItem->GLCode . "', - '" . $JournalItem->Narrative . "', + '" . DB_escape_string($JournalItem->Narrative) . "', '" . $JournalItem->Amount . "', '" . $JournalItem->tag."' )"; @@ -82,19 +86,19 @@ if ($_POST['JournalType']=='Reversing'){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . ($PeriodNo + 1) . "', '" . $JournalItem->GLCode . "', - 'Reversal - " . $JournalItem->Narrative . "', + '" . _('Reversal') . " - " . DB_escape_string($JournalItem->Narrative) . "', '" . -($JournalItem->Amount) ."', '".$JournalItem->tag."' )"; @@ -117,7 +121,8 @@ unset($_SESSION['JournalDetail']); /*Set up a newy in case user wishes to enter another */ - echo '<br /><a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; + echo '<br /> + <a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; /*And post the journal too */ include ('includes/GLPostings.inc'); include ('includes/footer.inc'); @@ -128,17 +133,17 @@ /* User hit delete the line from the journal */ $_SESSION['JournalDetail']->Remove_GLEntry($_GET['Delete']); -} elseif (isset($_POST['Process']) and $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal +} elseif (isset($_POST['Process']) AND $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal if ($_POST['GLCode']!='') { $extract = explode(' - ',$_POST['GLCode']); $_POST['GLCode'] = $extract[0]; } if ($_POST['Debit']>0) { - $_POST['GLAmount'] = $_POST['Debit']; + $_POST['GLAmount'] = filter_number_format($_POST['Debit']); } elseif ($_POST['Credit']>0) { - $_POST['GLAmount'] = '-' . $_POST['Credit']; + $_POST['GLAmount'] = -filter_number_format($_POST['Credit']); } - if ($_POST['GLManualCode'] != '' AND is_numeric($_POST['GLManualCode'])){ + if ($_POST['GLManualCode'] != ''){ // If a manual code was entered need to check it exists and isnt a bank account $AllowThisPosting = true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ @@ -167,17 +172,25 @@ unset($_POST['GLManualCode']); } else { $myrow = DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLManualCode'], + $myrow['accountname'], + $_POST['tag']); } } } else { $AllowThisPosting =true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ - if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + prnMsg(_('GL Journals involving the debtors control account cannot be entered. The general ledger debtors ledger (AR) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } - if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + prnMsg(_('GL Journals involving the creditors control account cannot be entered. The general ledger creditors ledger (AP) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } @@ -199,7 +212,11 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLCode'], + $myrow['accountname'], + $_POST['tag']); } } @@ -225,7 +242,9 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -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>'; // A new table in the first column of the main table @@ -234,18 +253,21 @@ $_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); } -echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; -echo '<td>' . _('Type') . ':</td> - <td><select name="JournalType">'; +echo '<table> + <tr> + <td colspan="5"><table class="selection"> + <tr> + <td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td> + <td>' . _('Type') . ':</td> + <td><select name="JournalType">'; if ($_POST['JournalType'] == 'Reversing'){ - echo '<option selected="True" value = "Reversing">' . _('Reversing').'</option>'; + echo '<option selected value = "Reversing">' . _('Reversing').'</option>'; echo '<option value = "Normal">' . _('Normal').'</option>'; } else { echo '<option value = "Reversing">' . _('Reversing').'</option>'; - echo '<option selected="True" value = "Normal">' . _('Normal') . '</option>'; + echo '<option selected value = "Normal">' . _('Normal') . '</option>'; } echo '</select></td> @@ -257,20 +279,27 @@ echo '<table class="selection" width="70%">'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ -echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; +echo '<tr> + <th colspan="3"> + <div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div> + </th> + </tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th> +echo '<tr> + <th>' . _('GL Tag') . '</th> <th>' . _('GL Account Code') . '</th> - <th>' . _('Select GL Account') . '</th></tr>'; + <th>' . _('Select GL Account') . '</th> + </tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ //Select the tag -echo '<tr><td><select name="tag">'; +echo '<tr> + <td><select name="tag">'; $SQL = "SELECT tagref, - tagdescription + tagdescription FROM tags ORDER BY tagref"; @@ -294,9 +323,9 @@ ' value="'. $_POST['GLManualCode'] .'" /></td>'; $sql="SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode"; + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -314,36 +343,51 @@ $_POST['GLNarrative'] = ''; } if (!isset($_POST['Credit'])) { - $_POST['Credit'] = ''; + $_POST['Credit'] = 0; } if (!isset($_POST['Debit'])) { - $_POST['Debit'] = ''; + $_POST['Debit'] = 0; } -echo '</tr><tr><th>' . _('Debit') . '</th> - <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; -echo '</tr><tr><th>' . _('Credit') . '</th> - <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; -echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>'; -echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>'; +echo '</tr> + <tr> + <th>' . _('Debit') . '</th> + <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Debit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <th>' . _('Credit') . '</th> + <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Credit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <td></td> + <td></td> + <th>'. _('Narrative'). '</th> + </tr> + <tr> + <th></th> + <th>' . _('GL Narrative') . '</th> + <td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td> + </tr> + </table> + <br />'; /*Close the main table */ +echo '<div class="centre"> + <input type="submit" name="Process" value="' . _('Accept') . '" /> + </div> + <br /> + <br />'; -echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; +echo '<table class="selection" width="85%"> + <tr> + <th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th> + </tr> + <tr> + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; - - -echo '<table class="selection" width="85%">'; - -echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; -echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th> - </tr>'; - $DebitTotal=0; $CreditTotal=0; $j=0; @@ -369,8 +413,9 @@ echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; - $DebitTotal=$DebitTotal+$JournalItem->Amount; + echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td>'; + $DebitTotal += $JournalItem->Amount; } elseif($JournalItem->Amount<0) { $Credit=(-1 * $JournalItem->Amount); echo '<td></td> @@ -384,9 +429,10 @@ } echo '<tr class="EvenTableRows"><td></td> - <td class="number"><b>' . _('Total') . '</b></td> - <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + </tr>'; if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . locale_number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); @@ -398,10 +444,15 @@ } echo '</table>'; -if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; +if (abs($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ + echo '<br /> + <br /> + <div class="centre"> + <input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /> + </div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { - echo '<br /><br />'; + echo '<br /> + <br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); } Modified: trunk/WOSerialNos.php =================================================================== --- trunk/WOSerialNos.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WOSerialNos.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -40,13 +40,15 @@ $NextSerialNo = $_POST['NextSerialNo']; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . ' + </p>'; $DbgMsg = _('The SQL that failed was'); if (isset($_POST['AddControlledItems'])){ if (isset($_POST['NumberToAdd'])){ // Must be adding serial numbers automatically - if (!is_numeric($_POST['NumberToAdd'])){ + if (!is_numeric(filter_number_format($_POST['NumberToAdd']))){ prnMsg(_('The quantity of controlled items to add was not numeric - a number is expected'),'error'); } else { DB_Txn_Begin($db); @@ -62,7 +64,7 @@ '" . $WO . "', '', '' "; - for ($i=0;$i<$_POST['NumberToAdd'];$i++){ + for ($i=0;$i< filter_number_format($_POST['NumberToAdd']);$i++){ $NextItemNumber = $NextSerialNo + $i; $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' @@ -93,7 +95,7 @@ $result = DB_query("UPDATE stockmaster SET nextserialno='" . $NextSerialNo . "' WHERE stockid='" . $StockID . "'",$db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . $_POST['NumberToAdd'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . filter_number_format($_POST['NumberToAdd']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); DB_Txn_Commit($db); @@ -105,20 +107,20 @@ prnMsg(_('The batch or serial number reference has not been entered - a reference is required'),'error'); $InputError=true; } - if (!is_numeric($_POST['Quantity'])){ + if (!is_numeric(filter_number_format($_POST['Quantity']))){ prnMsg(_('The quantity for the batch must be numeric'),'error'); $InputError=true; } $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference'] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference']) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg(_('The serial number or batch reference must be unique to the item - the reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference'] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference']) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -128,7 +130,7 @@ DB_Txn_Begin($db); $ErrMsg = _('Could not add a new serial number/batch'); $result = DB_query("UPDATE woitems - SET qtyreqd=qtyreqd+" . $_POST['Quantity'] . " + SET qtyreqd=qtyreqd+" . filter_number_format($_POST['Quantity']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); $sql = "INSERT INTO woserialnos (stockid, @@ -139,8 +141,8 @@ VALUES ('" . $StockID . "', '" . $WO . "', '', - '" . $_POST['Quantity'] . "', - '" . $_POST['Reference'] . "')"; + '" . filter_number_format($_POST['Quantity']) . "', + '" . DB_escape_string($_POST['Reference']) . "')"; $ErrMsg = _('Unable to add the batch or serial number requested'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -156,10 +158,10 @@ $result = DB_query("DELETE FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_GET['Reference'] ."'", + AND serialno='" . DB_escape_string($_GET['Reference']) ."'", $db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . $_GET['Quantity'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . filter_number_format($_GET['Quantity']) . " WHERE wo='" . $WO . "' AND stockid = '" . $StockID . "'",$db); @@ -183,13 +185,13 @@ $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference' . $i] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference' . $i]) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg($_POST['Reference' .$i] . ': ' . _('The reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference' .$i] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference' .$i]) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -197,13 +199,13 @@ } } if (!$InputError){ - $sql[] = "UPDATE woserialnos SET serialno='" . $_POST['Reference'.$i] . "', - quantity='" . $_POST['Quantity'.$i] ."', - qualitytext='" . $_POST['Notes'.$i] . "' + $sql[] = "UPDATE woserialnos SET serialno='" . DB_escape_string($_POST['Reference'.$i]) . "', + quantity='" . filter_number_format($_POST['Quantity'.$i]) ."', + qualitytext='" . DB_escape_string($_POST['Notes'.$i]) . "' WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_POST['OldReference'.$i] . "'"; - $WOQuantityTotal += $_POST['Quantity'.$i]; + AND serialno='" . DB_escape_string($_POST['OldReference'.$i]) . "'"; + $WOQuantityTotal += filter_number_format($_POST['Quantity'.$i]); } else { $WOQuantityTotal += $_POST['OldQuantity'.$i]; } @@ -226,39 +228,44 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; -echo '<input type="hidden" name="Description" value="' . $Description . '">'; -echo '<input type="hidden" name="WO" value="' . $WO . '">'; -echo '<input type="hidden" name="Serialised" value="' . $Serialised . '">'; -echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '">'; +echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; +echo '<input type="hidden" name="Description" value="' . $Description . '" />'; +echo '<input type="hidden" name="WO" value="' . $WO . '" />'; +echo '<input type="hidden" name="Serialised" value="' . $Serialised . '" />'; +echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '" />'; echo '<table class="selection">'; if ($Serialised==1 AND $NextSerialNo>0){ echo '<tr><td>' . _('Add A Number of New Serial Numbers'); echo ':</td> - <td><input type="text" name="NumberToAdd" size=10 class=number maxlength=10 value="1"></td> + <td><input type="text" name="NumberToAdd" size="10" class="number" maxlength="10" value="1" /></td> <td>' . _('Starting at') . ':</td><td align="right">' . $NextSerialNo . '</td>'; } else { //Need to allow entry of batch or serial number and its a batch a quantity too for individual entry if ($Serialised==1){ - echo '<tr><th></th><th>' . _('Serial No') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Serial No') . '</th></tr> <tr><td>'; echo _('Add a single serial number'); } else { - echo '<tr><th></th><th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> <tr><td>'; echo _('Add a single batch/lot number'); } - echo '<td><input type="text" name="Reference" maxlength="30" size="30"></td>'; + echo '<td><input type="text" name="Reference" maxlength="30" size="30" /></td>'; if ($Serialised==0){ //also need to add the quantity - echo '<td><input type="text" name="Quantity" size=10 class=number maxlength=10 value="1"></td>'; + echo '<td><input type="text" name="Quantity" size="10" class="number" maxlength="10" value="1" /></td>'; } else { //it will be 1 for a serial item - echo '<input type="hidden" name="Quantity" value=1>'; + echo '<input type="hidden" name="Quantity" value="1" />'; } } -echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '"></td></tr> +echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '" /></td> + </tr> </table> <br />'; @@ -275,11 +282,19 @@ if (DB_num_rows($WOSerialNoResult)==0){ prnMsg(_('There are no serial items or batches yet defined for this work order item. Create new items first'),'info'); } else { - echo '<br /><table class="selection">'; + echo '<br /> + <table class="selection">'; if ($Serialised==1){ - $Header = '<tr><th>' . _('Serial No') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Serial No') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } else { - $Header = '<tr><th>' . _('Batch Ref') . '</th><th>' . _('Quantity') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Batch Ref') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } echo $Header; $i = 0; @@ -291,28 +306,29 @@ $j=0; } - echo '<tr><td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; + echo '<tr> + <td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; echo '<input type="hidden" name="OldReference' . $i . '" value="' . $WOSNRow['serialno'] . '"/>'; if ($Serialised==0){ - echo '<td><input type="text" name="Quantity' . $i .'" value="' . $WOSNRow['quantity'] . '" /></td>'; - echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . $WOSNRow['quantity'] . '" />'; + echo '<td><input type="text" name="Quantity' . $i .'" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" /></td>'; + echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" />'; } else { - echo '<input type="hidden" name="Quantity' . $i . '" value="1">'; + echo '<input type="hidden" name="Quantity' . $i . '" value="1" />'; } - echo '<td><textarea name="Notes' . $i .'" cols=60 rows=3>' . $WOSNRow['qualitytext'] .'</textarea></td>'; - echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . $WOSNRow['quantity'] . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</td></tr>'; + echo '<td><textarea name="Notes' . $i .'" cols="60" rows="3">' . $WOSNRow['qualitytext'] .'</textarea></td>'; + echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . locale_number_format($WOSNRow['quantity'],'Variable') . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</a></td></tr>'; $i++; $j++; } - echo '<input type="hidden" name="CountOfItems" value=' . $i . '>'; + echo '<input type="hidden" name="CountOfItems" value="' . $i . '" />'; if ($Serialised==0){ echo '<tr><td style="text-align: center" colspan="3">'; } else { echo '<tr><td style="text-align: center" colspan="2">'; } - echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '"></td></tr>'; + echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '" /></td></tr>'; echo '</table>'; } //end of if there are woserialno items defined Modified: trunk/WWW_Access.php =================================================================== --- trunk/WWW_Access.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Access.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -24,7 +24,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['SecRoleName']) && mb_strlen($_POST['SecRoleName'])<4){ + if (isset($_POST['SecRoleName']) AND mb_strlen($_POST['SecRoleName'])<4){ $InputError = 1; prnMsg(_('The role description entered must be at least 4 characters long'),'error'); } @@ -34,12 +34,12 @@ unset($sql); if (isset($_POST['SecRoleName']) ){ // Update or Add Security Headings if(isset($SelectedRole)) { // Update Security Heading - $sql = "UPDATE securityroles SET secrolename = '".$_POST['SecRoleName']."' + $sql = "UPDATE securityroles SET secrolename = '" . DB_escape_string($_POST['SecRoleName']) . "' WHERE secroleid = '".$SelectedRole . "'"; $ErrMsg = _('The update of the security role description failed because'); $ResMsg = _('The Security role description was updated.'); } else { // Add Security Heading - $sql = "INSERT INTO securityroles (secrolename) VALUES ('".$_POST['SecRoleName']."')"; + $sql = "INSERT INTO securityroles (secrolename) VALUES ('" . DB_escape_string($_POST['SecRoleName']) ."')"; $ErrMsg = _('The update of the security role failed because'); $ResMsg = _('The Security role was created.'); } @@ -165,10 +165,16 @@ if (!isset($_POST['SecRoleName'])) { $_POST['SecRoleName']=''; } -echo '<tr><td>' . _('Role') . ':</td> - <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '"></tr>'; -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Role') . '"></div></form>'; +echo '<tr> + <td>' . _('Role') . ':</td> + <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '" /> + </tr>'; +echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Role') . '" /> + </div> + </form>'; if (isset($SelectedRole)) { $sql = "SELECT tokenid, tokenname Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Users.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -388,9 +388,9 @@ $_POST['Blocked'] = $myrow['blocked']; $_POST['PDFLanguage'] = $myrow['pdflanguage']; - echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; - echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; - echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '" /'; + echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '" />'; + echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '" />'; echo '<table class=selection> <tr><td>' . _('User code') . ':</td><td>'; echo $_POST['UserID'] . '</td></tr>'; @@ -400,7 +400,7 @@ echo '<table class="selection"> <tr> <td>' . _('User Login') . ':</td> - <td><input type="text" name="UserID" size="22" maxlength="20"></td></tr>'; + <td><input type="text" name="UserID" size="22" maxlength="20" /></td></tr>'; /*set the default modules to show to all this had trapped a few people previously*/ @@ -668,7 +668,7 @@ echo '</table> <br /> <div class="centre"> - <input type="submit" name="submit" value="' . _('Enter Information') . '"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> </form>'; Modified: trunk/WhereUsedInquiry.php =================================================================== --- trunk/WhereUsedInquiry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WhereUsedInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Where Used Inquiry'); include('includes/header.inc'); @@ -14,25 +12,30 @@ $StockID = trim(mb_strtoupper($_POST['StockID'])); } -echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a> + <br /> + <p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($StockID)){ $result = DB_query("SELECT description, - units, - mbflag - FROM stockmaster - WHERE stockid='".$StockID."'",$db); + units, + mbflag + FROM stockmaster + WHERE stockid='".$StockID."'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0){ prnMsg(_('The item code entered') . ' - ' . $StockID . ' ' . _('is not set up as an item in the system') . '. ' . _('Re-enter a valid item code or select from the Select Item link above'),'error'); include('includes/footer.inc'); exit; } - echo "<br /><font color=navy size=3><b>$StockID - $myrow[0] </b> (" . _('in units of') . ' ' . $myrow[1] . ')</font>'; + echo '<br /> + <font color="navy" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('in units of') . ' ' . $myrow[1] . ')</font>'; } -echo "<form action='" . $_SERVER['PHP_SELF'] . '?'. SID ."' method=post><div class='centre'>"; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <div class="centre"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($StockID)) { echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" value="' . $StockID . '" />'; @@ -40,19 +43,20 @@ echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" />'; } -echo "<input type=submit name='ShowWhereUsed' value='" . _('Show Where Used') . "'>"; +echo '<input type="submit" name="ShowWhereUsed" value="' . _('Show Where Used') . '" />'; -echo '</div><br />'; +echo '</div> + <br />'; if (isset($StockID)) { $SQL = "SELECT bom.*, - stockmaster.description - FROM bom INNER JOIN stockmaster + stockmaster.description + FROM bom INNER JOIN stockmaster ON bom.parent = stockmaster.stockid - WHERE component='" . $StockID . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto >='" . Date('Y-m-d') . "'"; + WHERE component='" . $StockID . "' + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto >='" . Date('Y-m-d') . "'"; $ErrMsg = _('The parents for the selected part could not be retrieved because');; $result = DB_query($SQL,$db,$ErrMsg); @@ -60,45 +64,44 @@ prnMsg(_('The selected item') . ' ' . $StockID . ' ' . _('is not used as a component of any other parts'),'error'); } else { - echo '<table width=97% class=selection>'; + echo '<table width=97% class=selection>'; - $tableheader = '<tr><th>' . _('Used By') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th></tr>'; - echo $tableheader; - $k=0; - while ($myrow=DB_fetch_array($result)) { + $TableHeader = '<tr> + <th>' . _('Used By') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + </tr>'; + echo $TableHeader; + $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">';; - $k=1; - } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k=1; + } - echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td>'; - echo '<td>' . $myrow['workcentreadded']. '</td>'; - echo '<td>' . $myrow['loccode']. '</td>'; - echo '<td>' . $myrow['quantity']. '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; + echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td> + <td>' . $myrow['workcentreadded']. '</td> + <td>' . $myrow['loccode']. '</td> + <td class="number">' . locale_number_format($myrow['quantity'],'Variable') . '</td> + <td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td> + <td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; - //end of page full new headings if - } + //end of page full new headings if + } - echo '</table>'; + echo '</table>'; } } // StockID is set -echo "<script>defaultControl(document.forms[0].StockID);</script>"; +echo '<script>defaultControl(document.forms[0].StockID);</script>'; - echo '</form>'; - include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/WorkCentres.php =================================================================== --- trunk/WorkCentres.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkCentres.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -42,7 +42,7 @@ delete code below*/ $sql = "UPDATE workcentres SET location = '" . $_POST['Location'] . "', - description = '" . $_POST['Description'] . "', + description = '" . DB_escape_string($_POST['Description']) . "', overheadrecoveryact ='" . $_POST['OverheadRecoveryAct'] . "', overheadperhour = '" . $_POST['OverheadPerHour'] . "' WHERE code = '" . $SelectedWC . "'"; @@ -52,13 +52,13 @@ /*Selected work centre is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new work centre form */ $sql = "INSERT INTO workcentres (code, - location, - description, - overheadrecoveryact, - overheadperhour) + location, + description, + overheadrecoveryact, + overheadperhour) VALUES ('" . $_POST['Code'] . "', '" . $_POST['Location'] . "', - '" . $_POST['Description'] . "', + '" . DB_escape_string($_POST['Description']) . "', '" . $_POST['OverheadRecoveryAct'] . "', '" . $_POST['OverheadPerHour'] . "' )"; @@ -107,7 +107,9 @@ then none of the above are true and the list of work centres 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*/ - 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>'; $sql = "SELECT workcentres.code, workcentres.description, @@ -120,31 +122,34 @@ $result = DB_query($sql,$db); echo '<table class="selection"> - <tr bgcolor ="#800000"><th>' . _('WC Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Overhead GL Account') . '</th> - <th>' . _('Overhead Per Hour') . '</th> + <tr bgcolor ="#800000"> + <th>' . _('WC Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Overhead GL Account') . '</th> + <th>' . _('Overhead Per Hour') . '</th> </tr>'; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { - printf("<tr><td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td><a href=\"%s&SelectedWC=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedWC=%s&delete=yes\">" . _('Delete') ."</td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + printf('<tr> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&SelectedWC=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedWC=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this work centre?') . '\');">' . _('Delete') .'</td> + </tr>', + $myrow['code'], + $myrow['description'], + $myrow['locationname'], + $myrow['overheadrecoveryact'], + $myrow['overheadperhour'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['code'], + $_SERVER['PHP_SELF'] . '?', + $myrow['code']); } //END WHILE LIST LOOP @@ -158,20 +163,21 @@ echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show all Work Centres') . '</a></div>'; } -echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<br /> + <form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedWC)) { //editing an existing work centre $sql = "SELECT code, - location, - description, - overheadrecoveryact, - overheadperhour - FROM workcentres - WHERE code='" . $SelectedWC . "'"; - + location, + description, + overheadrecoveryact, + overheadperhour + FROM workcentres + WHERE code='" . $SelectedWC . "'"; + $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -181,31 +187,36 @@ $_POST['OverheadRecoveryAct'] = $myrow['overheadrecoveryact']; $_POST['OverheadPerHour'] = $myrow['overheadperhour']; - echo '<input type="hidden" name="SelectedWC" value=' . $SelectedWC . '>'; - echo '<input type="hidden" name="Code" value="' . $_POST['Code'] . '">'; - echo '<table class="selection"><tr><td>' ._('Work Centre Code') . ':</td> - <td>' . $_POST['Code'] . '</td></tr>'; + echo '<input type="hidden" name="SelectedWC" value="' . $SelectedWC . '" /> + <input type="hidden" name="Code" value="' . $_POST['Code'] . '" /> + <table class="selection"> + <tr> + <td>' ._('Work Centre Code') . ':</td> + <td>' . $_POST['Code'] . '</td> + </tr>'; } else { //end of if $SelectedWC only do the else when a new record is being entered if (!isset($_POST['Code'])) { $_POST['Code'] = ''; } - echo '<table class="selection"><tr> - <td>' . _('Work Centre Code') . ':</td> - <td><input type="Text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '"></td> + echo '<table class="selection"> + <tr> + <td>' . _('Work Centre Code') . ':</td> + <td><input type="text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '" /></td> </tr>'; } $SQL = "SELECT locationname, - loccode + loccode FROM locations"; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { $_POST['Description'] = ''; } -echo '<tr><td>' . _('Work Centre Description') . ':</td> - <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '"></td> +echo '<tr> + <td>' . _('Work Centre Description') . ':</td> + <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '" /></td> </tr> <tr><td>' . _('Location') . ':</td> <td><select name="Location">'; @@ -214,7 +225,7 @@ if (isset($_POST['Location']) and $myrow['loccode']==$_POST['Location']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -223,13 +234,15 @@ DB_free_result($result); -echo '</select></td></tr> - <tr><td>' . _('Overhead Recovery GL Account') . ':</td> +echo '</select></td> + </tr> + <tr> + <td>' . _('Overhead Recovery GL Account') . ':</td> <td><select name="OverheadRecoveryAct">'; //SQL to poulate account selection boxes $SQL = "SELECT accountcode, - accountname + accountname FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_=accountgroups.groupname WHERE accountgroups.pandl!=0 @@ -253,17 +266,23 @@ } echo '</td></tr>'; -echo '<tr><td>' . _('Overhead Per Hour') . ':</td> - <td><input type="Text" class="number" name="OverheadPerHour" size=6 maxlength=6 value='.$_POST['OverheadPerHour'].'>'; +echo '<tr> + <td>' . _('Overhead Per Hour') . ':</td> + <td><input type="text" class="number" name="OverheadPerHour" size="6" maxlength="6" value="'.$_POST['OverheadPerHour'].'" />'; -echo '</td></tr></table>'; +echo '</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>'; if (!isset($_GET['SelectedWC']) or $_GET['SelectedWC']=='') { - echo "<script>defaultControl(document.forms[0].Code);</script>"; + echo '<script>defaultControl(document.forms[0].Code);</script>'; } else { - echo "<script>defaultControl(document.forms[0].Description);</script>"; + echo '<script>defaultControl(document.forms[0].Description);</script>'; } echo '</form>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderCosting.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -6,11 +6,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a><br />'; +echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a> + <br /> + <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>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -47,14 +49,17 @@ $WorkOrderRow = DB_fetch_array($WOResult); -echo '<table cellpadding=2 class=selection> - <tr><td class="label">' . _('Work order') . ':</td> +echo '<table class="selection"> + <tr> + <td class="label">' . _('Work order') . ':</td> <td>' . $_POST['WO'] .'</td> <td class="label">' . _('Manufactured at') . ':</td> <td>' . $WorkOrderRow['locationname'] . '</td> <td class="label">' . _('Required By') . ':</td> - <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td></tr> - </table><br />'; + <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td> + </tr> + </table> + <br />'; $WOItemsResult = DB_query("SELECT woitems.stockid, @@ -77,19 +82,23 @@ $db, $ErrMsg); -echo '<table class="selection"><tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Quantity Received') . '</th> - <th>' . _('Status') . '</th> - <th>' . _('Receive') . '</th> - <th>' . _('Issue') . '</th></tr>'; +echo '<table class="selection"> + <tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Quantity Received') . '</th> + <th>' . _('Status') . '</th> + <th>' . _('Receive') . '</th> + <th>' . _('Issue') . '</th> + </tr>'; $TotalStdValueRecd =0; while ($WORow = DB_fetch_array($WOItemsResult)){ - echo '<tr><td>' . $WORow['stockid'] . '</td> + echo '<tr> + <td>' . $WORow['stockid'] . '</td> <td>' . $WORow['description'] . '</td> <td class="number">' . locale_number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> <td>' . $WORow['units'] . '</td> @@ -106,18 +115,18 @@ <br /> <table class="selection">'; +echo '<tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Qty Reqd') . '</th> + <th>' . _('Cost Reqd') . '</th> + <th>' . _('Date Issued') . '</th> + <th>' . _('Issued Qty') . '</th> + <th>' . _('Issued Cost') . '</th> + <th>' . _('Usage Variance') . '</th> + <th>' . _('Cost Variance') . '</th> + </tr>'; -echo '<tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Qty Reqd') . '</th> - <th>' . _('Cost Reqd') . '</th> - <th>' . _('Date Issued') . '</th> - <th>' . _('Issued Qty') . '</th> - <th>' . _('Issued Cost') . '</th> - <th>' . _('Usage Variance') . '</th> - <th>' . _('Cost Variance') . '</th> - </tr>'; - $RequirementsResult = DB_query("SELECT worequirements.stockid, stockmaster.description, stockmaster.decimalplaces, @@ -185,7 +194,8 @@ } else { echo '<tr class="OddTableRows">'; } - echo '<td colspan="9"><hr></td></tr>'; + echo '<td colspan="9"><hr></td> + </tr>'; } if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -201,13 +211,15 @@ /*Required quantity is the quantity required of the component based on the quantity of the finished item received */ $UsageVar =($RequirementsRow['requiredqty']-$IssueQty)*($RequirementsRow['stdcost']); - echo '<td colspan="2"></td><td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td></td> - <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + echo '<td colspan="2"></td> + <td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td> + <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $TotalReqdCost += $RequirementsRow['expectedcost']; $TotalIssuedCost += $IssueCost; $TotalCostVar += $CostVar; @@ -217,26 +229,28 @@ } else { $k++; } - echo '<tr><td colspan="9"><hr></td></tr>'; + echo '<tr> + <td colspan="9"><hr></td> + </tr>'; } //Now need to run through the issues to the work order that weren't in the requirements $sql = "SELECT stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - trandate, - qty, - stockmoves.standardcost - FROM stockmoves INNER JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockmoves.stockid NOT IN - (SELECT worequirements.stockid - FROM worequirements - WHERE worequirements.wo='" . $_POST['WO'] . "')"; + stockmaster.description, + stockmaster.decimalplaces, + trandate, + qty, + stockmoves.standardcost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.type=28 + AND reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid NOT IN + (SELECT worequirements.stockid + FROM worequirements + WHERE worequirements.wo='" . $_POST['WO'] . "')"; $WOIssuesResult = DB_query($sql,$db,_('Could not get issues that were not required by the BOM because')); @@ -251,33 +265,38 @@ } echo '<td>' . $WOIssuesRow['stockid'] . '</td> - <td>' . $WOIssuesRow['description'] . '</td> - <td class="number">0</td> - <td class="number">0</td> - <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">0</td></tr>'; + <td>' . $WOIssuesRow['description'] . '</td> + <td class="number">0</td> + <td class="number">0</td> + <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">0</td> + </tr>'; $TotalUsageVar += ($WOIssuesRow['qty']*$WOIssuesRow['standardcost']); } } # <!-- <td colspan="5"></td> --> -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> </tr>'; -echo '<tr><td colspan="2" class="number">' . _('Totals') . '</td> - <td></td> - <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td></td><td></td> - <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; - -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="2" class="number">' . _('Totals') . '</td> + <td></td> + <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td></td><td></td> + <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; + +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> @@ -403,12 +422,12 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalUsageVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -422,12 +441,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -445,11 +464,11 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalCostVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, + typeno, + trandate, + periodno, + account, + narrative, amount) VALUES (29, '" . $WOCloseNo . "', @@ -464,12 +483,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -515,12 +534,21 @@ if ($WorkOrderRow['closed']==0){ - echo '<tr><td colspan="9"><div class="centre"><input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"></div></td></tr>'; + echo '<tr> + <td colspan="9"> + <div class="centre"> + <input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"> + </div> + </td> + </tr>'; } else { - echo '<tr><td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td></tr>'; + echo '<tr> + <td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td> + </tr>'; } -echo '</table>'; -echo '</form>'; +echo '</table> + + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderEntry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -7,8 +7,10 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . - '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; if (isset($_GET['ReqDate'])){ $ReqDate = $_GET['ReqDate']; @@ -68,23 +70,22 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.description " . LIKE . " '$SearchString' AND stockmaster.discontinued=0 AND mbflag='M' ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid... [truncated message content] |
From: <dai...@us...> - 2011-10-22 05:19:53
|
Revision: 4729 http://web-erp.svn.sourceforge.net/web-erp/?rev=4729&view=rev Author: daintree Date: 2011-10-22 05:19:43 +0000 (Sat, 22 Oct 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/GLJournal.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/WorkOrderStatus.php Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/GLJournal.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -10,9 +10,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -if (isset($_GET['NewJournal']) and $_GET['NewJournal'] == 'Yes' AND isset($_SESSION['JournalDetail'])){ +if (isset($_GET['NewJournal']) + AND $_GET['NewJournal'] == 'Yes' + AND isset($_SESSION['JournalDetail'])){ + unset($_SESSION['JournalDetail']->GLEntries); unset($_SESSION['JournalDetail']); + } if (!isset($_SESSION['JournalDetail'])){ @@ -44,7 +48,7 @@ $_SESSION['JournalDetail']->JournalType = $_POST['JournalType']; } -if (isset($_POST['CommitBatch']) and $_POST['CommitBatch']==_('Accept and Process Journal')){ +if (isset($_POST['CommitBatch']) AND $_POST['CommitBatch']==_('Accept and Process Journal')){ /* once the GL analysis of the journal is entered process all the data in the session cookie into the DB @@ -60,19 +64,19 @@ foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . $PeriodNo . "', '" . $JournalItem->GLCode . "', - '" . $JournalItem->Narrative . "', + '" . DB_escape_string($JournalItem->Narrative) . "', '" . $JournalItem->Amount . "', '" . $JournalItem->tag."' )"; @@ -82,19 +86,19 @@ if ($_POST['JournalType']=='Reversing'){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ('0', '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', '" . ($PeriodNo + 1) . "', '" . $JournalItem->GLCode . "', - 'Reversal - " . $JournalItem->Narrative . "', + '" . _('Reversal') . " - " . DB_escape_string($JournalItem->Narrative) . "', '" . -($JournalItem->Amount) ."', '".$JournalItem->tag."' )"; @@ -117,7 +121,8 @@ unset($_SESSION['JournalDetail']); /*Set up a newy in case user wishes to enter another */ - echo '<br /><a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; + echo '<br /> + <a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>'; /*And post the journal too */ include ('includes/GLPostings.inc'); include ('includes/footer.inc'); @@ -128,17 +133,17 @@ /* User hit delete the line from the journal */ $_SESSION['JournalDetail']->Remove_GLEntry($_GET['Delete']); -} elseif (isset($_POST['Process']) and $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal +} elseif (isset($_POST['Process']) AND $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal if ($_POST['GLCode']!='') { $extract = explode(' - ',$_POST['GLCode']); $_POST['GLCode'] = $extract[0]; } if ($_POST['Debit']>0) { - $_POST['GLAmount'] = $_POST['Debit']; + $_POST['GLAmount'] = filter_number_format($_POST['Debit']); } elseif ($_POST['Credit']>0) { - $_POST['GLAmount'] = '-' . $_POST['Credit']; + $_POST['GLAmount'] = -filter_number_format($_POST['Credit']); } - if ($_POST['GLManualCode'] != '' AND is_numeric($_POST['GLManualCode'])){ + if ($_POST['GLManualCode'] != ''){ // If a manual code was entered need to check it exists and isnt a bank account $AllowThisPosting = true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ @@ -167,17 +172,25 @@ unset($_POST['GLManualCode']); } else { $myrow = DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLManualCode'], + $myrow['accountname'], + $_POST['tag']); } } } else { $AllowThisPosting =true; //by default if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){ - if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']){ + prnMsg(_('GL Journals involving the debtors control account cannot be entered. The general ledger debtors ledger (AR) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } - if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' + AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact']){ + prnMsg(_('GL Journals involving the creditors control account cannot be entered. The general ledger creditors ledger (AP) integration is enabled so control accounts are automatically maintained by webERP. This setting can be disabled in System Configuration'),'warn'); $AllowThisPosting = false; } @@ -199,7 +212,11 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['JournalDetail']->add_to_glanalysis($_POST['GLAmount'], $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], $_POST['tag']); + $_SESSION['JournalDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLCode'], + $myrow['accountname'], + $_POST['tag']); } } @@ -225,7 +242,9 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -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>'; // A new table in the first column of the main table @@ -234,18 +253,21 @@ $_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); } -echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; -echo '<td>' . _('Type') . ':</td> - <td><select name="JournalType">'; +echo '<table> + <tr> + <td colspan="5"><table class="selection"> + <tr> + <td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td> + <td>' . _('Type') . ':</td> + <td><select name="JournalType">'; if ($_POST['JournalType'] == 'Reversing'){ - echo '<option selected="True" value = "Reversing">' . _('Reversing').'</option>'; + echo '<option selected value = "Reversing">' . _('Reversing').'</option>'; echo '<option value = "Normal">' . _('Normal').'</option>'; } else { echo '<option value = "Reversing">' . _('Reversing').'</option>'; - echo '<option selected="True" value = "Normal">' . _('Normal') . '</option>'; + echo '<option selected value = "Normal">' . _('Normal') . '</option>'; } echo '</select></td> @@ -257,20 +279,27 @@ echo '<table class="selection" width="70%">'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ -echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; +echo '<tr> + <th colspan="3"> + <div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div> + </th> + </tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th> +echo '<tr> + <th>' . _('GL Tag') . '</th> <th>' . _('GL Account Code') . '</th> - <th>' . _('Select GL Account') . '</th></tr>'; + <th>' . _('Select GL Account') . '</th> + </tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ //Select the tag -echo '<tr><td><select name="tag">'; +echo '<tr> + <td><select name="tag">'; $SQL = "SELECT tagref, - tagdescription + tagdescription FROM tags ORDER BY tagref"; @@ -294,9 +323,9 @@ ' value="'. $_POST['GLManualCode'] .'" /></td>'; $sql="SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode"; + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -314,36 +343,51 @@ $_POST['GLNarrative'] = ''; } if (!isset($_POST['Credit'])) { - $_POST['Credit'] = ''; + $_POST['Credit'] = 0; } if (!isset($_POST['Debit'])) { - $_POST['Debit'] = ''; + $_POST['Debit'] = 0; } -echo '</tr><tr><th>' . _('Debit') . '</th> - <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; -echo '</tr><tr><th>' . _('Credit') . '</th> - <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; -echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>'; -echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>'; +echo '</tr> + <tr> + <th>' . _('Debit') . '</th> + <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Debit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <th>' . _('Credit') . '</th> + <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . locale_number_format($_POST['Credit'],$_SESSION['CompanyRecord']['decimalplaces']) . '" /></td> + </tr> + <tr> + <td></td> + <td></td> + <th>'. _('Narrative'). '</th> + </tr> + <tr> + <th></th> + <th>' . _('GL Narrative') . '</th> + <td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td> + </tr> + </table> + <br />'; /*Close the main table */ +echo '<div class="centre"> + <input type="submit" name="Process" value="' . _('Accept') . '" /> + </div> + <br /> + <br />'; -echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; +echo '<table class="selection" width="85%"> + <tr> + <th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th> + </tr> + <tr> + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; - - -echo '<table class="selection" width="85%">'; - -echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; -echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th> - </tr>'; - $DebitTotal=0; $CreditTotal=0; $j=0; @@ -369,8 +413,9 @@ echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; - $DebitTotal=$DebitTotal+$JournalItem->Amount; + echo '<td class="number">' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td>'; + $DebitTotal += $JournalItem->Amount; } elseif($JournalItem->Amount<0) { $Credit=(-1 * $JournalItem->Amount); echo '<td></td> @@ -384,9 +429,10 @@ } echo '<tr class="EvenTableRows"><td></td> - <td class="number"><b>' . _('Total') . '</b></td> - <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + </tr>'; if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . locale_number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); @@ -398,10 +444,15 @@ } echo '</table>'; -if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; +if (abs($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ + echo '<br /> + <br /> + <div class="centre"> + <input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /> + </div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { - echo '<br /><br />'; + echo '<br /> + <br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); } Modified: trunk/WOSerialNos.php =================================================================== --- trunk/WOSerialNos.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WOSerialNos.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -40,13 +40,15 @@ $NextSerialNo = $_POST['NextSerialNo']; } -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . '</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="" alt="" />' . ' ' . _('For Work Order Number') . ' ' . $WO . ' ' . _('and output item') . ' ' . $StockID . ' - ' . $Description . ' + </p>'; $DbgMsg = _('The SQL that failed was'); if (isset($_POST['AddControlledItems'])){ if (isset($_POST['NumberToAdd'])){ // Must be adding serial numbers automatically - if (!is_numeric($_POST['NumberToAdd'])){ + if (!is_numeric(filter_number_format($_POST['NumberToAdd']))){ prnMsg(_('The quantity of controlled items to add was not numeric - a number is expected'),'error'); } else { DB_Txn_Begin($db); @@ -62,7 +64,7 @@ '" . $WO . "', '', '' "; - for ($i=0;$i<$_POST['NumberToAdd'];$i++){ + for ($i=0;$i< filter_number_format($_POST['NumberToAdd']);$i++){ $NextItemNumber = $NextSerialNo + $i; $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' @@ -93,7 +95,7 @@ $result = DB_query("UPDATE stockmaster SET nextserialno='" . $NextSerialNo . "' WHERE stockid='" . $StockID . "'",$db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . $_POST['NumberToAdd'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd+" . filter_number_format($_POST['NumberToAdd']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); DB_Txn_Commit($db); @@ -105,20 +107,20 @@ prnMsg(_('The batch or serial number reference has not been entered - a reference is required'),'error'); $InputError=true; } - if (!is_numeric($_POST['Quantity'])){ + if (!is_numeric(filter_number_format($_POST['Quantity']))){ prnMsg(_('The quantity for the batch must be numeric'),'error'); $InputError=true; } $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference'] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference']) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg(_('The serial number or batch reference must be unique to the item - the reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference'] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference']) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -128,7 +130,7 @@ DB_Txn_Begin($db); $ErrMsg = _('Could not add a new serial number/batch'); $result = DB_query("UPDATE woitems - SET qtyreqd=qtyreqd+" . $_POST['Quantity'] . " + SET qtyreqd=qtyreqd+" . filter_number_format($_POST['Quantity']) . " WHERE stockid='" . $StockID . "' AND wo='" . $WO . "'",$db,$ErrMsg,$DbgMsg,true); $sql = "INSERT INTO woserialnos (stockid, @@ -139,8 +141,8 @@ VALUES ('" . $StockID . "', '" . $WO . "', '', - '" . $_POST['Quantity'] . "', - '" . $_POST['Reference'] . "')"; + '" . filter_number_format($_POST['Quantity']) . "', + '" . DB_escape_string($_POST['Reference']) . "')"; $ErrMsg = _('Unable to add the batch or serial number requested'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -156,10 +158,10 @@ $result = DB_query("DELETE FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_GET['Reference'] ."'", + AND serialno='" . DB_escape_string($_GET['Reference']) ."'", $db); - $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . $_GET['Quantity'] . " + $result = DB_query("UPDATE woitems SET qtyreqd=qtyreqd-" . filter_number_format($_GET['Quantity']) . " WHERE wo='" . $WO . "' AND stockid = '" . $StockID . "'",$db); @@ -183,13 +185,13 @@ $result = DB_query("SELECT serialno FROM woserialnos WHERE wo='" . $WO . "' AND stockid='" . $StockID ."' - AND serialno='" . $_POST['Reference' . $i] . "'",$db); + AND serialno='" . DB_escape_string($_POST['Reference' . $i]) . "'",$db); if (DB_num_rows($result)!=0){ $InputError=true; prnMsg($_POST['Reference' .$i] . ': ' . _('The reference entered is already entered on this work order'),'error'); } $result = DB_query("SELECT serialno FROM stockserialitems - WHERE serialno='" . $_POST['Reference' .$i] . "' + WHERE serialno='" . DB_escape_string($_POST['Reference' .$i]) . "' AND stockid='" . $StockID ."'",$db); if (DB_num_rows($result)!=0){ $InputError=true; @@ -197,13 +199,13 @@ } } if (!$InputError){ - $sql[] = "UPDATE woserialnos SET serialno='" . $_POST['Reference'.$i] . "', - quantity='" . $_POST['Quantity'.$i] ."', - qualitytext='" . $_POST['Notes'.$i] . "' + $sql[] = "UPDATE woserialnos SET serialno='" . DB_escape_string($_POST['Reference'.$i]) . "', + quantity='" . filter_number_format($_POST['Quantity'.$i]) ."', + qualitytext='" . DB_escape_string($_POST['Notes'.$i]) . "' WHERE wo='" . $WO . "' AND stockid='" . $StockID . "' - AND serialno='" . $_POST['OldReference'.$i] . "'"; - $WOQuantityTotal += $_POST['Quantity'.$i]; + AND serialno='" . DB_escape_string($_POST['OldReference'.$i]) . "'"; + $WOQuantityTotal += filter_number_format($_POST['Quantity'.$i]); } else { $WOQuantityTotal += $_POST['OldQuantity'.$i]; } @@ -226,39 +228,44 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; -echo '<input type="hidden" name="Description" value="' . $Description . '">'; -echo '<input type="hidden" name="WO" value="' . $WO . '">'; -echo '<input type="hidden" name="Serialised" value="' . $Serialised . '">'; -echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '">'; +echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; +echo '<input type="hidden" name="Description" value="' . $Description . '" />'; +echo '<input type="hidden" name="WO" value="' . $WO . '" />'; +echo '<input type="hidden" name="Serialised" value="' . $Serialised . '" />'; +echo '<input type="hidden" name="NextSerialNo" value="' . $NextSerialNo . '" />'; echo '<table class="selection">'; if ($Serialised==1 AND $NextSerialNo>0){ echo '<tr><td>' . _('Add A Number of New Serial Numbers'); echo ':</td> - <td><input type="text" name="NumberToAdd" size=10 class=number maxlength=10 value="1"></td> + <td><input type="text" name="NumberToAdd" size="10" class="number" maxlength="10" value="1" /></td> <td>' . _('Starting at') . ':</td><td align="right">' . $NextSerialNo . '</td>'; } else { //Need to allow entry of batch or serial number and its a batch a quantity too for individual entry if ($Serialised==1){ - echo '<tr><th></th><th>' . _('Serial No') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Serial No') . '</th></tr> <tr><td>'; echo _('Add a single serial number'); } else { - echo '<tr><th></th><th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> + echo '<tr> + <th></th> + <th>' . _('Batch/Lot Ref') . '</th><th>' . _('Quantity') . '</th></tr> <tr><td>'; echo _('Add a single batch/lot number'); } - echo '<td><input type="text" name="Reference" maxlength="30" size="30"></td>'; + echo '<td><input type="text" name="Reference" maxlength="30" size="30" /></td>'; if ($Serialised==0){ //also need to add the quantity - echo '<td><input type="text" name="Quantity" size=10 class=number maxlength=10 value="1"></td>'; + echo '<td><input type="text" name="Quantity" size="10" class="number" maxlength="10" value="1" /></td>'; } else { //it will be 1 for a serial item - echo '<input type="hidden" name="Quantity" value=1>'; + echo '<input type="hidden" name="Quantity" value="1" />'; } } -echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '"></td></tr> +echo '<td><input type="submit" name="AddControlledItems" value="' . _('Add') . '" /></td> + </tr> </table> <br />'; @@ -275,11 +282,19 @@ if (DB_num_rows($WOSerialNoResult)==0){ prnMsg(_('There are no serial items or batches yet defined for this work order item. Create new items first'),'info'); } else { - echo '<br /><table class="selection">'; + echo '<br /> + <table class="selection">'; if ($Serialised==1){ - $Header = '<tr><th>' . _('Serial No') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Serial No') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } else { - $Header = '<tr><th>' . _('Batch Ref') . '</th><th>' . _('Quantity') . '</th><th>' . _('Notes') . '</th></tr>'; + $Header = '<tr> + <th>' . _('Batch Ref') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Notes') . '</th> + </tr>'; } echo $Header; $i = 0; @@ -291,28 +306,29 @@ $j=0; } - echo '<tr><td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; + echo '<tr> + <td><input type="text" name="Reference' . $i .'" value="' . $WOSNRow['serialno'] . '"/></td>'; echo '<input type="hidden" name="OldReference' . $i . '" value="' . $WOSNRow['serialno'] . '"/>'; if ($Serialised==0){ - echo '<td><input type="text" name="Quantity' . $i .'" value="' . $WOSNRow['quantity'] . '" /></td>'; - echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . $WOSNRow['quantity'] . '" />'; + echo '<td><input type="text" name="Quantity' . $i .'" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" /></td>'; + echo '<input type="hidden" name="OldQuantity' . $i . '" value="' . locale_number_format($WOSNRow['quantity'],'Variable') . '" />'; } else { - echo '<input type="hidden" name="Quantity' . $i . '" value="1">'; + echo '<input type="hidden" name="Quantity' . $i . '" value="1" />'; } - echo '<td><textarea name="Notes' . $i .'" cols=60 rows=3>' . $WOSNRow['qualitytext'] .'</textarea></td>'; - echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . $WOSNRow['quantity'] . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</td></tr>'; + echo '<td><textarea name="Notes' . $i .'" cols="60" rows="3">' . $WOSNRow['qualitytext'] .'</textarea></td>'; + echo '<td><a href="' . $_SESSION['PHP_SELF'] . '?Delete=1&Reference=' . $WOSNRow['serialno'] . '&Quantity=' . locale_number_format($WOSNRow['quantity'],'Variable') . '&WO=' . $WO . '&StockID=' . $StockID . '&Description=' . $Description . '&Serialised=' . $Serialised . '&NextSerialNo=' . $NextSerialNo . '">' . _('Delete') . '</a></td></tr>'; $i++; $j++; } - echo '<input type="hidden" name="CountOfItems" value=' . $i . '>'; + echo '<input type="hidden" name="CountOfItems" value="' . $i . '" />'; if ($Serialised==0){ echo '<tr><td style="text-align: center" colspan="3">'; } else { echo '<tr><td style="text-align: center" colspan="2">'; } - echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '"></td></tr>'; + echo '<input type="submit" name="UpdateItems" value="' . _('Update') . '" /></td></tr>'; echo '</table>'; } //end of if there are woserialno items defined Modified: trunk/WWW_Access.php =================================================================== --- trunk/WWW_Access.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Access.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -24,7 +24,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['SecRoleName']) && mb_strlen($_POST['SecRoleName'])<4){ + if (isset($_POST['SecRoleName']) AND mb_strlen($_POST['SecRoleName'])<4){ $InputError = 1; prnMsg(_('The role description entered must be at least 4 characters long'),'error'); } @@ -34,12 +34,12 @@ unset($sql); if (isset($_POST['SecRoleName']) ){ // Update or Add Security Headings if(isset($SelectedRole)) { // Update Security Heading - $sql = "UPDATE securityroles SET secrolename = '".$_POST['SecRoleName']."' + $sql = "UPDATE securityroles SET secrolename = '" . DB_escape_string($_POST['SecRoleName']) . "' WHERE secroleid = '".$SelectedRole . "'"; $ErrMsg = _('The update of the security role description failed because'); $ResMsg = _('The Security role description was updated.'); } else { // Add Security Heading - $sql = "INSERT INTO securityroles (secrolename) VALUES ('".$_POST['SecRoleName']."')"; + $sql = "INSERT INTO securityroles (secrolename) VALUES ('" . DB_escape_string($_POST['SecRoleName']) ."')"; $ErrMsg = _('The update of the security role failed because'); $ResMsg = _('The Security role was created.'); } @@ -165,10 +165,16 @@ if (!isset($_POST['SecRoleName'])) { $_POST['SecRoleName']=''; } -echo '<tr><td>' . _('Role') . ':</td> - <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '"></tr>'; -echo '</table><br /> - <div class="centre"><input type="submit" name="submit" value="' . _('Enter Role') . '"></div></form>'; +echo '<tr> + <td>' . _('Role') . ':</td> + <td><input type="text" name="SecRoleName" size=40 maxlength=40 value="' . $_POST['SecRoleName'] . '" /> + </tr>'; +echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Role') . '" /> + </div> + </form>'; if (isset($SelectedRole)) { $sql = "SELECT tokenid, tokenname Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WWW_Users.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -388,9 +388,9 @@ $_POST['Blocked'] = $myrow['blocked']; $_POST['PDFLanguage'] = $myrow['pdflanguage']; - echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; - echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; - echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '" /'; + echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '" />'; + echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '" />'; echo '<table class=selection> <tr><td>' . _('User code') . ':</td><td>'; echo $_POST['UserID'] . '</td></tr>'; @@ -400,7 +400,7 @@ echo '<table class="selection"> <tr> <td>' . _('User Login') . ':</td> - <td><input type="text" name="UserID" size="22" maxlength="20"></td></tr>'; + <td><input type="text" name="UserID" size="22" maxlength="20" /></td></tr>'; /*set the default modules to show to all this had trapped a few people previously*/ @@ -668,7 +668,7 @@ echo '</table> <br /> <div class="centre"> - <input type="submit" name="submit" value="' . _('Enter Information') . '"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> </form>'; Modified: trunk/WhereUsedInquiry.php =================================================================== --- trunk/WhereUsedInquiry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WhereUsedInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Where Used Inquiry'); include('includes/header.inc'); @@ -14,25 +12,30 @@ $StockID = trim(mb_strtoupper($_POST['StockID'])); } -echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a> + <br /> + <p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' + </p>'; if (isset($StockID)){ $result = DB_query("SELECT description, - units, - mbflag - FROM stockmaster - WHERE stockid='".$StockID."'",$db); + units, + mbflag + FROM stockmaster + WHERE stockid='".$StockID."'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0){ prnMsg(_('The item code entered') . ' - ' . $StockID . ' ' . _('is not set up as an item in the system') . '. ' . _('Re-enter a valid item code or select from the Select Item link above'),'error'); include('includes/footer.inc'); exit; } - echo "<br /><font color=navy size=3><b>$StockID - $myrow[0] </b> (" . _('in units of') . ' ' . $myrow[1] . ')</font>'; + echo '<br /> + <font color="navy" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('in units of') . ' ' . $myrow[1] . ')</font>'; } -echo "<form action='" . $_SERVER['PHP_SELF'] . '?'. SID ."' method=post><div class='centre'>"; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <div class="centre"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($StockID)) { echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" value="' . $StockID . '" />'; @@ -40,19 +43,20 @@ echo _('Enter an Item Code') . ': <input type="text" name="StockID" size="21" maxlength="20" />'; } -echo "<input type=submit name='ShowWhereUsed' value='" . _('Show Where Used') . "'>"; +echo '<input type="submit" name="ShowWhereUsed" value="' . _('Show Where Used') . '" />'; -echo '</div><br />'; +echo '</div> + <br />'; if (isset($StockID)) { $SQL = "SELECT bom.*, - stockmaster.description - FROM bom INNER JOIN stockmaster + stockmaster.description + FROM bom INNER JOIN stockmaster ON bom.parent = stockmaster.stockid - WHERE component='" . $StockID . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto >='" . Date('Y-m-d') . "'"; + WHERE component='" . $StockID . "' + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto >='" . Date('Y-m-d') . "'"; $ErrMsg = _('The parents for the selected part could not be retrieved because');; $result = DB_query($SQL,$db,$ErrMsg); @@ -60,45 +64,44 @@ prnMsg(_('The selected item') . ' ' . $StockID . ' ' . _('is not used as a component of any other parts'),'error'); } else { - echo '<table width=97% class=selection>'; + echo '<table width=97% class=selection>'; - $tableheader = '<tr><th>' . _('Used By') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th></tr>'; - echo $tableheader; - $k=0; - while ($myrow=DB_fetch_array($result)) { + $TableHeader = '<tr> + <th>' . _('Used By') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + </tr>'; + echo $TableHeader; + $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">';; - $k=1; - } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k=1; + } - echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td>'; - echo '<td>' . $myrow['workcentreadded']. '</td>'; - echo '<td>' . $myrow['loccode']. '</td>'; - echo '<td>' . $myrow['quantity']. '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td>'; - echo '<td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; + echo '<td><a target="_blank" href="' . $rootpath . '/BOMInquiry.php?StockID=' . $myrow['parent'] . '" alt="' . _('Show Bill Of Material') . '">' . $myrow['parent']. ' - ' . $myrow['description']. '</a></td> + <td>' . $myrow['workcentreadded']. '</td> + <td>' . $myrow['loccode']. '</td> + <td class="number">' . locale_number_format($myrow['quantity'],'Variable') . '</td> + <td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td> + <td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>'; - //end of page full new headings if - } + //end of page full new headings if + } - echo '</table>'; + echo '</table>'; } } // StockID is set -echo "<script>defaultControl(document.forms[0].StockID);</script>"; +echo '<script>defaultControl(document.forms[0].StockID);</script>'; - echo '</form>'; - include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/WorkCentres.php =================================================================== --- trunk/WorkCentres.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkCentres.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -42,7 +42,7 @@ delete code below*/ $sql = "UPDATE workcentres SET location = '" . $_POST['Location'] . "', - description = '" . $_POST['Description'] . "', + description = '" . DB_escape_string($_POST['Description']) . "', overheadrecoveryact ='" . $_POST['OverheadRecoveryAct'] . "', overheadperhour = '" . $_POST['OverheadPerHour'] . "' WHERE code = '" . $SelectedWC . "'"; @@ -52,13 +52,13 @@ /*Selected work centre is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new work centre form */ $sql = "INSERT INTO workcentres (code, - location, - description, - overheadrecoveryact, - overheadperhour) + location, + description, + overheadrecoveryact, + overheadperhour) VALUES ('" . $_POST['Code'] . "', '" . $_POST['Location'] . "', - '" . $_POST['Description'] . "', + '" . DB_escape_string($_POST['Description']) . "', '" . $_POST['OverheadRecoveryAct'] . "', '" . $_POST['OverheadPerHour'] . "' )"; @@ -107,7 +107,9 @@ then none of the above are true and the list of work centres 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*/ - 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>'; $sql = "SELECT workcentres.code, workcentres.description, @@ -120,31 +122,34 @@ $result = DB_query($sql,$db); echo '<table class="selection"> - <tr bgcolor ="#800000"><th>' . _('WC Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Overhead GL Account') . '</th> - <th>' . _('Overhead Per Hour') . '</th> + <tr bgcolor ="#800000"> + <th>' . _('WC Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Overhead GL Account') . '</th> + <th>' . _('Overhead Per Hour') . '</th> </tr>'; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { - printf("<tr><td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td><a href=\"%s&SelectedWC=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedWC=%s&delete=yes\">" . _('Delete') ."</td> - </tr>", - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + printf('<tr> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&SelectedWC=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedWC=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this work centre?') . '\');">' . _('Delete') .'</td> + </tr>', + $myrow['code'], + $myrow['description'], + $myrow['locationname'], + $myrow['overheadrecoveryact'], + $myrow['overheadperhour'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['code'], + $_SERVER['PHP_SELF'] . '?', + $myrow['code']); } //END WHILE LIST LOOP @@ -158,20 +163,21 @@ echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show all Work Centres') . '</a></div>'; } -echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; +echo '<br /> + <form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedWC)) { //editing an existing work centre $sql = "SELECT code, - location, - description, - overheadrecoveryact, - overheadperhour - FROM workcentres - WHERE code='" . $SelectedWC . "'"; - + location, + description, + overheadrecoveryact, + overheadperhour + FROM workcentres + WHERE code='" . $SelectedWC . "'"; + $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -181,31 +187,36 @@ $_POST['OverheadRecoveryAct'] = $myrow['overheadrecoveryact']; $_POST['OverheadPerHour'] = $myrow['overheadperhour']; - echo '<input type="hidden" name="SelectedWC" value=' . $SelectedWC . '>'; - echo '<input type="hidden" name="Code" value="' . $_POST['Code'] . '">'; - echo '<table class="selection"><tr><td>' ._('Work Centre Code') . ':</td> - <td>' . $_POST['Code'] . '</td></tr>'; + echo '<input type="hidden" name="SelectedWC" value="' . $SelectedWC . '" /> + <input type="hidden" name="Code" value="' . $_POST['Code'] . '" /> + <table class="selection"> + <tr> + <td>' ._('Work Centre Code') . ':</td> + <td>' . $_POST['Code'] . '</td> + </tr>'; } else { //end of if $SelectedWC only do the else when a new record is being entered if (!isset($_POST['Code'])) { $_POST['Code'] = ''; } - echo '<table class="selection"><tr> - <td>' . _('Work Centre Code') . ':</td> - <td><input type="Text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '"></td> + echo '<table class="selection"> + <tr> + <td>' . _('Work Centre Code') . ':</td> + <td><input type="text" name="Code" size="6" maxlength="5" value="' . $_POST['Code'] . '" /></td> </tr>'; } $SQL = "SELECT locationname, - loccode + loccode FROM locations"; $result = DB_query($SQL,$db); if (!isset($_POST['Description'])) { $_POST['Description'] = ''; } -echo '<tr><td>' . _('Work Centre Description') . ':</td> - <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '"></td> +echo '<tr> + <td>' . _('Work Centre Description') . ':</td> + <td><input type="Text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '" /></td> </tr> <tr><td>' . _('Location') . ':</td> <td><select name="Location">'; @@ -214,7 +225,7 @@ if (isset($_POST['Location']) and $myrow['loccode']==$_POST['Location']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -223,13 +234,15 @@ DB_free_result($result); -echo '</select></td></tr> - <tr><td>' . _('Overhead Recovery GL Account') . ':</td> +echo '</select></td> + </tr> + <tr> + <td>' . _('Overhead Recovery GL Account') . ':</td> <td><select name="OverheadRecoveryAct">'; //SQL to poulate account selection boxes $SQL = "SELECT accountcode, - accountname + accountname FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_=accountgroups.groupname WHERE accountgroups.pandl!=0 @@ -253,17 +266,23 @@ } echo '</td></tr>'; -echo '<tr><td>' . _('Overhead Per Hour') . ':</td> - <td><input type="Text" class="number" name="OverheadPerHour" size=6 maxlength=6 value='.$_POST['OverheadPerHour'].'>'; +echo '<tr> + <td>' . _('Overhead Per Hour') . ':</td> + <td><input type="text" class="number" name="OverheadPerHour" size="6" maxlength="6" value="'.$_POST['OverheadPerHour'].'" />'; -echo '</td></tr></table>'; +echo '</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>'; if (!isset($_GET['SelectedWC']) or $_GET['SelectedWC']=='') { - echo "<script>defaultControl(document.forms[0].Code);</script>"; + echo '<script>defaultControl(document.forms[0].Code);</script>'; } else { - echo "<script>defaultControl(document.forms[0].Description);</script>"; + echo '<script>defaultControl(document.forms[0].Description);</script>'; } echo '</form>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderCosting.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -6,11 +6,13 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a><br />'; +echo '<a href="'. $rootpath . '/SelectWorkOrder.php">' . _('Back to Work Orders'). '</a> + <br /> + <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>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -47,14 +49,17 @@ $WorkOrderRow = DB_fetch_array($WOResult); -echo '<table cellpadding=2 class=selection> - <tr><td class="label">' . _('Work order') . ':</td> +echo '<table class="selection"> + <tr> + <td class="label">' . _('Work order') . ':</td> <td>' . $_POST['WO'] .'</td> <td class="label">' . _('Manufactured at') . ':</td> <td>' . $WorkOrderRow['locationname'] . '</td> <td class="label">' . _('Required By') . ':</td> - <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td></tr> - </table><br />'; + <td>' . ConvertSQLDate($WorkOrderRow['requiredby']) . '</td> + </tr> + </table> + <br />'; $WOItemsResult = DB_query("SELECT woitems.stockid, @@ -77,19 +82,23 @@ $db, $ErrMsg); -echo '<table class="selection"><tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity Required') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Quantity Received') . '</th> - <th>' . _('Status') . '</th> - <th>' . _('Receive') . '</th> - <th>' . _('Issue') . '</th></tr>'; +echo '<table class="selection"> + <tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity Required') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Quantity Received') . '</th> + <th>' . _('Status') . '</th> + <th>' . _('Receive') . '</th> + <th>' . _('Issue') . '</th> + </tr>'; $TotalStdValueRecd =0; while ($WORow = DB_fetch_array($WOItemsResult)){ - echo '<tr><td>' . $WORow['stockid'] . '</td> + echo '<tr> + <td>' . $WORow['stockid'] . '</td> <td>' . $WORow['description'] . '</td> <td class="number">' . locale_number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> <td>' . $WORow['units'] . '</td> @@ -106,18 +115,18 @@ <br /> <table class="selection">'; +echo '<tr> + <th>' . _('Item') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Qty Reqd') . '</th> + <th>' . _('Cost Reqd') . '</th> + <th>' . _('Date Issued') . '</th> + <th>' . _('Issued Qty') . '</th> + <th>' . _('Issued Cost') . '</th> + <th>' . _('Usage Variance') . '</th> + <th>' . _('Cost Variance') . '</th> + </tr>'; -echo '<tr><th>' . _('Item') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Qty Reqd') . '</th> - <th>' . _('Cost Reqd') . '</th> - <th>' . _('Date Issued') . '</th> - <th>' . _('Issued Qty') . '</th> - <th>' . _('Issued Cost') . '</th> - <th>' . _('Usage Variance') . '</th> - <th>' . _('Cost Variance') . '</th> - </tr>'; - $RequirementsResult = DB_query("SELECT worequirements.stockid, stockmaster.description, stockmaster.decimalplaces, @@ -185,7 +194,8 @@ } else { echo '<tr class="OddTableRows">'; } - echo '<td colspan="9"><hr></td></tr>'; + echo '<td colspan="9"><hr></td> + </tr>'; } if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -201,13 +211,15 @@ /*Required quantity is the quantity required of the component based on the quantity of the finished item received */ $UsageVar =($RequirementsRow['requiredqty']-$IssueQty)*($RequirementsRow['stdcost']); - echo '<td colspan="2"></td><td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td></td> - <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + echo '<td colspan="2"></td> + <td class="number">' . locale_number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td></td> + <td class="number">' . locale_number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $TotalReqdCost += $RequirementsRow['expectedcost']; $TotalIssuedCost += $IssueCost; $TotalCostVar += $CostVar; @@ -217,26 +229,28 @@ } else { $k++; } - echo '<tr><td colspan="9"><hr></td></tr>'; + echo '<tr> + <td colspan="9"><hr></td> + </tr>'; } //Now need to run through the issues to the work order that weren't in the requirements $sql = "SELECT stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - trandate, - qty, - stockmoves.standardcost - FROM stockmoves INNER JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockmoves.stockid NOT IN - (SELECT worequirements.stockid - FROM worequirements - WHERE worequirements.wo='" . $_POST['WO'] . "')"; + stockmaster.description, + stockmaster.decimalplaces, + trandate, + qty, + stockmoves.standardcost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.type=28 + AND reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid NOT IN + (SELECT worequirements.stockid + FROM worequirements + WHERE worequirements.wo='" . $_POST['WO'] . "')"; $WOIssuesResult = DB_query($sql,$db,_('Could not get issues that were not required by the BOM because')); @@ -251,33 +265,38 @@ } echo '<td>' . $WOIssuesRow['stockid'] . '</td> - <td>' . $WOIssuesRow['description'] . '</td> - <td class="number">0</td> - <td class="number">0</td> - <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> - <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">0</td></tr>'; + <td>' . $WOIssuesRow['description'] . '</td> + <td class="number">0</td> + <td class="number">0</td> + <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> + <td class="number">' . locale_number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">0</td> + </tr>'; $TotalUsageVar += ($WOIssuesRow['qty']*$WOIssuesRow['standardcost']); } } # <!-- <td colspan="5"></td> --> -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> </tr>'; -echo '<tr><td colspan="2" class="number">' . _('Totals') . '</td> - <td></td> - <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td></td><td></td> - <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; - -echo '<tr><td colspan="3"></td> +echo '<tr> + <td colspan="2" class="number">' . _('Totals') . '</td> + <td></td> + <td class="number">' . locale_number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td></td><td></td> + <td class="number">' . locale_number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . locale_number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; + +echo '<tr> + <td colspan="3"></td> <td><hr/></td> <td colspan="2"></td> <td colspan="3"><hr></td> @@ -403,12 +422,12 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalUsageVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -422,12 +441,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -445,11 +464,11 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $TotalCostVar!=0){ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, + typeno, + trandate, + periodno, + account, + narrative, amount) VALUES (29, '" . $WOCloseNo . "', @@ -464,12 +483,12 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES (29, '" . $WOCloseNo . "', '" . Date('Y-m-d') . "', @@ -515,12 +534,21 @@ if ($WorkOrderRow['closed']==0){ - echo '<tr><td colspan="9"><div class="centre"><input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"></div></td></tr>'; + echo '<tr> + <td colspan="9"> + <div class="centre"> + <input type=submit name="Close" value="' . _('Close This Work Order') . '" onclick="return confirm(\'' . _('Closing the work order takes the variances to the general ledger (if integrated). The work order will no longer be able to have manufactured goods received entered against it or materials issued to it.') . ' ' . _('Are You Sure?') . '\');"> + </div> + </td> + </tr>'; } else { - echo '<tr><td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td></tr>'; + echo '<tr> + <td colspan="9">' . _('This work order is closed and cannot accept additional issues of materials or receipts of manufactured items') . '</td> + </tr>'; } -echo '</table>'; -echo '</form>'; +echo '</table> + + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2011-10-19 09:40:44 UTC (rev 4728) +++ trunk/WorkOrderEntry.php 2011-10-22 05:19:43 UTC (rev 4729) @@ -7,8 +7,10 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . - '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; if (isset($_GET['ReqDate'])){ $ReqDate = $_GET['ReqDate']; @@ -68,23 +70,22 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.description " . LIKE . " '$SearchString' AND stockmaster.discontinued=0 AND mbflag='M' ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid... [truncated message content] |
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. |
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: <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-18 05:51:14
|
Revision: 4726 http://web-erp.svn.sourceforge.net/web-erp/?rev=4726&view=rev Author: daintree Date: 2011-10-18 05:51:03 +0000 (Tue, 18 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLBudgets.php Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-10-17 16:22:16 UTC (rev 4725) +++ trunk/GLBudgets.php 2011-10-18 05:51:03 UTC (rev 4726) @@ -25,13 +25,17 @@ } //If an account has not been selected then select one here. -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>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="selectaccount">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table>'; -echo '<br /><tr><td>'. _('Select GL Account'). ":</td><td><select name='SelectedAccount' - onChange='ReloadForm(selectaccount.Select)'>"; +echo '<br /> + <tr> + <td>'. _('Select GL Account'). ':</td> + <td><select name="SelectedAccount" onChange="ReloadForm(selectaccount.Select)">'; $SQL = "SELECT accountcode, accountname @@ -40,36 +44,43 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg(_('No General ledger accounts have been set up yet') . ' - ' . _('budgets cannot be allocated until the GL accounts are set up'),'warn'); } else { while ($myrow=DB_fetch_array($result)){ - $account = $myrow['accountcode'] . ' - ' . $myrow['accountname']; - if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount==$myrow['accountcode']){ - echo '<option selected value=' . $myrow['accountcode'] . '>' . $account . '</option>'; + $Account = $myrow['accountcode'] . ' - ' . $myrow['accountname']; + if (isset($SelectedAccount) AND isset($LastCode) AND $SelectedAccount==$myrow['accountcode']){ + echo '<option selected value=' . $myrow['accountcode'] . '>' . $Account . '</option>'; $PrevCode=$LastCode; } else { - echo '<option value=' . $myrow['accountcode'] . '>' . $account . '</option>'; - if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount == $LastCode) { + echo '<option value=' . $myrow['accountcode'] . '>' . $Account . '</option>'; + if (isset($SelectedAccount) AND isset($LastCode) AND $SelectedAccount == $LastCode) { $NextCode=$myrow['accountcode']; } } $LastCode=$myrow['accountcode']; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } if (!isset($PrevCode)) {$PrevCode='';} if (!isset($NextCode)) {$NextCode='';} -echo '<input type="hidden" name="PrevAccount" value='.$PrevCode.'>'; -echo '<input type="hidden" name="NextAccount" value='.$NextCode.'>'; +echo '<input type="hidden" name="PrevAccount" value="'.$PrevCode.'" />'; +echo '<input type="hidden" name="NextAccount" value="'.$NextCode.'" />'; echo '</table>'; -echo '<br /><table><tr><td><input type="submit" name="Previous" value="' . _('Prev Account') . '"></td>'; -echo '<td><input type="submit" name="Select" value="' . _('Select Account') . '"></td>'; -echo '<td><input type="submit" name="Next" value="' . _('Next Account') . '"></td></tr>'; -echo '</table><br />'; -echo '</form>'; +echo '<br /> + <table> + <tr> + <td><input type="submit" name="Previous" value="' . _('Prev Account') . '" /></td> + <td><input type="submit" name="Select" value="' . _('Select Account') . '" /></td> + <td><input type="submit" name="Next" value="' . _('Next Account') . '" /></td> + </tr> + </table> + <br /> + </form>'; // End of account selection @@ -83,15 +94,15 @@ $ErrMsg = _('Cannot update GL budgets'); $DbgMsg = _('The SQL that failed to update the GL budgets was'); for ($i=1; $i<=12; $i++) { - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'last']),2). "' + $SQL="UPDATE chartdetails SET budget='" . round(filter_number_format($_POST[$i.'last']),$_SESSION['CompanyRecord']['decimalplaces']). "' WHERE period='" . ($CurrentYearEndPeriod-(24-$i)) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'this']),2). "' + $SQL="UPDATE chartdetails SET budget='" . round(filter_number_format($_POST[$i.'this']),$_SESSION['CompanyRecord']['decimalplaces']). "' WHERE period='" . ($CurrentYearEndPeriod-(12-$i)) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'next']),2)."' + $SQL="UPDATE chartdetails SET budget='". round(filter_number_format($_POST[$i.'next']),$_SESSION['CompanyRecord']['decimalplaces'])."' WHERE period='" . ($CurrentYearEndPeriod+$i) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); @@ -118,21 +129,21 @@ $result=DB_query($SQL,$db); while ($myrow=DB_fetch_array($result)) { - $budget[$myrow['period']]=$myrow['budget']; - $actual[$myrow['period']]=$myrow['actual']; + $Budget[$myrow['period']]=$myrow['budget']; + $Actual[$myrow['period']]=$myrow['actual']; } - if (isset($_POST['apportion'])) { + if (isset($_POST['Apportion'])) { for ($i=1; $i<=12; $i++) { if (filter_number_format($_POST['AnnualAmountLY']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmountLY']))){ - $budget[$CurrentYearEndPeriod+$i-24] =round(filter_number_format( $_POST['AnnualAmountLY'])/12,0); + $Budget[$CurrentYearEndPeriod+$i-24] =round(filter_number_format( $_POST['AnnualAmountLY'])/12,0); } if (filter_number_format($_POST['AnnualAmountTY']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmountTY']))){ - $budget[$CurrentYearEndPeriod+$i-12] = round(filter_number_format($_POST['AnnualAmountTY'])/12,0); + $Budget[$CurrentYearEndPeriod+$i-12] = round(filter_number_format($_POST['AnnualAmountTY'])/12,0); } if (filter_number_format($_POST['AnnualAmount']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmount']))){ - $budget[$CurrentYearEndPeriod+$i] = round(filter_number_format($_POST['AnnualAmount'])/12,0); + $Budget[$CurrentYearEndPeriod+$i] = round(filter_number_format($_POST['AnnualAmount'])/12,0); } } } @@ -148,19 +159,19 @@ echo '<form name="form" action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<br /><table class=selection>'; - echo '<tr><th colspan=3>'. _('Last Financial Year') .'</th>'; - echo '<th colspan=3>'. _('This Financial Year') .'</th>'; - echo '<th colspan=3>'. _('Next Financial Year') .'</th></tr>'; - - echo '<tr><th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],-1)) .'</th>'; - echo '<th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)) .'</th>'; - echo '<th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],1)) .'</th></tr>'; - - echo '<tr>'; + echo '<br /> + <table class="selection"> + <tr> + <th colspan="3">'. _('Last Financial Year') .'</th> + <th colspan="3">'. _('This Financial Year') .'</th> + <th colspan="3">'. _('Next Financial Year') .'</th> + </tr> + <tr> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],-1)) .'</th> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)) .'</th> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],1)) .'</th> + </tr> + <tr>'; for ($i=0; $i<3; $i++) { echo '<th>'. _('Period'). '</th> <th>'. _('Actual') . '</th> @@ -173,47 +184,57 @@ for ($i=1; $i<=12; $i++) { echo '<tr>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(24-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($budget[$CurrentYearEndPeriod-(24-$i)],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($Budget[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'" /></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod-(12-$i)],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'this" value="'. locale_number_format($budget[$CurrentYearEndPeriod-(12-$i)],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'this" value="'. locale_number_format($Budget[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'"></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod+($i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod+$i],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'next" value="'. locale_number_format($budget[$CurrentYearEndPeriod+$i],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod+$i],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'next" value="'. locale_number_format($Budget[$CurrentYearEndPeriod+$i],$_SESSION['CompanyRecord']['decimalplaces']) .'"></td>'; echo '</tr>'; - $LastYearActual=$LastYearActual+$actual[$CurrentYearEndPeriod-(24-$i)]; - $LastYearBudget=$LastYearBudget+$budget[$CurrentYearEndPeriod-(24-$i)]; - $ThisYearActual=$ThisYearActual+$actual[$CurrentYearEndPeriod-(12-$i)]; - $ThisYearBudget=$ThisYearBudget+$budget[$CurrentYearEndPeriod-(12-$i)]; - $NextYearActual=$NextYearActual+$actual[$CurrentYearEndPeriod+($i)]; - $NextYearBudget=$NextYearBudget+$budget[$CurrentYearEndPeriod+($i)]; + $LastYearActual=$LastYearActual+$Actual[$CurrentYearEndPeriod-(24-$i)]; + $LastYearBudget=$LastYearBudget+$Budget[$CurrentYearEndPeriod-(24-$i)]; + $ThisYearActual=$ThisYearActual+$Actual[$CurrentYearEndPeriod-(12-$i)]; + $ThisYearBudget=$ThisYearBudget+$Budget[$CurrentYearEndPeriod-(12-$i)]; + $NextYearActual=$NextYearActual+$Actual[$CurrentYearEndPeriod+($i)]; + $NextYearBudget=$NextYearBudget+$Budget[$CurrentYearEndPeriod+($i)]; } // Total Line - echo '<tr><th>'. _('Total') .'</th>'; - echo '<th align="right">'.locale_number_format($LastYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($LastYearBudget,2,'.',''). '</th>'; - echo '<th align="right"></th>'; - echo '<th align="right">'.locale_number_format($ThisYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($ThisYearBudget,2,'.',''). '</th>'; - echo '<th align="right"></th>'; - echo '<th align="right">'.locale_number_format($NextYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($NextYearBudget,2,'.',''). '</th></tr>'; - echo '<tr><td colspan=2>'._('Annual Budget').'</td> - <td><input class=number type="text" size="14" name="AnnualAmountLY" value="0.00"></td> - </td><td><td></td> - <td><input class=number type="text" size=14 name="AnnualAmountTY" value="0.00"></td> - <td></td> - <td><input onChange="numberFormat(this,2)" class="number" type="text" size="14" name="AnnualAmount" value="0.00"></td>'; - echo '<td><input type="submit" name="apportion" value="' . _('Apportion Budget') . '"></td>'; - echo '</tr>'; - echo '</table>'; - echo '<input type="hidden" name="SelectedAccount" value='.$SelectedAccount.'>'; + echo '<tr> + <th>'. _('Total') .'</th> + <th class="number">'.locale_number_format($LastYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($LastYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number"></th> + <th class="number">'.locale_number_format($ThisYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($ThisYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number"></th> + <th class="number">'.locale_number_format($NextYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($NextYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + </tr> + <tr> + <td colspan="2">'._('Annual Budget').'</td> + <td><input class="number" type="text" size="14" name="AnnualAmountLY" value="0.00" /></td> + </td><td> + <td></td> + <td><input class="number" type="text" size="14" name="AnnualAmountTY" value="0.00" /></td> + <td></td> + <td><input onChange="numberFormat(this,2)" class="number" type="text" size="14" name="AnnualAmount" value="0.00" /></td> + <td><input type="submit" name="Apportion" value="' . _('Apportion Budget') . '" /></td> + </tr> + </table>'; + + echo '<input type="hidden" name="SelectedAccount" value="'.$SelectedAccount.'" />'; echo '<script>defaultControl(document.form.1next);</script>'; - echo '<br /><div class="centre"><input type="submit" name=update value="' . _('Update') . '"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name=update value="' . _('Update') . '"> + </div> + + </form>'; $SQL="SELECT MIN(periodno) FROM periods"; $result=DB_query($SQL,$db); @@ -227,13 +248,14 @@ for ($i=$FirstPeriod;$i<=$LastPeriod;$i++) { $sql="SELECT accountcode, - period, - budget, - actual, - bfwd, - bfwdbudget - FROM chartdetails - WHERE period ='". $i . "' AND accountcode = '" . $SelectedAccount . "'"; + period, + budget, + actual, + bfwd, + bfwdbudget + FROM chartdetails + WHERE period ='". $i . "' + AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg = _('Could not retrieve the ChartDetail records because'); $result = DB_query($sql,$db,$ErrMsg); @@ -242,9 +264,9 @@ $CFwdBudget = $myrow['bfwdbudget'] + $myrow['budget']; $sql = "UPDATE chartdetails - SET bfwdbudget='" . $CFwdBudget . "' - WHERE period='" . ($myrow['period'] +1) . "' - AND accountcode = '" . $SelectedAccount . "'"; + SET bfwdbudget='" . $CFwdBudget . "' + WHERE period='" . ($myrow['period'] +1) . "' + AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg =_('Could not update the chartdetails record because'); $updresult = DB_query($sql,$db,$ErrMsg); @@ -254,4 +276,4 @@ 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-18 05:51:13
|
Revision: 4726 http://web-erp.svn.sourceforge.net/web-erp/?rev=4726&view=rev Author: daintree Date: 2011-10-18 05:51:03 +0000 (Tue, 18 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLBudgets.php Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-10-17 16:22:16 UTC (rev 4725) +++ trunk/GLBudgets.php 2011-10-18 05:51:03 UTC (rev 4726) @@ -25,13 +25,17 @@ } //If an account has not been selected then select one here. -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>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="selectaccount">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table>'; -echo '<br /><tr><td>'. _('Select GL Account'). ":</td><td><select name='SelectedAccount' - onChange='ReloadForm(selectaccount.Select)'>"; +echo '<br /> + <tr> + <td>'. _('Select GL Account'). ':</td> + <td><select name="SelectedAccount" onChange="ReloadForm(selectaccount.Select)">'; $SQL = "SELECT accountcode, accountname @@ -40,36 +44,43 @@ $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; prnMsg(_('No General ledger accounts have been set up yet') . ' - ' . _('budgets cannot be allocated until the GL accounts are set up'),'warn'); } else { while ($myrow=DB_fetch_array($result)){ - $account = $myrow['accountcode'] . ' - ' . $myrow['accountname']; - if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount==$myrow['accountcode']){ - echo '<option selected value=' . $myrow['accountcode'] . '>' . $account . '</option>'; + $Account = $myrow['accountcode'] . ' - ' . $myrow['accountname']; + if (isset($SelectedAccount) AND isset($LastCode) AND $SelectedAccount==$myrow['accountcode']){ + echo '<option selected value=' . $myrow['accountcode'] . '>' . $Account . '</option>'; $PrevCode=$LastCode; } else { - echo '<option value=' . $myrow['accountcode'] . '>' . $account . '</option>'; - if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount == $LastCode) { + echo '<option value=' . $myrow['accountcode'] . '>' . $Account . '</option>'; + if (isset($SelectedAccount) AND isset($LastCode) AND $SelectedAccount == $LastCode) { $NextCode=$myrow['accountcode']; } } $LastCode=$myrow['accountcode']; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; } if (!isset($PrevCode)) {$PrevCode='';} if (!isset($NextCode)) {$NextCode='';} -echo '<input type="hidden" name="PrevAccount" value='.$PrevCode.'>'; -echo '<input type="hidden" name="NextAccount" value='.$NextCode.'>'; +echo '<input type="hidden" name="PrevAccount" value="'.$PrevCode.'" />'; +echo '<input type="hidden" name="NextAccount" value="'.$NextCode.'" />'; echo '</table>'; -echo '<br /><table><tr><td><input type="submit" name="Previous" value="' . _('Prev Account') . '"></td>'; -echo '<td><input type="submit" name="Select" value="' . _('Select Account') . '"></td>'; -echo '<td><input type="submit" name="Next" value="' . _('Next Account') . '"></td></tr>'; -echo '</table><br />'; -echo '</form>'; +echo '<br /> + <table> + <tr> + <td><input type="submit" name="Previous" value="' . _('Prev Account') . '" /></td> + <td><input type="submit" name="Select" value="' . _('Select Account') . '" /></td> + <td><input type="submit" name="Next" value="' . _('Next Account') . '" /></td> + </tr> + </table> + <br /> + </form>'; // End of account selection @@ -83,15 +94,15 @@ $ErrMsg = _('Cannot update GL budgets'); $DbgMsg = _('The SQL that failed to update the GL budgets was'); for ($i=1; $i<=12; $i++) { - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'last']),2). "' + $SQL="UPDATE chartdetails SET budget='" . round(filter_number_format($_POST[$i.'last']),$_SESSION['CompanyRecord']['decimalplaces']). "' WHERE period='" . ($CurrentYearEndPeriod-(24-$i)) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'this']),2). "' + $SQL="UPDATE chartdetails SET budget='" . round(filter_number_format($_POST[$i.'this']),$_SESSION['CompanyRecord']['decimalplaces']). "' WHERE period='" . ($CurrentYearEndPeriod-(12-$i)) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - $SQL="UPDATE chartdetails SET budget='".Round(filter_number_format($_POST[$i.'next']),2)."' + $SQL="UPDATE chartdetails SET budget='". round(filter_number_format($_POST[$i.'next']),$_SESSION['CompanyRecord']['decimalplaces'])."' WHERE period='" . ($CurrentYearEndPeriod+$i) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); @@ -118,21 +129,21 @@ $result=DB_query($SQL,$db); while ($myrow=DB_fetch_array($result)) { - $budget[$myrow['period']]=$myrow['budget']; - $actual[$myrow['period']]=$myrow['actual']; + $Budget[$myrow['period']]=$myrow['budget']; + $Actual[$myrow['period']]=$myrow['actual']; } - if (isset($_POST['apportion'])) { + if (isset($_POST['Apportion'])) { for ($i=1; $i<=12; $i++) { if (filter_number_format($_POST['AnnualAmountLY']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmountLY']))){ - $budget[$CurrentYearEndPeriod+$i-24] =round(filter_number_format( $_POST['AnnualAmountLY'])/12,0); + $Budget[$CurrentYearEndPeriod+$i-24] =round(filter_number_format( $_POST['AnnualAmountLY'])/12,0); } if (filter_number_format($_POST['AnnualAmountTY']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmountTY']))){ - $budget[$CurrentYearEndPeriod+$i-12] = round(filter_number_format($_POST['AnnualAmountTY'])/12,0); + $Budget[$CurrentYearEndPeriod+$i-12] = round(filter_number_format($_POST['AnnualAmountTY'])/12,0); } if (filter_number_format($_POST['AnnualAmount']) != '0' AND is_numeric(filter_number_format($_POST['AnnualAmount']))){ - $budget[$CurrentYearEndPeriod+$i] = round(filter_number_format($_POST['AnnualAmount'])/12,0); + $Budget[$CurrentYearEndPeriod+$i] = round(filter_number_format($_POST['AnnualAmount'])/12,0); } } } @@ -148,19 +159,19 @@ echo '<form name="form" action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<br /><table class=selection>'; - echo '<tr><th colspan=3>'. _('Last Financial Year') .'</th>'; - echo '<th colspan=3>'. _('This Financial Year') .'</th>'; - echo '<th colspan=3>'. _('Next Financial Year') .'</th></tr>'; - - echo '<tr><th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],-1)) .'</th>'; - echo '<th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)) .'</th>'; - echo '<th colspan=3>'. _('Year ended').' - '. - Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],1)) .'</th></tr>'; - - echo '<tr>'; + echo '<br /> + <table class="selection"> + <tr> + <th colspan="3">'. _('Last Financial Year') .'</th> + <th colspan="3">'. _('This Financial Year') .'</th> + <th colspan="3">'. _('Next Financial Year') .'</th> + </tr> + <tr> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],-1)) .'</th> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)) .'</th> + <th colspan="3">'. _('Year ended').' - ' . Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],1)) .'</th> + </tr> + <tr>'; for ($i=0; $i<3; $i++) { echo '<th>'. _('Period'). '</th> <th>'. _('Actual') . '</th> @@ -173,47 +184,57 @@ for ($i=1; $i<=12; $i++) { echo '<tr>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(24-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($budget[$CurrentYearEndPeriod-(24-$i)],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($Budget[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'" /></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod-(12-$i)],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'this" value="'. locale_number_format($budget[$CurrentYearEndPeriod-(12-$i)],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'this" value="'. locale_number_format($Budget[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'"></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod+($i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($actual[$CurrentYearEndPeriod+$i],2).'</td>'; - echo '<td><input type="text" class="number" size=14 name="'.$i.'next" value="'. locale_number_format($budget[$CurrentYearEndPeriod+$i],2) .'"></td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod+$i],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; + echo '<td><input type="text" class="number" size=14 name="'.$i.'next" value="'. locale_number_format($Budget[$CurrentYearEndPeriod+$i],$_SESSION['CompanyRecord']['decimalplaces']) .'"></td>'; echo '</tr>'; - $LastYearActual=$LastYearActual+$actual[$CurrentYearEndPeriod-(24-$i)]; - $LastYearBudget=$LastYearBudget+$budget[$CurrentYearEndPeriod-(24-$i)]; - $ThisYearActual=$ThisYearActual+$actual[$CurrentYearEndPeriod-(12-$i)]; - $ThisYearBudget=$ThisYearBudget+$budget[$CurrentYearEndPeriod-(12-$i)]; - $NextYearActual=$NextYearActual+$actual[$CurrentYearEndPeriod+($i)]; - $NextYearBudget=$NextYearBudget+$budget[$CurrentYearEndPeriod+($i)]; + $LastYearActual=$LastYearActual+$Actual[$CurrentYearEndPeriod-(24-$i)]; + $LastYearBudget=$LastYearBudget+$Budget[$CurrentYearEndPeriod-(24-$i)]; + $ThisYearActual=$ThisYearActual+$Actual[$CurrentYearEndPeriod-(12-$i)]; + $ThisYearBudget=$ThisYearBudget+$Budget[$CurrentYearEndPeriod-(12-$i)]; + $NextYearActual=$NextYearActual+$Actual[$CurrentYearEndPeriod+($i)]; + $NextYearBudget=$NextYearBudget+$Budget[$CurrentYearEndPeriod+($i)]; } // Total Line - echo '<tr><th>'. _('Total') .'</th>'; - echo '<th align="right">'.locale_number_format($LastYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($LastYearBudget,2,'.',''). '</th>'; - echo '<th align="right"></th>'; - echo '<th align="right">'.locale_number_format($ThisYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($ThisYearBudget,2,'.',''). '</th>'; - echo '<th align="right"></th>'; - echo '<th align="right">'.locale_number_format($NextYearActual,2,'.',''). '</th>'; - echo '<th align="right">'.locale_number_format($NextYearBudget,2,'.',''). '</th></tr>'; - echo '<tr><td colspan=2>'._('Annual Budget').'</td> - <td><input class=number type="text" size="14" name="AnnualAmountLY" value="0.00"></td> - </td><td><td></td> - <td><input class=number type="text" size=14 name="AnnualAmountTY" value="0.00"></td> - <td></td> - <td><input onChange="numberFormat(this,2)" class="number" type="text" size="14" name="AnnualAmount" value="0.00"></td>'; - echo '<td><input type="submit" name="apportion" value="' . _('Apportion Budget') . '"></td>'; - echo '</tr>'; - echo '</table>'; - echo '<input type="hidden" name="SelectedAccount" value='.$SelectedAccount.'>'; + echo '<tr> + <th>'. _('Total') .'</th> + <th class="number">'.locale_number_format($LastYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($LastYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number"></th> + <th class="number">'.locale_number_format($ThisYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($ThisYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number"></th> + <th class="number">'.locale_number_format($NextYearActual,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + <th class="number">'.locale_number_format($NextYearBudget,$_SESSION['CompanyRecord']['decimalplaces']). '</th> + </tr> + <tr> + <td colspan="2">'._('Annual Budget').'</td> + <td><input class="number" type="text" size="14" name="AnnualAmountLY" value="0.00" /></td> + </td><td> + <td></td> + <td><input class="number" type="text" size="14" name="AnnualAmountTY" value="0.00" /></td> + <td></td> + <td><input onChange="numberFormat(this,2)" class="number" type="text" size="14" name="AnnualAmount" value="0.00" /></td> + <td><input type="submit" name="Apportion" value="' . _('Apportion Budget') . '" /></td> + </tr> + </table>'; + + echo '<input type="hidden" name="SelectedAccount" value="'.$SelectedAccount.'" />'; echo '<script>defaultControl(document.form.1next);</script>'; - echo '<br /><div class="centre"><input type="submit" name=update value="' . _('Update') . '"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name=update value="' . _('Update') . '"> + </div> + + </form>'; $SQL="SELECT MIN(periodno) FROM periods"; $result=DB_query($SQL,$db); @@ -227,13 +248,14 @@ for ($i=$FirstPeriod;$i<=$LastPeriod;$i++) { $sql="SELECT accountcode, - period, - budget, - actual, - bfwd, - bfwdbudget - FROM chartdetails - WHERE period ='". $i . "' AND accountcode = '" . $SelectedAccount . "'"; + period, + budget, + actual, + bfwd, + bfwdbudget + FROM chartdetails + WHERE period ='". $i . "' + AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg = _('Could not retrieve the ChartDetail records because'); $result = DB_query($sql,$db,$ErrMsg); @@ -242,9 +264,9 @@ $CFwdBudget = $myrow['bfwdbudget'] + $myrow['budget']; $sql = "UPDATE chartdetails - SET bfwdbudget='" . $CFwdBudget . "' - WHERE period='" . ($myrow['period'] +1) . "' - AND accountcode = '" . $SelectedAccount . "'"; + SET bfwdbudget='" . $CFwdBudget . "' + WHERE period='" . ($myrow['period'] +1) . "' + AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg =_('Could not update the chartdetails record because'); $updresult = DB_query($sql,$db,$ErrMsg); @@ -254,4 +276,4 @@ 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. |