From: <dai...@us...> - 2011-01-15 00:57:29
|
Revision: 4468 http://web-erp.svn.sourceforge.net/web-erp/?rev=4468&view=rev Author: daintree Date: 2011-01-15 00:57:20 +0000 (Sat, 15 Jan 2011) Log Message: ----------- Tims fork changes Modified Paths: -------------- trunk/AddCustomerNotes.php trunk/AddCustomerTypeNotes.php trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMs.php trunk/BankAccounts.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/ConfirmDispatch_Invoice.php trunk/Contracts.php trunk/CustLoginSetup.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/Customers.php trunk/DiscountCategories.php trunk/FixedAssetDepreciation.php trunk/FixedAssetItems.php trunk/FixedAssetLocations.php trunk/FixedAssetRegister.php trunk/FixedAssetTransfer.php trunk/GLAccountCSV.php trunk/GLAccountReport.php trunk/GLJournal.php trunk/MRP.php trunk/Prices.php trunk/RecurringSalesOrders.php trunk/SuppFixedAssetChgs.php trunk/build/make_release.sh trunk/doc/Change.log.html trunk/doc/Manual/ManualAPIFunctions.php trunk/includes/ConstructSQLForUserDefinedSalesReport.inc trunk/includes/DefineCartClass.php trunk/includes/DefineSuppTransClass.php trunk/includes/GLPostings.inc trunk/includes/MiscFunctions.php trunk/includes/PDFAgedDebtorsPageHeader.inc trunk/includes/PDFGrnHeader.inc trunk/includes/SQL_CommonFunctions.inc trunk/includes/SelectOrderItems_IntoCart.inc trunk/includes/UserLogin.php trunk/reportwriter/WriteForm.inc trunk/reportwriter/WriteReport.inc Removed Paths: ------------- trunk/FixedAssetList.php Modified: trunk/AddCustomerNotes.php =================================================================== --- trunk/AddCustomerNotes.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/AddCustomerNotes.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -91,7 +91,7 @@ } if (!isset($Id)) { - $SQLname='SELECT * from debtorsmaster where debtorno="'.$DebtorNo.'"'; + $SQLname="SELECT * from debtorsmaster where debtorno='".$DebtorNo."'"; $Result = DB_query($SQLname,$db); $row = DB_fetch_array($Result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/AddCustomerTypeNotes.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -88,7 +88,7 @@ } if (!isset($Id)) { - $SQLname='SELECT * from debtortype where typeid="'.$DebtorType.'"'; + $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') . Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BOMExtendedQty.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -51,18 +51,18 @@ // those parts into tempbom // This finds the top level - $sql = 'INSERT INTO passbom (part, extendedqpa, sortpart) + $sql = "INSERT INTO passbom (part, extendedqpa, sortpart) SELECT bom.component AS part, - (' . $_POST['Quantity'] . ' * bom.quantity) as extendedqpa, + (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa, CONCAT(bom.parent,bom.component) AS sortpart FROM bom - WHERE bom.parent =' . "'" . $_POST['Part'] . "' + WHERE bom.parent =" . "'" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $levelctr = 2; // $levelctr is the level counter - $sql = 'INSERT INTO tempbom ( + $sql = "INSERT INTO tempbom ( parent, component, sortpart, @@ -74,15 +74,15 @@ quantity) SELECT bom.parent, bom.component, - CONCAT(bom.parent,bom.component) AS sortpart,' - . $levelctr . ' as level, + CONCAT(bom.parent,bom.component) AS sortpart," + . $levelctr . " as level, bom.workcentreadded, bom.loccode, bom.effectiveafter, bom.effectiveto, - (' . $_POST['Quantity'] . ' * bom.quantity) as extendedqpa + (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa FROM bom - WHERE bom.parent =' . "'" . $_POST['Part'] . "' + WHERE bom.parent =" . "'" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); //echo "</br>sql is $sql</br>"; @@ -166,9 +166,9 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin); - $sql = 'SELECT stockmaster.stockid,stockmaster.description + $sql = "SELECT stockmaster.stockid,stockmaster.description FROM stockmaster - WHERE stockid = ' . "'" . $_POST['Part'] . "'"; + WHERE stockid = " . "'" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $assembly = $_POST['Part']; Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BOMIndented.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -46,11 +46,11 @@ // those parts into tempbom // This finds the top level - $sql = 'INSERT INTO passbom (part, sortpart) + $sql = "INSERT INTO passbom (part, sortpart) SELECT bom.component AS part, CONCAT(bom.parent,bom.component) AS sortpart FROM bom - WHERE bom.parent =' . "'" . $_POST['Part'] . "' + WHERE bom.parent =" . "'" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); @@ -158,10 +158,10 @@ } - $sql = 'SELECT stockmaster.stockid, + $sql = "SELECT stockmaster.stockid, stockmaster.description FROM stockmaster - WHERE stockid = ' . "'" . $_POST['Part'] . "'"; + WHERE stockid = " . "'" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $assembly = $_POST['Part']; Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BOMIndentedReverse.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -47,11 +47,11 @@ // those parts into tempbom // This finds the top level - $sql = 'INSERT INTO passbom (part, sortpart) + $sql = "INSERT INTO passbom (part, sortpart) SELECT bom.parent AS part, CONCAT(bom.component,bom.parent) AS sortpart FROM bom - WHERE bom.component =' . "'" . $_POST['Part'] . "' + WHERE bom.component =" . "'" . $_POST['Part'] . "' AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); @@ -157,10 +157,10 @@ } - $sql = 'SELECT stockmaster.stockid, + $sql = "SELECT stockmaster.stockid, stockmaster.description FROM stockmaster - WHERE stockid = ' . "'" . $_POST['Part'] . "'"; + WHERE stockid = " . "'" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $assembly = $_POST['Part']; Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BOMs.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -362,7 +362,7 @@ $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]); Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BankAccounts.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -82,7 +82,7 @@ /*Check if there are already transactions against this account - cant allow change currency if there are*/ - $sql = 'SELECT * FROM banktrans WHERE bankact=' . $SelectedBankAccount; + $sql = "SELECT * FROM banktrans WHERE bankact='" . $SelectedBankAccount . "'"; $BankTransResult = DB_query($sql,$db); if (DB_num_rows($BankTransResult)>0) { $sql = "UPDATE bankaccounts @@ -355,7 +355,7 @@ } if (isset($SelectedBankAccount)) { - $result = DB_query('SELECT invoice FROM bankaccounts where accountcode =' . $SelectedBankAccount ,$db); + $result = DB_query("SELECT invoice FROM bankaccounts where accountcode ='" . $SelectedBankAccount ."'",$db); while ($myrow = DB_fetch_array($result)) { if ($myrow['invoice']== 1) { echo '<option selected VALUE=1>'._('Yes').'</option><option value=0>'._('No').'</option>'; Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BankMatching.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -33,17 +33,17 @@ for ($Counter=1;$Counter <= $_POST['RowCounter']; $Counter++){ if (isset($_POST["Clear_" . $Counter]) and $_POST["Clear_" . $Counter]==True){ /*Get amount to be cleared */ - $sql = 'SELECT amount, + $sql = "SELECT amount, exrate FROM banktrans - WHERE banktransid="' . $_POST['BankTrans_' . $Counter].'"'; + WHERE banktransid='" . $_POST['BankTrans_' . $Counter]."'"; $ErrMsg = _('Could not retrieve transaction information'); $result = DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); $AmountCleared = round($myrow[0] / $myrow[1],2); /*Update the banktrans recoord to match it off */ - $sql = 'UPDATE banktrans SET amountcleared= '. $AmountCleared . - ' WHERE banktransid=' . $_POST['BankTrans_' . $Counter]; + $sql = "UPDATE banktrans SET amountcleared= ". $AmountCleared . + " WHERE banktransid='" . $_POST['BankTrans_' . $Counter] . "'"; $ErrMsg = _('Could not match off this payment because'); $result = DB_query($sql,$db,$ErrMsg); @@ -52,15 +52,15 @@ ((isset($_POST['AmtClear_' . $Counter]) AND $_POST['AmtClear_' . $Counter]<0 AND $Type=='Payments') OR ($Type=='Receipts' AND (isset($_POST['AmtClear_' . $Counter]) and $_POST['AmtClear_' . $Counter]>0)))){ /*if the amount entered was numeric and negative for a payment or positive for a receipt */ - $sql = 'UPDATE banktrans SET amountcleared=' . $_POST['AmtClear_' . $Counter] . ' - WHERE banktransid="' . $_POST['BankTrans_' . $Counter].'"'; + $sql = "UPDATE banktrans SET amountcleared=" . $_POST['AmtClear_' . $Counter] . " + WHERE banktransid='" . $_POST['BankTrans_' . $Counter]."'"; $ErrMsg = _('Could not update the amount matched off this bank transaction because'); $result = DB_query($sql,$db,$ErrMsg); } elseif (isset($_POST['Unclear_' . $Counter]) and $_POST['Unclear_' . $Counter]==True){ - $sql = 'UPDATE banktrans SET amountcleared = 0 - WHERE banktransid="' . $_POST['BankTrans_' . $Counter].'"'; + $sql = "UPDATE banktrans SET amountcleared = 0 + WHERE banktransid='" . $_POST['BankTrans_' . $Counter]."'"; $ErrMsg = _('Could not unclear this bank transaction because'); $result = DB_query($sql,$db,$ErrMsg); } Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/BankReconciliation.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -21,10 +21,10 @@ echo '<p>' . $_POST['BankStatmentBalance']; } else { /* Now need to get the currency of the account and the current table ex rate */ - $SQL = 'SELECT rate, bankaccountname + $SQL = "SELECT rate, bankaccountname FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev - WHERE bankaccounts.accountcode = "' . $_POST['BankAccount'].'"'; + WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); @@ -44,7 +44,7 @@ //yet to code the journal - $SQL = 'INSERT INTO gltrans (type, + $SQL = "INSERT INTO gltrans (type, typeno, trandate, periodno, @@ -52,17 +52,17 @@ narrative, amount) VALUES (36, - "' . $ExDiffTransNo . '", - "' . FormatDateForSQL($PostingDate) . '", - "' . $PeriodNo . '", - "' . $_SESSION['CompanyRecord']['exchangediffact'] . '", - "' . $BankAccountName . ' ' . _('reconciliation on') . ' ' . - Date($_SESSION['DefaultDateFormat']) . '","' . $ExchangeDifference . '")'; + '" . $ExDiffTransNo . "', + '" . FormatDateForSQL($PostingDate) . "', + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['exchangediffact'] . "', + '" . $BankAccountName . ' ' . _('reconciliation on') . " " . + Date($_SESSION['DefaultDateFormat']) . "','" . $ExchangeDifference . "')"; $ErrMsg = _('Cannot insert a GL entry for the exchange difference because'); $DbgMsg = _('The SQL that failed to insert the exchange difference GL entry was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL = 'INSERT INTO gltrans (type, + $SQL = "INSERT INTO gltrans (type, typeno, trandate, periodno, @@ -70,12 +70,12 @@ narrative, amount) VALUES (36, - "' . $ExDiffTransNo . '", - "' . FormatDateForSQL($PostingDate) . '", - "' . $PeriodNo . '", - "' . $_POST['BankAccount'] . '", - "' . $BankAccountName . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . '", - "' . (-$ExchangeDifference) . '")'; + '" . $ExDiffTransNo . "', + '" . FormatDateForSQL($PostingDate) . "', + '" . $PeriodNo . "', + '" . $_POST['BankAccount'] . "', + '" . $BankAccountName . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "', + '" . (-$ExchangeDifference) . "')"; $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -123,13 +123,13 @@ /*Get the balance of the bank account concerned */ - $sql = 'SELECT MAX(period) FROM chartdetails WHERE accountcode="' . $_POST['BankAccount'].'"'; + $sql = "SELECT MAX(period) FROM chartdetails WHERE accountcode='" . $_POST['BankAccount']."'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $LastPeriod = $myrow[0]; - $SQL = 'SELECT bfwd+actual AS balance - FROM chartdetails WHERE period="' . $LastPeriod . '" AND accountcode="' . $_POST['BankAccount'].'"'; + $SQL = "SELECT bfwd+actual AS balance + FROM chartdetails WHERE period='" . $LastPeriod . "' AND accountcode='" . $_POST['BankAccount']."'"; $ErrMsg = _('The bank account balance could not be returned by the SQL because'); $BalanceResult = DB_query($SQL,$db,$ErrMsg); @@ -138,12 +138,12 @@ $Balance = $myrow[0]; /* Now need to get the currency of the account and the current table ex rate */ - $SQL = 'SELECT rate, + $SQL = "SELECT rate, bankaccounts.currcode, bankaccounts.bankaccountname FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev - WHERE bankaccounts.accountcode = "' . $_POST['BankAccount'].'"'; + WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the currency and exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); $CurrencyRow = DB_fetch_row($CurrencyResult); @@ -159,7 +159,7 @@ echo '</b></td> <td valign=bottom class=number><b>' . number_format($Balance*$ExRate,2) . '</b></td></tr>'; - $SQL = 'SELECT amount/exrate AS amt, + $SQL = "SELECT amount/exrate AS amt, amountcleared, (amount/exrate)-amountcleared as outstanding, ref, @@ -169,9 +169,9 @@ FROM banktrans, systypes WHERE banktrans.type = systypes.typeid - AND banktrans.bankact="' . $_POST['BankAccount'] . '" + AND banktrans.bankact='" . $_POST['BankAccount'] . "' AND amount < 0 - AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate'; + AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate"; echo '<tr></tr>'; /*Bang in a blank line */ @@ -230,7 +230,7 @@ echo '<tr></tr> <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class=number>' . number_format($TotalUnpresentedCheques,2) . '</td></tr>'; - $SQL = 'SELECT amount/exrate AS amt, + $SQL = "SELECT amount/exrate AS amt, amountcleared, (amount/exrate)-amountcleared as outstanding, ref, @@ -240,9 +240,9 @@ FROM banktrans, systypes WHERE banktrans.type = systypes.typeid - AND banktrans.bankact="' . $_POST['BankAccount'] . '" + AND banktrans.bankact='" . $_POST['BankAccount'] . "' AND amount > 0 - AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate'; + AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate"; echo '<tr></tr>'; /*Bang in a blank line */ Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/ConfirmDispatch_Invoice.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -36,7 +36,7 @@ /*read in all the guff from the selected order into the Items cart */ - $OrderHeaderSQL = 'SELECT salesorders.orderno, + $OrderHeaderSQL = "SELECT salesorders.orderno, salesorders.debtorno, debtorsmaster.name, salesorders.branchcode, @@ -73,7 +73,7 @@ AND salesorders.debtorno = custbranch.debtorno AND locations.loccode=salesorders.fromstkloc AND debtorsmaster.currcode = currencies.currabrev - AND salesorders.orderno = "' . $_GET['OrderNumber'].'"'; + AND salesorders.orderno = '" . $_GET['OrderNumber']."'"; $ErrMsg = _('The order cannot be retrieved because'); $DbgMsg = _('The SQL to get the order header was'); @@ -122,7 +122,7 @@ /*now populate the line items array with the sales order details records */ - $LineItemsSQL = 'SELECT stkcode, + $LineItemsSQL = "SELECT stkcode, stockmaster.description, stockmaster.controlled, stockmaster.serialised, @@ -147,9 +147,9 @@ stockmaster.overheadcost AS standardcost FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorderdetails.orderno ="' . $_GET['OrderNumber'] . '" + WHERE salesorderdetails.orderno ='" . $_GET['OrderNumber'] . "' AND salesorderdetails.quantity - salesorderdetails.qtyinvoiced >0 - ORDER BY salesorderdetails.orderlineno'; + ORDER BY salesorderdetails.orderlineno"; $ErrMsg = _('The line items of the order cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); @@ -420,7 +420,7 @@ $FreightCost =0; } if (!is_numeric($BestShipper)){ - $SQL = 'SELECT shipper_id FROM shippers WHERE shipper_id=' . $_SESSION['Default_Shipper']; + $SQL = "SELECT shipper_id FROM shippers WHERE shipper_id='" . $_SESSION['Default_Shipper'] . "'"; $ErrMsg = _('There was a problem testing for a default shipper because'); $TestShipperExists = DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($TestShipperExists)==1){ Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/Contracts.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -374,7 +374,7 @@ $ErrMsg = _('The contract quotation could not be updated because'); $DbgMsg = _('The SQL that failed to update the quotation was'); $UpdQuoteResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - pnMsg(_('The contract quotation has been updated based on the new contract cost and margin'),'success'); + prnMsg(_('The contract quotation has been updated based on the new contract cost and margin'),'success'); echo '<br /><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; } @@ -980,4 +980,4 @@ } /*end of if customer selected and entering contract header*/ include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/CustLoginSetup.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -235,7 +235,7 @@ prnMsg(_('The demonstration user called demo cannot be deleted'),'error'); } else { */ - $sql='SELECT userid FROM audittrail where userid="'. $SelectedUser .'"'; + $sql="SELECT userid FROM audittrail where userid='". $SelectedUser ."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)!=0) { prnMsg(_('Cannot delete user as entries already exist in the audit trail'), 'warn'); Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/CustomerInquiry.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -26,16 +26,16 @@ } if (!isset($_POST['TransAfterDate'])) { - $sql = 'SELECT confvalue + $sql = "SELECT confvalue FROM `config` - WHERE confname ="NumberOfMonthMustBeShown"'; + WHERE confname ='NumberOfMonthMustBeShown'"; $ErrMsg=_('The config value NumberOfMonthMustBeShown cannot be retrieved'); $result = DB_query($sql,$db,$ErrMsg); $row = DB_fetch_array($result); $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m')-$row['confvalue'],Date('d'),Date('Y'))); } -$SQL = 'SELECT debtorsmaster.name, +$SQL = "SELECT debtorsmaster.name, currencies.currency, paymentterms.terms, debtorsmaster.creditlimit, @@ -47,23 +47,23 @@ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1', 'MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ')) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS due, SUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue - AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + ' . - $_SESSION['PastDueDays1'] . ') + AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . + $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1', 'MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ')) >= ' . $_SESSION['PastDueDays1'] . ') + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ". INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue1, SUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue - AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + ' . $_SESSION['PastDueDays2'] . ') THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1','MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ')) >= ' . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1','MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue2 FROM debtorsmaster, paymentterms, Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/CustomerReceipt.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -605,7 +605,7 @@ unset($_SESSION['CustomerRecord']); } - $SQL = 'SELECT debtorsmaster.name, + $SQL = "SELECT debtorsmaster.name, debtorsmaster.pymtdiscount, debtorsmaster.currcode, currencies.currency, @@ -618,17 +618,17 @@ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1','MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ')) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1','MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS due, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN - CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + ' . $_SESSION['PastDueDays1'] . ') THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight - debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight - debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1', 'MONTH') .'), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ')) >= ' . $_SESSION['PastDueDays1'] . ') THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') ."), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue1, SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN - CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + ' . $_SESSION['PastDueDays2'] . ') THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1','MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ')) >= ' . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1','MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue2 FROM debtorsmaster, paymentterms, Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/Customers.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -733,11 +733,11 @@ } // Select sales types for drop down list if (isset($_GET['Modify'])) { - $result=DB_query('SELECT sales_type FROM salestypes WHERE typeabbrev="'.$_POST['SalesType'].'"',$db); + $result=DB_query("SELECT sales_type FROM salestypes WHERE typeabbrev='".$_POST['SalesType']."'",$db); $myrow=DB_fetch_array($result); echo '<tr><td>' . _('Sales Type') . ":</td><td>".$myrow['sales_type']."</td></tr>"; } else { - $result=DB_query('SELECT typeabbrev, sales_type FROM salestypes ',$db); + $result=DB_query('SELECT typeabbrev, sales_type FROM salestypes',$db); echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ":</td> <td><select name='SalesType'>"; while ($myrow = DB_fetch_array($result)) { @@ -813,7 +813,7 @@ } if (isset($_GET['Modify'])) { - $result=DB_query('SELECT reasondescription FROM holdreasons WHERE reasoncode="'.$_POST['HoldReason'].'"',$db); + $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>"; } else { @@ -832,7 +832,7 @@ } if (isset($_GET['Modify'])) { - $result=DB_query('SELECT currency FROM currencies WHERE currabrev="'.$_POST['CurrCode'].'"',$db); + $result=DB_query("SELECT currency FROM currencies WHERE currabrev='".$_POST['CurrCode']."'",$db); $myrow=DB_fetch_array($result); echo '<tr><td>' . _('Credit Status') . ":</td><td>".$myrow['currency']."</td></tr>"; } else { @@ -890,7 +890,7 @@ echo '</select></td></tr></table></td></tr>'; echo '<tr><td colspan=2>'; - $sql = 'SELECT * FROM custcontacts where debtorno="'.$DebtorNo.'" ORDER BY contid'; + $sql = "SELECT * FROM custcontacts where debtorno='".$DebtorNo."' ORDER BY contid"; $result = DB_query($sql,$db); echo '<table class=selection>'; @@ -982,20 +982,20 @@ } if (isset($_POST['update'])) { - $SQLupdatecc='UPDATE custcontacts - SET contactname="'.$_POST['custname'].'", - role="'.$_POST['role'].'", - phoneno="'.$_POST['phoneno'].'", - notes="'.DB_escape_string($_POST['notes']).'" - Where debtorno="'.$DebtorNo.'" - and contid="'.$Edit.'"'; + $SQLupdatecc="UPDATE custcontacts + SET contactname='".$_POST['custname']."', + role='".$_POST['role']."', + phoneno='".$_POST['phoneno']."', + notes='".DB_escape_string($_POST['notes'])."' + Where debtorno='".$DebtorNo."' + and contid='".$Edit."'"; $resultupcc = DB_query($SQLupdatecc,$db); echo '<br>'.$SQLupdatecc; echo '<meta http-equiv="Refresh" content="0; url="' . $_SERVER['PHP_SELF'] . '?'.SID.'&DebtorNo='.$DebtorNo.'&ID='.$ID.'">'; } if (isset($_GET['delete'])) { - $SQl='DELETE FROM custcontacts where debtorno="'.$DebtorNo.'" - and contid="'.$ID.'"'; + $SQl="DELETE FROM custcontacts where debtorno='".$DebtorNo."' + and contid='".$ID."'"; $resultupcc = DB_query($SQl,$db); echo '<meta http-equiv="Refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?'.SID.'&DebtorNo='.$DebtorNo.'">'; @@ -1021,4 +1021,4 @@ } // end of main ifs include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/DiscountCategories.php =================================================================== --- trunk/DiscountCategories.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/DiscountCategories.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -127,12 +127,12 @@ if (isset($_POST['search'])) { if ($_POST['PartID']!='' and $_POST['PartDesc']=='') - $sql='SELECT stockid, description FROM stockmaster WHERE stockid LIKE"%'.$_POST['PartID'].'%"'; + $sql="SELECT stockid, description FROM stockmaster WHERE stockid LIKE '%".$_POST['PartID']."%'"; if ($_POST['PartID']=='' and $_POST['PartDesc']!='') - $sql='SELECT stockid, description FROM stockmaster WHERE description LIKE"%'.$_POST['PartDesc'].'%"'; + $sql="SELECT stockid, description FROM stockmaster WHERE description LIKE '%".$_POST['PartDesc']."%'"; if ($_POST['PartID']!='' and $_POST['PartDesc']!='') - $sql='SELECT stockid, description FROM stockmaster WHERE stockid LIKE"%'.$_POST['PartID'].'%" and - description LIKE"%'.$_POST['PartDesc'].'%"'; + $sql="SELECT stockid, description FROM stockmaster WHERE stockid LIKE '%".$_POST['PartID']."%' and + description LIKE '%".$_POST['PartDesc']."%'"; $result=DB_query($sql,$db); if (!isset($_POST['stockID'])) { echo _('Select a part code').':<br>'; Modified: trunk/FixedAssetDepreciation.php =================================================================== --- trunk/FixedAssetDepreciation.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetDepreciation.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -40,7 +40,7 @@ /* Get list of assets for journal */ -$sql='SELECT fixedassets.assetid, +$sql="SELECT fixedassets.assetid, fixedassets.description, fixedassets.depntype, fixedassets.depnrate, @@ -48,14 +48,14 @@ fixedassetcategories.accumdepnact, fixedassetcategories.depnact, fixedassetcategories.categorydescription, - SUM(CASE WHEN fixedassettrans.fixedassettranstype="cost" THEN fixedassettrans.amount ELSE 0 END) AS costtotal, - SUM(CASE WHEN fixedassettrans.fixedassettranstype="depn" THEN fixedassettrans.amount ELSE 0 END) AS depnbfwd + SUM(CASE WHEN fixedassettrans.fixedassettranstype='cost' THEN fixedassettrans.amount ELSE 0 END) AS costtotal, + SUM(CASE WHEN fixedassettrans.fixedassettranstype='depn' THEN fixedassettrans.amount ELSE 0 END) AS depnbfwd FROM fixedassets INNER JOIN fixedassetcategories ON fixedassets.assetcategoryid=fixedassetcategories.categoryid INNER JOIN fixedassettrans ON fixedassets.assetid=fixedassettrans.assetid - WHERE fixedassettrans.transdate<="' . FormatDateForSQL($_POST['ProcessDate']) . '" + WHERE fixedassettrans.transdate<='" . FormatDateForSQL($_POST['ProcessDate']) . "' GROUP BY fixedassets.assetid, fixedassets.description, fixedassets.depntype, @@ -64,7 +64,7 @@ fixedassetcategories.accumdepnact, fixedassetcategories.depnact, fixedassetcategories.categorydescription - ORDER BY assetcategoryid, assetid'; + ORDER BY assetcategoryid, assetid"; $AssetsResult=DB_query($sql, $db); $InputError = false; //always hope for the best Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetItems.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -277,25 +277,25 @@ $CancelDelete = 0; //what validation is required before allowing deletion of assets .... maybe there should be no deletion option? - $result = DB_query('SELECT cost, + $result = DB_query("SELECT cost, accumdepn, accumdepnact, costact FROM fixedassets INNER JOIN fixedassetcategories ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid="' . $AssetID . '"', $db); + WHERE assetid='" . $AssetID . "'", $db); $AssetRow = DB_fetch_array($result); $NBV = $AssetRow['cost'] -$AssetRow['accumdepn']; if ($NBV!=0) { $CancelDelete =1; //cannot delete assets where NBV is not 0 prnMsg(_('The asset still has a net book value - only assets with a zero net book value can be deleted'),'error'); } - $result = DB_query('SELECT * FROM fixedassettrans WHERE assetid="' . $AssetID . '"',$db); + $result = DB_query("SELECT * FROM fixedassettrans WHERE assetid='" . $AssetID . "'",$db); if (DB_num_rows($result) > 0){ $CancelDelete =1; /*cannot delete assets with transactions */ prnMsg(_('The asset has transactions associated with it. The asset can only be deleted when the fixed asset transactions are purged, otherwise the integrity of fixed asset reports may be compromised'),'error'); } - $result = DB_query('SELECT * FROM purchorderdetails WHERE assetid="' . $AssetID . '"',$db); + $result = DB_query("SELECT * FROM purchorderdetails WHERE assetid='" . $AssetID . "'",$db); if (DB_num_rows($result) > 0){ $CancelDelete =1; /*cannot delete assets where there is a purchase order set up for it */ prnMsg(_('There is a purchase order set up for this asset. The purchase order line must be deleted first'),'error'); Deleted: trunk/FixedAssetList.php =================================================================== --- trunk/FixedAssetList.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetList.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -1,46 +0,0 @@ -<?php -//$PageSecurity = 11; - -include('includes/session.inc'); -$title = _('Fixed Asset Properties List'); -include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . - _('Search') . '" alt="" />' . ' ' . $title .'</p>'; - -$sql='SELECT stockmaster.stockid, - assetmanager.serialno, - stockmaster.description, - stockcatproperties.label, - stockitemproperties.value - FROM assetmanager - LEFT JOIN stockmaster - ON assetmanager.stockid=stockmaster.stockid - LEFT JOIN stockcatproperties - ON stockmaster.categoryid=stockcatproperties.categoryid - LEFT JOIN stockitemproperties - ON stockcatproperties.stkcatpropid=stockitemproperties.stkcatpropid - WHERE stockmaster.stockid=stockitemproperties.stockid - ORDER BY assetmanager.serialno,stockmaster.stockid'; - -$result=DB_query($sql, $db); -echo '<table class=selection>'; -echo '<tr>'; -echo '<th>'._('Asset Type').'</th>'; -echo '<th>'._('Asset Reference').'</th>'; -echo '<th>'._('Description').'</th>'; -echo '<th>'._('Depreciation %').'</th>'; -echo '</tr>'; -while ($myrow=DB_fetch_array($result)) { - if ($myrow['value']!='Straight Line') { - echo '<tr>'; - echo '<td>'.$myrow['description'].'</td> - <td>'.$myrow['serialno'].'</td> - <td>'.$myrow['label'].'</td> - <td class=number>'.$myrow['value'].'%</td>'; - echo '</tr>'; - } -} -echo '</table>'; - -include('includes/footer.inc'); -?> \ No newline at end of file Modified: trunk/FixedAssetLocations.php =================================================================== --- trunk/FixedAssetLocations.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetLocations.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -19,16 +19,16 @@ $InputError=1; } if ($InputError==0) { - $sql='INSERT INTO fixedassetlocations + $sql="INSERT INTO fixedassetlocations VALUES ( - "'.$_POST['LocationID'].'", - "'.$_POST['LocationDescription'].'", - "'.$_POST['ParentLocationID'].'")'; + '".$_POST['LocationID']."', + '".$_POST['LocationDescription']."', + '".$_POST['ParentLocationID']."')"; $result=DB_query($sql, $db); } } if (isset($_GET['SelectedLocation'])) { - $sql='SELECT * FROM fixedassetlocations WHERE locationid="'.$_GET['SelectedLocation'].'"'; + $sql="SELECT * FROM fixedassetlocations WHERE locationid='".$_GET['SelectedLocation']."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); $LocationID = $myrow['locationid']; @@ -49,10 +49,10 @@ $InputError=1; } if ($InputError==0) { - $sql='UPDATE fixedassetlocations SET - locationdescription="'.$_POST['LocationDescription'].'", - parentlocationid="'.$_POST['ParentLocationID'].'" - WHERE locationid ="'.$_POST['LocationID'].'"'; + $sql="UPDATE fixedassetlocations SET + locationdescription='".$_POST['LocationDescription']."', + parentlocationid='".$_POST['ParentLocationID']."' + WHERE locationid ='".$_POST['LocationID']."'"; $result=DB_query($sql,$db); echo '<meta http-equiv="Refresh" content="0; url="'.$_SERVER['PHP_SELF'].'">'; } Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetRegister.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -14,7 +14,7 @@ } $DateFrom = FormatDateForSQL($_POST['FromDate']); $DateTo = FormatDateForSQL($_POST['ToDate']); - $sql = 'SELECT fixedassets.assetid, + $sql = "SELECT fixedassets.assetid, fixedassets.description, fixedassets.longdescription, fixedassets.assetcategoryid, @@ -24,17 +24,17 @@ fixedassetlocations.parentlocationid, fixedassets.assetlocation, fixedassets.disposaldate, - SUM(CASE WHEN (fixedassettrans.transdate <"' . $DateFrom . '" AND fixedassettrans.fixedassettranstype="cost") THEN fixedassettrans.amount ELSE 0 END) AS bfwdcost, - SUM(CASE WHEN (fixedassettrans.transdate <"' . $DateFrom .'" AND fixedassettrans.fixedassettranstype="depn") THEN fixedassettrans.amount ELSE 0 END) AS bfwddepn, - SUM(CASE WHEN (fixedassettrans.transdate >="' . $DateFrom .'" AND fixedassettrans.transdate <="' . $DateTo . '" AND fixedassettrans.fixedassettranstype="cost") THEN fixedassettrans.amount ELSE 0 END) AS periodadditions, - SUM(CASE WHEN fixedassettrans.transdate >="' . $DateFrom . '" AND fixedassettrans.transdate <="' . $DateTo . '" AND fixedassettrans.fixedassettranstype="depn" THEN fixedassettrans.amount ELSE 0 END) AS perioddepn, - SUM(CASE WHEN fixedassettrans.transdate >="' . $DateFrom . '" AND fixedassettrans.transdate <="' . $DateTo . '" AND fixedassettrans.fixedassettranstype="disposal" THEN fixedassettrans.amount ELSE 0 END) AS perioddisposal + SUM(CASE WHEN (fixedassettrans.transdate <'" . $DateFrom . "' AND fixedassettrans.fixedassettranstype='cost') THEN fixedassettrans.amount ELSE 0 END) AS bfwdcost, + SUM(CASE WHEN (fixedassettrans.transdate <'" . $DateFrom . "' AND fixedassettrans.fixedassettranstype='depn') THEN fixedassettrans.amount ELSE 0 END) AS bfwddepn, + SUM(CASE WHEN (fixedassettrans.transdate >='" . $DateFrom ."' AND fixedassettrans.transdate <='" . $DateTo . "' AND fixedassettrans.fixedassettranstype='cost') THEN fixedassettrans.amount ELSE 0 END) AS periodadditions, + SUM(CASE WHEN fixedassettrans.transdate >='" . $DateFrom . "' AND fixedassettrans.transdate <='" . $DateTo . "' AND fixedassettrans.fixedassettranstype='depn' THEN fixedassettrans.amount ELSE 0 END) AS perioddepn, + SUM(CASE WHEN fixedassettrans.transdate >='" . $DateFrom . "' AND fixedassettrans.transdate <='" . $DateTo . "' AND fixedassettrans.fixedassettranstype='disposal' THEN fixedassettrans.amount ELSE 0 END) AS perioddisposal FROM fixedassets INNER JOIN fixedassetcategories ON fixedassets.assetcategoryid=fixedassetcategories.categoryid INNER JOIN fixedassetlocations ON fixedassets.assetlocation=fixedassetlocations.locationid INNER JOIN fixedassettrans ON fixedassets.assetid=fixedassettrans.assetid - WHERE fixedassets.assetcategoryid ' . LIKE . '"' . $_POST['AssetCategory'] . '" - AND fixedassets.assetid ' . LIKE . '"' . $_POST['AssetID'] . '" + WHERE fixedassets.assetcategoryid " . LIKE . "'" . $_POST['AssetCategory'] . "' + AND fixedassets.assetid " . LIKE . "'" . $_POST['AssetID'] . "' GROUP BY fixedassets.assetid, fixedassets.description, fixedassets.longdescription, @@ -43,7 +43,7 @@ fixedassetlocations.locationdescription, fixedassets.datepurchased, fixedassetlocations.parentlocationid, - fixedassets.assetlocation'; + fixedassets.assetlocation"; $result = DB_query($sql, $db); if (isset($_POST['pdf'])) { $FontSize = 10; @@ -53,7 +53,7 @@ if ($_POST['AssetCategory']=='%') { $AssetCategory=_('All'); } else { - $CategorySQL='SELECT categorydescription FROM fixedassetcategories WHERE categoryid="'.$_POST['AssetCategory'].'"'; + $CategorySQL="SELECT categorydescription FROM fixedassetcategories WHERE categoryid='".$_POST['AssetCategory']."'"; $CategoryResult=DB_query($CategorySQL, $db); $CategoryRow=DB_fetch_array($CategoryResult); $AssetCategory=$CategoryRow['categorydescription']; @@ -62,7 +62,7 @@ if ($_POST['AssetID']=='%') { $AssetDescription =_('All'); } else { - $AssetSQL='SELECT description FROM fixedassets WHERE assetid="'.$_POST['AssetID'].'"'; + $AssetSQL="SELECT description FROM fixedassets WHERE assetid='".$_POST['AssetID']."'"; $AssetResult=DB_query($AssetSQL, $db); $AssetRow=DB_fetch_array($AssetResult); $AssetDescription =$AssetRow['description']; @@ -103,10 +103,10 @@ $Ancestors[0] = $myrow['locationdescription']; $i = 0; while ($Ancestors[$i] != '') { - $LocationSQL = 'SELECT parentlocationid from fixedassetlocations where locationdescription="' . $Ancestors[$i] . '"'; + $LocationSQL = "SELECT parentlocationid from fixedassetlocations where locationdescription='" . $Ancestors[$i] . "'"; $LocationResult = DB_query($LocationSQL, $db); $LocationRow = DB_fetch_array($LocationResult); - $ParentSQL = 'SELECT locationdescription from fixedassetlocations where locationid="' . $LocationRow['parentlocationid'] . '"'; + $ParentSQL = "SELECT locationdescription from fixedassetlocations where locationid='" . $LocationRow['parentlocationid'] . "'"; $ParentResult = DB_query($ParentSQL, $db); $ParentRow = DB_fetch_array($ParentResult); $i++; Modified: trunk/FixedAssetTransfer.php =================================================================== --- trunk/FixedAssetTransfer.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/FixedAssetTransfer.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -11,9 +11,9 @@ foreach ($_POST as $AssetToMove => $Value) { //Value is not used? if (substr($AssetToMove,0,4)=='Move') { // the form variable is of the format MoveAssetID so need to strip the move bit off $AssetID=substr($AssetToMove,4); - $sql='UPDATE fixedassets - SET assetlocation="'.$_POST['Location'.$AssetID] .'" - WHERE assetid="'. $AssetID . '"'; + $sql="UPDATE fixedassets + SET assetlocation='".$_POST['Location'.$AssetID] ."' + WHERE assetid='". $AssetID . "'"; $result=DB_query($sql, $db); } @@ -87,7 +87,7 @@ $_POST['AssetID']='%'; } - $sql= 'SELECT fixedassets.assetid, + $sql= "SELECT fixedassets.assetid, fixedassets.cost, fixedassets.accumdepn, fixedassets.description, @@ -99,10 +99,10 @@ FROM fixedassets INNER JOIN fixedassetlocations ON fixedassets.assetlocation=fixedassetlocations.locationid - WHERE fixedassets.assetcategoryid ' . LIKE . '"'.$_POST['AssetCat'].'" - AND fixedassets.description ' . LIKE . '"'.$_POST['Keywords'].'" - AND fixedassets.assetid ' . LIKE . '"'.$_POST['AssetID'].'" - AND fixedassets.serialno ' . LIKE . '"'.$_POST['SerialNumber'].'"'; + WHERE fixedassets.assetcategoryid " . LIKE . "'".$_POST['AssetCat']."' + AND fixedassets.description " . LIKE . "'".$_POST['Keywords']."' + AND fixedassets.assetid " . LIKE . "'".$_POST['AssetID']."' + AND fixedassets.serialno " . LIKE . "'".$_POST['SerialNumber']."'"; $Result=DB_query($sql, $db); echo '<form action="'. $_SERVER['PHP_SELF'] . '?' . SID .'" method=post><table class=selection>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/GLAccountCSV.php =================================================================== --- trunk/GLAccountCSV.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/GLAccountCSV.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -228,7 +228,7 @@ $FormatedTranDate = ConvertSQLDate($myrow['trandate']); - $tagsql='SELECT tagdescription FROM tags WHERE tagref='.$myrow['tag']; + $tagsql="SELECT tagdescription FROM tags WHERE tagref='".$myrow['tag'] . "'"; $tagresult=DB_query($tagsql,$db); $tagrow = DB_fetch_array($tagresult); if ($myrow['amount']<0){ Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/GLAccountReport.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -104,12 +104,12 @@ if ($PandLAccount==True) { $RunningTotal = 0; } else { - $sql = 'SELECT bfwd, + $sql = "SELECT bfwd, actual, period FROM chartdetails - WHERE chartdetails.accountcode=' . $SelectedAccount . - ' AND chartdetails.period=' . $FirstPeriodSelected; + WHERE chartdetails.accountcode='" . $SelectedAccount . + "' AND chartdetails.period='" . $FirstPeriodSelected . "'"; $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); @@ -136,12 +136,12 @@ if ($myrow['periodno']!=$PeriodNo){ if ($PeriodNo!=-9999){ //ie its not the first time around /*Get the ChartDetails balance b/fwd and the actual movement in the account for the period as recorded in the chart details - need to ensure integrity of transactions to the chart detail movements. Also, for a balance sheet account it is the balance carried forward that is important, not just the transactions*/ - $sql = 'SELECT bfwd, + $sql = "SELECT bfwd, actual, period FROM chartdetails - WHERE chartdetails.accountcode=' . $SelectedAccount . - ' AND chartdetails.period=' . $PeriodNo; + WHERE chartdetails.accountcode='" . $SelectedAccount . + "' AND chartdetails.period='" . $PeriodNo . "'"; $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); @@ -171,7 +171,7 @@ $FormatedTranDate = ConvertSQLDate($myrow['trandate']); - $tagsql='SELECT tagdescription FROM tags WHERE tagref='.$myrow['tag']; + $tagsql="SELECT tagdescription FROM tags WHERE tagref='".$myrow['tag'] . "'"; $tagresult=DB_query($tagsql,$db); $tagrow = DB_fetch_array($tagresult); @@ -264,7 +264,7 @@ <tr> <td>'._('Selected Accounts') . ':</td> <td><select name="Account[]" multiple>'; - $sql = 'SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode'; + $sql = "SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode"; $AccountsResult = DB_query($sql,$db); $i=0; while ($myrow=DB_fetch_array($AccountsResult,$db)){ @@ -279,7 +279,7 @@ echo '<td>'._('For Period range').':</td> <td><select Name=Period[] multiple>'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); $id=0; @@ -296,10 +296,10 @@ //Select the tag echo '<tr><td>' . _('Select Tag') . ':</td><td><select name="tag">'; - $SQL = 'SELECT tagref, + $SQL = "SELECT tagref, tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); echo '<option value=0>0 - '._('All tags'); Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/GLJournal.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -203,7 +203,7 @@ if (!isset($_POST['GLAmount'])) { $_POST['GLAmount']=0; } - $SQL = 'SELECT accountname FROM chartmaster WHERE accountcode=' . $_POST['GLCode']; + $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']); Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-01-14 09:47:14 UTC (rev 4467) +++ trunk/MRP.php 2011-01-15 00:57:20 UTC (rev 4468) @@ -44,11 +44,11 @@ prnMsg(_('Creating first level'),'info'); flush(); // This finds the top level - $sql = 'INSERT INTO passbom (part, sortpart) + $sql = "INSERT INTO passbom (part, sortpart) SELECT bom.component AS part, - CONCAT(bom.parent,"%",bom.component) AS sortpart + CONCAT(bom.parent,'%',bom.component) AS sortpart FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component - WHERE bom2.component IS NULL'; + WHERE bom2.component IS NULL"; $result = DB_query($sql,$db); $lctr = 2; @@ -201,7 +201,7 @@ // Get rid if temporary tables $sql = 'DROP TABLE IF EXISTS tempbom'; - //$result = DB_query($sql,$db); +- //$result = DB_query($sql,$db); $sql = 'DROP TABLE IF EXISTS passbom'; //$result = DB_query($sql,$db); $sql = 'DROP TABLE IF EXISTS passbom2'; @@ -230,7 +230,7 @@ prnMsg(_('Loading requirements from sales orders'),'info'); flush(); - $sql = 'INSERT INTO mrprequirements (part, + $sql = "INSERT INTO mrprequirements (part, daterequired, quantity, mrpdemandtype, @@ -240,22 +240,22 @@ SELECT stkcode, deliverydate, (quantity - qtyinvoiced) AS netqty, - "SO", + 'SO', salesorderdetails.orderno, - "1", + '1', stkcode FROM salesorders, salesorderdetails WHERE salesorders.orderno = salesorderdetails.orderno AND (quantity - qtyinvoiced) > 0 AND salesorderdetails.completed = 0 - AND salesorders.quotation = 0'; + AND salesorders.quotation = 0"; $result = DB_query($sql,$db); prnMsg(_('Loading requirements from work orders'),'info'); flush(); // Definition of demand from SelectProduct.php - $sql = 'INSERT INTO mrprequirements (part, + $sql = "INSERT INTO mrprequirements (part, daterequired, quantity, mrpdemandtype, @@ -265,19 +265,19 @@ SELECT worequirements.stockid, workorders.requiredby, qtypu*(woitems.qtyreqd - woitems.qtyrecd) AS netqty, - "WO", + 'WO', woitems.wo, - "1", + '1', parentstockid FROM woitems INNER JOIN worequirements ON woitems.stockid=worequirements.parentstockid INNER JOIN workorders ON woitems.wo=workorders.wo AND woitems.wo=worequirements.wo - WHERE workorders.closed=0'; + WHERE workorders.closed=0"; $result = DB_query($sql,$db); - $sql = 'INSERT INTO mrprequirements (part, + $sql = "INSERT INTO mrprequirements (part, daterequired, quantity, mrpdemandtype, @@ -289,15 +289,15 @@ quantity, mrpdemandtype, demandid, - "1", + '1', stockid - FROM mrpdemands'; + FROM mrpdemands"; if ($_POST['usemrpdemands'] == 'y') { $result = DB_query($sql,$db); prnMsg(_('Loading requirements based on mrpdemands'),'info'); flush(); } - $sql = 'INSERT INTO mrprequirements (part, + $sql = "INSERT INTO mrprequirements (part, daterequired, quantity, mrpdemandtype, @@ -307,12 +307,12 @@ SELECT stockid, NOW(), (reorderlevel - quantity) AS reordqty, - "REORD", - "1", - "1", + 'REORD', + '1', + '1', stockid FROM locstock - WHERE reorderlevel > quantity'; + WHERE reorderlevel > quantity"; $result = DB_query($sql,$db); prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); @@ -339,7 +339,7 @@ prnMsg(_('Loading supplies from purchase orders'),'info'); flush(); - $sql = 'INSERT INTO mrpsupplies (id, + $sql = "INSERT INTO mrpsupplies (id, part, duedate, supplyquantity, @@ -351,16 +351,16 @@ purchorderdetails.itemcode, purchorderdetails.deliverydate, (quantityord - quantityrecd) AS netqty, - "PO", + 'PO', purchorderdetails.orderno, purchorderdetails.deliverydate, 0 FROM purchorderdetails, purchorders WHERE purchorderdetails.orderno = purchorders.orderno - AND purchorders.status != "Cancelled" - AND purchorders.status != "Rejected" - AND(quantityord - quantityrecd) > 0'; + AND purchorders.status != 'Cancelled' + AND purchorders.status != 'Rejected' + AND(quantityord - quantityrecd) > 0"; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from inventory on hand'),'info'); @@ -382,7 +382,7 @@ } // End of foreach $WhereLocation .= ')'; } - $sql = 'INSERT INTO mrpsupplies (id, + $sql = "INSERT INTO mrpsupplies (id, part, duedate, supplyquan... [truncated message content] |