This list is closed, nobody may subscribe to it.
2008 |
Jan
|
Feb
|
Mar
(20) |
Apr
(110) |
May
(25) |
Jun
(62) |
Jul
(32) |
Aug
(17) |
Sep
(66) |
Oct
(280) |
Nov
(132) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(161) |
Feb
(177) |
Mar
(117) |
Apr
(147) |
May
(88) |
Jun
(569) |
Jul
(436) |
Aug
(107) |
Sep
(213) |
Oct
(301) |
Nov
(477) |
Dec
(128) |
2010 |
Jan
(69) |
Feb
(24) |
Mar
(43) |
Apr
(35) |
May
(35) |
Jun
(58) |
Jul
(145) |
Aug
(22) |
Sep
(383) |
Oct
(49) |
Nov
(41) |
Dec
(282) |
2011 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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] |
From: <dai...@us...> - 2011-01-14 09:47:21
|
Revision: 4467 http://web-erp.svn.sourceforge.net/web-erp/?rev=4467&view=rev Author: daintree Date: 2011-01-14 09:47:14 +0000 (Fri, 14 Jan 2011) Log Message: ----------- updates to manual - install scripts Modified Paths: -------------- trunk/doc/Change.log.html trunk/doc/Manual/ManualAccountsPayable.html trunk/doc/Manual/ManualDevelopmentStructure.html trunk/doc/Manual/ManualSecuritySchema.html trunk/install/index.php trunk/install/save.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/doc/Change.log.html 2011-01-14 09:47:14 UTC (rev 4467) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>14/1/11: Phil install scripts modified to copy over FormDesigns under the new company directory created</p> +<p>14/1/11: Phil Updates to manual for security and supplier invoice entry</p> <p>13/1/11:Phil PO_Items.php remove redundant code, setup entry of lines in supplier units</p> <p>13/1/11:Tim Z_ChangeCustomerCode.php now has foreign key checks defeated when deleting the old customer record and custbranch record </p> <p>13/1/11:Phil SupplierInvoice.php and SupplierCredit.php now check to ensure the total of contracts fixed asset charges goods received charges, shipment charges and GL charges are at least equal to the amount of the invoice or credit. It was possible when GL interface turned off to get strange results</p> Modified: trunk/doc/Manual/ManualAccountsPayable.html =================================================================== --- trunk/doc/Manual/ManualAccountsPayable.html 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/doc/Manual/ManualAccountsPayable.html 2011-01-14 09:47:14 UTC (rev 4467) @@ -141,27 +141,31 @@ <BR><BR> <font size="+1"><b>Comments</B></FONT> <BR><BR> -Comments are entirely optional. They appear in the supplier inquiry screen against the invoice. +Comments are entirely optional. They appear in the supplier inquiry screen against the invoice. <BR><BR> <font size="+1"><b>Different Types Of Charges On A Purchase Invoice</B></FONT> <BR><BR> -Depending on the nature of the supplier's charge and the items purchased there are several choices as to how the amount of the invoice is entered. +Depending on the nature of the supplier's charge and the items purchased there are several choices as to how the amount of the invoice is entered. <BR> <UL> -<LI>Charges for Stock Items - Entered against Goods Received</LI> +<LI>Charges for stock items on purchase order items received - Entered against purchase orders</LI> <LI>Charges for other expenses coded to different GL accounts</LI> <LI>Charges for Shipments where the cost is to be split between all items on the shipment</LI> +<LI>Charges for contracts - where the amounts are charged out against a contract</LI> +<LI>Charges for the purchase of fixed assets</li> </UL> -Supplier invoices can be entered for any or all of the choices together. +Supplier invoices (and credit notes) can be entered for any or all of the choices together. <BR><BR> +<font size="+1"><b>Creditors GL Interface</B></FONT> +<BR><BR> +If the GL interface to creditors is not set to yes in the company preferences screen then the total amount of the invoice can be entered directly. There is a check though to ensure that the total of the charges entered against purchase orders, shipments, contracts and gl is less than the total invoice amount entered directly. If the amount entered is less than the sum of the charges then a warning shows. However, if the GL interface is active the total of the charges against purchase orders, contracts, fixed assets, gl and shipments is accumulated into the main invoice entry screen amount of the invoice. +<BR><BR> <font size="+1"><b>Entry of Charges for Stock/Inventory Items</B></FONT> <BR><BR> All stock items must be received into stock against a purchase order. In the process a GRN (goods received note) entry created. Goods received will be evidenced in webERP by the stock movements inquiry showing the receipt of stock and also by the creation of a GRN against the supplier. If the general ledger interface is active a liability is posted to the GRN suspense account (defined in the company record) and the stock value is increased by the standard cost of the item at the time it is entered as received. The purchase order inquiry will also show the quantity received of the item (against the order). Entering a purchase invoice for stock items requires that the GRN records created for each item being charged for be matched off against the invoice. A special screen is available to search the GRNs outstanding for the supplier. This screen can be accessed directly from the invoice entry screen by clicking the button to enter against stock items. <BR><BR> The list of all the outstanding GRNs is shown together with any quantity already invoiced (on other invoices) and the price at which the purchase order was entered. The actual (currency) price that the supplier charged should be entered and the number of the items being invoiced on this invoice should be entered against the GRN too. This allows the actual charge for the item to be recorded against the GRN. Ultimately when the invoice is posted the actual cost (as converted at the invoice exchange rate)is recorded against the stock movement inquiry. When the invoice is entered, any for all GRNs matched to invoice charges, the purchase price variance calculated and posted to the general ledger (if the GL interface is active). <BR><BR> -If the GL interface is active the total of the charges against GRNs is accumulated into the main invoice entry screen. -<BR><BR> <font size="+1"><b>Entry of Invoices for Shipment Charges</B></FONT> <BR><BR> Shipment charges for freight, duty and cartage that the business wishes to cost into the purchase price of stock items must be entered against shipments. Shipments accumulate all these costs together before apportioning them to the items in the shipment and calculating the approriate purchase price variance. The button "Enter Against Shipments" shows a new screen that allows existing shipments to be selected and amounts (in currency of the supplier) entered against each shipment. If the shipment reference is already known it can be entered directly. Modified: trunk/doc/Manual/ManualDevelopmentStructure.html =================================================================== --- trunk/doc/Manual/ManualDevelopmentStructure.html 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/doc/Manual/ManualDevelopmentStructure.html 2011-01-14 09:47:14 UTC (rev 4467) @@ -1,25 +1,25 @@ -<br><br> +<br /><br /> <a name="DevelopmentStructure"><font size="+3"><b>Development - Structure</b></font></a> -<br><br> +<br /><br /> This page will be of interest primarily to developers wishing to get to grips with the system and how the various scripts function. -<br><br> +<br /><br /> <font size="+2"><b>Sales Orders</b></font> -<br><br> +<br /><br /> Initiation of orders is done from the script : -<br><br> +<br /><br /> SelectOrderItems.php -<br><br> +<br /><br /> This script contains functionality to select the customer for the order as well as selecting the parts for the order. -<br><br> +<br /><br /> The order processing logic revolves around a cart object called Items which is declared as a session variable. It contains an array of LineItem objects, each line @@ -29,38 +29,37 @@ order is thus cached in this session variable. Updates to the database for the cached sales order are only effected when the user explicitly commits modifications. This is actually done from the -<br><br> +<br /><br /> DeliveryDetails.php script. -<br><br> +<br /><br /> The SelectOrderItems.php script also allows modifications to pre-existing orders by repopulating the Items session object and the Items-LineItems array directly from the database. Checks are necessary to ensure that changes are sensible. -<br><br> +<br /><br /> The script has two ways to select parts to add to an order: -<br><br> +<br /><br /> 1. By selecting the stock category or an extract of the code or description. The user must then hit the search button to initiate the search. The page displays the choice of parts meeting the criteria for selection. -<br><br> -2. By entering the part code and -quantity directly. This allows quick entry of sales orders, where the +<br /><br /> +2. By entering the part code and quantity directly. This allows quick entry of sales orders, where the user is familiar with the stock codes. The user must hit the quick entry button to initiate the processing of entries in the quick entry grid. -<br><br> +<br /><br /> <font size="+2"><b>Pricing</b></font> -<br><br> +<br /><br /> The script looks up the pricing for the customer based on the customer currency and sales type. As many sales types as required can be set up each with its own price list. Where there is no pricing set up for the sales type and currency of the customer then no parts are available for adding to the order. -<br><br> +<br /><br /> <b>Kit set parts</B> can be entered - these are defined at the stage of the inventory item setup - they are exploded into their components for modification directly @@ -70,7 +69,7 @@ all these parts into the order, but then allow deletion of the 256Meg RAM and replacement with the code for 512Meg RAM or whatever modifications are required. -<br><br> +<br /><br /> <B>Assembly parts</B> can also be entered that refer to underlying component parts but priced at the assembly level. An assembly part is not exploded into its components @@ -78,11 +77,11 @@ sales analysis records but not for stock quantity records maintained although movement records are created for the assembly parts as well as the components of the assembly. -<br><br> +<br /><br /> <font size="+2"><b>Delivery and Freight Charges</b></font> -<br><br> +<br /><br /> Having selected the customer and the line items for the order, the delivery details need to be entered. Depending on the entries in logicworks.ini the freight @@ -102,89 +101,89 @@ DeliveryDetails.php script. There is therefore a requirement to maintain the volume in cubic meters and weight in kgs for each part and also the scale of freight costs if this functionality is used. -<br><br> +<br /><br /> If the data requirement to use this effectively is considered too great, it is possible to disable this freight calculation too in logicworks.ini. -<br><br> +<br /><br /> Once the order delivery details are all entered in the DeliveryDetails.php script then the order can be committed to the database. It is entirely cached in the Items session variable to this point and only when the order is placed or changes committed is the session variable cleared and the database updated. -<br><br> +<br /><br /> <font size="+2"><b>Finding Sales Orders</b></font> -<br><br> +<br /><br /> Orders can be found using the script: -<br><br> +<br /><br /> SelectSalesOrders.php -<br><br> +<br /><br /> This script allows a number of ways to find an outstanding sales order. <OL> - <LI>By + <li>By customer - a customer selected from the SelectCustomer.php script can call this script to show only outstanding orders for the - customer selected. - <LI>By + customer selected.</li> + <li>By part - selection of a part is built into the script. The purist would have the SelectProduct functionality seperated in a seperate script. However I feel that this way makes for a more intuative user - experience. - <LI>An order number can be - entered directly. + experience.</li> + <li>An order number can be + entered directly.</li> </OL> -<br> +<br /> The SelectSalesOrders.php -<br><br> +<br /><br /> script also provides links on the orders returned to allow the order to be modified or invoiced. -<br><br> +<br /><br /> Modification of order line items is done in the same script as originally created ... SelectOrderItems.php but it is not possible to change a line quantity to a quantity less than is already invoiced, or to delete a line that has some quantity already invoiced. -<br><br> +<br /><br /> <font size="+2"><b>Invoicing</b></font> -<br><br> +<br /><br /> An invoice can only be created by first selecting the items to invoice onto a sales order. The order can then be invoiced. -<br><br> +<br /><br /> The link to invoice the order from the SelectOutstandingOrders.php script shows all the line items on the order that are yet to be invoiced. There is opportunity for the user to alter the quantity to invoice but not the price/discount. There is also opportunity to manually over-ride tax calculations and freight charges. -<br><br> +<br /><br /> The ConfirmDispatch-Invoice.php script actually processes the invoice within a database transaction creating the DebtorTrans record, the SalesAnalysis record, the stock movement records updating the location stock records and the sales order delivery details. -<br><br> +<br /><br /> To look at the details of a completed order the script: -<br><br> +<br /><br /> SelectCompletedOrder.php -<br><br> +<br /><br /> allows similar selection facilities as the outstanding sales orders searches. This page also shows the quantities on the order that have been delivered and invoiced. -<br><br> +<br /><br /> <font size="+2"><b>Accounts Receivable / Debtors Accounts</b></font> -<br><br> +<br /><br /> A customer account consists of a master record ? the branch records set up against the master record and the transactions which require a branch record for invoices and @@ -194,11 +193,11 @@ (SysTypes TypeID=10) ie charges are recorded as positives in the DebtorTrans table and credits (SysTypes TypeID=11) and receipts (SysTypes TypeID=12) are recorded as negatives. -<br><br> +<br /><br /> <font size="+2"><b>Accounts Receivable Receipts</b></font> -<br><br> +<br /><br /> Since cash comes in for a number of reasons , the most common of which is the payment of invoices , the receipt form allows for entry of GL items as well as customer @@ -208,11 +207,11 @@ about the receipt before it is all accecpted. Only then is the database updated with the necessary records to record the receipt and general ledger impact if the debtors link is active. -<br><br> +<br /><br /> <font size="+2"><b>Accounts Receivable Allocations</b></font> -<br><br> +<br /><br /> The system is designed so that allocations can only be made by selecting either receipts or credit notes and the available invoices for allocating to are then found. @@ -220,45 +219,45 @@ credit is allocated. An update option allows the total left to allocate to be recalculated taking into account any amounts entered against invoices already. -<br><br> +<br /><br /> NB. Since there is no use of java or client side scripting, there is no way to keep track dynamically of how much is left to allocate. -<br><br> +<br /><br /> The allocations script can be called with: -<br><br> +<br /><br /> 1) no parameters where it will return all the receipts and credit notes that have a balance yet to be allocated to invoices. -<br><br> +<br /><br /> 2) A customer code - all credits and reciepts will show for that customer that are yet to be fully allocated. -<br><br> +<br /><br /> 3) A transaction type (11 or 12) and transaction number ? this will show the transaction and the amount previously allocated to it with the invoices it was allocated to together with any unallocated invoices. The existing allocations can be modified at will and new allocations made. -<br><br> +<br /><br /> <font size="+2"><b>Sales Analysis</b></font> -<br><br> +<br /><br /> All invoices and credit notes create or update sales analysis records. Sales analysis records go down to the part level. There is some duplication of data by maintainig a seperate sales analysis table. The rationale for this is: <UL> - <LI>improve + <li>improve the simplicity of required queries to produce sales analysis and hence speed of creation of reports. - <LI>allow + <li>allow indexing of common fields for analysis in sales analysis to further improve performance of sales analysis queries. - <LI>to remove the dependencies + <li>to remove the dependencies between data tables. If stock movements are purged this could create problems for sales analysis. </UL> @@ -270,112 +269,112 @@ Alternatively, reports can be run to create .csv (comma seperated values) files for analysis in most spreadsheet applications or import into user databases such as Borand?s Paradox or Micosoft Access. -<br><br> +<br /><br /> Sales analysis reports are designed and stored as a header record containing the information about the sorting and criteria for selection and detail records defining the columns to show on the report. -<br><br> +<br /><br /> Report column definitions allow the period range and type of information to show eg GP, cost, value, quantity. Periods are monthly and maintained invisibly to the user. The period is only ever used for general ledger reporting and for sales analysis. An enquiry page from the report columns definition page allows for easy reference to the period required. -<br><br> +<br /><br /> <font size="+2"><b>Purchase Orders</b></font> -<br><br> +<br /><br /> Similar selection facilities exist for purchase orders as do for Sales orders using the script -<br><br> +<br /><br /> POSelectOrders.php -<br><br> +<br /><br /> this script shows all outstanding orders where there are deliveries yet to be received. A specific supplier or part can be selected to show only purchase orders meeting the criteria selected. -<br><br> +<br /><br /> The script also shows links to: <OL> - <LI>Modify + <li>Modify the order within certain bounds eg cannot reduce a purchase order - line quantity below the quantity already received. - <LI>Print + line quantity below the quantity already received.</li> + <li>Print the purchase order. This link is disabled if the purchase order has already been printed. Orders can be re-printed but a warning shows that the order has already been printed so that there can be no - accidental double printing and sending of an order to a supplier. - <LI>Receive items on the order. + accidental double printing and sending of an order to a supplier.</li> + <li>Receive items on the order.</li> </OL> <font size="+2"><b>Inventory</b></font> -<br><br> +<br /><br /> Stock movements are created - depending on the type of stock item - each time a product is invoiced or credited. If an item is credited and written off eg. goods damaged in transit then two stock movements are created: <OL> - <LI>To + <li>To bring the stock item back into stock and record the credit to the - customer. - <LI>To write the item off to the - selected GL account. + customer.</li> + <li>To write the item off to the + selected GL account.</li> </OL> -<br> +<br /> Stock movements are also created when an item is received against a purchase order. -<br><br> +<br /><br /> Each time a stock movement is entered the stock quantity at the location is updated. -<br><br> +<br /><br /> The stock is therefore fully integrated with sales and purchasing. The only stock transactions that involve direct entry are: <OL> - <LI>Stock + <li>Stock transfers between locations. - <LI>Stock quantity adjustments. + <li>Stock quantity adjustments. </OL> -<br> +<br /> It is not possible to enter either of these two types of transaction against dummy, assembly or kitset parts since no stock movements or stock quantities exist for these types of parts. -<br><br> +<br /><br /> <font size="+2"><b>Stock Inquiries</b></font> -<br><br> +<br /><br /> Selecting a product shows all the options available to operate on the part. <UL> - <LI>Stock usage by location - <LI>Stock + <li>Stock usage by location + <li>Stock status showing quantity on hand, quantity on order, quantity demanded and re-order quantity. - <LI>Stock + <li>Stock movements by location for defined date range. - <LI>Outstanding sales orders + <li>Outstanding sales orders </UL> -<br> +<br /> All inquires follow a similar format, that allow input of the stock code directly for users familiar with the codes. Alternatively, the enquiry script can be called from the SelectProduct.php script which has all the facilities to be able to select the part required. -<br><br> +<br /><br /> <font size="+2"><b>Accounts Payable</b></font> -<br><br> +<br /><br /> Supplier invoices are entered using the script: -<br><br> +<br /><br /> SuppInvoice.php -<br><br> +<br /><br /> This script must be called with a SupplierID from the SelectSupplier.php page. Once a supplier is passed to the page a new SuppTrans object is created to hold (cache) @@ -383,20 +382,20 @@ arrays one for the GL analysis, one to hold the shipment charges (e.g. freight, cartage and duty) and the third for the Goods Received to be invoiced GRNs ? these could also be items on a shipment. -<br><br> +<br /><br /> If the GL link to creditors in the company preferences is set then the amount to invoice must be accumulated from stock items received being invoiced, the shipment charges and the general ledger postings entered. There is no opportunity to enter the total invoice amount manually. -<br><br> +<br /><br /> General ledger analysis link only shows if the GL Creditors link is active. This script allows population of the GLCodes array. The page allows a GL code to be entered directly by a user familiar with the GLCodes or to select a code from a select box. Plenty of space for narrative is available too. -<br><br> +<br /><br /> The link from the SupplierInvoice.php script to the SuppInvGRNItems.php allows the goods received from the supplier that have not already been invoiced @@ -409,28 +408,28 @@ remaining two parameters are used to check the proportion that the order is over invoiced by in terms of the quantity invoiced and the price charged respectively. -<br><br> +<br /><br /> The total of all lines of goods received being invoiced are accumulated. If the GL link to creditors is active then the order lines and the GL lines are accumulated together to get the total currency amount of the invoice. If the link is not active the currency amount must be entered manually, but the amount must be more than the goods received being invoiced. -<br><br> +<br /><br /> The due date of supplier invoices defaults to the date of the invoice entered after applying the terms defined for the supplier. There is an option to create a payment directly from the invoice creation. The payment record created will be for the total of the single invoice. -<br><br> +<br /><br /> <font size="+2"><b>Supplier Payments</b></font> -<br><br> +<br /><br /> Records can be created for all due amounts either by using the payment run or using the manual payment entry. -<br><br> +<br /><br /> The payment run creates payment records for all payments due to the specified date in the specified currency at the specified exchange rate, from the specified bank @@ -440,12 +439,12 @@ and produces general ledger transactions if the creditors link is active. The bank payment record is also created for bank reconciliation purposes. -<br><br> +<br /><br /> Manual supplier payments can be entered by selecting the supplier then the manual payment link. The currency of the supplier is automatically defaulted. However, the rate must be entered and the amount together with any reference. -<br><br> +<br /><br /> Manual payments screen called without the SupplierID also allows entry of general ledger analysed payments. \ No newline at end of file Modified: trunk/doc/Manual/ManualSecuritySchema.html =================================================================== --- trunk/doc/Manual/ManualSecuritySchema.html 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/doc/Manual/ManualSecuritySchema.html 2011-01-14 09:47:14 UTC (rev 4467) @@ -129,10 +129,16 @@ is pre-defined and can not be edited<br> using any webERP tool.</td> </tr> -</tbody></table></body></html> +</tbody></table> <br> <br> +<b>Changes in Later Versions</b> +<br> +<br> +Below the default security roles and page security values are set out. However, be aware that all these settings are now modifiable in the database. The roles can be defined choosing which security tokens will be allowed. Also, as of version 4.0 it is now possible to change the PageSecurity of each script to allow access to be more tightly defined. The PageSecurity value for a particular script is mapped to the security token that is either available to a particular user or not. Without the security token being in the users list of allowed security tokens then the script will not be available to that user. +<br> +<br> <b>Security Roles: Defaults for webERP version 3.0.5:</b><br> <br> 1 - Inquiries/Order Entry<br> @@ -177,7 +183,7 @@ <br> <table border="2"> <tbody><tr><th>Page (script) File Name -</th><th>PageSecurity value +</th><th>PageSecurity value </th></tr> <tr> Modified: trunk/install/index.php =================================================================== --- trunk/install/index.php 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/install/index.php 2011-01-14 09:47:14 UTC (rev 4467) @@ -4,7 +4,7 @@ ini_set('display_errors', 'On'); // Start a session if(!defined('SESSION_STARTED')) { - session_name('ba_session_id'); + session_name('ba_session_id'); session_start(); define('SESSION_STARTED', true); } @@ -105,11 +105,11 @@ </tr> <?php } ?> <tr> - <td width="140" style="color: #666666;">PHP Version > 4.1.0</td> + <td width="140" style="color: #666666;">PHP Version > 5.1.0</td> <td width="35"> <?php $phpversion = substr(PHP_VERSION, 0, 6); - if($phpversion > 4.1) { + if($phpversion > 5.1) { ?><font class="good">Yes</font><?php } else { ?><font class="bad">No</font><?php @@ -165,15 +165,14 @@ <?php // Try to guess installation URL $GuessedURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; - $GuessedURL = rtrim(dirname($GuessedURL), 'install'); + $GuessedURL = trim(rtrim(dirname($GuessedURL), 'install')); ?> - <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value=" - <?php - if(isset($_SESSION['ba_url'])) { - echo $_SESSION['ba_url']; - } else { - echo $GuessedURL; - } + <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php + if(isset($_SESSION['ba_url'])) { + echo $_SESSION['ba_url']; + } else { + echo $GuessedURL; + } ?>" /> </td> </tr> @@ -239,15 +238,13 @@ <td width="7"> </td> <td width="70" style="color: #666666;">Username:</td> <td> - <input type="text" tabindex="44" name="database_username" style="width: 98%;" value=" - <?php + <input type="text" tabindex="44" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; - } - ?> - " /> + } + ?>" /> </td> </tr> <tr> Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2011-01-13 09:33:59 UTC (rev 4466) +++ trunk/install/save.php 2011-01-14 09:47:14 UTC (rev 4467) @@ -236,7 +236,12 @@ $Result = mkdir($CompanyDir . '/EDI_Pending'); $Result = mkdir($CompanyDir . '/reportwriter'); $Result = mkdir($CompanyDir . '/pdf_append'); - + $Result = mkdir($CompanyDir . '/FormDesigns'); + copy ($path_to_root . '/companies/weberpdemo/FormDesigns/GoodsReceived.xml', $CompanyDir . '/FormDesigns/GoodsReceived.xml'); + copy ($path_to_root . '/companies/weberpdemo/FormDesigns/PickingList.xml', $CompanyDir . '/FormDesigns/PickingList.xml'); + copy ($path_to_root . '/companies/weberpdemo/FormDesigns/PurchaseOrder.xml', $CompanyDir . '/FormDesigns/PurchaseOrder.xml'); + copy ($path_to_root . '/companies/weberpdemo/FormDesigns/SalesInvoice.xml', $CompanyDir . '/FormDesigns/SalesInvoice.xml'); + // Now have a destination to place the logo image. if (isset($_FILES['LogoFile'])) { if ($_FILES['LogoFile']['error'] == UPLOAD_ERR_OK) { @@ -257,15 +262,6 @@ } } -//Need to get the new version number -$ConfigDistributionFile = file($path_to_root . '/config.distrib.php'); -$ConfigDistributionFileLines = sizeof($ConfigDistributionFile); -for ($i=0; $i<$ConfigDistributionFileLines; $i++) { - $ConfigDistributionFile[$i] = trim($ConfigDistributionFile[$i]); - if (substr($ConfigDistributionFile[$i], 0, 8) == '$Version'){ - $VersionString = $ConfigDistributionFile[$i]; - } -} //$msg holds the text of the new config.php file $msg = "<?php\n\n"; $msg .= "/* \$Revision: 1.7 $ */\n"; @@ -275,8 +271,6 @@ $msg .= "\$DefaultLanguage ='en_GB.utf8';\n\n"; $msg .= "// Whether to display the demo login and password or not on the login screen\n"; $msg .= "\$allow_demo_mode = False;\n\n"; -$msg .= "// webERP version\n\n"; -$msg .= $VersionString . "\n\n"; $msg .= "// Connection information for the database\n"; $msg .= "// \$host is the computer ip address or name where the database is located\n"; $msg .= "// assuming that the web server is also the sql server\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-01-13 09:34:06
|
Revision: 4466 http://web-erp.svn.sourceforge.net/web-erp/?rev=4466&view=rev Author: daintree Date: 2011-01-13 09:33:59 +0000 (Thu, 13 Jan 2011) Log Message: ----------- PO_Items.php birthday Modified Paths: -------------- trunk/PO_Items.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/Z_ChangeCustomerCode.php trunk/doc/Change.log.html Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/PO_Items.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -32,44 +32,25 @@ echo '<a href="'.$rootpath.'/PO_Header.php?' . SID . 'identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br>'; } -if (isset($_POST['StockID2']) AND $_GET['Edit']=='') { -/* If a stock item is selected and a purchdata record - * exists for it then find that record. - */ - $sql = "SELECT stockmaster.description, - purchdata.suppliers_partno, - purchdata.converstionfactor, - stockmaster.pkg_type, - stockmaster.units, - stockmaster.netweight, - stockmaster.kgs, - stockmaster.volume - FROM purchdata INNER JOIN stockmaster - ON purchdata.stockid=stockmaster.stockid - WHERE purchdata.stockid='" . $_POST['StockID2'] . "' AND - purchdata.supplierno='".$_SESSION['PO'.$identifier]->SupplierID."'"; - - $ErrMsg = _('The stock record of the stock selected') . ': ' . $_POST['Stock'] . ' ' . - _('cannot be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - $myrow = DB_fetch_array($result); - - $_POST['ItemDescription'] = $myrow['description']; - $_POST['Suppliers_PartNo'] = $myrow['suppliers_partno']; - $_POST['Package'] = $myrow['pkg_type']; - $_POST['uom'] = $myrow['units']; - $_POST['NetWeight'] = $myrow['netweight']; - $_POST['KGs'] = $myrow['kgs']; - $_POST['ConversionFactor']=$myrow['conversionfactor']; - $_POST['CuFt'] = $myrow[6]; -} // end if (isset($_POST['StockID2']) && $_GET['Edit']=='') - -if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { +if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=$_POST['Qty'.$POLine->LineNo]; - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['Price'.$POLine->LineNo]; + if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ + prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; + } else { //a valid number for the conversion factor is entered + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; + } + if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ + prnMsg(_('The quantity in the supplier units is expected to be numeric. Please re-enter as a number'),'error'); + } else { //ok to update the PO object variables + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=$_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; + } + if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ + prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); + } else { //ok to update the PO object variables + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['SuppPrice'.$POLine->LineNo]/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; + } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->NetWeight=$_POST['NetWeight'.$POLine->LineNo]; $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -522,30 +503,6 @@ } -if (isset($_POST['LookupPrice']) and isset($_POST['StockID2'])){ - $sql = "SELECT purchdata.price, - purchdata.conversionfactor, - purchdata.suppliersuom, - purchdata.supplierdescription - FROM purchdata - WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' - AND purchdata.stockid = '". strtoupper($_POST['StockID2']) . "'"; - - $ErrMsg = _('The supplier pricing details for') . ' ' . strtoupper($_POST['StockID']) . ' ' . _('could not be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the pricing details but failed was'); - $LookupResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($LookupResult)==1){ - $myrow = DB_fetch_array($LookupResult); - $_POST['Price'] = $myrow['price']/$myrow['conversionfactor']; - $_POST['SuppliersUOM'] = $myrow['suppliersuom']; - $_POST['ConversionFactor'] = $myrow['conversionfactor']; - - } else { - prnMsg(_('There is no purchasing data set up for this supplier') . ' - ' . $_SESSION['PO'.$identifier]->SupplierID . ' ' . _('and item') . ' ' . strtoupper($_POST['StockID']),'warn'); - } -} - if (isset($_POST['UpdateLine'])){ $AllowUpdate=true; /*Start assuming the best ... now look for the worst*/ @@ -730,9 +687,12 @@ /*end if Enter line button was hit */ -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 - * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new items for each of these form variables need to parse out the items and look up the details to add them to the purchase order $_POST is of course the global array of all posted form variables */ +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 + * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new + * items for each of these form variables need to parse out the items and look up the details to add them to the purchase + * order $_POST is of course the global array of all posted form variables */ foreach ($_POST as $FormVariableName => $Quantity) { if (substr($FormVariableName, 0, 6)=='NewQty') { //if the form variable represents a Qty to add to the order @@ -783,13 +743,12 @@ ON purchdata.suppliersuom=unitsofmeasure.unitid AND purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' WHERE chartmaster.accountcode = stockcategory.stockact - AND stockcategory.categoryid = stockmaster.categoryid - AND stockmaster.stockid = '". $ItemCode . "' - AND purchdata.effectivefrom = - (SELECT max(effectivefrom) - FROM purchdata - WHERE purchdata.stockid='". $ItemCode . "' - AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "')"; + AND stockcategory.categoryid = stockmaster.categoryid + AND stockmaster.stockid = '". $ItemCode . "' + AND purchdata.effectivefrom = (SELECT max(effectivefrom) + FROM purchdata + WHERE purchdata.stockid='". $ItemCode . "' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "')"; } else { $sql="SELECT stockmaster.description, stockmaster.stockid, @@ -884,7 +843,7 @@ } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'),'error'); if ($debug==1){ - echo "<br>".$sql; + echo '<br / >'.$sql; } include('includes/footer.inc'); exit; @@ -913,12 +872,13 @@ echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Our Unit') .'</th> - <th>' . _('Quantity') . '<th> - <th>' . _('Supp Unit') . '</th> <th>' . _('Weight') . '</th> + <th>' . _('Quantity Our Units') . '</th> + <th>' . _('Our Unit') .'</th> <th>' . _('Price Our Units') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> + <th>' . _('Unit Conversion Factor') . '</th> + <th>' . _('Quantity Supplier Units') . '</th> + <th>' . _('Supplier Unit') . '</th> <th>' . _('Price Supp Units') . ' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> <th>' . _('Subtotal') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> <th>' . _('Deliver By') .'</th> @@ -931,7 +891,7 @@ if ($POLine->Deleted==False) { $LineTotal = $POLine->Quantity * $POLine->Price; - $DisplayLineTotal = number_format($LineTotal,$POLine->DecimalPlaces); + $DisplayLineTotal = number_format($LineTotal,2); // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { @@ -950,29 +910,29 @@ echo '<td>' . $POLine->StockID . '</td> <td>' . $POLine->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity,$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="NetWeight' . $POLine->LineNo . '" size="8" value="' . $POLine->NetWeight . '"></td> + <td class="number">' . number_format($POLine->Quantity,$POLine->DecimalPlaces) . '</td> <td>' . $POLine->Units . '</td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> + <td class="number">' . $DisplayPrice . '</td> + <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppUOM . '</td> - <td><input type="text" class="number" name="NetWeight' . $POLine->LineNo . '" size="11" value="' . $POLine->NetWeight . '"></td> - <td><input type="text" class="number" name="Price' . $POLine->LineNo . '" size="11" value="' .$DisplayPrice.'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' .number_format(($POLine->Price *$POLine->ConversionFactor),2) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="11" value="' .number_format($POLine->Price/$POLine->ConversionFactor,2) .'"></td> - <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="11" value="' .$POLine->ReqDelDate .'"></td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; } } $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2); - echo '<tr><td colspan=6 class=number>' . _('TOTAL') . _(' excluding Tax') . '</td><td class=number><b>' . $DisplayTotal . '</b></td></tr></table>'; + echo '<tr><td colspan="10" class=number>' . _('TOTAL') . _(' excluding Tax') . '</td> + <td class=number><b>' . $DisplayTotal . '</b></td> + </tr></table>'; echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="Update Order Lines">'; + echo ' <input type="submit" name="Commit" value="Process Order"></div>'; - if (!isset($_POST['NewItem']) and isset($_GET['Edit'])) { - - /*show a form for putting in a new line item with or without a stock entry */ - } + } /*Only display the order line items if there are any !! */ Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/SupplierCredit.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -611,8 +611,8 @@ }elseif ($_SESSION['SuppTrans']->ExRate <= 0){ $InputError = True; prnMsg(_('The credit note as entered cannot be processed because the exchange rate for the credit note has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'warn'); - }elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalAssetValue + $TotalGRNValue,2)){ - prnMsg(_('The credit note total as entered is less than the sum of the shipment charges') . ', ' . _('the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere') . ', ' . _('the credit note as entered will not be processed'),'error'); + }elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalGRNValue + $TotalGLValue + $TotalAssetValue + $TotalShiptValue + $TotalContractsValue,2)){ + prnMsg(_('The credit note total as entered is less than the sum of the shipment charges, the general ledger entries (if any) and the charges for goods received, contracts and fixed assets. There must be a mistake somewhere, the credit note as entered will not be processed'),'error'); $InputError = True; } else { Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/SupplierInvoice.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -577,18 +577,17 @@ prnMsg( _('The invoice as entered cannot be processed because the exchange rate for the invoice has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'error'); }elseif ( $_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalContractsValue+ $TotalAssetValue+$TotalGRNValue,2)){ - prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); + prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any), the charges for goods received, contract charges and fixed asset charges. There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); $InputError = True; } else { $sql = "SELECT count(*) - FROM supptrans - WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' - AND supptrans.suppreference='" . $_POST['SuppReference'] . "'"; + FROM supptrans + WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' + AND supptrans.suppreference='" . $_POST['SuppReference'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sql to check for the previous entry of the same invoice failed'); - $DbgMsg = _('The following SQL to start an SQL transaction was used'); - + $DbgMsg = _('The following SQL to test for a previous invoice with the same reference from the same supplier was used'); $result=DB_query($sql, $db, $ErrMsg, $DbgMsg, True); $myrow=DB_fetch_row($result); @@ -601,7 +600,6 @@ if ($InputError == False){ /* SQL to process the postings for purchase invoice */ - /*Start an SQL transaction */ $Result = DB_Txn_Begin($db); @@ -647,21 +645,21 @@ the credit is to creditors control act done later for the total invoice value + tax*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - jobref) - VALUES (20, - '" . $InvoiceNo . "', - '" . $SQLInvoiceDate . "', - '" . $PeriodNo . "', - '" . $EnteredGLCode->GLCode . "', - '" . $_SESSION['SuppTrans']->SupplierID . ' ' . $EnteredGLCode->Narrative . "', - '" . round($EnteredGLCode->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "', - '" . $EnteredGLCode->JobRef . "')"; + typeno, + trandate, + periodno, + account, + narrative, + amount, + jobref) + VALUES (20, + '" . $InvoiceNo . "', + '" . $SQLInvoiceDate . "', + '" . $PeriodNo . "', + '" . $EnteredGLCode->GLCode . "', + '" . $_SESSION['SuppTrans']->SupplierID . ' ' . $EnteredGLCode->Narrative . "', + '" . round($EnteredGLCode->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "', + '" . $EnteredGLCode->JobRef . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction could not be added because'); $DbgMsg = _('The following SQL to insert the GL transaction was used'); @@ -684,12 +682,12 @@ narrative, amount) VALUES (20, - '" . $InvoiceNo . "', - '" . $SQLInvoiceDate . "', - '" . $PeriodNo . "', - '" . $_SESSION['SuppTrans']->GRNAct . "', - '" . $_SESSION['SuppTrans']->SupplierID . ' ' . _('Shipment charge against') . ' ' . $ShiptChg->ShiptRef . "', - '" . round($ShiptChg->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "')"; + '" . $InvoiceNo . "', + '" . $SQLInvoiceDate . "', + '" . $PeriodNo . "', + '" . $_SESSION['SuppTrans']->GRNAct . "', + '" . $_SESSION['SuppTrans']->SupplierID . ' ' . _('Shipment charge against') . ' ' . $ShiptChg->ShiptRef . "', + '" . round($ShiptChg->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the shipment') . ' ' . $ShiptChg->ShiptRef . ' ' . _('could not be added because'); Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/Z_ChangeCustomerCode.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -35,59 +35,59 @@ prnMsg(_('Inserting the new debtors master record'),'info'); $sql = "INSERT INTO debtorsmaster (`debtorno`, - `name`, - `address1`, - `address2`, - `address3`, - `address4`, - `currcode`, - `salestype`, - `clientsince`, - `holdreason`, - `paymentterms`, - `discount`, - `discountcode`, - `pymtdiscount`, - `lastpaid`, - `lastpaiddate`, - `creditlimit`, - `invaddrbranch`, - `ediinvoices`, - `ediorders`, - `edireference`, - `editransport`, - `ediaddress`, - `ediserveruser`, - `ediserverpwd`, - `typeid`) - SELECT '" . $_POST['NewDebtorNo'] . "', - `name`, - `address1`, - `address2`, - `address3`, - `address4`, - `currcode`, - `salestype`, - `clientsince`, - `holdreason`, - `paymentterms`, - `discount`, - `discountcode`, - `pymtdiscount`, - `lastpaid`, - `lastpaiddate`, - `creditlimit`, - `invaddrbranch`, - `ediinvoices`, - `ediorders`, - `edireference`, - `editransport`, - `ediaddress`, - `ediserveruser`, - `ediserverpwd`, - `typeid` - FROM debtorsmaster - WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; + `name`, + `address1`, + `address2`, + `address3`, + `address4`, + `currcode`, + `salestype`, + `clientsince`, + `holdreason`, + `paymentterms`, + `discount`, + `discountcode`, + `pymtdiscount`, + `lastpaid`, + `lastpaiddate`, + `creditlimit`, + `invaddrbranch`, + `ediinvoices`, + `ediorders`, + `edireference`, + `editransport`, + `ediaddress`, + `ediserveruser`, + `ediserverpwd`, + `typeid`) + SELECT '" . $_POST['NewDebtorNo'] . "', + `name`, + `address1`, + `address2`, + `address3`, + `address4`, + `currcode`, + `salestype`, + `clientsince`, + `holdreason`, + `paymentterms`, + `discount`, + `discountcode`, + `pymtdiscount`, + `lastpaid`, + `lastpaiddate`, + `creditlimit`, + `invaddrbranch`, + `ediinvoices`, + `ediorders`, + `edireference`, + `editransport`, + `ediaddress`, + `ediserveruser`, + `ediserverpwd`, + `typeid` + FROM debtorsmaster + WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $DbgMsg =_('The SQL that failed was'); $ErrMsg = _('The SQL to insert the new debtors master record failed') . ', ' . _('the SQL statement was'); @@ -95,63 +95,63 @@ prnMsg(_('Inserting new customer branch records'),'info'); $sql = "INSERT INTO custbranch ( `branchcode`, - `debtorno`, - `brname`, - `braddress1`, - `braddress2`, - `braddress3`, - `braddress4`, - `braddress5`, - `braddress6`, - `estdeliverydays`, - `area`, - `salesman`, - `fwddate`, - `phoneno`, - `faxno`, - `contactname`, - `email`, - `defaultlocation`, - `taxgroupid`, - `disabletrans`, - `brpostaddr1`, - `brpostaddr2`, - `brpostaddr3`, - `brpostaddr4`, - `brpostaddr5`, - `brpostaddr6`, - `defaultshipvia`, - `custbranchcode`) - SELECT branchcode, - '" . $_POST['NewDebtorNo'] . "', - `brname`, - `braddress1`, - `braddress2`, - `braddress3`, - `braddress4`, - `braddress5`, - `braddress6`, - `estdeliverydays`, - `area`, - `salesman`, - `fwddate`, - `phoneno`, - `faxno`, - `contactname`, - `email`, - `defaultlocation`, - `taxgroupid`, - `disabletrans`, - `brpostaddr1`, - `brpostaddr2`, - `brpostaddr3`, - `brpostaddr4`, - `brpostaddr5`, - `brpostaddr6`, - `defaultshipvia`, - `custbranchcode` - FROM custbranch - WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; + `debtorno`, + `brname`, + `braddress1`, + `braddress2`, + `braddress3`, + `braddress4`, + `braddress5`, + `braddress6`, + `estdeliverydays`, + `area`, + `salesman`, + `fwddate`, + `phoneno`, + `faxno`, + `contactname`, + `email`, + `defaultlocation`, + `taxgroupid`, + `disabletrans`, + `brpostaddr1`, + `brpostaddr2`, + `brpostaddr3`, + `brpostaddr4`, + `brpostaddr5`, + `brpostaddr6`, + `defaultshipvia`, + `custbranchcode`) + SELECT branchcode, + '" . $_POST['NewDebtorNo'] . "', + `brname`, + `braddress1`, + `braddress2`, + `braddress3`, + `braddress4`, + `braddress5`, + `braddress6`, + `estdeliverydays`, + `area`, + `salesman`, + `fwddate`, + `phoneno`, + `faxno`, + `contactname`, + `email`, + `defaultlocation`, + `taxgroupid`, + `disabletrans`, + `brpostaddr1`, + `brpostaddr2`, + `brpostaddr3`, + `brpostaddr4`, + `brpostaddr5`, + `brpostaddr6`, + `defaultshipvia`, + `custbranchcode` + FROM custbranch + WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $ErrMsg = _('The SQL to insert new customer branch records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -204,6 +204,8 @@ $ErrMsg = _('The SQL to update contract header records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $result = DB_IgnoreForeignKeys($db); + prnMsg(_('Deleting the old customer branch records from the CustBranch table'),'info'); $sql = "DELETE FROM custbranch WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $ErrMsg = _('The SQL to delete the old CustBranch records for the old debtor record failed'); @@ -218,6 +220,7 @@ $result = DB_Txn_Commit($db); + $result = DB_ReinstateForeignKeys($db); } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/doc/Change.log.html 2011-01-13 09:33:59 UTC (rev 4466) @@ -1,12 +1,13 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/1/11:Phil PO_Items.php remove redundant code, setup entry of lines in supplier units</p> +<p>13/1/11:Tim Z_ChangeCustomerCode.php now has foreign key checks defeated when deleting the old customer record and custbranch record </p> +<p>13/1/11:Phil SupplierInvoice.php and SupplierCredit.php now check to ensure the total of contracts fixed asset charges goods received charges, shipment charges and GL charges are at least equal to the amount of the invoice or credit. It was possible when GL interface turned off to get strange results</p> <p>12/1/11:Phil DailyBankTransactions.php made it so a range of dates can be selected but defaults to just today</p> <p>11/1/11:Phil fix choice of portrait or landscape invoices - fix landscape default form layout. Fix portrait invoice logo position</p> <p>11/1/11:Phil fix customer transaction inquiries to show correct links where user is not authorised for credit notes or GL inquiries</p> <p>11/1/11:Phil SupplierCredit.php and SupplierInvoice.php recalculate price variance to post differences on fixed asset additions correctly</p> <p>11/1/11:Phil PO_PDFPurchOrder.php - fixed for coding conventions removed uneccessary sql calls</p> -<p>11/1/11:Phil -<p>11/1/11:Phil <p>11/1/11: Murray Collingwood: Emailing invoices was writing the pdf file twice - once with fwrite and once with the TCPDF output function with the option 'F'</p> <p>8/1/11 Ricard Andreu: Z_ChangeCustomerCode.php added typeid field that made change customer code fail. Also corrected typo for foreign key checking side stepping for Z_ChangeBranchCode.php</p> <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> @@ -14,7 +15,7 @@ <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> <p>4/1/11 Phil: Start rework of purchase order scripts ... again.</p> <p>4/1/11 Phil: Select Purchase orders now defaults to just pending and authorised/printed - other statii are options</p> -<p>1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user.</p> +<p>1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user. Deleted DBUpgradeNumber config variable now use the VersionNumber already there</p> <p>31/12/10 Tim: Tidy up of CounterSales.php - CamelCasing, quoting SQL, closing slashes in xhtml tags</p> <p>29/12/10 Phil: Reverted to single SQL upgrade file per release - but retaining Tim's upgrade mechanism if the DBUpgradeNumber is out of date. Removed pseudo SQL language required for upgrade script and the 52 update files - just applies plain vanilla SQL from the scripts required</p> <p>29/12/10 Tim: DB upgrade mechanism with separate pseudo SQL for each database change in a separate file + 52 files of updates since 3.11.4</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-01-12 09:20:05
|
Revision: 4465 http://web-erp.svn.sourceforge.net/web-erp/?rev=4465&view=rev Author: daintree Date: 2011-01-12 09:19:59 +0000 (Wed, 12 Jan 2011) Log Message: ----------- DailyBankTrans now accepts a date range Modified Paths: -------------- trunk/DailyBankTransactions.php trunk/doc/Change.log.html Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-01-11 08:58:07 UTC (rev 4464) +++ trunk/DailyBankTransactions.php 2011-01-12 09:19:59 UTC (rev 4465) @@ -1,8 +1,8 @@ <?php -//$PageSecurity = 8; +//$PageSecurity = 8; now from Database Scripts table include ('includes/session.inc'); -$title = _('Daily Banking Inquiry'); +$title = _('Bank Transactions Inquiry'); include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . @@ -14,12 +14,12 @@ echo '<table class=selection>'; - $SQL = 'SELECT bankaccountname, - bankaccounts.accountcode, - bankaccounts.currcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = 'SELECT bankaccountname, + bankaccounts.accountcode, + bankaccounts.currcode + FROM bankaccounts, + chartmaster + WHERE bankaccounts.accountcode=chartmaster.accountcode'; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); @@ -46,8 +46,11 @@ } echo '</select></td></tr>'; } - echo '<tr><td>' . _('Transactions Dated') . ':</td> - <td><input type="text" name="TransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10 size=11 + 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>'; @@ -56,61 +59,72 @@ echo '<br><div class="centre"><input type="submit" name="Show" value="' . _('Show transactions'). '"></div>'; echo '</form>'; } else { - $sql="SELECT banktrans.*, - bankaccounts.bankaccountname, - systypes.typename, - systypes.typeid - FROM banktrans - LEFT JOIN bankaccounts - ON banktrans.bankact=bankaccounts.accountcode - LEFT JOIN systypes - ON banktrans.type=systypes.typeid - WHERE bankact='".$_POST['BankAccount']."' - AND transdate='".FormatDateForSQL($_POST['TransDate'])."'"; + $SQL = "SELECT bankaccountname, + bankaccounts.currcode + FROM bankaccounts + WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; + $BankResult = DB_query($SQL,$db,_('Could not retrieve the bank account details')); + + + $sql="SELECT banktrans.currcode, + banktrans.amount, + banktrans.functionalexrate, + banktrans.exrate, + banktrans.banktranstype, + banktrans.transdate, + bankaccounts.bankaccountname, + systypes.typename, + systypes.typeid + FROM banktrans + INNER JOIN bankaccounts + ON banktrans.bankact=bankaccounts.accountcode + INNER JOIN systypes + ON banktrans.type=systypes.typeid + WHERE bankact='".$_POST['BankAccount']."' + AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "'"; $result = DB_query($sql, $db); - if (DB_num_rows($result)>0) { - $myrow = DB_fetch_array($result); - echo '<table class=selection>'; - echo '<tr><th colspan=7><font size=3 color=blue>'; - echo _('Account Transactions For').' '.$myrow['bankaccountname'].' '._('On').' '.$_POST['TransDate']; - echo '</font></th></tr>'; - echo '<tr>'; - echo '<th>'._('Transaction type').'</th>'; - echo '<th>'._('Type').'</th>'; - echo '<th>'._('Reference').'</th>'; - echo '<th>'._('Amount in').' '.$myrow['currcode'].'</th>'; - echo '<th>'._('Running Total').' '.$myrow['currcode'].'</th>'; - echo '<th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th>'; - echo '<th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th>'; - echo '</tr>'; - echo '<tr>'; - echo '<td>'.$myrow['typename'].'</td>'; - echo '<td>'.$myrow['banktranstype'].'</td>'; - echo '<td>'.$myrow['ref'].'</td>'; - echo '<td class=number>'.number_format($myrow['amount'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td>'; - echo '</tr>'; - $AccountCurrTotal = $myrow['amount']; - $LocalCurrTotal = $myrow['amount']/$myrow['functionalexrate']; - while ($myrow=DB_fetch_array($result)) { + if (DB_num_rows($result)==0) { + prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); + } else { + $BankDetailRow = DB_fetch_array($BankResult); + 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> + </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; + + while ($myrow = DB_fetch_array($result)){ + $AccountCurrTotal += $myrow['amount']; - $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']; - echo '<tr>'; - echo '<td>'.$myrow['typename'].'</td>'; - echo '<td>'.$myrow['banktranstype'].'</td>'; - echo '<td>'.$myrow['ref'].'</td>'; - echo '<td class=number>'.number_format($myrow['amount'],2).'</td>'; - echo '<td class=number>'.number_format($AccountCurrTotal,2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate'],2).'</td>'; - echo '<td class=number>'.number_format($LocalCurrTotal,2).'</td>'; - echo '</tr>'; + $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; + + echo '<tr> + <td>'. ConvertSQLDate($myrow['transdate']) . '</td> + <td>'.$myrow['typename'].'</td> + <td>'.$myrow['banktranstype'].'</td> + <td>'.$myrow['ref'].'</td> + <td class=number>'.number_format($myrow['amount'],2).'</td> + <td class=number>'.number_format($AccountCurrTotal,2).'</td> + <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td> + <td class=number>'.number_format($LocalCurrTotal,2).'</td> + </tr>'; } echo '</table>'; - } else { - prnMsg( _('There are no transactions for this account on that day'), 'info'); - } + } //end if no bank trans in the range to show + echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' 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>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-11 08:58:07 UTC (rev 4464) +++ trunk/doc/Change.log.html 2011-01-12 09:19:59 UTC (rev 4465) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/1/11:Phil DailyBankTransactions.php made it so a range of dates can be selected but defaults to just today</p> <p>11/1/11:Phil fix choice of portrait or landscape invoices - fix landscape default form layout. Fix portrait invoice logo position</p> <p>11/1/11:Phil fix customer transaction inquiries to show correct links where user is not authorised for credit notes or GL inquiries</p> <p>11/1/11:Phil SupplierCredit.php and SupplierInvoice.php recalculate price variance to post differences on fixed asset additions correctly</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-01-11 08:58:16
|
Revision: 4464 http://web-erp.svn.sourceforge.net/web-erp/?rev=4464&view=rev Author: daintree Date: 2011-01-11 08:58:07 +0000 (Tue, 11 Jan 2011) Log Message: ----------- fix up of purch orders/reciving etc Modified Paths: -------------- trunk/CustomerInquiry.php trunk/GoodsReceived.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml trunk/doc/Change.log.html trunk/includes/DefinePOClass.php trunk/includes/PDFTransPageHeader.inc trunk/includes/PDFTransPageHeaderPortrait.inc trunk/includes/PO_ReadInOrder.inc Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-01-10 21:30:27 UTC (rev 4463) +++ trunk/CustomerInquiry.php 2011-01-11 08:58:07 UTC (rev 4464) @@ -15,7 +15,7 @@ if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])){ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info'); - echo "<br><div class='centre'><a href='". $rootpath . "/SelectCustomer.php?" . SID . "'>" . _('Select a Customer to Inquire On') . '</a><br></div>'; + echo '<br><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br></div>'; include('includes/footer.inc'); exit; } else { @@ -185,26 +185,25 @@ echo '<table class="selection" cellpadding="2" colspan="7">'; -$tableheader = "<tr bgcolor =#800000> - <th>" . _('Type') . "</th> - <th>" . _('Number') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('Branch') . "</th> - <th>" . _('Reference') . "</th> - <th>" . _('Comments') . "</th> - <th>" . _('Order') . "</th> - <th>" . _('Total') . "</th> - <th>" . _('Allocated') . "</th> - <th>" . _('Balance') . "</th> - <th>" . _('More Info') . "</th> - <th>" . _('More Info') . "</th> - <th>" . _('More Info') . "</th> - <th>" . _('More Info') . "</th> - <th>" . _('More Info') . "</th></tr>"; +$tableheader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Allocated') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th></tr>'; echo $tableheader; - $j = 1; $k=0; //row colour counter while ($myrow=DB_fetch_array($TransResult)) { @@ -218,33 +217,47 @@ } $FormatedTranDate = ConvertSQLDate($myrow['trandate']); + + if ($_SESSION['InvoicePortraitFormat']==1){ //Invoice/credits in portrait + $PrintCustomerTransactionScript = 'PrintCustTransPortrait.php'; + } else { //produce pdfs in landscape + $PrintCustomerTransactionScript = 'PrintCustTrans.php'; + } + + $BaseFormatString = '<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 class=number>%s</td>'; - $base_formatstr = "<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 class=number>%s</td>"; - $credit_invoice_str = "<td><a href='%s/Credit_Invoice.php?InvoiceNumber=%s'>" . _('Credit ') ."<IMG SRC='%s/credit.gif' title='" . _('Click to credit the invoice') . "'></a></td>"; -$preview_invoice_str = "<td><a href='%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice'>" . _('HTML ') . "<IMG SRC='%s/preview.gif' title='" . _('Click to preview the invoice') . "'></a></td> -<td><a href='%s/PrintCustTransPortrait.php?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True'>" . _('PDF ') . "<IMG SRC='%s/pdf.png' title='" . _('Click for PDF') . "'></a></td> - <td><a href='%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice'>" . _('Email ') . "<IMG SRC='%s/email.gif' title='" . _('Click to email the invoice') . "'></a></td>"; - $preview_credit_str = "<td><a href='%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit'>" . _('HTML ') . " <IMG SRC='%s/preview.gif' title='" . _('Click to preview the credit note') . "'></a></td> -<td><a href='" .$rootpath."/PrintCustTransPortrait.php?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True'>" . _('PDF ') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/pdf.png' title='" . _('Click for PDF') . "'></a></td> - <td><a href='%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit'>" . _('Email') . " <IMG SRC='%s/email.gif' title='" . _('Click to email the credit note') . "'></a></td>"; + $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<IMG SRC="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; + + $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<IMG SRC="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<IMG SRC="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; + + $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <IMG SRC="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; - if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ /*Show a link to allow an invoice to be credited */ + /* assumed allowed page security token 3 allows the user to create credits for invoices */ + if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ + /*Show a link to allow an invoice to be credited */ + /* assumed allowed page security token 8 allows the user to see GL transaction information */ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ - printf($base_formatstr . - $credit_invoice_str . - $preview_invoice_str . - "<td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> - </tr>", + + /* format string with GL inquiry options and for invoice to be credited */ + + printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . + '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <IMG SRC="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + </tr>', + //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -255,27 +268,30 @@ number_format($myrow['totalamount'],2), number_format($myrow['allocated'],2), number_format($myrow['totalamount']-$myrow['allocated'],2), + //$CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', + //$PreviewInvoiceFormatString parameters $rootpath, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', $rootpath, + $PrintCustomerTransactionScript, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', + //Parameter for string for GL Trans Inquiries $rootpath, SID, $myrow['type'], $myrow['transno']); - } else { - printf($base_formatstr . - $credit_invoice_str . - $preview_invoice_str . - '</tr>', + } else { //user does not have privileges to see GL inquiry stuff + + printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . '</tr>', + //BaseFormatString parameters $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -286,10 +302,17 @@ number_format($myrow['totalamount'],2), number_format($myrow['allocated'],2), number_format($myrow['totalamount']-$myrow['allocated'],2), + //CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', - $rootpath, $myrow['transno'], + //$PreviewInvoiceFormatString parameters + $rootpath, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', + $rootpath, + $PrintCustomerTransactionScript, + $myrow['transno'], $rootpath.'/css/'.$theme.'/images', $rootpath, $myrow['transno'], @@ -298,35 +321,39 @@ } elseif($myrow['type']==10) { /*its an invoice but not high enough priveliges to credit it */ - printf($base_formatstr . - $preview_invoice_str . + printf($BaseFormatString . + $PreviewInvoiceFormatString . '</tr>', + //$BaseFormatString parameters $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['branchcode'], - $myrow['reference'], - $myrow['invtext'], - $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), - $rootpath, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', - $rootpath, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', - $rootpath, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images'); + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['branchcode'], + $myrow['reference'], + $myrow['invtext'], + $myrow['order_'], + number_format($myrow['totalamount'],2), + number_format($myrow['allocated'],2), + number_format($myrow['totalamount']-$myrow['allocated'],2), + //$PreviewInvoiceFormatString parameters + $rootpath, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', + $rootpath, + $PrintCustomerTransactionScript, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', + $rootpath, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images'); } elseif ($myrow['type']==11) { /*its a credit note */ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ - printf($base_formatstr . - $preview_credit_str . + printf($BaseFormatString . + $PreviewCreditFormatString . "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> <td><a href='%s/GLTransInquiry.php?%sTypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a><IMG SRC="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', + //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -337,13 +364,18 @@ number_format($myrow['totalamount'],2), number_format($myrow['allocated'],2), number_format($myrow['totalamount']-$myrow['allocated'],2), + //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', + $rootpath, + $PrintCustomerTransactionScript, $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', + // hand coded format string for Allocations and GLTrans Inquiry parameters $rootpath, $myrow['id'], $rootpath, @@ -351,8 +383,8 @@ $myrow['type'], $myrow['transno']); } else { - printf($base_formatstr . - $preview_credit_str . + printf($BaseFormatString . + $PreviewCreditFormatString . "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='%s/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> </tr>", $myrow['typename'], @@ -365,22 +397,27 @@ number_format($myrow['totalamount'],2), number_format($myrow['allocated'],2), number_format($myrow['totalamount']-$myrow['allocated'],2), + //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', $rootpath, - $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', + $PrintCustomerTransactionScript, + $myrow['transno'], + $rootpath.'/css/'.$theme.'/images', $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', + //Parameters for hand coded string to show allocations $rootpath, $myrow['id'], $rootpath.'/css/'.$theme.'/images'); } } elseif ($myrow['type']==12 AND $myrow['totalamount']<0) { /*its a receipt which could have an allocation*/ + + //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ - printf($base_formatstr . + printf($BaseFormatString . "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> <td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> </tr>", @@ -400,8 +437,8 @@ SID, $myrow['type'], $myrow['transno']); - } else { - printf($base_formatstr . + } else { //no permission for GLTrans Inquiries + printf($BaseFormatString . "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> </tr>", $myrow['typename'], @@ -418,9 +455,11 @@ $myrow['id']); } } elseif ($myrow['type']==12 AND $myrow['totalamount']>0) { /*its a negative receipt */ + + //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ - printf($base_formatstr . - "<td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a></td></tr>', + printf($BaseFormatString . + '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -435,8 +474,8 @@ SID, $myrow['type'], $myrow['transno']); - } else { - printf($base_formatstr . '<td></tr>', + } else { //no permission for GLTrans Inquiries + printf($BaseFormatString . '<td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -449,9 +488,10 @@ number_format($myrow['totalamount']-$myrow['allocated'],2)); } } else { + //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ - printf($base_formatstr . - "<td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a></td></tr>', + printf($BaseFormatString . + '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -467,7 +507,7 @@ $myrow['type'], $myrow['transno']); } else { - printf($base_formatstr . '</tr>', + printf($BaseFormatString . '</tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-01-10 21:30:27 UTC (rev 4463) +++ trunk/GoodsReceived.php 2011-01-11 08:58:07 UTC (rev 4464) @@ -4,22 +4,31 @@ /* $Revision: 1.44 $ */ -//$PageSecurity = 11; +//$PageSecurity = 11; now stored in the database /* Session started in header.inc for password checking and authorisation level check */ include('includes/DefinePOClass.php'); include('includes/DefineSerialItems.php'); include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); -if (empty($identifier)) { - $identifier=''; + +/*The identifier makes this goods received session unique so cannot get confused + * with other sessions of goods received on the same machine/browser + * The identifier only needs to be unique for this php session, so a + * unix timestamp will be sufficient. + */ + +if (empty($_GET['identifier'])) { + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; } $title = _('Receive Purchase Orders'); include('includes/header.inc'); echo '<a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . '">' . _('Back to Purchase Orders'). '</a><br>'; -if (isset($_GET['PONumber']) and $_GET['PONumber']<=0 and !isset($_SESSION['PO'])) { +if (isset($_GET['PONumber']) and $_GET['PONumber']<=0 and !isset($_SESSION['PO'.$identifier])) { /* This page can only be called with a purchase order number for invoicing*/ echo '<div class="centre"><a href= "' . $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . '">'. _('Select a purchase order to receive').'</a></div>'; @@ -34,37 +43,31 @@ } elseif (isset($_POST['Update']) OR isset($_POST['ProcessGoodsReceived'])) { /* if update quantities button is hit page has been called and ${$Line->LineNo} would have be - set from the post to the quantity to be received in this receival*/ + set from the post to the quantity to be received */ - foreach ($_SESSION['PO']->LineItems as $Line) { + foreach ($_SESSION['PO'.$identifier]->LineItems as $Line) { $RecvQty = $_POST['RecvQty_' . $Line->LineNo]; if (!is_numeric($RecvQty)){ $RecvQty = 0; } - $_SESSION['PO']->LineItems[$Line->LineNo]->ReceiveQty = $RecvQty; + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->ReceiveQty = $RecvQty; } } -$StatusSQL="SELECT status FROM purchorders WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; -$StatusResult=DB_query($StatusSQL, $db); -$StatusRow=DB_fetch_array($StatusResult); -$Status=$StatusRow['status']; - -if ($Status != PurchOrder::STATUS_PRINTED) { +if ($_SESSION['PO'.$identifier]->Status != 'Printed') { prnMsg( _('Purchase orders must have a status of Printed before they can be received').'.<br>'. - _('Order number') . ' ' . $_GET['PONumber'] . ' ' . _('has a status of') . ' ' . _($Status), 'warn'); + _('Order number') . ' ' . $_GET['PONumber'] . ' ' . _('has a status of') . ' ' . _($_SESSION['PO'.$identifier]->Status), 'warn'); include('includes/footer.inc'); exit; } /* Always display quantities received and recalc balance for all items on the order */ - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Receive') . '" alt="" />' . ' ' . _('Receive Purchase Order') . ''; -echo ' : '. $_SESSION['PO']->OrderNo .' '. _('from'). ' ' . $_SESSION['PO']->SupplierName . '</p>'; -echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; +echo ' : '. $_SESSION['PO'.$identifier]->OrderNo .' '. _('from'). ' ' . $_SESSION['PO'.$identifier]->SupplierName . '</p>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier=' . $identifier . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['ProcessGoodsReceived'])) { @@ -93,13 +96,14 @@ </tr>'; /*show the line items on the order with the quantity being received for modification */ - $_SESSION['PO']->Total = 0; + $_SESSION['PO'.$identifier]->Total = 0; } $k=0; //row colour counter -if (count($_SESSION['PO']->LineItems)>0 and !isset($_POST['ProcessGoodsReceived'])){ - foreach ($_SESSION['PO']->LineItems as $LnItm) { +if (count($_SESSION['PO'.$identifier]->LineItems)>0 and !isset($_POST['ProcessGoodsReceived'])){ + + foreach ($_SESSION['PO'.$identifier]->LineItems as $LnItm) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -120,7 +124,7 @@ //Setup & Format values for LineItem display $LineTotal = ($LnItm->ReceiveQty * $LnItm->Price ); - $_SESSION['PO']->Total = $_SESSION['PO']->Total + $LineTotal; + $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; $DisplayQtyOrd = number_format($LnItm->Quantity,$LnItm->DecimalPlaces); $DisplayQtyRec = number_format($LnItm->QtyReceived,$LnItm->DecimalPlaces); $DisplayLineTotal = number_format($LineTotal,2); @@ -133,7 +137,7 @@ FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno='".$_SESSION['PO']->SupplierID."' + WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' AND stockid='".$LnItm->StockID."' GROUP BY unitsofmeasure.unitname"; @@ -185,7 +189,7 @@ echo '</tr>'; }//foreach(LineItem) echo "<script>defaultControl(document.forms[0].RecvQty_$LnItm->LineNo);</script>"; -$DisplayTotal = number_format($_SESSION['PO']->Total,2); +$DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2); if ($_SESSION['ShowValueOnGRN']==1) { echo '<tr><td colspan=7 class=number><b>' . _('Total value of goods received'). '</b></td> <td class=number><b>'. $DisplayTotal. '</b></td> @@ -195,14 +199,6 @@ } }//If count(LineItems) > 0 -$SomethingReceived = 0; -if (count($_SESSION['PO']->LineItems)>0){ - foreach ($_SESSION['PO']->LineItems as $OrderLine) { - if ($OrderLine->ReceiveQty>0){ - $SomethingReceived =1; - } - } -} /************************* LINE ITEM VALIDATION ************************/ @@ -213,9 +209,9 @@ $NegativesFound = false; $InputError = false; -if (count($_SESSION['PO']->LineItems)>0){ +if (count($_SESSION['PO'.$identifier]->LineItems)>0){ - foreach ($_SESSION['PO']->LineItems as $OrderLine) { + foreach ($_SESSION['PO'.$identifier]->LineItems as $OrderLine) { if ($OrderLine->ReceiveQty+$OrderLine->QtyReceived > $OrderLine->Quantity * (1+ ($_SESSION['OverReceiveProportion'] / 100))){ $DeliveryQuantityTooLarge =1; @@ -225,7 +221,7 @@ $SQL = "SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $OrderLine->StockID . "' - AND loccode= '" . $_SESSION['PO']->Location . "'"; + AND loccode= '" . $_SESSION['PO'.$identifier]->Location . "'"; $CheckNegResult = DB_query($SQL,$db); $CheckNegRow = DB_fetch_row($CheckNegResult); if ($CheckNegRow[0]+$OrderLine->ReceiveQty<0){ @@ -236,7 +232,7 @@ } /* end loop around the items received */ } /* end if there are lines received */ -if ($SomethingReceived==0 AND isset($_POST['ProcessGoodsReceived'])){ /*Then dont bother proceeding cos nothing to do ! */ +if ($_SESSION['PO'.$identifier]->SomethingReceived()==0 AND isset($_POST['ProcessGoodsReceived'])){ /*Then dont bother proceeding cos nothing to do ! */ prnMsg(_('There is nothing to process') . '. ' . _('Please enter valid quantities greater than zero'),'warn'); echo '<div class="centre"><input type=submit name=Update Value=' . _('Update') . '></div>'; @@ -254,7 +250,7 @@ prnMsg(_('Modify the ordered items on the purchase invoice if you wish to increase the quantities'),'info'); echo '<div class="centre"><input type=submit name=Update Value=' . _('Update') . '>'; -} elseif (isset($_POST['ProcessGoodsReceived']) AND $SomethingReceived==1 AND $InputError == false){ +} elseif (isset($_POST['ProcessGoodsReceived']) AND $_SESSION['PO'.$identifier]->SomethingReceived()==1 AND $InputError == false){ /* SQL to process the postings for goods received... */ /* Company record set at login for information on GL Links and debtors GL account*/ @@ -277,7 +273,7 @@ shiptref, jobref FROM purchorderdetails - WHERE orderno='" . (int) $_SESSION['PO']->OrderNo . "' + WHERE orderno='" . (int) $_SESSION['PO'.$identifier]->OrderNo . "' AND completed=0 ORDER BY podetailitem"; @@ -290,13 +286,13 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['PO']->LineItems[$LineNo]->GLCode != $myrow['glcode'] OR - $_SESSION['PO']->LineItems[$LineNo]->ShiptRef != $myrow['shiptref'] OR - $_SESSION['PO']->LineItems[$LineNo]->JobRef != $myrow['jobref'] OR - $_SESSION['PO']->LineItems[$LineNo]->QtyInv != $myrow['qtyinvoiced'] OR - $_SESSION['PO']->LineItems[$LineNo]->StockID != $myrow['itemcode'] OR - $_SESSION['PO']->LineItems[$LineNo]->Quantity != $myrow['quantityord'] OR - $_SESSION['PO']->LineItems[$LineNo]->QtyReceived != $myrow['quantityrecd']) { + if ($_SESSION['PO'.$identifier]->LineItems[$LineNo]->GLCode != $myrow['glcode'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->ShiptRef != $myrow['shiptref'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->JobRef != $myrow['jobref'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->QtyInv != $myrow['qtyinvoiced'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->StockID != $myrow['itemcode'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->Quantity != $myrow['quantityord'] OR + $_SESSION['PO'.$identifier]->LineItems[$LineNo]->QtyReceived != $myrow['quantityrecd']) { prnMsg(_('This order has been changed or invoiced since this delivery was started to be actioned') . '. ' . _('Processing halted') . '. ' . _('To enter a delivery against this purchase order') . ', ' . _('it must be re-selected and re-read again to update the changes made by the other user'),'warn'); @@ -304,35 +300,35 @@ if ($debug==1){ echo '<table border=1>'; echo '<tr><td>' . _('GL Code of the Line Item') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->GLCode . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->GLCode . '</td> <td>' . $myrow['glcode'] . '</td></tr>'; echo '<tr><td>' . _('ShiptRef of the Line Item') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->ShiptRef . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->ShiptRef . '</td> <td>' . $myrow['shiptref'] . '</td></tr>'; echo '<tr><td>' . _('Contract Reference of the Line Item') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->JobRef . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->JobRef . '</td> <td>' . $myrow['jobref'] . '</td> </tr>'; echo '<tr><td>' . _('Quantity Invoiced of the Line Item') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->QtyInv . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->QtyInv . '</td> <td>' . $myrow['qtyinvoiced'] . '</td></tr>'; echo '<tr><td>' . _('Stock Code of the Line Item') . ':</td> - <td>'. $_SESSION['PO']->LineItems[$LineNo]->StockID . '</td> + <td>'. $_SESSION['PO'.$identifier]->LineItems[$LineNo]->StockID . '</td> <td>' . $myrow['itemcode'] . '</td></tr>'; echo '<tr><td>' . _('Order Quantity of the Line Item') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->Quantity . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->Quantity . '</td> <td>' . $myrow['quantityord'] . '</td></tr>'; echo '<tr><td>' . _('Quantity of the Line Item Already Received') . ':</td> - <td>' . $_SESSION['PO']->LineItems[$LineNo]->QtyReceived . '</td> + <td>' . $_SESSION['PO'.$identifier]->LineItems[$LineNo]->QtyReceived . '</td> <td>' . $myrow['quantityrecd'] . '</td></tr>'; echo '</table>'; } echo "<div class='centre'><a href='$rootpath/PO_SelectOSPurchOrder.php?" . SID . "'>". _('Select a different purchase order for receiving goods against').'</a></div>'; echo "<div class='centre'><a href='$rootpath/GoodsReceived.php?" . SID . '&PONumber=' . - $_SESSION['PO']->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; - unset($_SESSION['PO']->LineItems); - unset($_SESSION['PO']); + $_SESSION['PO'.$identifier]->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; + unset($_SESSION['PO'.$identifier]->LineItems); + unset($_SESSION['PO'.$identifier]); unset($_POST['ProcessGoodsReceived']); include ('includes/footer.inc'); exit; @@ -351,11 +347,11 @@ $PeriodNo = GetPeriod($_POST['DefaultReceivedDate'], $db); $_POST['DefaultReceivedDate'] = FormatDateForSQL($_POST['DefaultReceivedDate']); - foreach ($_SESSION['PO']->LineItems as $OrderLine) { + foreach ($_SESSION['PO'.$identifier]->LineItems as $OrderLine) { if ($OrderLine->ReceiveQty !=0 AND $OrderLine->ReceiveQty!='' AND isset($OrderLine->ReceiveQty)) { - $LocalCurrencyPrice = ($OrderLine->Price / $_SESSION['PO']->ExRate); + $LocalCurrencyPrice = ($OrderLine->Price / $_SESSION['PO'.$identifier]->ExRate); if ($OrderLine->StockID!='') { /*Its a stock item line */ /*Need to get the current standard cost as it is now so we can process GL jorunals later*/ @@ -369,23 +365,23 @@ $myrow = DB_fetch_row($Result); if ($OrderLine->QtyReceived==0){ //its the first receipt against this line - $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost = $myrow[0]; + $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost = $myrow[0]; } $CurrentStandardCost = $myrow[0]; /*Set the purchase order line stdcostunit = weighted average / standard cost used for all receipts of this line This assures that the quantity received against the purchase order line multiplied by the weighted average of standard costs received = the total of standard cost posted to GRN suspense*/ - $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost = (($CurrentStandardCost * $OrderLine->ReceiveQty) + ($_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost *$OrderLine->QtyReceived)) / ($OrderLine->ReceiveQty + $OrderLine->QtyReceived); + $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost = (($CurrentStandardCost * $OrderLine->ReceiveQty) + ($_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost *$OrderLine->QtyReceived)) / ($OrderLine->ReceiveQty + $OrderLine->QtyReceived); } elseif ($OrderLine->QtyReceived==0 AND $OrderLine->StockID=='') { /*Its a nominal item being received */ /*Need to record the value of the order per unit in the standard cost field to ensure GRN account entries clear */ - $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost = $LocalCurrencyPrice; + $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost = $LocalCurrencyPrice; } if ($OrderLine->StockID=='') { /*Its a NOMINAL item line */ - $CurrentStandardCost = $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost; + $CurrentStandardCost = $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost; } /*Now the SQL to do the update to the PurchOrderDetails */ @@ -393,13 +389,13 @@ if ($OrderLine->ReceiveQty >= ($OrderLine->Quantity - $OrderLine->QtyReceived)){ $SQL = "UPDATE purchorderdetails SET quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', - stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', + stdcostunit='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=1 WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } else { $SQL = "UPDATE purchorderdetails SET quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', - stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', + stdcostunit='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=0 WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } @@ -412,7 +408,7 @@ if ($OrderLine->StockID !=''){ /*Its a stock item so use the standard cost for the journals */ $UnitCost = $CurrentStandardCost; } else { /*otherwise its a nominal PO item so use the purchase cost converted to local currency */ - $UnitCost = $OrderLine->Price / $_SESSION['PO']->ExRate; + $UnitCost = $OrderLine->Price / $_SESSION['PO'.$identifier]->ExRate; } /*Need to insert a GRN item */ @@ -431,7 +427,7 @@ '" . $OrderLine->ItemDescription . "', '" . $_POST['DefaultReceivedDate'] . "', '" . $OrderLine->ReceiveQty . "', - '" . $_SESSION['PO']->SupplierID . "', + '" . $_SESSION['PO'.$identifier]->SupplierID . "', '" . $CurrentStandardCost . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('A GRN record could not be inserted') . '. ' . _('This receipt of goods has not been processed because'); @@ -446,7 +442,7 @@ $SQL="SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $OrderLine->StockID . "' - AND loccode= '" . $_SESSION['PO']->Location . "'"; + AND loccode= '" . $_SESSION['PO'.$identifier]->Location . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==1){ @@ -460,7 +456,7 @@ $SQL = "UPDATE locstock SET quantity = locstock.quantity + '" . $OrderLine->ReceiveQty . "' WHERE locstock.stockid = '" . $OrderLine->StockID . "' - AND loccode = '" . $_SESSION['PO']->Location . "'"; + AND loccode = '" . $_SESSION['PO'.$identifier]->Location . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); @@ -483,13 +479,13 @@ '" . $OrderLine->StockID . "', 25, '" . $GRN . "', - '" . $_SESSION['PO']->Location . "', + '" . $_SESSION['PO'.$identifier]->Location . "', '" . $_POST['DefaultReceivedDate'] . "', '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . $_SESSION['PO']->SupplierID . " (" . $_SESSION['PO']->SupplierName . ") - " .$_SESSION['PO']->OrderNo . "', + '" . $_SESSION['PO'.$identifier]->SupplierID . " (" . $_SESSION['PO'.$identifier]->SupplierName . ") - " .$_SESSION['PO'.$identifier]->OrderNo . "', '" . $OrderLine->ReceiveQty . "', - '" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', + '" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', '" . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . "' )"; @@ -509,7 +505,7 @@ //need to test if the controlled item exists first already $SQL = "SELECT COUNT(*) FROM stockserialitems WHERE stockid='" . $OrderLine->StockID . "' - AND loccode = '" . $_SESSION['PO']->Location . "' + AND loccode = '" . $_SESSION['PO'.$identifier]->Location . "' AND serialno = '" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not check if a batch or lot stock item already exists because'); $DbgMsg = _('The following SQL to test for an already existing controlled but not serialised stock item was used'); @@ -523,7 +519,7 @@ $SQL = "UPDATE stockserialitems SET quantity = quantity + '" . $Item->BundleQty . "'"; } $SQL .= "WHERE stockid='" . $OrderLine->StockID . "' - AND loccode = '" . $_SESSION['PO']->Location . "' + AND loccode = '" . $_SESSION['PO'.$identifier]->Location . "' AND serialno = '" . $Item->BundleRef . "'"; } else { $SQL = "INSERT INTO stockserialitems (stockid, @@ -532,7 +528,7 @@ qualitytext, quantity) VALUES ('" . $OrderLine->StockID . "', - '" . $_SESSION['PO']->Location . "', + '" . $_SESSION['PO'.$identifier]->Location . "', '" . $Item->BundleRef . "', '', '" . $Item->BundleQty . "')"; @@ -582,7 +578,7 @@ transdate, periodno, inputdate, - fixedassettranstype + fixedassettranstype, amount) VALUES ('" . $OrderLine->AssetID . "', 25, @@ -599,9 +595,12 @@ /*Now get the correct cost GL account from the asset category */ $AssetRow = DB_fetch_array($CheckAssetExistsResult); /*Over-ride any GL account specified in the order with the asset category cost account */ - $_SESSION['PO']->LineItems[$OrderLine->LineNo]->GLCode = $AssetRow['costact']; + $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->GLCode = $AssetRow['costact']; /*Now if there are no previous additions to this asset update the date purchased */ - if ($AssetRow['datepurchased']=='0000-00-00'){ + if ($AssetRow['datepurchased']=='0000-00-00'){ + /* it is a new addition as the date is set to 0000-00-00 when the asset record is created + * before any cost is added to the asset + */ $SQL = "UPDATE fixedassets SET datepurchased='" . $_POST['DefaultReceivedDate'] . "', cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " WHERE assetid = '" . $OrderLine->AssetID . "'"; @@ -615,11 +614,12 @@ } //assetid provided doesn't exist so ignore it and treat as a normal nominal item } //assetid is set so the nominal item is an asset -/* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['PO']->GLLink==1 AND $OrderLine->GLCode !=0){ /*GLCode is set to 0 when the GLLink is not activated this covers a situation where the GLLink is now active but it wasn't when this PO was entered */ + + /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ + if ($_SESSION['PO'.$identifier]->GLLink==1 AND $OrderLine->GLCode !=0){ + /*GLCode is set to 0 when the GLLink is not activated this covers a situation where the GLLink is now active but it wasn't when this PO was entered */ -/*first the debit using the GLCode in the PO detail record entry*/ - + /*first the debit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -633,7 +633,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $PeriodNo . "', '" . $OrderLine->GLCode . "', - 'PO: " . $_SESSION['PO']->OrderNo . " " . $_SESSION['PO']->SupplierID . " - " . $OrderLine->StockID + 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . number_format($CurrentStandardCost,2) . "', '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' @@ -645,7 +645,7 @@ /* If the CurrentStandardCost != UnitCost (the standard at the time the first delivery was booked in, and its a stock item, then the difference needs to be booked in against the purchase price variance account */ - /*now the GRN suspense entry*/ + /*now the GRN suspense entry*/ $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -658,7 +658,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', - '" . _('PO') . ': ' . $_SESSION['PO']->OrderNo . ' ' . $_SESSION['PO']->SupplierID . ' - ' . + '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', '" . -$UnitCost * $OrderLine->ReceiveQty . "' @@ -671,35 +671,23 @@ } /* end of if GL and stock integrated and standard cost !=0 */ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - $CompletedSQL="SELECT SUM(completed) as completedlines, - COUNT(podetailitem) as alllines - FROM purchorderdetails - WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; - $CompletedResult=DB_query($CompletedSQL,$db); - $MyCompletedRow=DB_fetch_array($CompletedResult); - $Status=$MyCompletedRow['alllines']-$MyCompletedRow['completedlines']; - - if ($Status==0) { - $sql="SELECT stat_comment - FROM purchorders - WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; - $result=DB_query($sql,$db); - $myrow=DB_fetch_array($result); - $comment=$myrow['stat_comment']; - $date = date($_SESSION['DefaultDateFormat']); - $StatusComment=$date.' - Order Completed'.'<br>'.$comment; + + + + if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1) { //all lines on the purchase order are now completed + $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComment; $sql="UPDATE purchorders - SET status='" . PurchOrder::STATUS_COMPLITED . "', + SET status='Completed', stat_comment='" . $StatusComment . "' - WHERE orderno='" . $_SESSION['PO']->OrderNo . "'"; + WHERE orderno='" . $_SESSION['PO'.$identifier]->OrderNo . "'"; $result=DB_query($sql,$db); } $Result = DB_Txn_Commit($db); - $PONo = $_SESSION['PO']->OrderNo; - unset($_SESSION['PO']->LineItems); - unset($_SESSION['PO']); + $PONo = $_SESSION['PO'.$identifier]->OrderNo; + unset($_SESSION['PO'.$identifier]->LineItems); + unset($_SESSION['PO'.$identifier]); unset($_POST['ProcessGoodsReceived']); echo '<br><div class=centre>'. _('GRN number'). ' '. $GRN .' '. _('has been processed').'<br>'; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-01-10 21:30:27 UTC (rev 4463) +++ trunk/PO_Items.php 2011-01-11 08:58:07 UTC (rev 4464) @@ -102,8 +102,7 @@ if ($_SESSION['ExistingOrder']==0){ /*its a new order to be inserted */ //Do we need to check authorisation to create - no because already trapped when new PO session started - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['PO'.$identifier]->Initiator. - '</a> - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br>'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">' . $_SESSION['PO'.$identifier]->Initiator . '</a> - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br>'; /*Get the order number */ $_SESSION['PO'.$identifier]->OrderNo = GetNextTransNo(18, $db); Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-01-10 21:30:27 UTC (rev 4463) +++ trunk/PO_PDFPurchOrder.php 2011-01-11 08:58:07 UTC (rev 4464) @@ -4,16 +4,25 @@ include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); include('includes/DefinePOClass.php'); + if(!isset($_GET['OrderNo']) && !isset($_POST['OrderNo'])){ $title = _('Select a Purchase Order'); include('includes/header.inc'); echo '<div class="centre"><br><br><br>'; prnMsg( _('Select a Purchase Order Number to Print before calling this page') , 'error'); - echo '<br><br><br><table class="table_index"> - <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?'.SID .'">' . _('Outstanding Purchase Orders') . '</a></li> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Purchase Order Inquiry') . '</a></li> - </td></tr></table></div><br><br><br>'; + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr><td class="menu_group_item"> + <li><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?'.SID .'">' . _('Outstanding Purchase Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Purchase Order Inquiry') . '</a></li> + </td> + </tr></table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit(); @@ -29,10 +38,10 @@ $title = _('Print Purchase Order Number').' '. $OrderNo; /* If we are not previewing the order then find * the order status */ -if ($OrderNo != 'Preview') { +if ($OrderNo != 'Preview') { // then we are printing a real order $sql="SELECT status - FROM purchorders - WHERE orderno='".$OrderNo."'"; + FROM purchorders + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $OrderStatus=$myrow['status']; @@ -42,70 +51,81 @@ $OrderStatus = _('Printed'); $MakePDFThenDisplayIt = True; } -if ($OrderStatus != PurchOrder::STATUS_AUTHORISED and $OrderStatus != PurchOrder::STATUS_PRINTED) { +if ($OrderStatus != 'Authorised' AND $OrderStatus != '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'); include('includes/footer.inc'); exit; } +if ($_POST['PrintOrEmail']=='Email' AND ! IsEmailAddress($_POST['EmailTo'])){ + include('includes/header.inc'); + prnMsg( _('The email address entered does not appear to be valid. No emails have been sent.'),'warn'); + include('includes/footer.inc'); + exit; +} $ViewingOnly = 0; -if (isset($_GET['ViewingOnly']) && $_GET['ViewingOnly']!='') { +if (isset($_GET['ViewingOnly']) AND $_GET['ViewingOnly']!='') { $ViewingOnly = $_GET['ViewingOnly']; -} elseif (isset($_POST['ViewingOnly']) && $_POST['ViewingOnly']!='') { +} elseif (isset($_POST['ViewingOnly']) AND $_POST['ViewingOnly']!='') { $ViewingOnly = $_POST['ViewingOnly']; } -/* If we are previewing the order then we dont - * want to email it */ -if ($OrderNo != 'Preview') { +/* If we are previewing the order then we dont want to email it */ +if ($OrderNo == 'Preview') { //OrderNo is set to 'Preview' when just looking at the format of the printed order $_POST['PrintOrEmail']='Print'; } -if (isset($_POST['DoIt']) AND ($_POST['PrintOrEmail']=='Print' || $ViewingOnly==1) ){ +if (isset($_POST['DoIt']) AND ($_POST['PrintOrEmail']=='Print' OR $ViewingOnly==1) ){ $MakePDFThenDisplayIt = True; -} elseif (isset($_POST['DoIt']) AND $_POST['PrintOrEmail']=='Email' AND strlen($_POST['EmailTo'])>6){ +} elseif (isset($_POST['DoIt']) AND $_POST['PrintOrEmail']=='Email'){ $MakePDFThenEmailIt = True; } -if (isset($OrderNo) && $OrderNo != "" && $OrderNo > 0 && $OrderNo != 'Preview'){ - //Check this up front. Note that the myrow recordset is carried into the actual make pdf section +if (isset($OrderNo) AND $OrderNo != '' AND $OrderNo > 0 AND $OrderNo != 'Preview'){ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the purchase order header details for Order Number'). ' ' . $OrderNo . ' ' . _('from the database'); - $sql = "SELECT - purchorders.supplierno, - suppliers.suppname, - suppliers.address1, - suppliers.address2, - suppliers.address3, - suppliers.address4, - purchorders.comments, - purchorders.orddate, - purchorders.rate, - purchorders.dateprinted, - purchorders.deladd1, - purchorders.deladd2, - purchorders.deladd3, - purchorders.deladd4, - purchorders.deladd5, - purchorders.deladd6, - purchorders.allowprint, - purchorders.requisitionno, - purchorders.initiator, - purchorders.paymentterms, - suppliers.currcode - FROM purchorders INNER JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorders.orderno='" . $OrderNo ."'"; + $sql = "SELECT purchorders.supplierno, + suppliers.suppname, + suppliers.address1, + suppliers.address2, + suppliers.address3, + suppliers.address4, + purchorders.comments, + purchorders.orddate, + purchorders.rate, + purchorders.dateprinted, + purchorders.deladd1, + purchorders.deladd2, + purchorders.deladd3, + purchorders.deladd4, + purchorders.deladd5, + purchorders.deladd6, + purchorders.allowprint, + purchorders.requisitionno, + purchorders.initiator, + purchorders.paymentterms, + suppliers.currcode, + purchorders.status, + purchorders.stat_comment + FROM purchorders INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorders.orderno='" . $OrderNo ."'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)==0){ /*There is no order header returned */ $title = _('Print Purchase Order Error'); include('includes/header.inc'); echo '<div class="centre"><br><br><br>'; prnMsg( _('Unable to Locate Purchase Order Number') . ' : ' . $OrderNo . ' ', 'error'); - echo '<br><br><br><table class="table_index"> - <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?'.SID .'">' . _('Outstanding Purchase Orders') . '</a></li> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Purchase Order Inquiry') . '</a></li> - </td></tr></table></div><br><br><br>'; + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr><td class="menu_group_item"> + <li><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?'.SID .'">' . _('Outstanding Purchase Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Purchase Order Inquiry') . '</a></li> + </td> + </tr> + </table> + </div><br><br><br>'; include('includes/footer.inc'); exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned */ @@ -115,8 +135,7 @@ $title = _('Purchase Order Already Printed'); include('includes/header.inc'); echo '<p>'; - prnMsg( _('Purchase Order Number').' ' . $OrderNo . ' '. - _('has previously been printed') . '. ' . _('It was printed on'). ' ' . + prnMsg( _('Purchase Order Number').' ' . $OrderNo . ' '. _('has previously been printed') . '. ' . _('It was printed on'). ' ' . ConvertSQLDate($POHeader['dateprinted']) . '<br>'. _('To re-print the order it must be modified to allow a reprint'). '<br>'. _('This check is there to ensure that duplicate purchase orders are not sent to the supplier resulting in several deliveries of the same supplies'), 'warn'); @@ -179,17 +198,17 @@ $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $OrderNo . ' ' . _('from the database'); $sql = "SELECT itemcode, - deliverydate, - itemdescription, - unitprice, - unitname as units, - quantityord, - decimalplaces - FROM purchorderdetails LEFT JOIN stockmaster - ON purchorderdetails.itemcode=stockmaster.stockid - LEFT JOIN unitsofmeasure - ON purchorderdetails.uom=unitsofmeasure.unitid - WHERE orderno ='" . $OrderNo ."'"; + deliverydate, + itemdescription, + unitprice, + unitname as units, + quantityord, + decimalplaces + FROM purchorderdetails LEFT JOIN stockmaster + ON purchorderdetails.itemcode=stockmaster.stockid + LEFT JOIN unitsofmeasure + ON purchorderdetails.uom=unitsofmeasure.unitid + WHERE orderno ='" . $OrderNo ."'"; $result=DB_query($sql,$db); } if ($OrderNo=='Preview' or DB_num_rows($result)>0){ @@ -213,22 +232,22 @@ if ($_POST['ShowAmounts']=='Yes'){ $DisplayPrice = number_format($POLine['unitprice'],2); } else { - $DisplayPrice = "----"; + $DisplayPrice = '----'; } $DisplayDelDate = ConvertSQLDate($POLine['deliverydate'],2); if ($_POST['ShowAmounts']=='Yes'){ $DisplayLineTotal = number_format($POLine['unitprice']*$POLine['quantityord'],2); } else { - $DisplayLineTotal = "----"; + $DisplayLineTotal = '----'; } /* Dont search for supplier data if it is a preview */ if ($OrderNo !='Preview') { //check the supplier code from code item $sqlsupp = "SELECT supplierdescription - FROM purchdata - WHERE stockid='" . $POLine['itemcode'] . "' - AND supplierno ='" . $POHeader['supplierno'] . "' - AND price='".$POLine['unitprice']."'"; + FROM purchdata + WHERE stockid='" . $POLine['itemcode'] . "' + AND supplierno ='" . $POHeader['supplierno'] . "' + AND price='".$POLine['unitprice']."'"; $SuppResult = DB_query($sqlsupp,$db); $SuppDescRow = DB_fetch_row($SuppResult); } else { @@ -237,7 +256,7 @@ if($SuppDescRow[0]==""){ $Desc=$POLine['itemdescription']; }else{ - $Desc="".$SuppDescRow['0']." - ".$POLine['itemdescription'].""; + $Desc= $SuppDescRow['0'].' - '.$POLine['itemdescription'].""; } $OrderTotal += ($POLine['unitprice']*$POLine['quantityord']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize,$POLine['itemcode'], 'left'); @@ -273,66 +292,46 @@ if ($_POST['ShowAmounts']=='Yes'){ $DisplayOrderTotal = number_format($OrderTotal,2); } else { - $DisplayOrderTotal = "----"; + $DisplayOrderTotal = '----'; } $pdf->addText($FormDesign->OrderTotalCaption->x,$Page_Height - $FormDesign->OrderTotalCaption->y, $FormDesign->OrderTotalCaption->FontSize, _('Order Total - excl tax'). ' ' . $POHeader['currcode']); $LeftOvers = $pdf->addTextWrap($FormDesign->OrderTotal->x,$Page_Height - $FormDesign->OrderTotal->y,$FormDesign->OrderTotal->Length,$FormDesign->OrderTotal->FontSize,$DisplayOrderTotal, 'right'); } /*end if there are order details to show on the order*/ //} /* end of check to see that there was an order selected to print */ - //failed var to allow us to print if the email fails. - $failed = false; + + $Success = 1; //assume the best and email goes - has to be set to 1 to allow update status if ($MakePDFThenDisplayIt){ - $pdf->OutputD($_SESSION['DatabaseName'] . '_PurchaseOrder_' . date('Y-m-d') . '.pdf');//UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_PurchaseOrder_' . $OrderNo . '_' . date('Y-m-d') . '.pdf');//UldisN $pdf->__destruct(); //UldisN } else { /* must be MakingPDF to email it */ - /* UldisN - $pdfcode = $pdf->output(); - $fp = fopen( $_SESSION['reports_dir'] . '/PurchOrder.pdf','wb'); - fwrite ($fp, $pdfcode); - fclose ($fp); - */ - $PdfFileName = $_SESSION['DatabaseName'] . '_PurchaseOrder_' . date('Y-m-d') . '.pdf'; - $ReportsDirName = $_SESSION['reports_dir']; - $pdf->Output($ReportsDirName . '/' . $PdfFileName,'F');//UldisN - $pdf->__destruct(); //UldisN + + $PdfFileName = $_SESSION['DatabaseName'] . '_PurchaseOrder_' . $OrderNo . '_' .date('Y-m-d') . '.pdf'; + $pdf->Output($_SESSION['reports_dir'] . '/' . $PdfFileName,'F'); + $pdf->__destruct(); include('includes/htmlMimeMail.php'); $mail = new htmlMimeMail(); - $attachment = $mail->getFile($ReportsDirName . '/' . $PdfFileName); + $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $PdfFileName); $mail->setText( _('Please find herewith our purchase order number').' ' . $OrderNo); $mail->setSubject( _('Purchase Order Number').' ' . $OrderNo); $mail->addAttachment($attachment, $PdfFileName, 'application/pdf'); $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] .">"); - $result = $mail->send(array($_POST['EmailTo'])); - if ($result==1){ - $failed = false; - echo '<p>'; + $Success = $mail->send(array($_POST['EmailTo'])); + if ($Success==1){ + echo '<p />'; prnMsg( _('Purchase Order'). ' ' . $OrderNo.' ' . _('has been emailed to') .' ' . $_POST['EmailTo'] . ' ' . _('as directed'), 'success'); - } else { - $failed = true; - echo '<p>'; + } else { //email failed + echo '<p />'; prnMsg( _('Emailing Purchase order'). ' ' . $OrderNo.' ' . _('to') .' ' . $_POST['EmailTo'] . ' ' . _('failed'), 'error'); } } - if ($ViewingOnly==0 && !$failed) { - $commentsql="SELECT initiator,stat_comment FROM purchorders WHERE orderno='".$OrderNo."'"; - $commentresult=DB_query($commentsql,$db); - $commentrow=DB_fetch_array($commentresult); - $comment=$commentrow['stat_comment']; - $emailsql="SELECT email FROM www_users WHERE userid='".$commentrow['initiator']."'"; - $emailresult=DB_query($emailsql, $db); - $emailrow=DB_fetch_array($emailresult); - $date = date($_SESSION['DefaultDateFormat']); - $StatusComment=$date.' - Printed by <a href="mailto:'.$emailrow['email'].'">'.$_SESSION['UserID']. - '</a><br>'.$comment; - $sql = " - UPDATE purchorders - SET - allowprint = 0, - dateprinted = '" . Date('Y-m-d') . "', - status = '" . PurchOrder::STATUS_PRINTED . "', - stat_comment = '" . $StatusComment . "' - WHERE - purchorders.orderno = '" . $OrderNo."'"; + if ($ViewingOnly==0 AND $Success==1) { + $StatusComment = date($_SESSION['DefaultDateFormat']) .' - ' . _('Printed by') . '<a href="mailto:'.$_SESSION['UserEmail'] .'">'.$_SESSION['UsersRealName']. '</a><br />' . $POHeader['stat_comment']; + + $sql = "UPDATE purchorders SET allowprint = 0, + dateprinted = '" . Date('Y-m-d') . "', + status = 'Printed', + stat_comment = '" . $StatusComment . "' + WHERE purchorders.orderno = '" . $OrderNo."'"; $result = DB_query($sql,$db); } } /* There was enough info to either print or email the purchase order */ @@ -374,19 +373,19 @@ if ($_POST['PrintOrEmail']=='Email'){ $ErrMsg = _('There was a problem retrieving the contact details for the supplier'); $SQL = "SELECT suppliercontacts.contact, - suppliercontacts.email - FROM suppliercontacts INNER JOIN purchorders - ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno='".$OrderNo."'"; + suppliercontacts.email + FROM suppliercontacts INNER JOIN purchorders + ON suppliercontacts.supplierid=purchorders.supplierno + WHERE purchorders.orde... [truncated message content] |
From: <dai...@us...> - 2011-01-10 21:30:34
|
Revision: 4463 http://web-erp.svn.sourceforge.net/web-erp/?rev=4463&view=rev Author: daintree Date: 2011-01-10 21:30:27 +0000 (Mon, 10 Jan 2011) Log Message: ----------- continuation of PO rationalisation Modified Paths: -------------- trunk/PO_Items.php trunk/includes/ConnectDB.inc trunk/includes/DefinePOClass.php trunk/includes/PO_ReadInOrder.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-01-08 08:45:36 UTC (rev 4462) +++ trunk/PO_Items.php 2011-01-10 21:30:27 UTC (rev 4463) @@ -2,7 +2,7 @@ /* $Id PO_Items.php 4183 2010-12-14 09:30:20Z daintree $ */ -//$PageSecurity = 4; +//$PageSecurity = 4; Now retrieved from database include('includes/DefinePOClass.php'); include('includes/SQL_CommonFunctions.inc'); @@ -32,13 +32,13 @@ echo '<a href="'.$rootpath.'/PO_Header.php?' . SID . 'identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br>'; } -// add new request here 08-09-26 if (isset($_POST['StockID2']) AND $_GET['Edit']=='') { /* If a stock item is selected and a purchdata record * exists for it then find that record. */ $sql = "SELECT stockmaster.description, purchdata.suppliers_partno, + purchdata.converstionfactor, stockmaster.pkg_type, stockmaster.units, stockmaster.netweight, @@ -53,23 +53,24 @@ _('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - $myrow = DB_fetch_row($result); + $myrow = DB_fetch_array($result); - $_POST['ItemDescription'] = $myrow[0]; - $_POST['Suppliers_PartNo'] = $myrow[1]; - $_POST['Package'] = $myrow[2]; - $_POST['uom'] = $myrow[3]; - $_POST['nw'] = $myrow[4]; - $_POST['gw'] = $myrow[5]; + $_POST['ItemDescription'] = $myrow['description']; + $_POST['Suppliers_PartNo'] = $myrow['suppliers_partno']; + $_POST['Package'] = $myrow['pkg_type']; + $_POST['uom'] = $myrow['units']; + $_POST['NetWeight'] = $myrow['netweight']; + $_POST['KGs'] = $myrow['kgs']; + $_POST['ConversionFactor']=$myrow['conversionfactor']; $_POST['CuFt'] = $myrow[6]; } // end if (isset($_POST['StockID2']) && $_GET['Edit']=='') if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { - if ($POLine->Deleted==False) { + if ($POLine->Deleted == false) { $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=$_POST['Qty'.$POLine->LineNo]; $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['Price'.$POLine->LineNo]; - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->nw=$_POST['nw'.$POLine->LineNo]; + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->NetWeight=$_POST['NetWeight'.$POLine->LineNo]; $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } } @@ -82,7 +83,7 @@ */ $InputError=0; /*Start off assuming the best */ if ($_SESSION['PO'.$identifier]->DelAdd1=='' or strlen($_SESSION['PO'.$identifier]->DelAdd1)<3){ - prnMsg( _('The purchase order can not be committed to the database because there is no delivery street address specified'),'error'); + prnMsg( _('The purchase order cannot be committed to the database because there is no delivery street address specified'),'error'); $InputError=1; } elseif ($_SESSION['PO'.$identifier]->Location=='' or ! isset($_SESSION['PO'.$identifier]->Location)){ prnMsg( _('The purchase order can not be committed to the database because there is no location specified to book any stock items into'),'error'); @@ -100,6 +101,7 @@ if ($_SESSION['ExistingOrder']==0){ /*its a new order to be inserted */ +//Do we need to check authorisation to create - no because already trapped when new PO session started $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['PO'.$identifier]->Initiator. '</a> - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br>'; @@ -193,12 +195,13 @@ subtotal_amount, package, pcunit, - nw, - gw, + netweight, + kgs, cuft, total_quantity, total_amount, - assetid ) + assetid, + conversionfactor ) VALUES ( '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', @@ -215,12 +218,13 @@ '" . $POLine->SubTotal_Amount . "', '" . $POLine->Package . "', '" . $POLine->PcUnit . "', - '" . $POLine->nw . "', - '" . $POLine->gw . "', + '" . $POLine->NetWeight . "', + '" . $POLine->KGs . "', '" . $POLine->CuFt . "', '" . $POLine->Total_Quantity . "', '" . $POLine->Total_Amount . "', - '" . $POLine->AssetID . "')"; + '" . $POLine->AssetID . "', + '" . $POLine->SuppConversionFactor . "')"; $ErrMsg =_('One of the purchase order detail records could not be inserted into the database because'); $DbgMsg =_('The SQL statement used to insert the purchase order detail record and failed was'); $result =DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -295,12 +299,13 @@ subtotal_amount, package, pcunit, - nw, - gw, + netweight, + kgs, cuft, total_quantity, total_amount, - assetid ) + assetid, + suppconversionfactor ) VALUES ( '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', @@ -317,12 +322,13 @@ '" . $POLine->SubTotal_Amount . "', '" . $POLine->Package . "', '" . $POLine->PcUnit . "', - '" . $POLine->nw . "', - '" . $POLine->gw . "', + '" . $POLine->NetWeight . "', + '" . $POLine->KGs . "', '" . $POLine->CuFt . "', '" . $POLine->Total_Quantity . "', '" . $POLine->Total_Amount . "', - '" . $POLine->AssetID . "')"; + '" . $POLine->AssetID . "', + '" . $POLine->ConversionFactor . "')"; } else { if ($POLine->Quantity==$POLine->QtyReceived){ @@ -340,13 +346,14 @@ subtotal_amount='" . $POLine->SubTotal_Amount . "', package='" . $POLine->Package . "', pcunit='" . $POLine->PcUnit . "', - nw='" . $POLine->nw . "', - gw='" . $POLine->gw . "', + netweight='" . $POLine->NetWeight . "', + kgs='" . $POLine->KGs . "', cuft='" . $POLine->CuFt . "', total_quantity='" . $POLine->Total_Quantity . "', total_amount='" . $POLine->Total_Amount . "', completed=1, - assetid='" . $POLine->AssetID . "' + assetid='" . $POLine->AssetID . "', + suppconversionfactor = '" . $POLine->ConversionFactor . "' WHERE podetailitem='" . $POLine->PODetailRec . "'"; } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', @@ -363,12 +370,13 @@ subtotal_amount='" . $POLine->SubTotal_Amount . "', package='" . $POLine->Package . "', pcunit='" . $POLine->PcUnit . "', - nw='" . $POLine->nw . "', - gw='" . $POLine->gw . "', + netweight='" . $POLine->NetWeight . "', + kgs='" . $POLine->KGs . "', cuft='" . $POLine->CuFt . "', total_quantity='" . $POLine->Total_Quantity . "', total_amount='" . $POLine->Total_Amount . "', - assetid='" . $POLine->AssetID . "' + assetid='" . $POLine->AssetID . "', + suppconversionfactor = '" . $POLine->ConversionFactor . "' WHERE podetailitem='" . $POLine->PODetailRec . "'"; } } @@ -409,7 +417,6 @@ 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 ."' @@ -422,7 +429,6 @@ 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 ."' @@ -442,7 +448,6 @@ 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'] . "' @@ -455,7 +460,6 @@ 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'] . "' @@ -472,7 +476,6 @@ 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 @@ -484,7 +487,6 @@ 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'] . "' @@ -524,6 +526,7 @@ if (isset($_POST['LookupPrice']) and isset($_POST['StockID2'])){ $sql = "SELECT purchdata.price, purchdata.conversionfactor, + purchdata.suppliersuom, purchdata.supplierdescription FROM purchdata WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' @@ -536,8 +539,11 @@ if (DB_num_rows($LookupResult)==1){ $myrow = DB_fetch_array($LookupResult); $_POST['Price'] = $myrow['price']/$myrow['conversionfactor']; + $_POST['SuppliersUOM'] = $myrow['suppliersuom']; + $_POST['ConversionFactor'] = $myrow['conversionfactor']; + } else { - prnMsg(_('Sorry') . ' ... ' . _('there is no purchasing data set up for this supplier') . ' - ' . $_SESSION['PO'.$identifier]->SupplierID . ' ' . _('and item') . ' ' . strtoupper($_POST['StockID']),'warn'); + prnMsg(_('There is no purchasing data set up for this supplier') . ' - ' . $_SESSION['PO'.$identifier]->SupplierID . ' ' . _('and item') . ' ' . strtoupper($_POST['StockID']),'warn'); } } @@ -590,16 +596,17 @@ $_POST['JobRef'], $_POST['ItemNo'], $_SESSION['PO'.$identifier]->LineItems[$_POST['LineNo']]->uom, - 1, //conversion factor not set?? + $_POST['ConverionFactor'], $_POST['Suppliers_PartNo'], $_POST['Qty']*$_POST['Price'], $_POST['Package'], $_POST['PcUnit'], - $_POST['nw'], - $_POST['gw'], + $_POST['NetWeight'], + $_POST['KGs'], $_POST['CuFt'], $_POST['Qty'], - $_POST['Qty']*$_POST['Price'] ); + $_POST['Qty']*$_POST['Price'], + $_POST['SuppliersUOM'] ); include ('includes/PO_UnsetFormVbls.php'); } @@ -693,7 +700,7 @@ $_POST['Qty'], $_POST['ItemDescription'], $_POST['Price'], - _('each'), + $_POST['uom'], $_POST['GLCode'], $_POST['ReqDelDate'], $_POST['ShiptRef'], @@ -702,21 +709,21 @@ 0, 0, $GLAccountName, - 2, + $_POST['DecimalPlaces'], $_POST['ItemNo'], - $_POST['uom'], - 1, - 1, + $_POST['SuppliersUOM'], + $_POST['ConversionFactor'], + $_POST['LeadTime'], $_POST['Suppliers_PartNo'], $_POST['SubTotal_Amount'], $_POST['Package'], $_POST['PcUnit'], - $_POST['nw'], - $_POST['gw'], + $_POST['NetWeight'], + $_POST['KGs'], $_POST['CuFt'], $_POST['Total_Quantity'], $_POST['Total_Amount'], - $_POST['AssetID'] ); + $_POST['AssetID']); include ('includes/PO_UnsetFormVbls.php'); } @@ -725,11 +732,12 @@ 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 $key => $value) { - if (substr($key, 0, 3)=='qty') { - $ItemCode=substr($key, 3, strlen($key)-3); - $Quantity=$value; +/* take the form entries and enter the data from the form into the PurchOrder class variable + * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new items for each of these form variables need to parse out the items and look up the details to add them to the purchase order $_POST is of course the global array of all posted form variables */ + + foreach ($_POST as $FormVariableName => $Quantity) { + if (substr($FormVariableName, 0, 6)=='NewQty') { //if the form variable represents a Qty to add to the order + $ItemCode=substr($FormVariableName, 6, strlen($FormVariableName)-6); $AlreadyOnThisOrder =0; if ($_SESSION['PO_AllowSameItemMultipleTimes'] ==false){ @@ -770,7 +778,7 @@ purchdata.leadtime FROM stockcategory, chartmaster, - stockmaster LEFT JOIN purchdata + stockmaster INNER JOIN purchdata ON stockmaster.stockid = purchdata.stockid LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid @@ -836,8 +844,7 @@ $myrow['kgs'], '', $Quantity, - $Quantity*$myrow['price'] - ); + $Quantity*$myrow['price'] ); } else { /*There was no supplier purchasing data for the item selected so enter a purchase order line with zero price */ @@ -893,8 +900,6 @@ echo "<form name=form1 action='" . $_SERVER['PHP_SELF'] . "?" . SID . "identifier=".$identifier. "' method=post>"; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -//echo _('Purchase Order') . ': <font color=BLUE size=4><b>' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierName . ' </b></font> - ' . _('All amounts stated in') . ' ' . $_SESSION['PO'.$identifier]->CurrCode . '<br>'; - /*need to set up entry for item description where not a stock item and GL Codes */ if (count($_SESSION['PO'.$identifier]->LineItems)>0 and !isset($_GET['Edit'])){ @@ -906,17 +911,20 @@ } echo '<br><b>'._(' Order Summary') . '</b>'; echo '<table cellpadding=2 colspan=7 class=selection>'; - echo "<tr> - <th>" . _('Item Code') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('UOM') ."</th> - <th>" . _('Weight') . "</th> - <th>" . _('Price') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ")</th> - <th>" . _('Subtotal') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ")</th> - <th>" . _('Deliver By') ."</th> - </tr>"; - + echo '<tr> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Our Unit') .'</th> + <th>' . _('Quantity') . '<th> + <th>' . _('Supp Unit') . '</th> + <th>' . _('Weight') . '</th> + <th>' . _('Price Our Units') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> + <th>' . _('Price Supp Units') . ' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> + <th>' . _('Subtotal') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> + <th>' . _('Deliver By') .'</th> + </tr>'; + $_SESSION['PO'.$identifier]->Total = 0; $k = 0; //row colour counter @@ -924,9 +932,7 @@ if ($POLine->Deleted==False) { $LineTotal = $POLine->Quantity * $POLine->Price; - // Note decimal places should not fixed at 2, use POLine->DecimalPlaces instead - // $DisplayLineTotal = number_format($LineTotal,2); - $DisplayLineTotal = number_format($LineTotal,2); + $DisplayLineTotal = number_format($LineTotal,$POLine->DecimalPlaces); // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { @@ -934,7 +940,6 @@ } else { $DisplayPrice = number_format($POLine->Price,4,'.',''); } - $DisplayQuantity = number_format($POLine->Quantity,$POLine->DecimalPlaces,'.',''); if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -943,35 +948,18 @@ echo '<tr class="OddTableRows">'; $k=1; } - $UomSQL="SELECT conversionfactor, - suppliersuom, - unitsofmeasure. - unitname - FROM purchdata - LEFT JOIN unitsofmeasure - ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' - AND stockid='".$POLine->StockID."'"; - $UomResult=DB_query($UomSQL, $db); - if (DB_num_rows($UomResult)>0) { - $UomRow=DB_fetch_array($UomResult); - if (strlen($UomRow['suppliersuom'])>0) { - $Uom=$UomRow['unitname']; - } else { - $Uom=$POLine->Units; - } - } else { - $Uom=$POLine->Units; - } - echo '<td>' . $POLine->StockID . '</td> <td>' . $POLine->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $POLine->LineNo .'" size="11" value="' . $DisplayQuantity . '"></td> - <td>' . $Uom . '</td> - <td><input type="text" class="number" name="nw' . $POLine->LineNo . '" size="11" value="' . $POLine->nw . '"></td> + <td><input type="text" class="number" name="Qty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity,$POLine->DecimalPlaces) . '"></td> + <td>' . $POLine->Units . '</td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> + <td>' . $POLine->SuppUOM . '</td> + <td><input type="text" class="number" name="NetWeight' . $POLine->LineNo . '" size="11" value="' . $POLine->NetWeight . '"></td> <td><input type="text" class="number" name="Price' . $POLine->LineNo . '" size="11" value="' .$DisplayPrice.'"></td> <td class="number">' . $DisplayLineTotal . '</td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="11" value="' .number_format($POLine->Price/$POLine->ConversionFactor,2) .'"></td> + <td class="number">' . $DisplayLineTotal . '</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="11" value="' .$POLine->ReqDelDate .'"></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; @@ -1082,13 +1070,12 @@ <input type=submit name='NonStockOrder' value='" . _('Order a non stock item') . "'> </div><br>"; - $PartsDisplayed =0; } if (isset($SearchResult)) { - echo "<table cellpadding=1 colspan=7 class=selection>"; + echo '<table cellpadding="1" colspan="7" class="selection">'; $TableHeader = '<tr> <th>' . _('Code') . '</th> @@ -1145,7 +1132,7 @@ <td>".$myrow['description']."</td> <td>".$Uom."</td> <td>".$ImageSource."</td> - <td><input class='number' type='text' size=6 value=0 name='qty".$myrow['stockid']."'></td> + <td><input class='number' type='text' size=6 value=0 name='NewQty".$myrow['stockid']."'></td> <input type='hidden' size=6 value=".$Uom." name=uom> </tr>"; Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-01-08 08:45:36 UTC (rev 4462) +++ trunk/includes/ConnectDB.inc 2011-01-10 21:30:27 UTC (rev 4463) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='3.12.2'; //must update manually every time there is a DB change +$Version='3.12.3'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); @@ -14,8 +14,8 @@ $_SESSION['DatabaseName'] = $_POST['CompanyNameField']; include_once ($PathPrefix . 'includes/ConnectDB_' . $dbType . '.inc'); } else { - prnMsg(_('The company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is not configured for use with this installation of webERP. Check that a directory named ' . $_POST['CompanyNameField'] . ' is set up under the companies sub-directory.'),'error'); - prnMsg(_('Check the company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is the same as the database name.'),'error'); + prnMsg(_('The company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is not configured for use with this installation of webERP. Check that a directory named ' . $_POST['CompanyNameField'] . ' is set up under the companies sub-directory.'),'error'); + prnMsg(_('Check the company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is the same as the database name.'),'error'); prnMsg(_('The company name abbreviation entered at login must also have a company directory defined. See your system administrator'),'error'); } } elseif (isset($DatabaseName)) { /* Scripts that do not require a login must have the $DatabaseName variable set in hard code */ Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2011-01-08 08:45:36 UTC (rev 4462) +++ trunk/includes/DefinePOClass.php 2011-01-10 21:30:27 UTC (rev 4463) @@ -81,8 +81,8 @@ $SubTotal_Amount=0, $Package=0, $PcUnit=0, - $nw=0, - $gw=0, + $NetWeight=0, + $KGs=0, $CuFt=0, $Total_Quantity=0, $Total_Amount=0, @@ -115,8 +115,8 @@ $SubTotal_Amount, $Package, $PcUnit, - $nw, - $gw, + $NetWeight, + $KGs, $CuFt, $Total_Quantity, $Total_Amount, @@ -143,11 +143,12 @@ $SubTotal_Amount, $Package, $PcUnit, - $nw, - $gw, + $NetWeight, + $KGs, $CuFt, $Total_Quantity, - $Total_Amount){ + $Total_Amount, + $SuppUOM){ $this->LineItems[$LineNo]->ItemDescription = $ItemDescription; $this->LineItems[$LineNo]->Quantity = $Qty; @@ -164,11 +165,12 @@ $this->LineItems[$LineNo]->Subtotal_Amount = $SubTotal_Amount; $this->LineItems[$LineNo]->Package = $Package; $this->LineItems[$LineNo]->PcUnit = $PcUnit; - $this->LineItems[$LineNo]->nw = $nw; - $this->LineItems[$LineNo]->gw = $gw; + $this->LineItems[$LineNo]->NetWeight = $NetWeight; + $this->LineItems[$LineNo]->KGs = $KGs; $this->LineItems[$LineNo]->CuFt = $CuFt; $this->LineItems[$LineNo]->Total_Quantity = $Total_Quantity; $this->LineItems[$LineNo]->Total_Amount = $Total_Amount; + $this->LineItems[$LineNo]->SuppUOM = $SuppUOM; } function remove_from_order(&$LineNo){ @@ -218,7 +220,7 @@ Var $GLActName; Var $Quantity; Var $Price; - Var $Units; //errrrr what is uom for then + Var $Units; Var $ReqDelDate; Var $QtyInv; Var $QtyReceived; @@ -227,15 +229,15 @@ var $Completed; Var $JobRef; Var $ItemNo; - Var $SuppUOM; var $ConversionFactor; + var $SuppUOM; Var $Suppliers_PartNo; Var $SubTotal_Amount; Var $LeadTime; Var $Package; Var $PcUnit; - Var $nw; - Var $gw; + Var $NetWeight; + Var $KGs; Var $CuFt; Var $Total_Quantity; Var $Total_Amount; @@ -271,8 +273,8 @@ $LeadTime, $Package, $PcUnit, - $nw, - $gw, + $NetWeight, + $KGs, $CuFt, $Total_Quantity, $Total_Amount, @@ -300,8 +302,8 @@ $this->Subtotal_Amount = $SubTotal_Amount; $this->LeadTime = $LeadTime; $this->PcUnit = $PcUnit; - $this->nw = $nw; - $this->gw = $gw; + $this->NetWeight = $NetWeight; + $this->KGs = $KGs; $this->CuFt = $CuFt; $this->Total_Quantity = $Total_Quantity; $this->Total_Amount = $Total_Amount; Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2011-01-08 08:45:36 UTC (rev 4462) +++ trunk/includes/PO_ReadInOrder.inc 2011-01-10 21:30:27 UTC (rev 4463) @@ -50,7 +50,7 @@ locations.managed , purchorders.paymentterms FROM purchorders - LEFT JOIN locations ON purchorders.intostocklocation=locations.loccode, + INNER JOIN locations ON purchorders.intostocklocation=locations.loccode, suppliers WHERE purchorders.supplierno = suppliers.supplierid AND purchorders.orderno = ' . $_GET['ModifyOrderNumber']; Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-08 08:45:36 UTC (rev 4462) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-10 21:30:27 UTC (rev 4463) @@ -811,3 +811,7 @@ ('ReportMaker.php', 1, 'Produces reports from the report writer templates created'), ('ReportCreator.php', 13, 'Report Writer and Form Creator script that creates templates for user defined reports and forms'); UPDATE config SET confvalue='3.12.2' WHERE confname='VersionNumber'; +ALTER TABLE `purchorderdetails` CHANGE `nw` `netweight` VARCHAR( 50 ) DEFAULT ''; +ALTER TABLE `purchorderdetails` CHANGE `gw` `kgs` VARCHAR( 50 ) DEFAULT ''; +ALTER TABLE `purchorderdetails` ADD `suppconversionfactor` DOUBLE NOT NULL DEFAULT '1'; +UPDATE config SET confvalue='3.12.3' WHERE confname='VersionNumber'; \ 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-01-08 08:45:43
|
Revision: 4462 http://web-erp.svn.sourceforge.net/web-erp/?rev=4462&view=rev Author: daintree Date: 2011-01-08 08:45:36 +0000 (Sat, 08 Jan 2011) Log Message: ----------- Ricard fixes Modified Paths: -------------- trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/doc/Change.log.html Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2011-01-06 05:16:06 UTC (rev 4461) +++ trunk/Z_ChangeBranchCode.php 2011-01-08 08:45:36 UTC (rev 4462) @@ -183,7 +183,7 @@ $result = DB_Txn_Commit($db); - $result = DB_IgnoreForeignKeyChecks($db); + $result = DB_IgnoreForeignKeys($db); prnMsg(_('Deleting the old customer branch record'),'info'); $sql = "DELETE FROM custbranch WHERE debtorno='" . $_POST['DebtorNo'] . "' @@ -191,7 +191,7 @@ $ErrMsg = _('The SQL to delete the old customer branch record failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true,true); - $result = DB_ReinstateForeignKeyChecks($db); + $result = DB_ReinstateForeignKeys($db); } Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2011-01-06 05:16:06 UTC (rev 4461) +++ trunk/Z_ChangeCustomerCode.php 2011-01-08 08:45:36 UTC (rev 4462) @@ -58,7 +58,8 @@ `editransport`, `ediaddress`, `ediserveruser`, - `ediserverpwd`) + `ediserverpwd`, + `typeid`) SELECT '" . $_POST['NewDebtorNo'] . "', `name`, `address1`, @@ -83,7 +84,8 @@ `editransport`, `ediaddress`, `ediserveruser`, - `ediserverpwd` + `ediserverpwd`, + `typeid` FROM debtorsmaster WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-06 05:16:06 UTC (rev 4461) +++ trunk/doc/Change.log.html 2011-01-08 08:45:36 UTC (rev 4462) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>8/1/11 Ricard Andreu: Z_ChangeCustomerCode.php added typeid field that made change customer code fail. Also corrected typo for foreign key checking side stepping for Z_ChangeBranchCode.php</p> <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> <p>4/1/11 Paul T: Bug# 3151192 - insert underscore for superglobal.</p> <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-01-06 05:16:13
|
Revision: 4461 http://web-erp.svn.sourceforge.net/web-erp/?rev=4461&view=rev Author: daintree Date: 2011-01-06 05:16:06 +0000 (Thu, 06 Jan 2011) Log Message: ----------- report writer - changes Modified Paths: -------------- trunk/Z_PriceChanges.php trunk/api/api_php.php trunk/includes/ConnectDB.inc trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php trunk/reportwriter/WriteReport.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/Z_PriceChanges.php =================================================================== --- trunk/Z_PriceChanges.php 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/Z_PriceChanges.php 2011-01-06 05:16:06 UTC (rev 4461) @@ -103,33 +103,33 @@ if ($_POST['WhichPrices'] == 'Only Non-customer special prices'){ $sql = 'UPDATE prices SET price=price*(1+' . $IncrementPercentage . ") - WHERE typeabbrev='" . $_POST['PriceList'] . "' - AND stockid='" . $myrow['stockid'] . "' - AND typeabbrev='" . $_POST['PriceList'] . "' - AND debtorno=''"; + WHERE typeabbrev='" . $_POST['PriceList'] . "' + AND stockid='" . $myrow['stockid'] . "' + AND typeabbrev='" . $_POST['PriceList'] . "' + AND debtorno=''"; }else if ($_POST['WhichPrices'] == 'Only customer special prices'){ $sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ") - WHERE typeabbrev='" . $_POST['PriceList'] . "' - AND stockid='" . $myrow['stockid'] . "' - AND typeabbrev='" . $_POST['PriceList'] . "' - AND debtorno!=''"; + WHERE typeabbrev='" . $_POST['PriceList'] . "' + AND stockid='" . $myrow['stockid'] . "' + AND typeabbrev='" . $_POST['PriceList'] . "' + AND debtorno!=''"; } else if ($_POST['WhichPrices'] == 'Both customer special prices and non-customer special prices'){ $sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ") - WHERE typeabbrev='" . $_POST['PriceList'] . "' - AND stockd='" . $myrow['stockid'] . "' - AND typeabbrev='" . $_POST['PriceList'] . "'"; + WHERE typeabbrev='" . $_POST['PriceList'] . "' + AND stockd='" . $myrow['stockid'] . "' + AND typeabbrev='" . $_POST['PriceList'] . "'"; } else if ($_POST['WhichPrices'] == 'Selected customer special prices only'){ $sql = 'UPDATE prices SET price=price*(1+' . $IncrementPercentage . ") - WHERE typeabbrev='" . $_POST['PriceList'] . "' - AND stockid='" . $myrow['stockid'] . "' - AND typeabbrev='" . $_POST['PriceList'] . "' - AND debtorno='" . $_SESSION['CustomerID'] . "'"; + WHERE typeabbrev='" . $_POST['PriceList'] . "' + AND stockid='" . $myrow['stockid'] . "' + AND typeabbrev='" . $_POST['PriceList'] . "' + AND debtorno='" . $_SESSION['CustomerID'] . "'"; } Modified: trunk/api/api_php.php =================================================================== --- trunk/api/api_php.php 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/api/api_php.php 2011-01-06 05:16:06 UTC (rev 4461) @@ -10,7 +10,7 @@ $PathPrefix=dirname(__FILE__).'/../'; include('api_session.inc'); - include 'api_errorcodes.php'; + include('api_errorcodes.php'); /* Include SQL_CommonFunctions.inc, to use GetNextTransNo().*/ include($PathPrefix.'includes/SQL_CommonFunctions.inc'); Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/includes/ConnectDB.inc 2011-01-06 05:16:06 UTC (rev 4461) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='3.12.1'; //must update manually every time there is a DB change +$Version='3.12.2'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Modified: trunk/reportwriter/FormMaker.php =================================================================== --- trunk/reportwriter/FormMaker.php 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/reportwriter/FormMaker.php 2011-01-06 05:16:06 UTC (rev 4461) @@ -3,14 +3,14 @@ $DirectoryLevelsDeep = 1; $PathPrefix = '../'; -$PageSecurity = 1; // set security level for webERP +//$PageSecurity = 1; // set security level for webERP require($PathPrefix . 'includes/session.inc'); // TBD The followiung line needs to be replace when more translations are available $ReportLanguage = 'en_US'; // default language file define('DBReports','reports'); // name of the databse holding the main report information (ReportID) define('DBRptFields','reportfields'); // name of the database holding the report fields -define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory +//define('FPDF_FONTPATH','../fonts/'); FPDF path to fonts directory define('DefRptPath',$PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/reportwriter/'); // path to default reports // Fetch necessary include files - Host application specific (webERP) require_once($PathPrefix . 'includes/DateFunctions.inc'); @@ -98,7 +98,7 @@ } } // else use default settings, i.e. no overrides // All done with setup, build the form - require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports + require($PathPrefix . 'includes/tcpdf.php'); // TCPDF class to generate reports require('WriteForm.inc'); // build the pdf pages (this function exits the script if successful; otherwise returns with error) $success = BuildPDF($ReportID, $Prefs); // build and output form, should not return from this function @@ -139,9 +139,14 @@ foreach ($ReportGroups as $key=>$GName) { $OutputString .= '<tr bgcolor="#CCCCCC"><td colspan="3" align="center">'.$GName.'</td></tr>'; $OutputString .= '<tr><td colspan="3" width="250" valign="top">'; - $sql= "SELECT id, groupname, reportname FROM ".DBReports." - WHERE defaultreport='1' AND reporttype='frm' - ORDER BY groupname, reportname"; + $sql= "SELECT id, + groupname, + reportname + FROM ".DBReports." + WHERE defaultreport='1' + AND reporttype='frm' + ORDER BY groupname, + reportname"; $Result=DB_query($sql,$db,'','',false,true); $FormList = ''; while ($Temp = DB_fetch_array($Result)) $FormList[] = $Temp; @@ -160,9 +165,11 @@ $OutputString .= '</td></tr>'; } } else { // fetch the forms specific to a group GroupID - $sql= "SELECT id, reportname FROM ".DBReports." - WHERE defaultreport='1' AND groupname='".$GroupID."' - ORDER BY reportname"; + $sql= "SELECT id, + reportname + FROM ".DBReports." + WHERE defaultreport='1' AND groupname='".$GroupID."' + ORDER BY reportname"; $Result=DB_query($sql,$db,'','',false,true); $OutputString .= '<tr><td colspan="3" width="250" valign="top">'; while ($Forms = DB_fetch_array($Result)) { @@ -175,15 +182,33 @@ function FetchReportDetails($ReportID) { global $db; - $sql= "SELECT reportname, reporttype, groupname, papersize, paperorientation, - margintop, marginbottom, marginleft, marginright, - table1, table2, table2criteria, table3, table3criteria, table4, table4criteria, - table5, table5criteria, table6, table6criteria - FROM ".DBReports." - WHERE id = ".$ReportID.";"; + $sql= "SELECT reportname, + reporttype, + groupname, + papersize, + paperorientation, + margintop, + marginbottom, + marginleft, + marginright, + table1, + table2, + table2criteria, + table3, + table3criteria, + table4, + table4criteria, + table5, + table5criteria, + table6, + table6criteria + FROM " . DBReports . " + WHERE id = ".$ReportID.";"; $Result=DB_query($sql,$db,'','',false,true); $myrow=DB_fetch_assoc($Result); - foreach ($myrow as $key=>$value) $Prefs[$key]=$value; + foreach ($myrow as $key=>$value) { + $Prefs[$key]=$value; + } // Build drop down menus for selectable criteria $Temp = RetrieveFields($ReportID, 'dateselect'); $Prefs['DateListings'] = $Temp[0]; // only need the first field @@ -196,8 +221,9 @@ global $db; $FieldListings = ''; $sql= "SELECT * FROM ".DBRptFields." - WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' - ORDER BY seqnum"; + WHERE reportid = '".$ReportID."' + AND entrytype = '".$EntryType."' + ORDER BY seqnum"; $Result=DB_query($sql,$db,'','',false,true); while ($FieldValues = DB_fetch_assoc($Result)) { $FieldListings[] = $FieldValues; } return $FieldListings; @@ -210,9 +236,15 @@ // retrieve the dropdown based on the params field (dropdown type) $Params = explode(':',$FieldListings['params']); // the first value is the criteria type $CritBlocks = explode(':',$CritChoices[array_shift($Params)]); - if (!isset($Params[0])) $Params[0] = '-'; // default to no default if this parameter doesn't exist - if (!isset($Params[1])) $Params[1] = ''; // default to no entry for default from box - if (!isset($Params[2])) $Params[2] = ''; // default to no entry for default to box + if (!isset($Params[0])) { + $Params[0] = '-'; // default to no default if this parameter doesn't exist + } + if (!isset($Params[1])) { + $Params[1] = ''; // default to no entry for default from box + } + if (!isset($Params[2])) { + $Params[2] = ''; // default to no entry for default to box + } switch (array_shift($CritBlocks)) { // determine how many text boxes to build default: case 0: $EndString = '<td> </td><td> </td>'; @@ -225,7 +257,11 @@ } // end switch array_shift($CritBlocks) $CriteriaString .= '<td><select name="defcritsel'.$SeqNum.'">'; foreach ($CritBlocks as $value) { - if ($Params[0]==$value) $Selected = ' selected'; else $Selected = ''; // find the default + if ($Params[0]==$value) { + $Selected = ' selected'; + } else { + $Selected = ''; // find the default + } $CriteriaString .= '<option value="'.$value.'"'.$Selected.'>'.$value.'</option>'; } $CriteriaString .= '</select></td>'; Modified: trunk/reportwriter/ReportMaker.php =================================================================== --- trunk/reportwriter/ReportMaker.php 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/reportwriter/ReportMaker.php 2011-01-06 05:16:06 UTC (rev 4461) @@ -2,14 +2,14 @@ /* $Revision: 1.7 $ */ $DirectoryLevelsDeep =1; $PathPrefix = '../'; -$PageSecurity = 1; // set security level for webERP +//$PageSecurity = 1; // set security level for webERP // TBD The followiung line needs to be replace when more translations are available $ReportLanguage = 'en_US'; // default language file -define('DBReports','reports'); // name of the databse holding the main report information (ReportID) -define('DBRptFields','reportfields'); // name of the database holding the report fields -define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory +define('DBReports','reports'); // name of the databse table holding the main report information (ReportID) +define('DBRptFields','reportfields'); // name of the database table holding the report fields +//define('FPDF_FONTPATH','../fonts/'); FPDF path to fonts directory // Fetch necessary include files - Host application specific (webERP) require($PathPrefix . 'includes/session.inc'); @@ -49,7 +49,7 @@ if ($SeqNum<>1) $success = ChangeSequence($ReportID, $SeqNum, 'fieldlist', 'up'); } elseif (isset($_POST['dn'.$SeqNum.'_x'])) { // the shift down button was pushed $sql = "SELECT seqnum FROM ".DBRptFields." - WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist';"; + WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist';"; $Result=DB_query($sql,$db,'','',false,true); if ($SeqNum<DB_num_rows($Result)) { $success = ChangeSequence($ReportID, $SeqNum, 'fieldlist', 'down'); @@ -131,7 +131,7 @@ case RPT_BTN_EXPPDF: $Prefs = ReadPostData($ReportID, $Prefs); // include the necessary files to build report - require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports + require($PathPrefix . 'includes/tcpdf/tcpdf.php'); // TCPDF class to generate reports require('WriteReport.inc'); $ReportData = ''; $success = BuildSQL($Prefs); Modified: trunk/reportwriter/WriteReport.inc =================================================================== --- trunk/reportwriter/WriteReport.inc 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/reportwriter/WriteReport.inc 2011-01-06 05:16:06 UTC (rev 4461) @@ -1,278 +1,267 @@ -<?PHP -// for compatability with extended char sets -if ($_SESSION['Language']=='zh_CN'){ - include($PathPrefix . 'includes/FPDF_Chinese.php'); -} elseif ($_SESSION['Language']=='ja_JP'){ - include($PathPrefix . 'includes/FPDF_Japanese.php'); -} elseif ($_SESSION['Language']=='ko_KR'){ - include($PathPrefix . 'includes/FPDF_Korean.php'); -} else { - class PDF_Language extends FPDF { } -} +<?php +require_once($PathPrefix .'/includes/class.pdf.php'); -class PDF extends PDF_Language { +class PDF extends Cpdf { var $y0; // current y position var $x0; // current x position var $pageY; // y value of bottom of page less bottom margin - -function PDF() { - global $Prefs; - $PaperSize = explode(':',$Prefs['papersize']); - $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]); - if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height - $this->pageY = $PaperSize[2]-$Prefs['marginbottom']; - } else { // Landscape - $this->pageY = $PaperSize[1]-$Prefs['marginbottom']; + + function PDF() { + global $Prefs; + $PaperSize = explode(':',$Prefs['papersize']); + $this->Cpdf($Prefs['paperorientation'], 'mm', $PaperSize[0]); + if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height + $this->pageY = $PaperSize[2]-$Prefs['marginbottom']; + } else { // Landscape + $this->pageY = $PaperSize[1]-$Prefs['marginbottom']; + } + $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']); + $this->SetAutoPageBreak(0, $Prefs['marginbottom']); + + $this->SetDrawColor(128,0,0); + $this->SetLineWidth(.35); // 1 point + $this->AliasNbPages(); + $this->AddPage(); + } - $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']); - $this->SetAutoPageBreak(0, $Prefs['marginbottom']); - $this->SetFont($Prefs['coynamefont']); - $this->SetDrawColor(128,0,0); - $this->SetLineWidth(.35); // 1 point - $this->AliasNbPages(); - $this->AddPage(); - - if ($_SESSION['Language']=='zh_CN'){ - $this->AddBig5Font(); - } elseif ($_SESSION['Language']=='zh_HK'){ - $this->AddCIDFont(); - } elseif ($_SESSION['Language']=='ja_JP'){ - $this->AddSJISFont(); - } elseif ($_SESSION['Language']=='ko_KR'){ - $this->AddUHCFont(); - } -} - -function Header() { - global $Prefs, $Heading, $Seq; - define(RowSpace,2); // define separation between the heading rows - if ($Prefs['coynameshow']) { // Show the company name - $this->SetFont($Prefs['coynamefont'],'B',$Prefs['coynamefontsize']); - $Colors = explode(':',$Prefs['coynamefontcolor']); + + function Header() { + global $Prefs, $Heading, $Seq; + define(RowSpace,2); // define separation between the heading rows + if ($Prefs['coynameshow']) { // Show the company name + $Colors = explode(':',$Prefs['coynamefontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']); + } + if ($Prefs['title1show']) { // Set title 1 heading + $Colors = explode(':',$Prefs['title1fontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']); + } + if ($Prefs['title2show']) { // Set Title 2 heading + $Colors = explode(':',$Prefs['title2fontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']); + } + // Set the filter heading + $Colors = explode(':',$Prefs['filterfontcolor']); $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']); - } - if ($Prefs['title1show']) { // Set title 1 heading - $this->SetFont($Prefs['title1font'],'',$Prefs['title1fontsize']); - $Colors = explode(':',$Prefs['title1fontcolor']); + $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm + $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']); + $this->y0=$this->GetY(); // set y position after report headings before column titles + // Set the table header + $Colors = explode(':',$Prefs['datafontcolor']); $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']); + $this->SetDrawColor(128,0,0); + $this->SetLineWidth(.35); // 1 point + $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; + // fetch the column widths and put into array to match the columns of data + $CellXPos[0] = $Prefs['marginleft']; + for ($x=1; $x<=20; $x++) { + $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; + } + // Fetch the column break array + foreach ($Seq as $Temp) { + if ($Temp['break']) { + $ColBreak[] = true; + } else { + $ColBreak[] = false; + } + } + // See if we need to truncate the data + if ($Prefs['TruncListings']['params']=='1') { + $trunc=true; + } else { + $trunc=false; + } + // Ready to draw the column titles in the header + $maxY = $this->y0; // set to track the tallest column + $col = 1; + $LastY = $this->y0; + foreach ($Heading as $key=>$value) { + $this->SetLeftMargin($CellXPos[$col-1]); + $this->SetX($CellXPos[$col-1]); + $this->SetY($LastY); + // truncate data if selected + if ($trunc) { + $value=$this->TruncData($value, $Prefs['col'.$col.'width']); + } + $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value); + if ($ColBreak[$key]) { + $col++; + $LastY = $this->y0; + } else $LastY = $this->GetY(); + if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height + } + // Draw a bottom line for the end of the heading + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->Cell(0,$maxY-$this->y0,' ','B'); + $this->y0=$maxY+0.35; } - if ($Prefs['title2show']) { // Set Title 2 heading - $this->SetFont($Prefs['title2font'],'',$Prefs['title2fontsize']); - $Colors = explode(':',$Prefs['title2fontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']); + + function SubTitle($Title) { + global $Prefs; + // substitutes a command string with current information + $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title); + $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title); + return $Title; } - // Set the filter heading - $this->SetFont($Prefs['filterfont'],'',$Prefs['filterfontsize']); - $Colors = explode(':',$Prefs['filterfontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm - $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']); - $this->y0=$this->GetY(); // set y position after report headings before column titles - // Set the table header - $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']); - $Colors = explode(':',$Prefs['datafontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $this->SetDrawColor(128,0,0); - $this->SetLineWidth(.35); // 1 point - $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; - // fetch the column widths and put into array to match the columns of data - $CellXPos[0] = $Prefs['marginleft']; - for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; - // Fetch the column break array - foreach ($Seq as $Temp) if ($Temp['break']) $ColBreak[] = true; else $ColBreak[] = false; - // See if we need to truncate the data - if ($Prefs['TruncListings']['params']=='1') $trunc=true; else $trunc=false; - // Ready to draw the column titles in the header - $maxY = $this->y0; // set to track the tallest column - $col = 1; - $LastY = $this->y0; - foreach ($Heading as $key=>$value) { - $this->SetLeftMargin($CellXPos[$col-1]); - $this->SetX($CellXPos[$col-1]); - $this->SetY($LastY); - // truncate data if selected - if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); - $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value); - if ($ColBreak[$key]) { - $col++; - $LastY = $this->y0; - } else $LastY = $this->GetY(); - if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height + + function Footer() { + //Position at 1.5 cm from bottom + $this->SetY(-15); + //Arial italic 8 + $this->SetTextColor(0); + //Page number + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } - // Draw a bottom line for the end of the heading - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->Cell(0,$maxY-$this->y0,' ','B'); - $this->y0=$maxY+0.35; -} - -function SubTitle($Title) { - global $Prefs; - // substitutes a command string with current information - $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title); - $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title); - return $Title; -} - -function Footer() { - //Position at 1.5 cm from bottom - $this->SetY(-15); - //Arial italic 8 - $this->SetFont('Helvetica','',8); - $this->SetTextColor(0); - //Page number - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); -} - -function ReportTable($Data) { - global $Prefs, $Seq; - - $FillColor = array(224, 235, 255); - $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']); - $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); - $Colors = explode(':',$Prefs['datafontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; - // Fetch the column widths and put into array to match the columns of data - $CellXPos[0] = $Prefs['marginleft']; - for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; - // Fetch the column break array - foreach ($Seq as $Temp) { - if ($Temp['break']){ - $ColBreak[] = true; + + function ReportTable($Data) { + global $Prefs, $Seq; + + $FillColor = array(224, 235, 255); + $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); + $Colors = explode(':',$Prefs['datafontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; + // Fetch the column widths and put into array to match the columns of data + $CellXPos[0] = $Prefs['marginleft']; + for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; + // Fetch the column break array + foreach ($Seq as $Temp) { + if ($Temp['break']){ + $ColBreak[] = true; + } else { + $ColBreak[] = false; + } + } + // See if we need to truncate the data + if ($Prefs['TruncListings']['params']=='1') { + $trunc=true; } else { - $ColBreak[] = false; + $trunc=false; } - } - // See if we need to truncate the data - if ($Prefs['TruncListings']['params']=='1') { - $trunc=true; - } else { - $trunc=false; - } - // Ready to draw the column data - $fill=false; - $NeedTop='No'; - $MaxRowHt = 0; //track the tallest row to estimate page breaks - foreach($Data as $myrow) { - $Action = array_shift($myrow); - $todo = explode(':',$Action); // contains a letter of the date type and title/groupname - switch ($todo[0]) { - case "r": // Report Total - case "g": // Group Total - // Draw a fill box - if ($this->y0+(2*$MaxRowHt)>$this->pageY) { - // Fill the end of the report with white space + // Ready to draw the column data + $fill=false; + $NeedTop='No'; + $MaxRowHt = 0; //track the tallest row to estimate page breaks + foreach($Data as $myrow) { + $Action = array_shift($myrow); + $todo = explode(':',$Action); // contains a letter of the date type and title/groupname + switch ($todo[0]) { + case "r": // Report Total + case "g": // Group Total + // Draw a fill box + if ($this->y0+(2*$MaxRowHt)>$this->pageY) { + // Fill the end of the report with white space + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); + $this->AddPage(); + $MaxRowHt=0; + } $this->SetLeftMargin($CellXPos[0]); $this->SetX($CellXPos[0]); $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); - $this->AddPage(); - $MaxRowHt=0; - } - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->SetFillColor(240); - $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); - // Add total heading - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report'; - $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C'); - $this->y0=$this->GetY()+0.35; - $NeedTop = 'Next'; - $fill=false; // set so totals data will not be filled - // now fall into the 'd' case to show the data - case "d": // data element - default: - // figure out if a border needs to be drawn for total separation - // and fill color (draws an empty box over the row just written with the fill color) - $brdr = 0; - if ($NeedTop=='Yes') { - $brdr='T'; - $fill=false; // set so first data after total will not be filled - $NeedTop='No'; - } elseif ($NeedTop=='Next') { - $brdr='LR'; - $NeedTop='Yes'; - } - // Draw a fill box - if (($this->y0+$MaxRowHt)>$this->pageY) { - // Fill the end of the report with white space + $this->SetFillColor(240); + $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); + // Add total heading $this->SetLeftMargin($CellXPos[0]); $this->SetX($CellXPos[0]); $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); - $this->AddPage(); - $MaxRowHt=0; - } - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); - // fill in the data - $maxY = $this->y0; // set to current top of row - $col = 1; - $LastY = $this->y0; - foreach ($myrow as $key=>$value) { - $this->SetLeftMargin($CellXPos[$col-1]); - $this->SetX($CellXPos[$col-1]); - $this->SetY($LastY); - // truncate data if necessary - if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); - $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0); - if ($ColBreak[$key]) { - $col++; - $LastY = $this->y0; - } else $LastY = $this->GetY(); - if ($this->GetY()>$maxY) $maxY = $this->GetY(); - } - $this->SetLeftMargin($CellXPos[0]); // restore left margin - break; + if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report'; + $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C'); + $this->y0=$this->GetY()+0.35; + $NeedTop = 'Next'; + $fill=false; // set so totals data will not be filled + // now fall into the 'd' case to show the data + case "d": // data element + default: + // figure out if a border needs to be drawn for total separation + // and fill color (draws an empty box over the row just written with the fill color) + $brdr = 0; + if ($NeedTop=='Yes') { + $brdr='T'; + $fill=false; // set so first data after total will not be filled + $NeedTop='No'; + } elseif ($NeedTop=='Next') { + $brdr='LR'; + $NeedTop='Yes'; + } + // Draw a fill box + if (($this->y0+$MaxRowHt)>$this->pageY) { + // Fill the end of the report with white space + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); + $this->AddPage(); + $MaxRowHt=0; + } + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); + // fill in the data + $maxY = $this->y0; // set to current top of row + $col = 1; + $LastY = $this->y0; + foreach ($myrow as $key=>$value) { + $this->SetLeftMargin($CellXPos[$col-1]); + $this->SetX($CellXPos[$col-1]); + $this->SetY($LastY); + // truncate data if necessary + if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); + $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0); + if ($ColBreak[$key]) { + $col++; + $LastY = $this->y0; + } else $LastY = $this->GetY(); + if ($this->GetY()>$maxY) $maxY = $this->GetY(); + } + $this->SetLeftMargin($CellXPos[0]); // restore left margin + break; + } + $ThisRowHt=$maxY-$this->y0; // seee how tall this row was + if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination + $this->y0=$maxY; // set y position to largest value for next row + $fill=!$fill; + } + // Fill the end of the report with white space + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1); + } + + function TruncData($strData, $ColWidth) { + $percent=0.90; //percent to truncate from max to account for proportional spacing + $CurWidth = $this->GetStringWidth($strData); + if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated + // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance + // A better aproach would be an recursive call to this function until the string just fits. + $NumChars = strlen($strData); + // Reduce the string by 1-$percent and retest + $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth); } - $ThisRowHt=$maxY-$this->y0; // seee how tall this row was - if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination - $this->y0=$maxY; // set y position to largest value for next row - $fill=!$fill; - } - // Fill the end of the report with white space - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1); -} - -function TruncData($strData, $ColWidth) { - $percent=0.90; //percent to truncate from max to account for proportional spacing - $CurWidth = $this->GetStringWidth($strData); - if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated - // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance - // A better aproach would be an recursive call to this function until the string just fits. - $NumChars = strlen($strData); - // Reduce the string by 1-$percent and retest - $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth); + return $strData; } - return $strData; -} + + function Stream($FileName) { + $this->Output($FileName,'D'); + } -function Stream($FileName) { - $this->Output($FileName,'D'); -} - } // end class function BuildSQL($Prefs) { Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-05 09:49:09 UTC (rev 4460) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-06 05:16:06 UTC (rev 4461) @@ -804,4 +804,10 @@ ('Z_UploadResult.php', 15, 'Utility to upload a file to a remote server'); INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '3.12.0'); -UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber'; \ No newline at end of file +UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber'; + +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES +('FormMaker.php', 1, 'Allows running user defined Forms'), +('ReportMaker.php', 1, 'Produces reports from the report writer templates created'), +('ReportCreator.php', 13, 'Report Writer and Form Creator script that creates templates for user defined reports and forms'); +UPDATE config SET confvalue='3.12.2' WHERE confname='VersionNumber'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2011-01-05 01:44:09
|
Revision: 4459 http://web-erp.svn.sourceforge.net/web-erp/?rev=4459&view=rev Author: turbopt Date: 2011-01-05 01:44:03 +0000 (Wed, 05 Jan 2011) Log Message: ----------- Insert underscore missing in superglobal. Modified Paths: -------------- trunk/WorkOrderReceive.php trunk/doc/Change.log.html Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2011-01-04 00:34:27 UTC (rev 4458) +++ trunk/WorkOrderReceive.php 2011-01-05 01:44:03 UTC (rev 4459) @@ -547,7 +547,7 @@ qualitytext = '" . DB_escape_string($QualityText) . "' WHERE stockid='" . $_POST['StockID'] . "' AND loccode = '" . $_POST['IntoLocation'] . "' - AND serialno = '" . $POST['BatchRef' .$i] . "'"; + AND serialno = '" . $_POST['BatchRef' .$i] . "'"; } else { $SQL = "INSERT INTO stockserialitems (stockid, loccode, Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-04 00:34:27 UTC (rev 4458) +++ trunk/doc/Change.log.html 2011-01-05 01:44:03 UTC (rev 4459) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> -<p>/</p> +<p></p> +<p>4/1/11 Paul T: Bug# 3151192 - insert underscore for superglobal.</p> <p>4/1/11 Phil: Rework of purchase order scripts ... again.</p> <p>4/1/11 Phil: Select Purchase orders now defaults to just pending and authorised/printed - other statii are options</p> <p>1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user.</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-01-04 00:34:35
|
Revision: 4458 http://web-erp.svn.sourceforge.net/web-erp/?rev=4458&view=rev Author: daintree Date: 2011-01-04 00:34:27 +0000 (Tue, 04 Jan 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Areas.php trunk/ContractBOM.php trunk/ContractCosting.php trunk/ContractOtherReqts.php trunk/Contracts.php trunk/EmailConfirmation.php trunk/MailSalesReport_csv.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/RecurringSalesOrdersProcess.php trunk/SelectContract.php trunk/SelectProduct.php trunk/UpgradeDatabase.php trunk/doc/Change.log.html trunk/doc/Manual/ManualContents.php trunk/includes/ConnectDB.inc trunk/includes/DefineContractClass.php trunk/includes/DefinePOClass.php trunk/includes/GetConfig.php trunk/includes/PO_ReadInOrder.inc trunk/includes/UserLogin.php trunk/includes/session.inc trunk/index.php trunk/sql/mysql/upgrade3.09-3.10.sql trunk/sql/mysql/upgrade3.10-3.11.sql trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/Areas.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -180,7 +180,7 @@ if (!isset($_GET['delete'])) { - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '><br>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '"><br>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedArea)) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractBOM.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -38,8 +38,8 @@ if (isset($_POST['BackToHeader'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '">'; - echo '<p>'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '" />'; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the Contract page. If this does not happen perhaps the browser does not support META Refresh') . '<a href="' . $rootpath . '/Contracts.php?' . SID. 'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'),'info'); include('includes/footer.inc'); exit; @@ -144,7 +144,7 @@ $DbgMsg = _('The SQL statement that failed was'); $SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - if (DB_num_rows($SearchResult)==0 && $debug==1){ + if (DB_num_rows($SearchResult)==0 AND $debug==1){ prnMsg( _('There are no products to display matching the criteria provided'),'warn'); } if (DB_num_rows($SearchResult)==1){ @@ -212,7 +212,7 @@ } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ - echo "<br>".$sql; + echo "<br />".$sql; } include('includes/footer.inc'); exit; @@ -231,11 +231,12 @@ 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">'; + if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo ' ' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef; + echo '<tr><th colspan="7"><font color="navy" size="2">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</font></th></tr>'; } - echo '<table cellpadding=2 colspan=7 border=1>'; echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> @@ -264,18 +265,18 @@ 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="' . $ContractComponent->Quantity . '" /></td> <td>' . $ContractComponent->UOM . '</td> <td class="number">' . $ContractComponent->ItemCost . '</td> <td class="number">' . $DisplayLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractComponent->ComponentID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } $DisplayTotal = number_format($TotalCost,2); - echo '<tr><td colspan=6 class="number">' . _('Total Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; - echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Order Lines') . '">'; - echo ' <input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '">'; + echo '<tr><td colspan="6" class="number">' . _('Total Cost') . '</td><td class="number"><b>' . $DisplayTotal . '</b></td></tr></table>'; + echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="' . _('Update Lines') . '" />'; + echo '<input type="submit" name="BackToHeader" value="' . _('Back To Contract Header') . '" /></div>'; } /*Only display the contract BOM lines if there are any !! */ @@ -289,18 +290,18 @@ $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); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . + _('Print') . '" alt="" />' . ' ' . _('Search For Stock Items') . '</p>'; + echo '<table class="selection"><tr>'; - echo '<table class=selection><tr><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . - _('Print') . '" alt="">' . ' ' . _('Search For Stock Items') . ''; + echo ":</tr><tr><td><select name='StockCat'>"; - echo ":</font></tr><tr><td><select name='StockCat'>"; - - echo "<option selected value='All'>" . _('All'); + echo "<option selected='True' value='All'>" . _('All').'</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ - echo "<option selected value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } else { - echo "<option value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } } @@ -316,19 +317,19 @@ } 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> + <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="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?"' . SID . - '">' . _('Create a New Stock Item') . "</a></font></td></tr> - </table><br> - <div class='centre'><input type=submit name='Search' value='" . _('Search Now') . "'> - </div><br>"; + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . + '">' . _('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; @@ -336,16 +337,16 @@ if (isset($SearchResult)) { - echo '<table cellpadding=1 colspan=7>'; + echo '<table cellpadding="1" colspan="7">'; - $tableheader = '<tr> + $TableHeader = '<tr> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Units') . '</th> <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th + <th>' . _('Quantity') . '</th> </tr>'; - echo $tableheader; + echo $TableHeader; $j = 1; $k=0; //row colour counter @@ -362,7 +363,7 @@ $filename = $myrow['stockid'] . '.jpg'; if (file_exists( $_SESSION['part_pics_dir'] . '/' . $filename) ) { - $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $filename . '" width="50" height="50">'; + $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $filename . '" width="50" height="50" />'; } else { $ImageSource = '<i>'._('No Image').'</i>'; } @@ -371,7 +372,7 @@ <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><input class="number" type="text" size="6" value="0" name="qty'.$myrow['stockid'].'" /></td> </tr>'; $PartsDisplayed++; @@ -389,10 +390,10 @@ prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('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 '<hr />'; echo '</form>'; include('includes/footer.inc'); Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractCosting.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -16,7 +16,7 @@ } if (!isset($_GET['SelectedContract'])){ - echo '<br>'; + echo '<br />'; prnMsg( _('This page is expected to be called with the contract reference to show the costing for'), 'error'); include ('includes/footer.inc'); exit; @@ -52,7 +52,7 @@ } echo '<p class="page_title_text"> - <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />'; + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" />'; if ($_SESSION['Contract'.$identifier]->Status==3){ echo _('Closed') . ' '; } elseif ($_SESSION['Contract'.$identifier]->Status==2){ @@ -62,13 +62,12 @@ } echo _('Contract') . '<br />' . $_SESSION['Contract'.$identifier]->CustomerName . '<br />' . $_SESSION['Contract'.$identifier]->ContractDescription.'</p>'; -echo '<table> +echo '<table class="selection"> <tr> - <th colspan=6>' . _('Original Costing') .'</th> - <th colspan=6>' . _('Actual Costs') .'</th></tr> - <tr>'; + <th colspan="6">' . _('Original Costing') .'</th> + <th colspan="6">' . _('Actual Costs') .'</th></tr>'; -echo '<tr><th colspan=12>' . _('Inventory Required') . '</th></tr>'; +echo '<tr><th colspan="12">' . _('Inventory Required') . '</th></tr>'; echo '<tr><th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> @@ -83,7 +82,7 @@ <th>' . _('Unit Cost') . '</th> <th>' . _('Total Cost') . '</th> </tr>'; -$ContractBOMBudget =0; +$ContractBOMBudget = 0; $ContractBOMActual = 0; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { echo '<tr><td>' . $Component->StockID . '</td> @@ -95,7 +94,7 @@ $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; - echo '<td colspan=2 align="centre">' . _('Actual usage') . '</td> + echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,2) . '</td> @@ -127,7 +126,7 @@ $OtherReqtsBudget = 0; //other requirements budget sub-table -echo '<tr><td colspan=6><table> +echo '<tr><td colspan="6"><table class="selection"> <tr><th>' . _('Requirement') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit Cost') . '</th> @@ -144,7 +143,7 @@ </table></td>'; //Now other requirements actual in a sub table -echo '<td colspan="6"><table> +echo '<td colspan="6"><table class="selection"> <tr><th>' . _('Supplier') . '</th> <th>' . _('Reference') . '</th> <th>' . _('Date') . '</th> @@ -215,17 +214,17 @@ narrative, amount) VALUES ( 32, - " . $ContractCloseNo . ", + '" . $ContractCloseNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $GLCodes['wipact'] . "', '" . _('Variance on contract') . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . -$Variance . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); - $DbgMsg = _('The following SQL to insert the GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL = "INSERT INTO gltrans ( type, + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); + $DbgMsg = _('The following SQL to insert the GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $SQL = "INSERT INTO gltrans ( type, typeno, trandate, periodno, @@ -233,22 +232,24 @@ narrative, amount) VALUES ( 32, - " . $ContractCloseNo . ", + '" . $ContractCloseNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', '" . $GLCodes['materialuseagevarac'] . "', '" . _('Variance on contract') . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . "', '" . $Variance . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); - $DbgMsg = _('The following SQL to insert the GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The gl entry of WIP for the variance on closing the contract could not be inserted because'); + $DbgMsg = _('The following SQL to insert the GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //Now update the status of the contract to closed - $SQL = "UPDATE contracts SET status=3 WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The status of the contract could not be updated to closed because'); - $DbgMsg = _('The following SQL to change the status of the contract was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $SQL = "UPDATE contracts + SET status=3 + WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The status of the contract could not be updated to closed because'); + $DbgMsg = _('The following SQL to change the status of the contract was used'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); /*Check if the contract work order is still open */ $CheckIfWOOpenResult = DB_query("SELECT closed @@ -272,146 +273,145 @@ * If work done on the contract is a write off then the user must also write off the stock of the contract item as a separate job */ - $result =DB_query("SELECT qtyrecd FROM woitems + $result =DB_query("SELECT qtyrecd FROM woitems WHERE stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND wo='" . $_SESSION['Contract'.$identifier]->WO . "'",$db); - if (DB_num_rows($result)==1) { - $myrow=DB_fetch_row($result); - if ($myrow[0]==0){ //then the contract wo has not been received (it will only ever be for 1 item) + if (DB_num_rows($result)==1) { + $myrow=DB_fetch_row($result); + if ($myrow[0]==0){ //then the contract wo has not been received (it will only ever be for 1 item) - $WOReceiptNo = GetNextTransNo(26, $db); + $WOReceiptNo = GetNextTransNo(26, $db); - /* Need to get the current location quantity will need it later for the stock movement */ - $SQL = "SELECT locstock.quantity + /* Need to get the current location quantity will need it later for the stock movement */ + $SQL = "SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND loccode= '" . $_SESSION['Contract'.$identifier]->LocCode . "'"; - $Result = DB_query($SQL, $db); - if (DB_num_rows($Result)==1){ - $LocQtyRow = DB_fetch_row($Result); - $QtyOnHandPrior = $LocQtyRow[0]; - } else { - /*There must actually be some error this should never happen */ - $QtyOnHandPrior = 0; - } + $Result = DB_query($SQL, $db); + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /*There must actually be some error this should never happen */ + $QtyOnHandPrior = 0; + } - $SQL = "UPDATE locstock - SET quantity = locstock.quantity + 1 - WHERE locstock.stockid = '" . $_SESSION['Contract'.$identifier]->ContractRef . "' + $SQL = "UPDATE locstock + SET quantity = locstock.quantity + 1 + WHERE locstock.stockid = '" . $_SESSION['Contract'.$identifier]->ContractRef . "' AND loccode= '" . $_SESSION['Contract'.$identifier]->LocCode . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); - $DbgMsg = _('The following SQL to update the location stock record was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); + $DbgMsg = _('The following SQL to update the location stock record was used'); + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Insert stock movements - with unit cost */ + /*Insert stock movements - with unit cost */ - $SQL = "INSERT INTO stockmoves (stockid, - type, - transno, - loccode, - trandate, - price, - prd, - reference, - qty, - standardcost, - newqoh) - VALUES ('" . $_SESSION['Contract'.$identifier]->ContractRef . "', - 26, - " . $WOReceiptNo . ", - '" . $_SESSION['Contract'.$identifier]->LocCode . "', - '" . Date('Y-m-d') . "', - " . ($OtherReqtsBudget+$ContractBOMBudget) . ", - " . $PeriodNo . ", - '" . $_SESSION['Contract'.$identifier]->WO . "', - 1, - " . ($OtherReqtsBudget+$ContractBOMBudget) . ", - " . ($QtyOnHandPrior + 1) . ")"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + price, + prd, + reference, + qty, + standardcost, + newqoh) + VALUES ('" . $_SESSION['Contract'.$identifier]->ContractRef . "', + 26, + '" . $WOReceiptNo . "', + '" . $_SESSION['Contract'.$identifier]->LocCode . "', + '" . Date('Y-m-d') . "', + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "', + '" . $PeriodNo . "', + '" . $_SESSION['Contract'.$identifier]->WO . "', + 1, + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "', + '" . ($QtyOnHandPrior + 1) . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order receipt because'); - $DbgMsg = _('The following SQL to insert the stock movement records was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order receipt because'); + $DbgMsg = _('The following SQL to insert the stock movement records was used'); + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + /*Get the ID of the StockMove... */ + $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); - /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ - /*GL integration with stock is activated so need the GL journals to make it so */ + /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ + /*GL integration with stock is activated so need the GL journals to make it so */ + /*first the debit the finished stock of the item received from the WO + the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off + it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/ - /*first the debit the finished stock of the item received from the WO - the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off - it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (26, + '" . $WOReceiptNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $GLCodes['stockact'] . "', + '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', + '" . ($OtherReqtsBudget+$ContractBOMBudget) . "')"; - $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (26, - " . $WOReceiptNo . ", - '" . Date('Y-m-d') . "', - " . $PeriodNo . ", - " . $GLCodes['stockact'] . ", - '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', - " . ($OtherReqtsBudget+$ContractBOMBudget) . ')'; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The receipt of contract work order finished stock GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the work order receipt of finished items GLTrans record was used'); + $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The receipt of contract work order finished stock GL posting could not be inserted because'); - $DbgMsg = _('The following SQL to insert the work order receipt of finished items GLTrans record was used'); - $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); + /*now the credit WIP entry*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (26, + '" . $WOReceiptNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $GLCodes['wipact'] . "', + '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', + '" . -($OtherReqtsBudget+$ContractBOMBudget) . "')"; - /*now the credit WIP entry*/ - $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (26, - " . $WOReceiptNo . ", - '" . Date('Y-m-d') . "', - " . $PeriodNo . ", - " . $GLCodes['wipact'] . ", - '" . $_SESSION['Contract'.$identifier]->WO . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' - x 1 @ ' . number_format(($OtherReqtsBudget+$ContractBOMBudget),2) . "', - " . -($OtherReqtsBudget+$ContractBOMBudget) . ")"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The WIP credit on receipt of finished items from a work order GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the WIP GLTrans record was used'); + $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The WIP credit on receipt of finished items from a work order GL posting could not be inserted because'); - $DbgMsg = _('The following SQL to insert the WIP GLTrans record was used'); - $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + } /* end of if GL and stock integrated and standard cost !=0 */ - } /* end of if GL and stock integrated and standard cost !=0 */ - - //update the wo with the new qtyrecd - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('Could not update the work order item record with the total quantity received because'); - $DbgMsg = _('The following SQL was used to update the work order'); - $UpdateWOResult =DB_query("UPDATE woitems + //update the wo with the new qtyrecd + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('Could not update the work order item record with the total quantity received because'); + $DbgMsg = _('The following SQL was used to update the work order'); + $UpdateWOResult =DB_query("UPDATE woitems SET qtyrecd=qtyrecd+1 - WHERE wo=" . $_SESSION['Contract'.$identifier]->WO . " - AND stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "'", - $db,$ErrMsg,$DbgMsg,true); - }//end if the contract wo was not received - work order item received/processed above if not - }//end if there was a row returned from the woitems query - } //end if the work order was still open (so end of closing it and processing receipt if necessary) + WHERE wo='" . $_SESSION['Contract'.$identifier]->WO . "' + AND stockid='" . $_SESSION['Contract'.$identifier]->ContractRef . "'", + $db,$ErrMsg,$DbgMsg,true); + }//end if the contract wo was not received - work order item received/processed above if not + }//end if there was a row returned from the woitems query + } //end if the work order was still open (so end of closing it and processing receipt if necessary) - DB_Txn_Commit($db); + DB_Txn_Commit($db); - $_SESSION['Contract'.$identifier]->Status=3; - prnMsg(_('The contract has been closed. No further charges can be posted against this contract.'),'success'); + $_SESSION['Contract'.$identifier]->Status=3; + prnMsg(_('The contract has been closed. No further charges can be posted against this contract.'),'success'); } //end if Closing the contract Close Contract button hit 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="' . $_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 '<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>'; } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/ContractOtherReqts.php =================================================================== --- trunk/ContractOtherReqts.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/ContractOtherReqts.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -40,8 +40,8 @@ if (isset($_POST['BackToHeader'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '">'; - echo '<p>'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/Contracts.php?' . SID . 'identifier='.$identifier. '" />'; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the Contract page. If this does not happen perhaps the browser does not support META Refresh') . '<a href="' . $rootpath . '/Contracts.php?' . SID. 'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'),'info'); include('includes/footer.inc'); exit; @@ -84,12 +84,12 @@ if (count($_SESSION['Contract'.$identifier]->ContractReqts)>0){ + echo '<table cellpadding="2" colspan="7" class="selection">'; if (isset($_SESSION['Contract'.$identifier]->ContractRef)) { - echo ' ' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef; + echo '<tr><th colspan="5">' . _('Contract Reference:') .' '. $_SESSION['Contract'.$identifier]->ContractRef.'</th></tr>'; } - echo '<table cellpadding=2 colspan=7 border=1>'; echo '<tr> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '</th> @@ -115,31 +115,36 @@ } 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="' . $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="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $ContractReqtID . '">' . _('Delete') . '</a></td></tr>'; $TotalCost += $LineTotal; } $DisplayTotal = 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') . '">'; + 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>'; } /*Only display the contract other requirements lines if there are any !! */ -echo '<hr>'; +echo '<br />'; /*Now show form to add new requirements to the contract */ -echo '<table> +if (!isset($_POST['RequirementDescription'])) { + $_POST['RequirementDescription']=''; + $_POST['Quantity']=0; + $_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" name="Quantity" size=10 maxlength=10 value="' . $_POST['Quantity'] . '"></td></tr>'; -echo '<tr><td>' . _('Cost Per Unit') . ':</td><td><input type="text" name="CostPerUnit" size=10 maxlength=10 value="' . $_POST['CostPerUnit'] . '"></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 '<div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '"></div>'; +echo '<br /><div class="centre"><input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" /></div>'; echo '</form>'; include('includes/footer.inc'); Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/Contracts.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -81,8 +81,8 @@ } if (isset($_POST['EnterContractBOM']) AND !$InputError){ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractBOM.php?' . SID . 'identifier='.$identifier. "'>"; - echo '<p>'; + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractBOM.php?' . SID . 'identifier='.$identifier. "' />"; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the entry of the Contract line items page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . "<a href='$rootpath/ContractBOM.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); @@ -90,8 +90,8 @@ exit; } if (isset($_POST['EnterContractRequirements']) AND !$InputError){ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractOtherReqts.php?' . SID . 'identifier='.$identifier. "'>"; - echo '<p>'; + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/ContractOtherReqts.php?' . SID . 'identifier='.$identifier. "' />"; + echo '<br />'; prnMsg(_('You should automatically be forwarded to the entry of the Contract requirements page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . "<a href='$rootpath/ContractOtherReqts.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); @@ -100,7 +100,7 @@ } } /* end of if going to contract BOM or contract requriements */ -echo '<a href="'. $rootpath . '/SelectContract.php?' . SID .'">'. _('Back to Contract Selection'). '</a><br>'; +echo '<a href="'. $rootpath . '/SelectContract.php?' . SID .'">'. _('Back to Contract Selection'). '</a><br />'; //attempting to upload the drawing image file if (isset($_FILES['Drawing']) AND $_FILES['Drawing']['name'] !='' AND $_SESSION['Contract'.$identifier]->ContractRef!='') { @@ -306,9 +306,9 @@ $sql = "UPDATE contracts SET categoryid = '" . $_POST['CategoryID'] ."', requireddate = '" . FormatDateForSQL($_POST['RequiredDate']) . "', loccode='" . $_POST['LocCode'] . "', - margin = " . $_POST['Margin'] . ", + margin = '" . $_POST['Margin'] . "', customerref = '" . $_POST['CustomerRef'] . "', - exrate = " . $_POST['ExRate'] . " + exrate = '" . $_POST['ExRate'] . "' WHERE contractref ='" . $_POST['ContractRef'] . "'"; $ErrMsg = _('Cannot update the contract because'); $result = DB_query($sql,$db,$ErrMsg); @@ -323,7 +323,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Component->StockID . "', '" . $WorkCentre . "', - " . $Component->Quantity . ")"; + '" . $Component->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -338,7 +338,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Requirement->Requirement . "', '" . $Requirement->CostPerUnit . "', - " . $Requirement->Quantity . ")"; + '" . $Requirement->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -375,7 +375,7 @@ $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'); - echo '<br><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; + echo '<br /><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; } if ($ExistingContract['status'] == 0 AND $_POST['Status']==1){ @@ -405,9 +405,9 @@ '" . $_POST['CategoryID'] . "', '" . $_POST['LocCode'] . "', '" . FormatDateForSQL($_POST['RequiredDate']) . "', - " . $_POST['Margin'] . ", + '" . $_POST['Margin'] . "', '" . $_POST['CustomerRef'] . "', - ". $_POST['ExRate'] .")"; + '". $_POST['ExRate'] ."')"; $ErrMsg = _('The new contract could not be added because'); $result = DB_query($sql,$db,$ErrMsg); @@ -422,7 +422,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Component->StockID . "', '" . $WorkCentre . "', - " . $Component->Quantity . ")"; + '" . $Component->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } @@ -435,7 +435,7 @@ VALUES ( '" . $_POST['ContractRef'] . "', '" . $Requirement->Requirement . "', '" . $Requirement->CostPerUnit . "', - " . $Requirement->Quantity . ")"; + '" . $Requirement->Quantity . "')"; $result = DB_query($sql,$db,$ErrMsg); } prnMsg(_('The new contract has been added to the database'),'success'); @@ -595,7 +595,7 @@ $_SESSION['Contract'.$identifier]->Status=1; $_SESSION['Contract'.$identifier]->OrderNo=$OrderNo; prnMsg(_('The contract has been made into quotation number') . ' ' . $OrderNo,'info'); - echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $OrderNo . '&Quotations=Quotes_Only">' . _('Go to quotation number:') . ' ' . $OrderNo . '</a>'; + echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $OrderNo . '&Quotations=Quotes_Only">' . _('Go to quotation number:') . ' ' . $OrderNo . '</a>'; } //end of if making a quotation @@ -709,7 +709,7 @@ if (DB_num_rows($result)==0){ prnMsg(_('The customer details were unable to be retrieved'),'error'); if ($debug==1){ - prnMsg(_('The SQL used that failed to get the customer details was:') . '<p>' . $sql,'error'); + prnMsg(_('The SQL used that failed to get the customer details was:') . '<br />' . $sql,'error'); } } else { $_SESSION['Contract'.$identifier]->BranchName = $myrow['brname']; @@ -737,29 +737,29 @@ 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'] . '?' .SID .'&identifier=' . $identifier .'" name="CustomerSelection" method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' .SID .'&identifier=' . $identifier .'" name="CustomerSelection" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table cellpadding=3 colspan=4 class=selection> + echo '<table cellpadding="3" colspan="4" class="selection"> <tr> <td><h5>' . _('Part of the Customer Branch Name') . ':</h5></td> - <td><input tabindex=1 type="Text" name="CustKeywords" size=20 maxlength=25></td> + <td><input tabindex="1" type="text" name="CustKeywords" size="20" maxlength="25" /></td> <td><h2><b>' . _('OR') . '</b></h2></td> <td><h5>' . _('Part of the Customer Branch Code'). ':</h5></td> - <td><input tabindex=2 type="Text" name="CustCode" size=15 maxlength=18></td> + <td><input tabindex="2" type="text" name="CustCode" size="15" maxlength="18" /></td> <td><h2><b>' . _('OR') . '</b></h2></td> <td><h5>' . _('Part of the Branch Phone Number') . ':</h5></td> - <td><input tabindex=3 type="Text" name="CustPhone" size=15 maxlength=18></td> + <td><input tabindex="3" type="text" name="CustPhone" size="15" maxlength="18" /></td> </tr> </table> - <br><div class="centre"><input tabindex=4 type=submit name="SearchCustomers" value="' . _('Search Now') . '"> - <input tabindex=5 type=submit action=reset value="' . _('Reset') .'"></div>'; + <br /><div class="centre"><input tabindex="4" type="submit" name="SearchCustomers" value="' . _('Search Now') . '" /> + <input tabindex="5" type="submit" action="reset" value="' . _('Reset') .'" /></div>'; if (isset($result_CustSelect)) { - echo '<table cellpadding=2 colspan=7>'; + echo '<table cellpadding="2" class="selection">'; - $TableHeader = '<br><tr> + $TableHeader = '<br /><tr> <th>' . _('Customer') . '</th> <th>' . _('Branch') . '</th> <th>' . _('Contact') . '</th> @@ -781,34 +781,34 @@ $k=1; } if ($LastCustomer != $myrow['name']) { - echo '<td>'.$myrow['name'].'</td>'; + echo '<td>'.htmlentities($myrow['name']).'</td>'; } else { echo '<td></td>'; } - echo '<td><input tabindex='.number_format($j+5).' type=submit name="Submit" value="'.$myrow['brname'].'"</td> - <input type=hidden name="SelectedCustomer" value="'.$myrow['debtorno'].' - '.$myrow['branchcode'].'"> - <td>'.$myrow['contactname'].'</td> + echo '<td><input tabindex="'.number_format($j+5).'" type="submit" name="Submit" value="'.htmlentities($myrow['brname']).'" /></td> + <input type="hidden" name="SelectedCustomer" value="'.$myrow['debtorno'].' - '.$myrow['branchcode'].'" /> + <td>'.htmlentities($myrow['contactname']).'</td> <td>'.$myrow['phoneno'].'</td> <td>'.$myrow['faxno'].'</td> - </tr></form>'; + </tr>'; $LastCustomer=$myrow['name']; $j++; //end of page full new headings if } //end of while loop - echo '</table>'; + echo '</table></form>'; }//end if results to show //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'] . '?' . SID . '&identifier=' . $identifier . '" method="post">'; + echo '<form name="ContractEntry" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&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') . '" alt=""> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt="" /> ' . $_SESSION['Contract'.$identifier]->CustomerName; if ($_SESSION['CompanyRecord']['currencydefault'] != $_SESSION['Contract'.$identifier]->CurrCode){ @@ -821,34 +821,34 @@ /*Set up form for entry of contract header stuff */ - echo '<table>'; + echo '<table class="selection">'; echo '<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 . '">'; + echo '<input type="text" name="ContractRef" size="21" maxlength="20" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />'; } else { /*Just show the contract Ref - dont allow modification */ - echo '<input type="hidden" name="ContractRef" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '">' . $_SESSION['Contract'.$identifier]->ContractRef; + echo '<input type="hidden" name="ContractRef" value="' . $_SESSION['Contract'.$identifier]->ContractRef . '" />' . $_SESSION['Contract'.$identifier]->ContractRef; } echo '</td></tr>'; echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" >'; - $sql = 'SELECT categoryid, categorydescription FROM stockcategory WHERE stocktype!="A"'; + $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve stock categories and failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); while ($myrow=DB_fetch_array($result)){ if (!isset($_SESSION['Contract'.$identifier]->CategoryID) or $myrow['categoryid']==$_SESSION['Contract'.$identifier]->CategoryID){ - echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option selected="True" value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'].'</option>'; } else { - echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'].'</option>'; } } echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Contract Categories') . '</a></td></tr>'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $ErrMsg = _('The stock locations could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve stock locations and failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -856,36 +856,36 @@ echo '<tr><td>' . _('Location') . ':</td><td><select name="LocCode" >'; while ($myrow=DB_fetch_array($result)){ if (!isset($_SESSION['Contract'.$identifier]->LocCode) or $myrow['loccode']==$_SESSION['Contract'.$identifier]->LocCode){ - echo '<option selected VALUE="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected="True" value="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option VALUE="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></td></tr>'; echo '<tr><td>' . _('Contract Description'); - echo ':</td><td><textarea name="ContractDescription" style="width:100%" rows=5>' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td></tr>'; + 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>'; + 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="' . $_SESSION['Contract'.$identifier]->Margin . '"></td></tr>'; + echo '<tr><td>' . _('Gross Profit') . ' %:</td><td><input type="text" name="Margin" size="4" maxlength="4" value="' . $_SESSION['Contract'.$identifier]->Margin . '" /></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>'; + <td><input type="text" name="ExRate" size="10" maxlength="10" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" /></td></tr>'; } else { - echo '<input type="hidden" name="ExRate" value=' . $_SESSION['Contract'.$identifier]->ExRate . '>'; + echo '<input type="hidden" name="ExRate" value="' . $_SESSION['Contract'.$identifier]->ExRate . '" />'; } echo '<tr><td>' . _('Contract Status') . ':</td><td>'; @@ -901,17 +901,18 @@ } elseif ($_SESSION['Contract'.$identifier]->Status == 2){ echo _('Order Placed'); } - echo '</select></td></tr>'; + echo '<input type="hidden" name="Status" value="'.$_SESSION['Contract'.$identifier]->Status.'" />'; + 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) { - echo '<tr><td>' . _('Contract Work Order Ref') . ':</td><td>' . $_SESSION['Contract'.$identifier]->WorkOrder . '</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 '</table><hr>'; + echo '</table><br />'; echo '<table><tr><td> - <table><tr><th colspan=6>' . _('Stock Items Required') . '</th></tr>'; + <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> @@ -936,7 +937,7 @@ } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> - <table><tr><th colspan=4>' . _('Other Requirements') . '</th></tr>'; + <table class="selection"><tr><th colspan="4">' . _('Other Requirements') . '</th></tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ echo '<tr><th>' . _('Requirement') . '</th> @@ -956,27 +957,27 @@ echo '<tr><td colspan="4"><i>' . _('None Entered') . '</i></td></tr>'; } echo '</table></td></tr></table>'; - echo '<hr>'; - echo'<table><tr><th>' . _('Total Contract Cost') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost),2) . '</th><th>' . _('Contract Price') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),2) . '</th></tr></table>'; + echo '<br />'; + echo'<table class="selection"><tr><th>' . _('Total Contract Cost') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost),2) . '</th><th>' . _('Contract Price') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),2) . '</th></tr></table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '"> - <input type=submit name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'">'; + 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') .'">'; + echo '<input type="submit" name="CommitContract" value="' . _('Commit Changes') .'" />'; } elseif($_SESSION['Contract'.$identifier]->Status==1){ //quoted but not yet ordered - echo '<input type=submit name="CommitContract" value="' . _('Update Quotation') .'">'; + 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*/ -echo '</form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/EmailConfirmation.php =================================================================== --- trunk/EmailConfirmation.php 2010-12-30 22:10:43 UTC (rev 4457) +++ trunk/EmailConfirmation.php 2011-01-04 00:34:27 UTC (rev 4458) @@ -27,37 +27,37 @@ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.debtorno, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.dela... [truncated message content] |
From: <dai...@us...> - 2010-12-30 22:10:50
|
Revision: 4457 http://web-erp.svn.sourceforge.net/web-erp/?rev=4457&view=rev Author: daintree Date: 2010-12-30 22:10:43 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Conventions counter sales Modified Paths: -------------- trunk/CounterSales.php trunk/UpgradeDatabase.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2010-12-30 05:46:48 UTC (rev 4456) +++ trunk/CounterSales.php 2010-12-30 22:10:43 UTC (rev 4457) @@ -1,10 +1,10 @@ <?php -/* $Id: SelectOrderItems.php 3453 2010-05-06 06:39:52Z lindsayh $*/ +/* $Id: $*/ include('includes/DefineCartClass.php'); //$PageSecurity = 1; /* Session started in session.inc for password checking and authorisation level check -config.php is in turn included in session.inc*/ +config.php is in turn included in session.inc $PageSecurity now comes from session.inc (and gets read in by GetConfig.php*/ include('includes/session.inc'); @@ -33,10 +33,10 @@ unset($_POST['PartSearch']); } -if (isset($_POST['order_items'])){ +if (isset($_POST['OrderItems'])){ foreach ($_POST as $key => $value) { if (strstr($key,'itm')) { - $NewItem_array[substr($key,3)] = trim($value); + $NewItemArray[substr($key,3)] = trim($value); } } } @@ -46,7 +46,7 @@ } if (isset($_GET['NewOrder'])){ - /*New order entry - clear any existing order details from the Items object and initiate a newy*/ + /*New order entry - clear any existing order details from the Items object and initiate a newy*/ if (isset($_SESSION['Items'.$identifier])){ unset ($_SESSION['Items'.$identifier]->LineItems); $_SESSION['Items'.$identifier]->ItemsOrdered=0; @@ -153,13 +153,13 @@ prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_POST['Select'] . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); if ($debug==1){ - echo '<br>' . _('The SQL that failed to get the branch details was') . ':<br>' . $sql; + echo '<br />' . _('The SQL that failed to get the branch details was') . ':<br />' . $sql; } include('includes/footer.inc'); exit; } // add echo - echo '<br>'; + echo '<br />'; $myrow = DB_fetch_array($result); $_SESSION['Items'.$identifier]->DeliverTo = ''; @@ -170,10 +170,11 @@ $_SESSION['Items'.$identifier]->DeliveryDays = $myrow['estdeliverydays']; $_SESSION['Items'.$identifier]->TaxGroup = $myrow['taxgroupid']; - if ($_SESSION['Items'.$identifier]->SpecialInstructions) - prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); + if ($_SESSION['Items'.$identifier]->SpecialInstructions) { + prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); + } - if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ + if ($_SESSION['CheckCreditLimits'] > 0) { /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items'.$identifier]->CreditAvailable = GetCreditAvailable($_SESSION['Items'.$identifier]->DebtorNo,$db); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ @@ -200,9 +201,9 @@ unset($_SESSION['Items'.$identifier]); $_SESSION['Items'.$identifier] = new cart; - echo '<br><br>'; + 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="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a>'; include('includes/footer.inc'); exit; @@ -211,17 +212,17 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Counter Sales') . '" alt="" />' . ' '; echo _('Counter Sale') . ' - ' . $_SESSION['Items'.$identifier]->LocationName . ' (' . _('all amounts in') . ' ' . $_SESSION['Items'.$identifier]->DefaultCurrency . ')'; - echo '</p></b></div>'; + echo '</p>'; } if (isset($_POST['Search']) or isset($_POST['Next']) or isset($_POST['Prev'])){ if ($_POST['Keywords']!=='' AND $_POST['StockCode']=='') { - $msg='</b><div class="page_help_text">' . _('Item description has been used in search') . '.</div>'; - } elseif ($_POST['StockCode']!=='' AND $_POST['Keywords']=='') { - $msg='</b><div class="page_help_text">' . _('Item Code has been used in search') . '.</div>'; - } elseif ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { - $msg='</b><div class="page_help_text">' . _('Stock Category has been used in search') . '.</div>'; + $msg='<div class="page_help_text">' . _('Item description has been used in search') . '.</div>'; + } else if ($_POST['StockCode']!=='' AND $_POST['Keywords']=='') { + $msg='<div class="page_help_text">' . _('Item Code has been used in search') . '.</div>'; + } else if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { + $msg='<div class="page_help_text">' . _('Stock Category has been used in search') . '.</div>'; } if (isset($_POST['Keywords']) AND strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces @@ -256,7 +257,7 @@ ORDER BY stockmaster.stockid"; } - } elseif (strlen($_POST['StockCode'])>0){ + } else if (strlen($_POST['StockCode'])>0){ $_POST['StockCode'] = strtoupper($_POST['StockCode']); $SearchString = '%' . $_POST['StockCode'] . '%'; @@ -316,7 +317,7 @@ } if (isset($_POST['Next'])) { - $Offset = $_POST['nextlist']; + $Offset = $_POST['NextList']; } if (isset($_POST['Prev'])) { $Offset = $_POST['previous']; @@ -347,7 +348,7 @@ /* Always do the stuff below */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '"& name="SelectParts" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'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 @@ -365,21 +366,21 @@ /*Process Quick Entry */ /* If enter is pressed on the quick entry screen, the default button may be Recalculate */ - if (isset($_POST['order_items']) + if (isset($_POST['OrderItems']) OR isset($_POST['QuickEntry']) OR isset($_POST['Recalculate'])){ - /* get the item details from the database and hold them in the cart object */ + /* get the item details from the database and hold them in the cart object */ - /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */ - $Discount = 0; + /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */ + $Discount = 0; - $i=1; - while ($i<=$_SESSION['QuickEntries'] and isset($_POST['part_' . $i]) and $_POST['part_' . $i]!='') { + $i=1; + while ($i<=$_SESSION['QuickEntries'] and isset($_POST['part_' . $i]) and $_POST['part_' . $i]!='') { $QuickEntryCode = 'part_' . $i; $QuickEntryQty = 'qty_' . $i; $QuickEntryPOLine = 'poline_' . $i; - $QuickEntryItemDue = 'itemdue_' . $i; + $QuickEntryItemDue = 'ItemDue_' . $i; $i++; @@ -406,7 +407,7 @@ } if(!Is_Date($NewItemDue)) { - prnMsg(_('An invalid date entry was made for ') . ' ' . $NewItem . ' ' . _('The date entry') . ' ' . $NewItemDue . ' ' . _('must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); + prnMsg(_('An invalid date entry was made for ') . ' ' . $NewItem . ' ' . _('The date entry') . ' ' . $NewItemDue . ' ' . _('must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); //Attempt to default the due date to something sensible? $NewItemDue = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); } @@ -435,16 +436,16 @@ $KitResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ + while ($KitParts = DB_fetch_array($KitResult,$db)) { $NewItem = $KitParts['component']; $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewPOLine = 0; include('includes/SelectOrderItems_IntoCart.inc'); } - } elseif ($myrow['mbflag']=='G'){ + } else if ($myrow['mbflag']=='G'){ prnMsg(_('Phantom assemblies cannot be sold, these items exist only as bills of materials used in other manufactured items. The following item has not been added to the order:') . ' ' . $NewItem, 'warn'); - } elseif ($myrow['controlled']==1){ + } else if ($myrow['controlled']==1){ prnMsg(_('The system does not currently cater for counter sales of lot controlled or serialised items'),'warn'); } else { /*Its not a kit set item*/ include('includes/SelectOrderItems_IntoCart.inc'); @@ -457,9 +458,9 @@ /*Now do non-quick entry delete/edits/adds */ -if ((isset($_SESSION['Items'.$identifier])) OR isset($NewItem)){ +if ((isset($_SESSION['Items'.$identifier])) OR isset($NewItem)) { - if(isset($_GET['Delete'])){ + if (isset($_GET['Delete'])){ $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete']); /*Don't do any DB updates*/ } @@ -469,10 +470,10 @@ $Quantity = $_POST['Quantity_' . $OrderLine->LineNumber]; - if (ABS($OrderLine->Price - $_POST['Price_' . $OrderLine->LineNumber])>0.01){ + if (abs($OrderLine->Price - $_POST['Price_' . $OrderLine->LineNumber])>0.01){ $Price = $_POST['Price_' . $OrderLine->LineNumber]; $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-($_POST['Discount_' . $OrderLine->LineNumber]/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-$_POST['Discount_' . $OrderLine->LineNumber])/100); - } elseif (ABS($OrderLine->GPPercent - $_POST['GPPercent_' . $OrderLine->LineNumber])>=0.001) { + } else if (abs($OrderLine->GPPercent - $_POST['GPPercent_' . $OrderLine->LineNumber])>=0.001) { //then do a recalculation of the price at this new GP Percentage $Price = ($OrderLine->StandardCost*$ExRate)/(1 -(($_POST['GPPercent_' . $OrderLine->LineNumber] + $_POST['Discount_' . $OrderLine->LineNumber])/100)); } else { @@ -489,14 +490,14 @@ $OrderLine->DiscountPercent = 0; } - if ($Quantity<0 OR $Price <0 OR $DiscountPercentage >100 OR $DiscountPercentage <0){ + if ($Quantity<0 or $Price <0 or $DiscountPercentage >100 or $DiscountPercentage <0){ prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn'); - } elseif ($OrderLine->Quantity !=$Quantity - OR $OrderLine->Price != $Price - OR ABS($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 - OR $OrderLine->Narrative != $Narrative - OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] - OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { + } else if ($OrderLine->Quantity !=$Quantity + or $OrderLine->Price != $Price + or abs($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 + or $OrderLine->Narrative != $Narrative + or $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] + or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, @@ -564,52 +565,52 @@ } /*end of if its a new item */ -if (isset($NewItem_array) && isset($_POST['order_items'])){ +if (isset($NewItemArray) and isset($_POST['OrderItems'])){ /* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */ /*Now figure out if the item is a kit set - the field MBFlag='K'*/ - foreach($NewItem_array as $NewItem => $NewItemQty) { - if($NewItemQty > 0) { - $sql = "SELECT stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; + foreach($NewItemArray as $NewItem => $NewItemQty) { + if($NewItemQty > 0) { + $sql = "SELECT stockmaster.mbflag + FROM stockmaster + WHERE stockmaster.stockid='". $NewItem ."'"; - $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); + $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); - $KitResult = DB_query($sql, $db,$ErrMsg); + $KitResult = DB_query($sql, $db,$ErrMsg); - //$NewItemQty = 1; /*By Default */ - $Discount = 0; /*By default - can change later or discount category override */ + //$NewItemQty = 1; /*By Default */ + $Discount = 0; /*By default - can change later or discount category override */ - if ($myrow=DB_fetch_array($KitResult)){ - if ($myrow['mbflag']=='K'){ /*It is a kit set item */ - $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + if ($myrow=DB_fetch_array($KitResult)){ + if ($myrow['mbflag']=='K'){ /*It is a kit set item */ + $sql = "SELECT bom.component, + bom.quantity + FROM bom + WHERE bom.parent='" . $NewItem . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; - $ErrMsg = _('Could not retrieve kitset components from the database because'); - $KitResult = DB_query($sql,$db,$ErrMsg); + $ErrMsg = _('Could not retrieve kitset components from the database because'); + $KitResult = DB_query($sql,$db,$ErrMsg); - $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ - $NewItem = $KitParts['component']; - $NewItemQty = $KitParts['quantity'] * $ParentQty; - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - include('includes/SelectOrderItems_IntoCart.inc'); - $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1)); - } - - } else { /*Its not a kit set item*/ + $ParentQty = $NewItemQty; + while ($KitParts = DB_fetch_array($KitResult,$db)){ + $NewItem = $KitParts['component']; + $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewItemDue = date($_SESSION['DefaultDateFormat']); $NewPOLine = 0; include('includes/SelectOrderItems_IntoCart.inc'); $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1)); } - } /* end of if its a new item */ - } /*end of if its a new item */ + + } else { /*Its not a kit set item*/ + $NewItemDue = date($_SESSION['DefaultDateFormat']); + $NewPOLine = 0; + include('includes/SelectOrderItems_IntoCart.inc'); + $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1)); + } + } /* end of if its a new item */ + } /*end of if its a new item */ } } @@ -646,16 +647,16 @@ } } /* end of discount matrix lookup code */ -if (count($_SESSION['Items'.$identifier]->LineItems)>0){ /*only show order lines if there are any */ +if (count($_SESSION['Items'.$identifier]->LineItems)>0 and !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */ /* // ************************************************************************* // T H I S W H E R E T H E S A L E I S D I S P L A Y E D // ************************************************************************* */ - echo '<br> + echo '<br /> <table width="90%" cellpadding="2" colspan="7"> - <tr bgcolor=#800000>'; + <tr bgcolor="#800000">'; echo '<th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -666,8 +667,8 @@ <th>' . _('GP %') . '</th> <th>' . _('Net') . '</th> <th>' . _('Tax') . '</th> - <th>' . _('Total') . '<br>' . _('Incl Tax') . '</th> - </tr>'; + <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th> + </tr>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -695,23 +696,24 @@ } echo $RowStarter; - echo '<input type="hidden" name="POLine_' . $OrderLine->LineNumber . '" value="">'; + echo '<input type="hidden" name="POLine_' . $OrderLine->LineNumber . '" value="" />'; + echo '<input type="hidden" name="ItemDue_' . $OrderLine->LineNumber . '" value="'.$OrderLine->ItemDue.'" />'; - echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?' . SID .'identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> + echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?' . SID .'identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> <td>' . $OrderLine->ItemDescription . '</td>'; - echo '<td><input class="number" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; + echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . $OrderLine->Quantity . '" />'; echo '</td> <td class="number">' . $OrderLine->QOHatLoc . '</td> <td>' . $OrderLine->Units . '</td>'; - echo '<td><input class="number" type=text name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . $OrderLine->Price . '></td> - <td><input class="number" type=text name="Discount_' . $OrderLine->LineNumber . '" size=5 maxlength=4 value=' . ($OrderLine->DiscountPercent * 100) . '></td> - <td><input class="number" type=text name="GPPercent_' . $OrderLine->LineNumber . '" size=3 maxlength=40 value=' . $OrderLine->GPPercent . '></td>'; - echo '</td><td class=number>' . number_format($SubTotal,2) . '</td>'; + echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . $OrderLine->Price . '" /></td> + <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . ($OrderLine->DiscountPercent * 100) . '" /></td> + <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . $OrderLine->GPPercent . '" /></td>'; + echo '<td class="number">' . number_format($SubTotal,2) . '</td>'; $LineDueDate = $OrderLine->ItemDue; - if (!Is_Date($OrderLine->ItemDue)){ + if (!is_Date($OrderLine->ItemDue)){ $LineDueDate = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); $_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->ItemDue= $LineDueDate; } @@ -736,13 +738,13 @@ echo '<td class="number">' . number_format($TaxLineTotal ,2) . '</td>'; echo '<td class="number">' . number_format($SubTotal + $TaxLineTotal ,2) . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'&identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'&identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ echo $RowStarter; - echo '<td valign="top" colspan="11">' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br></td></tr>'; + echo '<td valign="top" colspan="11">' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br /></td></tr>'; } else { - echo '<input type=hidden name="Narrative" value="">'; + echo '<input type="hidden" name="Narrative" value="" />'; } $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $SubTotal; @@ -752,31 +754,31 @@ } /* end of loop around items */ echo '<tr class="EvenTableRows"><td colspan="8" class="number"><b>' . _('Total') . '</b></td> - <td class=number>' . number_format(($_SESSION['Items'.$identifier]->total),2) . '</td> - <td class=number>' . number_format($TaxTotal,2) . '</td> - <td class=number>' . number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),2) . '</td> + <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total),2) . '</td> + <td class="number">' . number_format($TaxTotal,2) . '</td> + <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),2) . '</td> </tr> </table>'; echo '<table><tr><td>'; //nested table echo '<table><tr> <td>'. _('Picked Up By') .':</td> - <td><input type=text size=25 maxlength=25 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> + <td><input type="text" size="25" maxlength="25" name="DeliverTo" value="' . stripslashes($_SESSION['Items'.$identifier]->DeliverTo) . '" /></td> </tr>'; echo '<tr> <td>'. _('Contact Phone Number') .':</td> - <td><input type=text size=25 maxlength=25 name="PhoneNo" value="' . $_SESSION['Items'.$identifier]->PhoneNo . '"></td> + <td><input type="text" size="25" maxlength="25" name="PhoneNo" value="' . stripslashes($_SESSION['Items'.$identifier]->PhoneNo) . '" /></td> </tr>'; - echo '<tr><td>' . _('Contact Email') . ':</td><td><input type=text size=25 maxlength=30 name="Email" value="' . $_SESSION['Items'.$identifier]->Email . '"></td></tr>'; + echo '<tr><td>' . _('Contact Email') . ':</td><td><input type="text" size="25" maxlength="30" name="Email" value="' . stripslashes($_SESSION['Items'.$identifier]->Email) . '" /></td></tr>'; echo '<tr><td>'. _('Customer Reference') .':</td> - <td><input type=text size=25 maxlength=25 name="CustRef" value="' . $_SESSION['Items'.$identifier]->CustRef . '"></td> + <td><input type="text" size="25" maxlength="25" name="CustRef" value="' . stripcslashes($_SESSION['Items'.$identifier]->CustRef) . '" /></td> </tr>'; echo '<tr> <td>'. _('Comments') .':</td> - <td><textarea name=Comments cols=23 rows=5>' . $_SESSION['Items'.$identifier]->Comments .'</textarea></td> + <td><textarea name="Comments" cols="23" rows="5">' . stripcslashes($_SESSION['Items'.$identifier]->Comments) .'</textarea></td> </tr>'; echo '</table>'; //end the sub table in the first column of master table echo '</td><th valign="bottom">'; //for the master table @@ -786,10 +788,10 @@ echo '<tr><td>' . _('Payment Type') . ':</td><td><select name="PaymentMethod">'; while ($PaymentMethodRow = DB_fetch_array($PaymentMethodsResult)){ - if ($_POST['PaymentMethod'] == $PaymentMethodRow['paymentid']){ - echo '<option selected value=' . $PaymentMethodRow['paymentid'] . '>' . $PaymentMethodRow['paymentname'] . '</option>'; + if (isset($_POST['PaymentMethod']) and $_POST['PaymentMethod'] == $PaymentMethodRow['paymentid']){ + echo '<option selected="True" value="' . $PaymentMethodRow['paymentid'] . '">' . $PaymentMethodRow['paymentname'] . '</option>'; } else { - echo '<option value=' . $PaymentMethodRow['paymentid'] . '>' . $PaymentMethodRow['paymentname'] . '</option>'; + echo '<option value="' . $PaymentMethodRow['paymentid'] . '">' . $PaymentMethodRow['paymentname'] . '</option>'; } } echo '</select></td></tr>'; @@ -798,10 +800,10 @@ echo '<tr><td>' . _('Banked to') . ':</td><td><select name="BankAccount">'; while ($BankAccountsRow = DB_fetch_array($BankAccountsResult)){ - if ($_POST['BankAccount'] == $BankAccountsRow['accountcode']){ - echo '<option selected value=' . $BankAccountsRow['accountcode'] . '>' . $BankAccountsRow['bankaccountname'] . '</option>'; + if (isset($_POST['BankAccount']) and $_POST['BankAccount'] == $BankAccountsRow['accountcode']){ + echo '<option selected="True" value="' . $BankAccountsRow['accountcode'] . '">' . $BankAccountsRow['bankaccountname'] . '</option>'; } else { - echo '<option value=' . $BankAccountsRow['accountcode'] . '>' . $BankAccountsRow['bankaccountname'] . '</option>'; + echo '<option value="' . $BankAccountsRow['accountcode'] . '">' . $BankAccountsRow['bankaccountname'] . '</option>'; } } echo '</select></td></tr>'; @@ -809,19 +811,19 @@ if (!isset($_POST['AmountPaid'])){ $_POST['AmountPaid'] =0; } - echo '<tr><td>' . _('Amount Paid') . ':</td><td><input type="text" class="number" name="AmountPaid" maxlength="12" size="12" value=' . $_POST['AmountPaid'] . '></td></tr>'; + echo '<tr><td>' . _('Amount Paid') . ':</td><td><input type="text" class="number" name="AmountPaid" maxlength="12" size="12" value="' . $_POST['AmountPaid'] . '" /></td></tr>'; echo '</table>'; //end the sub table in the second column of master table - echo '</td></tr></table>'; //end of column/row/master table - echo '<br><div class="centre"><input type=submit name="Recalculate" Value="' . _('Re-Calculate') . '"> - <input type=submit name="ProcessSale" value="' . _('Process The Sale') . '"></div><hr>'; + echo '</th></tr></table>'; //end of column/row/master table + echo '<br /><div class="centre"><input type="submit" name="Recalculate" value="' . _('Re-Calculate') . '" /> + <input type="submit" name="ProcessSale" value="' . _('Process The Sale') . '" /></div><hr />'; } # end of if lines /* ********************************** * Invoice Processing Here * ********************************** * */ -if (isset($_POST['ProcessSale']) && $_POST['ProcessSale'] != ""){ +if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ""){ $InputError = false; //always assume the best //but check for the worst @@ -829,7 +831,7 @@ prnMsg(_('There are no lines on this sale. Please enter lines to invoice first'),'error'); $InputError = true; } - if (ABS($_POST['AmountPaid'] -($_SESSION['Items'.$identifier]->total+$TaxTotal))>=0.01) { + if (abs($_POST['AmountPaid'] -($_SESSION['Items'.$identifier]->total+$TaxTotal))>=0.01) { prnMsg(_('The amount entered as payment does not equal the amount of the invoice. Please ensure the customer has paid the correct amount and re-enter'),'error'); $InputError = true; } @@ -855,7 +857,7 @@ prnMsg( _('Invoicing the selected order would result in negative stock. The system parameters are set to prohibit negative stocks from occurring. This invoice cannot be created until the stock on hand is corrected.'),'error',$OrderLine->StockID . ' ' . $CheckNegRow['description'] . ' - ' . _('Negative Stock Prohibited')); $NegativesFound = true; } - } elseif ($CheckNegRow['mbflag']=='A') { + } else if ($CheckNegRow['mbflag']=='A') { /*Now look for assembly components that would go negative */ $SQL = "SELECT bom.component, @@ -941,14 +943,14 @@ confirmeddate, deliverblind) VALUES ( - " . $OrderNo . ", + '" . $OrderNo . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', '" . Date("Y-m-d H:i") . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - " . $_SESSION['Items'.$identifier]->ShipVia . ", + '" . $_SESSION['Items'.$identifier]->ShipVia . "', '". DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', '" . _('Counter Sale') . "', '" . $_SESSION['Items'.$identifier]->PhoneNo . "', @@ -978,17 +980,17 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineItemsSQL = $StartOf_LineItemsSQL . - $StockItem->LineNumber . ', - ' . $OrderNo . ", + "'".$StockItem->LineNumber . "', + '" . $OrderNo . "', '" . $StockItem->StockID . "', - ". $StockItem->Price . ', - ' . $StockItem->Quantity . ', - ' . floatval($StockItem->DiscountPercent) . ", + '". $StockItem->Price . "', + '" . $StockItem->Quantity . "', + '" . floatval($StockItem->DiscountPercent) . "', '" . DB_escape_string($StockItem->Narrative) . "', '" . Date('Y-m-d') . "', '" . Date('Y-m-d') . "', - " . $StockItem->Quantity . ', - 1)'; + '" . $StockItem->Quantity . "', + 1)"; $ErrMsg = _('Unable to add the sales order line'); $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); @@ -998,7 +1000,7 @@ * and it is a real order (not just a quotation)*/ if ($StockItem->MBflag=='M' - AND $_SESSION['AutoCreateWOs']==1){ //oh yeah its all on! + and $_SESSION['AutoCreateWOs']==1){ //oh yeah its all on! //now get the data required to test to see if we need to make a new WO $QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid='" . $StockItem->StockID . "'",$db); @@ -1064,7 +1066,7 @@ loccode, requiredby, startdate) - VALUES (" . $WONo . ", + VALUES ('" . $WONo . "', '" . $_SESSION['DefaultFactoryLocation'] . "', '" . Date('Y-m-d') . "', '" . Date('Y-m-d'). "')", @@ -1089,10 +1091,10 @@ stockid, qtyreqd, stdcost) - VALUES ( " . $WONo . ", + VALUES ('" . $WONo . "', '" . $StockItem->StockID . "', - " . $WOQuantity . ", - " . $Cost . ")"; + '" . $WOQuantity . "', + '" . $Cost . "')"; $ErrMsg = _('The work order item could not be added'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -1104,32 +1106,33 @@ "\n" . _('These are for') . ' ' . $_SESSION['Items'.$identifier]->CustomerName . ' ' . _('there order ref') . ': ' . $_SESSION['Items'.$identifier]->CustRef . ' ' ._('our order number') . ': ' . $OrderNo; if ($StockItem->Serialised AND $StockItem->NextSerialNo>0){ - //then we must create the serial numbers for the new WO also - $FactoryManagerEmail .= "\n" . _('The following serial numbers have been reserved for this work order') . ':'; + //then we must create the serial numbers for the new WO also + $FactoryManagerEmail .= "\n" . _('The following serial numbers have been reserved for this work order') . ':'; - for ($i=0;$i<$WOQuantity;$i++){ + for ($i=0;$i<$WOQuantity;$i++){ - $result = DB_query("SELECT serialno FROM stockserialitems + $result = DB_query("SELECT serialno FROM stockserialitems WHERE serialno='" . ($StockItem->NextSerialNo + $i) . "' AND stockid='" . $StockItem->StockID ."'",$db); - if (DB_num_rows($result)!=0){ - $WOQuantity++; - prnMsg(($StockItem->NextSerialNo + $i) . ': ' . _('This automatically generated serial number already exists - it cannot be added to the work order'),'error'); - } else { - $sql = 'INSERT INTO woserialnos (wo, + if (DB_num_rows($result)!=0){ + $WOQuantity++; + prnMsg(($StockItem->NextSerialNo + $i) . ': ' . _('This automatically generated serial number already exists - it cannot be added to the work order'),'error'); + } else { + $sql = "INSERT INTO woserialnos (wo, stockid, serialno) - VALUES (' . $WONo . ", + VALUES ('" . $WONo . "', '" . $StockItem->StockID . "', - " . ($StockItem->NextSerialNo + $i) . ')'; - $ErrMsg = _('The serial number for the work order item could not be added'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - $FactoryManagerEmail .= "\n" . ($StockItem->NextSerialNo + $i); - } - } //end loop around creation of woserialnos - $NewNextSerialNo = ($StockItem->NextSerialNo + $WOQuantity +1); - $ErrMsg = _('Could not update the new next serial number for the item'); - $UpdateNextSerialNoResult = DB_query('UPDATE stockmaster SET nextserialno=' . $NewNextSerialNo . " WHERE stockid='" . $StockItem->StockID . "'",$db,$ErrMsg,$DbgMsg,true); + '" . ($StockItem->NextSerialNo + $i) . "')"; + $ErrMsg = _('The serial number for the work order item could not be added'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $FactoryManagerEmail .= "\n" . ($StockItem->NextSerialNo + $i); + } + } //end loop around creation of woserialnos + $NewNextSerialNo = ($StockItem->NextSerialNo + $WOQuantity +1); + $ErrMsg = _('Could not update the new next serial number for the item'); + $UpdateSQL="UPDATE stockmaster SET nextserialno='" . $NewNextSerialNo . "' WHERE stockid='" . $StockItem->StockID . "'"; + $UpdateNextSerialNoResult = DB_query($UpdateSQL,$db,$ErrMsg,$DbgMsg,true); } // end if the item is serialised and nextserialno is set $EmailSubject = _('New Work Order Number') . ' ' . $WONo . ' ' . _('for') . ' ' . $StockItem->StockID . ' x ' . $WOQuantity; @@ -1158,7 +1161,7 @@ $DefaultDispatchDate = Date('Y-m-d'); /*Update order header for invoice charged on */ - $SQL = "UPDATE salesorders SET comments = CONCAT(comments,'" . ' ' . _('Invoice') . ': ' . "','" . $InvoiceNo . "') WHERE orderno= " . $OrderNo; + $SQL = "UPDATE salesorders SET comments = CONCAT(comments,'" . ' ' . _('Invoice') . ': ' . "','" . $InvoiceNo . "') WHERE orderno= '" . $OrderNo."'"; $ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order header could not be updated with the invoice number'); $DbgMsg = _('The following SQL to update the sales order was used'); @@ -1184,22 +1187,22 @@ shipvia, alloc ) VALUES ( - ". $InvoiceNo . ", + '". $InvoiceNo . "', 10, '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', '" . $DefaultDispatchDate . "', '" . date('Y-m-d H-i-s') . "', - " . $PeriodNo . ", + '" . $PeriodNo . "', '" . $_SESSION['Items'.$identifier]->CustRef . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - " . $OrderNo . ", - " . $_SESSION['Items'.$identifier]->total . ", - " . $TaxTotal . ", - " . $ExRate . ", + '" . $OrderNo . "', + '" . $_SESSION['Items'.$identifier]->total . "', + '" . $TaxTotal . "', + '" . $ExRate . "', '" . $_SESSION['Items'.$identifier]->Comments . "', - " . $_SESSION['Items'.$identifier]->ShipVia . ', - ' . ($_SESSION['Items'.$identifier]->total + $TaxTotal) . ')'; + '" . $_SESSION['Items'.$identifier]->ShipVia . "', + '" . ($_SESSION['Items'.$identifier]->total + $TaxTotal) . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction record could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); @@ -1210,12 +1213,12 @@ /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { - $SQL = 'INSERT INTO debtortranstaxes (debtortransid, + $SQL = "INSERT INTO debtortranstaxes (debtortransid, taxauthid, taxamount) - VALUES (' . $DebtorTransID . ', - ' . $TaxAuthID . ', - ' . $TaxAmount/$ExRate . ')'; + VALUES ('" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . $TaxAmount/$ExRate . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -1234,7 +1237,7 @@ /* Need to get the current location quantity will need it later for the stock movement */ - $SQL="SELECT locstock.quantity + $SQL="SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $OrderLine->StockID . "' AND loccode= '" . $_SESSION['Items'.$identifier]->Location . "'"; @@ -1290,9 +1293,9 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Can not retrieve assembly components location stock quantities because '); $DbgMsg = _('The SQL that failed was'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - if (DB_num_rows($Result)==1){ - $LocQtyRow = DB_fetch_row($Result); - $QtyOnHandPrior = $LocQtyRow[0]; + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; } else { /*There must be some error this should never happen */ $QtyOnHandPrior = 0; @@ -1317,17 +1320,17 @@ ) VALUES ( '" . $AssParts['component'] . "', 10, - " . $InvoiceNo . ", - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - " . $PeriodNo . ", - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', - " . -$AssParts['quantity'] * $OrderLine->Quantity . ", - " . $AssParts['standard'] . ", - 0, - newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', + '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', + '" . $AssParts['standard'] . "', + 0, + newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); @@ -1375,18 +1378,18 @@ narrative ) VALUES ('" . $OrderLine->StockID . "', 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $_SESSION['Items'.$identifier]->Location . "', '" . $DefaultDispatchDate . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', - " . $LocalCurrencyPrice . ", - " . $PeriodNo . ", + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', '" . $OrderNo . "', - " . -$OrderLine->Quantity . ", - " . $OrderLine->DiscountPercent . ", - " . $OrderLine->StandardCost . ", - " . ($QtyOnHandPrior - $OrderLine->Quantity) . ", + '" . -$OrderLine->Quantity . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->Quantity) . "', '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil @@ -1410,17 +1413,17 @@ narrative ) VALUES ('" . $OrderLine->StockID . "', 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $_SESSION['Items'.$identifier]->Location . "', '" . $DefaultDispatchDate . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', - " . $LocalCurrencyPrice . ", - " . $PeriodNo . ", + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', '" . $OrderNo . "', - " . -$OrderLine->Quantity . ", - " . $OrderLine->DiscountPercent . ", - " . $OrderLine->StandardCost . ", + '" . -$OrderLine->Quantity . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', '" . DB_escape_string($OrderLine->Narrative) . "')"; } @@ -1434,16 +1437,16 @@ /*Insert the taxes that applied to this line */ foreach ($OrderLine->Taxes as $Tax) { - $SQL = 'INSERT INTO stockmovestaxes (stkmoveno, + $SQL = "INSERT INTO stockmovestaxes (stkmoveno, taxauthid, taxrate, taxcalculationorder, taxontax) - VALUES (' . $StkMoveNo . ', - ' . $Tax->TaxAuthID . ', - ' . $Tax->TaxRate . ', - ' . $Tax->TaxCalculationOrder . ', - ' . $Tax->TaxOnTax . ')'; + VALUES ('" . $StkMoveNo . "', + '" . $Tax->TaxAuthID . "', + '" . $Tax->TaxRate . "', + '" . $Tax->TaxCalculationOrder . "', + '" . $Tax->TaxOnTax . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Taxes and rates applicable to this invoice line item could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement tax detail records was used'); @@ -1510,7 +1513,7 @@ AND salesanalysis.area=custbranch.area AND salesanalysis.salesperson=custbranch.salesman AND salesanalysis.typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' - AND salesanalysis.periodno=" . $PeriodNo . " + AND salesanalysis.periodno='" . $PeriodNo . "' AND salesanalysis.cust " . LIKE . " '" . $_SESSION['Items'.$identifier]->DebtorNo . "' AND salesanalysis.custbranch " . LIKE . " '" . $_SESSION['Items'.$identifier]->Branch . "' AND salesanalysis.stockid " . LIKE . " '" . $OrderLine->StockID . "' @@ -1540,7 +1543,7 @@ WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' - AND periodno = " . $PeriodNo . " + AND periodno = '" . $PeriodNo . "' AND cust " . LIKE . " '" . $_SESSION['Items'.$identifier]->DebtorNo . "' AND custbranch " . LIKE . " '" . $_SESSION['Items'.$identifier]->Branch . "' AND stockid " . LIKE . " '" . $OrderLine->StockID . "' @@ -1563,13 +1566,13 @@ salesperson, stkcategory ) SELECT '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - " . $PeriodNo . ", - " . ($OrderLine->Price * $OrderLine->Quantity / $ExRate) . ", - " . ($OrderLine->StandardCost * $OrderLine->Quantity) . ", + '" . $PeriodNo . "', + '" . ($OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', + '" . ($OrderLine->StandardCost * $OrderLine->Quantity) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', - " . $OrderLine->Quantity . ", - " . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . ", + '" . $OrderLine->Quantity . "', + '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', '" . $OrderLine->StockID . "', custbranch.area, 1, @@ -1600,7 +1603,7 @@ narrative, amount) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items'.$identifier]->DefaultSalesType, $db) . "', @@ -1622,7 +1625,7 @@ narrative, amount ) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', @@ -1648,7 +1651,7 @@ amount ) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', @@ -1656,7 +1659,7 @@ '" . (-$OrderLine->Price * $OrderLine->Quantity/$ExRate) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales GL posting could not be inserted because'); - $DbgMsg = '<br>' ._('The following SQL to insert the GLTrans record was used'); + $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); if ($OrderLine->DiscountPercent !=0){ @@ -1670,7 +1673,7 @@ amount ) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', @@ -1696,7 +1699,7 @@ narrative, amount ) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', @@ -1719,7 +1722,7 @@ narrative, amount ) VALUES ( 10, - " . $InvoiceNo . ", + '" . $InvoiceNo . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $TaxGLCodes[$TaxAuthID] . "', @@ -1736,7 +1739,7 @@ if ($_POST['AmountPaid']!=0){ $ReceiptNumber = GetNextTransNo(12,$db); - $SQL='INSERT INTO gltrans (type, + $SQL="INSERT INTO gltrans (type, typeno, trandate, periodno, @@ -1744,7 +1747,7 @@ narrative, amount) VALUES (12, - ' . $ReceiptNumber . ", + '" . $ReceiptNumber . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $_POST['BankAccount'] . "', @@ -1755,7 +1758,7 @@ $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); /* Now Credit Debtors account with receipt */ - $SQL='INSERT INTO gltrans ( type, + $SQL="INSERT INTO gltrans ( type, typeno, trandate, periodno, @@ -1763,7 +1766,7 @@ narrative, amount) VALUES (12, - ' . $ReceiptNumber . ", + '" . $ReceiptNumber . "', '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', @@ -1827,7 +1830,7 @@ //insert a new debtortrans for the receipt - $SQL = 'INSERT INTO debtortrans (transno, + $SQL = "INSERT INTO debtortrans (transno, type, debtorno, trandate, @@ -1838,7 +1841,7 @@ ovamount, alloc, invtext) - VALUES (' . $ReceiptNumber . ", + VALUES ('" . $ReceiptNumber . "', 12, '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $DefaultDispatchDate . "', @@ -1866,11 +1869,11 @@ //and finally add the allocation record between receipt and invoice - $SQL = 'INSERT INTO custallocns ( amt, + $SQL = "INSERT INTO custallocns ( amt, datealloc, transid_allocfrom, transid_allocto ) - VALUES (' . $_POST['AmountPaid'] . ", + VALUES ('" . $_POST['AmountPaid'] . "', '" . $DefaultDispatchDate . "', '" . $ReceiptDebtorTransID . "', '" . $DebtorTransID . "')"; @@ -1889,14 +1892,14 @@ echo prnMsg( _('Invoice number'). ' '. $InvoiceNo .' '. _('processed'), 'success'); - echo '<br><div class="centre">'; + echo '<br /><div class="centre">'; if ($_SESSION['InvoicePortraitFormat']==0){ - echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTrans.php?' . SID . 'FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Landscape') . ')</a><br><br>'; + echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTrans.php?' . SID . 'FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Landscape') . ')</a><br /><br />'; } else { - echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?' . SID . 'FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Portrait') . ')</a><br><br>'; + echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?' . SID . '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>'; + echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a></div>'; } // There were input errors so don't process nuffin @@ -1912,9 +1915,9 @@ /* Now show the stock item selection search stuff below */ if (!isset($_POST['ProcessSale'])){ - if (isset($_POST['PartSearch']) && $_POST['PartSearch']!=''){ + if (isset($_POST['PartSearch']) and $_POST['PartSearch']!=''){ - echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '">'; + echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '" />'; if ($_SESSION['FrequentlyOrderedItems']>0){ //show the Frequently Order Items selection where configured to do so @@ -1936,7 +1939,7 @@ $result2 = DB_query($SQL,$db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' '; echo _('Frequently Ordered Items') . '</p><br />'; - echo '<div class="page_help_text">' . _('Frequently Ordered Items') . _(', shows the most frequently ordered items in the last 6 months. You can choose from this list, or search further for other items') . '.</div><br>'; + echo '<div class="page_help_text">' . _('Frequently Ordered Items') . _(', shows the most frequently ordered items in the last 6 months. You can choose from this list, or search further for other items') . '.</div><br />'; echo '<table class="table1">'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Description') . '</th> @@ -1954,13 +1957,13 @@ // This code needs sorting out, but until then : $ImageSource = _('No Image'); // Find the quantity in stock at location - $qohsql = "SELECT sum(quantity) + $QohSql = "SELECT sum(quantity) FROM locstock WHERE stockid='" .$myrow['stockid'] . "' AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - $qohresult = DB_query($qohsql,$db); - $qohrow = DB_fetch_row($qohresult); - $qoh = $qohrow[0]; + $QohResult = DB_query($QohSql,$db); + $QohRow = DB_fetch_row($QohResult); + $QOH = $QohRow[0]; // Find the quantity on outstanding sales orders $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem @@ -2020,7 +2023,7 @@ } $OnOrder = $PurchQty + $WoQty; - $Available = $qoh - $DemandQty + $OnOrder; + $Available = $QOH - $DemandQty + $OnOrder; printf('<td>%s</font></td> <td>%s</td> @@ -2029,13 +2032,13 @@ <td style="text-align:center">%s</td> <td style="text-align:center">%s</td> <td style="text-align:center">%s</td> - <td><font size=1><input class="number" tabindex='.number_format($j+7).' type="textbox" size=6 name="itm'.$myrow['stockid'].'" value=0> + <td><font size=1><input class="number" tabindex="'.number_format($j+7).'" type="textbox" size="6" name="itm'.$myrow['stockid'].'" value="0" /> </td> </tr>', $myrow['stockid'], $myrow['description'], $myrow['units'], - $qoh, + $QOH, $DemandQty, $OnOrder, $Available, @@ -2050,22 +2053,22 @@ #end of page full new headings if } #end of while loop for Frequently Ordered Items - echo '<td style="text-align:center" colspan=8><input type="hidden" name="order_items" value=1><input tabindex='.number_format($j+8).' type="submit" value="'._('Add to Sale').'"></td>'; + echo '<td style="text-align:center" colspan="8"><input type="hidden" name="OrderItems" value="1" /><input tabindex='.number_format($j+8).' type="submit" value="'._('Add to Sale').'" /></td>'; echo '</table>'; } //end of if Frequently Ordered Items > 0 if (isset($msg)){ - echo '<p><div class="centre"><b><p>' . $msg . '</b></p>'; + echo '<p><div class="centre"><b>' . $msg . '</b></div></p>'; } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' '; echo _('Search for Items') . '</p>'; - echo '<div class="page_help_text">' . _('Search for Items') . _(', Searches the database for items, you can narrow the results by selecting a stock category, or just enter a partial item description or partial item code') . '.</div><br>'; - echo '<table class="selection"><tr><td><b>' . _('Select a Stock Category') . ': </b><select tabindex=1 name="StockCat">'; + echo '<div class="page_help_text">' . _('Search for Items') . _(', Searches the database for items, you can narrow the results by selecting a stock category, or just enter a partial item description or partial item code') . '.</div><br />'; + echo '<table class="selection"><tr><td><b>' . _('Select a Stock Category') . ': </b><select tabindex="1" name="StockCat">'; if (!isset($_POST['StockCat'])){ - echo "<option selected value='All'>" . _('All'); + echo "<option selected='True' value='All'>" . _('All').'</option>'; $_POST['StockCat'] ='All'; } else { - echo "<option value='All'>" . _('All'); + echo "<option value='All'>" . _('All').'</option>'; } $SQL="SELECT categoryid, categorydescription @@ -2075,9 +2078,9 @@ $result1 = DB_query($SQL,$db); while ($myrow1 = DB_fetch_array($result1)) { if ($_POST['StockCat']==$myrow1['categoryid']){ - echo '<option selected value=' . $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option selected="True" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } else { - echo '<option value='. $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; } } @@ -2085,38 +2088,37 @@ </select></td> <td><b><?php echo _('Enter partial Description'); ?>:</b> - <input tabindex=2 type="Text" name="Keywords" size=20 maxlength=25 value="<?php if (isset($_POST['Keywords'])) echo $_POST['Keywords']; ?>"></td> + <input tabindex="2" type="text" name="Keywords" size="20" maxlength="25" value="<?php if (isset($_POST['Keywords'])) echo $_POST['Keywords']; ?>" /></td> <td align="right"><b><?php echo _('OR'); ?> </b><b><?php echo _('Enter extract of the Stock Code'); ?>:</b> - <input tabindex=3 type="Text" name="StockCode" size=15 maxlength=18 value="<?php if (isset($_POST['StockCode'])) echo $_POST['StockCode']; ?>"></td> + <input tabindex="3" type="text" name="StockCode" size="15" maxlength="18" value="<?php if (isset($_POST['StockCode'])) echo $_POST['StockCode']; ?>" /></td> </tr><tr> - <td style="text-align:center" colspan=1><input tabindex=4 type=submit name="Search" value="<?php echo _('Search Now'); ?>"></td> - <td style="text-align:center" colspan=1><input tabindex=5 type=submit name="QuickEntry" value="<?php echo _('Use Quick Entry'); ?>"></td> + <td style="text-align:center" colspan="1"><input tabindex="4" type="submit" name="Search" value="<?php echo _('Search Now'); ?>" /></td> + <td style="text-align:center" colspan="1"><input tabindex="5" type="submit" name="QuickEntry" value="<?php echo _('Use Quick Entry'); ?>" /></td> <?php if (!isset($_POST['PartSearch'])) { echo '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.Keywords);}</script>'; } - echo '</tr></table><br>'; - echo '</b>'; + echo '</tr></table><br />'; // Add some useful help as the order progresses if (isset($SearchResult)) { - echo '<br>'; + echo '<br />'; echo '<div class="page_help_text">' . _('Select an item by entering the quantity required. Click Order when ready.') . '</div>'; - echo '<br>'; + echo '<br />'; } if (isset($SearchResult)) { $j = 1; - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . ' method=post name="orderform">'; + echo '<form action="' . $_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 colspan=><input type="hidden" name="previous" value='.number_format($Offset-1).'><input tabindex='.number_format($j+7).' type="submit" name="Prev" value="'._('Prev').'"></td>'; - echo '<td style="text-align:center" colspan=6><input type="hidden" name="order_items" value=1><input tabindex='.number_format($j+8).' type="submit" value="'._('Add to Sale').'"></td>'; - echo '<td colspan=><input type="hidden" name="nextlist" value='.number_format($Offset+1).'><input tabindex='.number_format($j+9).' type="submit" name="Next" value="'._('Next').'"></td></tr>'; + echo '<tr><td><input type="hidden" name="previous" value="'.number_format($Offset-1).'" /><input tabindex="'.number_format($j+7).'" type="submit" name="Prev" value="'._('Prev').'" /></td>'; + echo '<td style="text-align:center" colspan="6"><input type="hidden" name="OrderItems" value="1" /><input tabindex="'.number_format($j+8).'" type="submit" value="'._('Add to Sale').'" /></td>'; + echo '<td><input type="hidden" name="NextList" value="'.number_format($Offset+1).'" /><input tabindex="'.number_format($j+9).'" type="submit" name="Next" value="'._('Next').'" /></td></tr>'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Units') . '</th> @@ -2146,13 +2148,13 @@ */ // Find the quantity in stock at location - $qohsql = "SELECT sum(quantity) + $QohSql = "SELECT sum(quantity) FROM locstock WHERE stockid='" .$myrow['stockid'] . "' AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - $qohresult = DB_query($qohsql,$db); - $qohrow = DB_fetch_row($qohresult); - $qoh = $qohrow[0]; + $qohresult = DB_query($QohSql,$db); + $QohRow = DB_fetch_row($QohResult); + $QOH = $qohrow[0]; // Find the quantity on outstanding sales orders $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS... [truncated message content] |
From: <dai...@us...> - 2010-12-30 05:46:55
|
Revision: 4456 http://web-erp.svn.sourceforge.net/web-erp/?rev=4456&view=rev Author: daintree Date: 2010-12-30 05:46:48 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Upgrade changes Modified Paths: -------------- trunk/MRP.php trunk/PageSecurity.php trunk/UpgradeDatabase.php trunk/includes/ConnectDB.inc trunk/includes/GetConfig.php trunk/includes/session.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/MRP.php 2010-12-30 05:46:48 UTC (rev 4456) @@ -24,17 +24,15 @@ $result = DB_query('DROP TABLE IF EXISTS bomlevels',$db); $result = DB_query('DROP TABLE IF EXISTS levels',$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( - part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + $sql = 'CREATE TEMPORARY TABLE passbom (part char(20), + sortpart text) DEFAULT CHARSET=utf8'; $ErrMsg = _('The SQL to to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - $sql = 'CREATE TEMPORARY TABLE tempbom ( - parent char(20), - component char(20), - sortpart text, - level int) DEFAULT CHARSET=utf8'; + $sql = 'CREATE TEMPORARY TABLE tempbom (parent char(20), + component char(20), + sortpart text, + level int) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of tempbom failed because')); // To create levels, first, find parts in bom that are top level assemblies. // Do this by doing a LEFT JOIN from bom to bom (as bom2), linking @@ -47,10 +45,10 @@ flush(); // This finds the top level $sql = 'INSERT INTO passbom (part, sortpart) - SELECT bom.component AS part, - CONCAT(bom.parent,"%",bom.component) AS sortpart - FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component - WHERE bom2.component IS NULL'; + SELECT bom.component AS part, + CONCAT(bom.parent,"%",bom.component) AS sortpart + FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component + WHERE bom2.component IS NULL'; $result = DB_query($sql,$db); $lctr = 2; @@ -82,9 +80,8 @@ $result = DB_query('ALTER TABLE passbom RENAME AS passbom2',$db); $result = DB_query('DROP TABLE IF EXISTS passbom',$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( - part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + $sql = 'CREATE TEMPORARY TABLE passbom (part char(20), + sortpart text) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db); $sql = "INSERT INTO passbom (part, sortpart) @@ -96,8 +93,8 @@ $sql = 'SELECT COUNT(*) FROM bom - INNER JOIN passbom ON bom.parent = passbom.part - GROUP BY bom.parent'; + INNER JOIN passbom ON bom.parent = passbom.part + GROUP BY bom.parent'; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -144,23 +141,23 @@ eoq double NOT NULL default "0") DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db); $sql = 'INSERT INTO levels (part, - level, - leadtime, - pansize, - shrinkfactor, - eoq) - SELECT bomlevels.part, - MAX(bomlevels.level), - 0, - pansize, - shrinkfactor, - stockmaster.eoq - FROM bomlevels - INNER JOIN stockmaster ON bomlevels.part = stockmaster.stockid - GROUP BY bomlevels.part, - pansize, - shrinkfactor, - stockmaster.eoq'; + level, + leadtime, + pansize, + shrinkfactor, + eoq) + SELECT bomlevels.part, + MAX(bomlevels.level), + 0, + pansize, + shrinkfactor, + stockmaster.eoq + FROM bomlevels + INNER JOIN stockmaster ON bomlevels.part = stockmaster.stockid + GROUP BY bomlevels.part, + pansize, + shrinkfactor, + stockmaster.eoq'; $result = DB_query($sql,$db); $sql = 'ALTER TABLE levels ADD INDEX part(part)'; $result = DB_query($sql,$db); @@ -188,15 +185,15 @@ // Update leadtime in levels from purchdata. Do it twice so can make sure leadtime from preferred // vendor is used $sql = 'UPDATE levels,purchdata - SET levels.leadtime = purchdata.leadtime - WHERE levels.part = purchdata.stockid - AND purchdata.leadtime > 0'; + SET levels.leadtime = purchdata.leadtime + WHERE levels.part = purchdata.stockid + AND purchdata.leadtime > 0'; $result = DB_query($sql,$db); $sql = 'UPDATE levels,purchdata - SET levels.leadtime = purchdata.leadtime - WHERE levels.part = purchdata.stockid - AND purchdata.preferred = 1 - AND purchdata.leadtime > 0'; + SET levels.leadtime = purchdata.leadtime + WHERE levels.part = purchdata.stockid + AND purchdata.preferred = 1 + AND purchdata.leadtime > 0'; $result = DB_query($sql,$db); prnMsg(_('Levels table has been created'),'info'); @@ -222,105 +219,100 @@ // requirement left and have to pass that down to the BOM parts using the // CreateLowerLevelRequirement() function. Mostly do this so can distinguish the type // of requirements for the MRPShortageReport so don't show double requirements. - $sql = 'CREATE TABLE mrprequirements ( - part char(20), - daterequired date, - quantity double, - mrpdemandtype varchar(6), - orderno int(11), - directdemand smallint, - whererequired char(20)) DEFAULT CHARSET=utf8'; + $sql = 'CREATE TABLE mrprequirements ( part char(20), + daterequired date, + quantity double, + mrpdemandtype varchar(6), + orderno int(11), + directdemand smallint, + whererequired char(20)) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of mrprequirements failed because')); prnMsg(_('Loading requirements from sales orders'),'info'); flush(); - $sql = 'INSERT INTO mrprequirements - (part, - daterequired, - quantity, - mrpdemandtype, - orderno, - directdemand, - whererequired) - SELECT stkcode, - deliverydate, - (quantity - qtyinvoiced) AS netqty, - "SO", - salesorderdetails.orderno, - "1", - stkcode - FROM salesorders, salesorderdetails - WHERE salesorders.orderno = salesorderdetails.orderno - AND (quantity - qtyinvoiced) > 0 - AND salesorderdetails.completed = 0 - AND salesorders.quotation = 0'; + $sql = 'INSERT INTO mrprequirements (part, + daterequired, + quantity, + mrpdemandtype, + orderno, + directdemand, + whererequired) + SELECT stkcode, + deliverydate, + (quantity - qtyinvoiced) AS netqty, + "SO", + salesorderdetails.orderno, + "1", + stkcode + FROM salesorders, salesorderdetails + WHERE salesorders.orderno = salesorderdetails.orderno + AND (quantity - qtyinvoiced) > 0 + AND salesorderdetails.completed = 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, - daterequired, - quantity, - mrpdemandtype, - orderno, - directdemand, - whererequired) - SELECT worequirements.stockid, - workorders.requiredby, - qtypu*(woitems.qtyreqd - woitems.qtyrecd) AS netqty, - "WO", - woitems.wo, - "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'; + $sql = 'INSERT INTO mrprequirements (part, + daterequired, + quantity, + mrpdemandtype, + orderno, + directdemand, + whererequired) + SELECT worequirements.stockid, + workorders.requiredby, + qtypu*(woitems.qtyreqd - woitems.qtyrecd) AS netqty, + "WO", + woitems.wo, + "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'; $result = DB_query($sql,$db); - $sql = 'INSERT INTO mrprequirements - (part, - daterequired, - quantity, - mrpdemandtype, - orderno, - directdemand, - whererequired) - SELECT stockid, - duedate, - quantity, - mrpdemandtype, - demandid, - "1", - stockid - FROM mrpdemands'; + $sql = 'INSERT INTO mrprequirements (part, + daterequired, + quantity, + mrpdemandtype, + orderno, + directdemand, + whererequired) + SELECT stockid, + duedate, + quantity, + mrpdemandtype, + demandid, + "1", + stockid + FROM mrpdemands'; if ($_POST['usemrpdemands'] == 'y') { $result = DB_query($sql,$db); prnMsg(_('Loading requirements based on mrpdemands'),'info'); flush(); } - $sql = 'INSERT INTO mrprequirements - (part, - daterequired, - quantity, - mrpdemandtype, - orderno, - directdemand, - whererequired) - SELECT stockid, - NOW(), - (reorderlevel - quantity) AS reordqty, - "REORD", - "1", - "1", - stockid - FROM locstock - WHERE reorderlevel > quantity'; + $sql = 'INSERT INTO mrprequirements (part, + daterequired, + quantity, + mrpdemandtype, + orderno, + directdemand, + whererequired) + SELECT stockid, + NOW(), + (reorderlevel - quantity) AS reordqty, + "REORD", + "1", + "1", + stockid + FROM locstock + WHERE reorderlevel > quantity'; $result = DB_query($sql,$db); prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); @@ -334,108 +326,105 @@ $result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db); // updateflag is set to 1 in UpdateSupplies if change date when matching requirements to // supplies. Actually only change update flag in the array created from mrpsupplies - $sql = 'CREATE TABLE mrpsupplies ( - id int(11) NOT NULL auto_increment, - part char(20), - duedate date, - supplyquantity double, - ordertype varchar(6), - orderno int(11), - mrpdate date, - updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, + part char(20), + duedate date, + supplyquantity double, + ordertype varchar(6), + orderno int(11), + mrpdate date, + updateflag smallint(6), + PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of mrpsupplies failed because')); prnMsg(_('Loading supplies from purchase orders'),'info'); flush(); - $sql = 'INSERT INTO mrpsupplies - (id, - part, - duedate, - supplyquantity, - ordertype, - orderno, - mrpdate, - updateflag) - SELECT Null, - purchorderdetails.itemcode, - purchorderdetails.deliverydate, - (quantityord - quantityrecd) AS netqty, - "PO", - purchorderdetails.orderno, - purchorderdetails.deliverydate, - 0 - FROM purchorderdetails, - purchorders - WHERE purchorderdetails.orderno = purchorders.orderno - AND purchorders.status != "Cancelled" - AND(quantityord - quantityrecd) > 0'; + $sql = 'INSERT INTO mrpsupplies (id, + part, + duedate, + supplyquantity, + ordertype, + orderno, + mrpdate, + updateflag) + SELECT Null, + purchorderdetails.itemcode, + purchorderdetails.deliverydate, + (quantityord - quantityrecd) AS netqty, + "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'; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from inventory on hand'),'info'); flush(); // Set date for inventory already onhand to 0000-00-00 so it is first in sort if ($_POST['location'][0] == 'All') { - $whereloc = ' '; + $WhereLocation = ' '; } elseif (sizeof($_POST['location']) == 1) { - $whereloc = " AND loccode ='" . $_POST['location'][0] . "' "; + $WhereLocation = " AND loccode ='" . $_POST['location'][0] . "' "; } else { - $whereloc = " AND loccode IN("; + $WhereLocation = " AND loccode IN("; $commactr = 0; foreach ($_POST['location'] as $key => $value) { - $whereloc .= "'" . $value . "'"; + $WhereLocation .= "'" . $value . "'"; $commactr++; if ($commactr < sizeof($_POST['location'])) { - $whereloc .= ","; + $WhereLocation .= ","; } // End of if } // End of foreach - $whereloc .= ')'; + $WhereLocation .= ')'; } - $sql = 'INSERT INTO mrpsupplies - (id, - part, - duedate, - supplyquantity, - ordertype, - orderno, - mrpdate, - updateflag) - SELECT Null, - stockid, - "0000-00-00", - SUM(quantity), - "QOH", - 1, - "0000-00-00", - 0 - FROM locstock - WHERE quantity > 0 ' . - $whereloc . - 'GROUP BY stockid'; + $sql = 'INSERT INTO mrpsupplies (id, + part, + duedate, + supplyquantity, + ordertype, + orderno, + mrpdate, + updateflag) + SELECT Null, + stockid, + "0000-00-00", + SUM(quantity), + "QOH", + 1, + "0000-00-00", + 0 + FROM locstock + WHERE quantity > 0 ' . + $WhereLocation . + 'GROUP BY stockid'; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from work orders'),'info'); flush(); - $sql = 'INSERT INTO mrpsupplies - (id, - part, - duedate, - supplyquantity, - ordertype, - orderno, - mrpdate, - updateflag) - SELECT Null, - stockid, - workorders.requiredby, - (woitems.qtyreqd-woitems.qtyrecd) AS netqty, - "WO", - woitems.wo, - workorders.requiredby, - 0 - FROM woitems INNER JOIN workorders - ON woitems.wo=workorders.wo - WHERE workorders.closed=0'; + $sql = 'INSERT INTO mrpsupplies (id, + part, + duedate, + supplyquantity, + ordertype, + orderno, + mrpdate, + updateflag) + SELECT Null, + stockid, + workorders.requiredby, + (woitems.qtyreqd-woitems.qtyrecd) AS netqty, + "WO", + woitems.wo, + workorders.requiredby, + 0 + FROM woitems INNER JOIN workorders + ON woitems.wo=workorders.wo + WHERE workorders.closed=0'; $result = DB_query($sql,$db); $sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)'; @@ -447,16 +436,15 @@ prnMsg(_('Creating planned orders table'),'info'); flush(); $result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db); - $sql = 'CREATE TABLE mrpplannedorders ( - id int(11) NOT NULL auto_increment, - part char(20), - duedate date, - supplyquantity double, - ordertype varchar(6), - orderno int(11), - mrpdate date, - updateflag smallint(6), - PRIMARY KEY (id))'; + $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, + part char(20), + duedate date, + supplyquantity double, + ordertype varchar(6), + orderno int(11), + mrpdate date, + updateflag smallint(6), + PRIMARY KEY (id))'; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number @@ -474,7 +462,7 @@ // part, that serves as a gross requirement for a lower level part, so will read down through // the Bill of Materials to generate those requirements in function LevelNetting(). for ($level = $maxlevel; $level >= $minlevel; $level--) { - $sql = 'SELECT * FROM levels WHERE level = "' . $level .'" LIMIT 50000'; //should cover most eventualities!! + $sql = 'SELECT * FROM levels WHERE level = "' . $level .'" LIMIT 50000'; //should cover most eventualities!! ... yes indeed :-) prnMsg('</br>------ ' . _('Processing level') .' ' . $level . ' ------','info'); flush(); @@ -509,19 +497,19 @@ } // End of if } // End of foreach $sql = "INSERT INTO mrpparameters (runtime, - location, - pansizeflag, - shrinkageflag, - eoqflag, - usemrpdemands, - leeway) - VALUES (NOW(), - '" . $locparm . "', - '" . $_POST['pansizeflag'] . "', - '" . $_POST['shrinkageflag'] . "', - '" . $_POST['eoqflag'] . "', - '" . $_POST['usemrpdemands'] . "', - '" . $_POST['Leeway'] . "')"; + location, + pansizeflag, + shrinkageflag, + eoqflag, + usemrpdemands, + leeway) + VALUES (NOW(), + '" . $locparm . "', + '" . $_POST['pansizeflag'] . "', + '" . $_POST['shrinkageflag'] . "', + '" . $_POST['eoqflag'] . "', + '" . $_POST['usemrpdemands'] . "', + '" . $_POST['Leeway'] . "')"; $result = DB_query($sql,$db); } else { // End of if submit isset @@ -613,7 +601,7 @@ $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'"; $result = DB_query($sql,$db); $myrow=DB_fetch_row($result); - $decimalplaces = $myrow[0]; + $DecimalPlaces = $myrow[0]; // Load mrprequirements into $requirements array $sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired"; @@ -702,7 +690,7 @@ // Should the quantity be rounded? if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) { $requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor); - $requirement['quantity'] = round($requirement['quantity'],$decimalplaces); + $requirement['quantity'] = round($requirement['quantity'],$DecimalPlaces); } if ($excessqty >= $requirement['quantity']) { $plannedqty = 0; Modified: trunk/PageSecurity.php =================================================================== --- trunk/PageSecurity.php 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/PageSecurity.php 2010-12-30 05:46:48 UTC (rev 4456) @@ -1,6 +1,5 @@ <?php - include('includes/session.inc'); $title = _('Page Security Levels'); @@ -9,23 +8,24 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/security.png" title="' . _('Page Security Levels') . '" alt="" />' . ' ' . $title.'</p><br />'; -if (isset($_POST['update'])) { - foreach ($_POST as $key => $value) { - if ($key!='update' and $key!='FormID') { - $key=substr($key, 0, strlen($key)-4).'.php'; - $sql="UPDATE pagesecurity SET security='".$value."' WHERE script='".$key."'"; - $updateresult=DB_query($sql, $db); +if (isset($_POST['Update'])) { + foreach ($_POST as $ScriptName => $PageSecurityValue) { + if ($ScriptName!='Update' and $ScriptName!='FormID') { + //$key=substr($key, 0, strlen($key)-4).'.php'; + $sql="UPDATE scripts SET pagesecurity='".$PageSecurityValue."' WHERE script='".$ScriptName."'"; + $UpdateResult=DB_query($sql, $db,_('Could not update the page security value for the script because')); } } } -$sql="SELECT script, - security - FROM pagesecurity"; +$sql='SELECT script, + pagesecurity, + description + FROM scripts'; $result=DB_query($sql, $db); -echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; +echo '<br /><form method="post" id="PageSecurity" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; @@ -39,7 +39,7 @@ echo '<tr><td>'.$myrow['script'].'</td>'; echo '<td><select name="'.$myrow['script'].'">'; while ($mytokenrow=DB_fetch_array($TokenResult)) { - if ($mytokenrow['tokenid']==$myrow['security']) { + if ($mytokenrow['tokenid']==$myrow['pagesecurity']) { echo '<option selected="True" value="'.$mytokenrow['tokenid'].'">'.htmlentities($mytokenrow['tokenname']).'</option>'; } else { echo '<option value="'.$mytokenrow['tokenid'].'">'.htmlentities($mytokenrow['tokenname']).'</option>'; @@ -51,8 +51,7 @@ echo '</table><br />'; -echo '<div class="centre"><input type="submit" name="update" value="'._('Update Security Levels').'" /></div><br /></form>'; +echo '<div class="centre"><input type="submit" name="Update" value="'._('Update Security Levels').'" /></div><br /></form>'; include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/UpgradeDatabase.php 2010-12-30 05:46:48 UTC (rev 4456) @@ -7,9 +7,12 @@ if (empty($_POST['DoUpgrade'])){ - if (!isset($_SESSION['VersionNumber')){ - prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('the database is a prior version and upgrade scripts are required to be run. Upgrades to the database prior to ') - prnMsg(_('This script will run perform any modifications to the database since v 3.11 required to allow the additional functionality in later scripts'),'info'); + if (!isset($_SESSION['VersionNumber'])){ + prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is not actually recorded at this version'),'info'); + } else { + prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('and the database version is') . ' ' . $_SESSION['VersionNumber'],'info'); + } + prnMsg(_('This script will run perform any modifications to the database required to allow the additional functionality in later scripts'),'info'); echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -82,6 +85,10 @@ echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. _('Entry has already been done').'</td></tr>'; break; + case 1064: + echo '<tr><td>' . $sql . '</td><td bgcolor="red">'._('Note').' - '. + _('SQL syntax error. The SQL error message is'). ' ' . DB_error_msg($db) . '</td></tr>'; + break; case 1068: echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. _('Primary key already exists').'</td></tr>'; @@ -92,7 +99,7 @@ break; default: echo '<tr><td>' . $sql . '</td><td bgcolor="red">'._('Failure').' - '. - _('Error number').' - '.DB_error_no($db) .'</td></tr>'; + _('Error number').' - '.DB_error_no($db) .' ' . DB_error_msg($db) . '</td></tr>'; break; } unset($sql); Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/includes/ConnectDB.inc 2010-12-30 05:46:48 UTC (rev 4456) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='4.00'; //must update manually every time there is a DB change +$Version='3.12.1'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); if (!isset($_SESSION['DatabaseName'])){ Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/includes/GetConfig.php 2010-12-30 05:46:48 UTC (rev 4456) @@ -25,7 +25,7 @@ $sql='SELECT script, pagesecurity FROM scripts'; $ErrMsg = _('Could not get the page security details from the database because'); - $result=DB_query($sql, $db); + $result=DB_query($sql, $db,_('Could not get page security details from the scripts table because')); while ($myrow=DB_fetch_array($result)) { $_SESSION['PageSecurity'][$myrow['script']]=$myrow['pagesecurity']; Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/includes/session.inc 2010-12-30 05:46:48 UTC (rev 4456) @@ -115,12 +115,11 @@ /*User is logged in so get configuration parameters - save in session*/ include($PathPrefix . 'includes/GetConfig.php'); -if (isset($_SESSION[basename($_SERVER['SCRIPT_NAME'])])) { - /*The page security variable is now retrieved from the database in GetConfig.php and stored in the $SESSION['PageSecurity'] array - * the key for the array is the script name - the script name is retrieved from the basename ($_SERVER['SCRIPT_NAME']) - */ - $PageSecurity = $_SESSION['PageSecurity'][basename($_SERVER['SCRIPT_NAME'])]; -} +/*The page security variable is now retrieved from the database in GetConfig.php and stored in the $SESSION['PageSecurity'] array + * the key for the array is the script name - the script name is retrieved from the basename ($_SERVER['SCRIPT_NAME']) + */ +$PageSecurity = $_SESSION['PageSecurity'][basename($_SERVER['SCRIPT_NAME'])]; + /*If the Code $Version - held in ConnectDB.inc is > than the Database VersionNumber held in config table then do upgrades */ if (($Version>$_SESSION['VersionNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { header('Location: UpgradeDatabase.php'); @@ -311,12 +310,8 @@ return $Password; } } -if (isset($_SESSION['VersionNumber'])) { - $Version = $_SESSION['VersionNumber']; -} else { - $Version=''; -} + if (sizeof($_POST) > 0) { if (!isset($_POST['FormID']) or ($_POST['FormID'] != $_SESSION['FormID'])) { $title = _('Error in form verificationm'); Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-29 23:18:49 UTC (rev 4455) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-30 05:46:48 UTC (rev 4456) @@ -440,11 +440,12 @@ `longdescription` text NOT NULL, `depntype` int(11) NOT NULL DEFAULT '1', `depnrate` double NOT NULL, - `disposaldate` date NOT NULL DEFAULT '0000-00-00' + `disposaldate` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`assetid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('41', 'Asset Addition', '1'); INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('42', 'Asset Category Change', '1'); INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('43', 'Delete w/down asset', '1'); @@ -802,4 +803,6 @@ ('Z_UploadForm.php', 15, 'Utility to upload a file to a remote server'), ('Z_UploadResult.php', 15, 'Utility to upload a file to a remote server'); -INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '4.00'); +INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '3.12.0'); +UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber'; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-12-29 23:18:58
|
Revision: 4455 http://web-erp.svn.sourceforge.net/web-erp/?rev=4455&view=rev Author: daintree Date: 2010-12-29 23:18:49 +0000 (Wed, 29 Dec 2010) Log Message: ----------- Database upgrade Modified Paths: -------------- trunk/UpgradeDatabase.php trunk/includes/ConnectDB.inc trunk/includes/GetConfig.php trunk/includes/footer.inc trunk/includes/session.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Added Paths: ----------- trunk/sql/mysql/upgrade2.7-2.8.sql trunk/sql/mysql/upgrade2.8-2.9.sql trunk/sql/mysql/upgrade2.9-2.9a.sql trunk/sql/mysql/upgrade2.9a-2.9b.sql trunk/sql/mysql/upgrade3.00-3.01.sql trunk/sql/mysql/upgrade3.01-3.02.sql trunk/sql/mysql/upgrade3.02-3.03.sql trunk/sql/mysql/upgrade3.03-3.04.sql trunk/sql/mysql/upgrade3.04-3.05.sql trunk/sql/mysql/upgrade3.05-3.06.sql trunk/sql/mysql/upgrade3.06-3.07.sql trunk/sql/mysql/upgrade3.07-3.08.sql trunk/sql/mysql/upgrade3.09-3.10.sql trunk/sql/mysql/upgrade3.10-3.11.sql Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-29 09:53:54 UTC (rev 4454) +++ trunk/UpgradeDatabase.php 2010-12-29 23:18:49 UTC (rev 4455) @@ -7,7 +7,8 @@ if (empty($_POST['DoUpgrade'])){ - + if (!isset($_SESSION['VersionNumber')){ + prnMsg(_('The webERP code is version') . ' ' . $Version . ' ' . _('the database is a prior version and upgrade scripts are required to be run. Upgrades to the database prior to ') prnMsg(_('This script will run perform any modifications to the database since v 3.11 required to allow the additional functionality in later scripts'),'info'); echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; @@ -22,7 +23,7 @@ prnMsg(_('If there are any failures then please check with your system administrator'). '. '._('Please read all notes carefully to ensure they are expected'),'info'); - if($_SESSION['DBUpdateNumber']< 1) { /* DBUpdateNumber set to 1 when upgrade3.11.1-4.00.sql is run */ + if($_SESSION['VersionNumber']< '4.00') { /* VersionNumber is set to '4.00' when upgrade3.11.1-4.00.sql is run */ if ($dbType=='mysql' OR $dbType =='mysqli'){ $SQLScripts[0] = './sql/mysql/upgrade3.11.1-4.00.sql'; } @@ -99,12 +100,11 @@ } //end if its a valid sql line not a comment } //end of for loop around the lines of the sql script echo '</table>'; - } //end of loop around SQLScripts to apply + } //end of loop around SQLScripts apply $result =DB_ReinstateForeignKeys($db); - /*Now get the modified DBUpgradeNumber */ - $result = DB_query('SELECT confvalue FROM config WHERE confname="DBUpdateNumber"',$db); - $myrow = DB_fetch_array($result); - $_SESSION['DBUpdateNumber'] = $myrow['confvalue']; + /*Now get the modified VersionNumber and script pagesecurities */ + $ForceConfigReload=true; + include('includes/GetConfig.php'); } /*Dont do upgrade */ Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2010-12-29 09:53:54 UTC (rev 4454) +++ trunk/includes/ConnectDB.inc 2010-12-29 23:18:49 UTC (rev 4455) @@ -1,10 +1,10 @@ <?php /* $Id$*/ -/*DBVersion is compared against the value for config.confvalue WHERE confname=DBUpdateNumber in the database - * this value is saved in the $_SESSION['DBUpdateNumber'] when includes/GetConfig.php is run - * if DBUpdateNumber is < DBVersion then */ +/*Version is compared against the value for config.confvalue WHERE confname=VersionNumber in the database + * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run + * if VersionNumber is < $Version then the DB update script is run */ -$DBVersion=1; //must update manually every time there is a DB change +$Version='4.00'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); if (!isset($_SESSION['DatabaseName'])){ Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2010-12-29 09:53:54 UTC (rev 4454) +++ trunk/includes/GetConfig.php 2010-12-29 23:18:49 UTC (rev 4455) @@ -31,9 +31,9 @@ $_SESSION['PageSecurity'][$myrow['script']]=$myrow['pagesecurity']; } - if (!isset($_SESSION['DBUpdateNumber'])){ // the config record for DBUpdateNumber is not yet added - $_SESSION['DBUpdateNumber']=-1; - header('Location: UpgradeDatabase.php'); //divert to the db upgrade if the DBUpdateNumber is not in the config table + if (!isset($_SESSION['VersionNumber'])){ // the config record for VersionNumber is not yet added + $_SESSION['VersionNumber']=-1; + header('Location: UpgradeDatabase.php'); //divert to the db upgrade if the VersionNumber is not in the config table } /* Also reads all the company data set up in the company record and returns an array */ Modified: trunk/includes/footer.inc =================================================================== --- trunk/includes/footer.inc 2010-12-29 09:53:54 UTC (rev 4454) +++ trunk/includes/footer.inc 2010-12-29 23:18:49 UTC (rev 4455) @@ -12,7 +12,6 @@ setlocale(LC_ALL,$_SESSION['Language']); if (!isset($DefaultClock)) { include('config.php'); - $Version=$_SESSION['VersionNumber']; } echo '<p style="text-align:right">'.(strftime('%A')).', '.(date($_SESSION['DefaultDateFormat']).' | '.(strftime(($DefaultClock==12) ? '%I:%M %p' : '%H:%M'))).'</p>'; @@ -26,7 +25,7 @@ echo '</td></tr>'; - echo '<tr><td class="footer">webERP v' . $Version . ' ' . _('Copyright') . ' © weberp.org - '.date('Y').'</td></tr>'; + echo '<tr><td class="footer">webERP v' . $_SESSION['VersionNumber'] . ' ' . _('Copyright') . ' © weberp.org - '.date('Y').'</td></tr>'; if(http_file_exists('http://sflogo.sourceforge.net/sflogo.php')) { echo '<tr><td class="footer"><a href="https://sourceforge.net/projects/web-erp"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=70949&type=12" width="120" height="30" border="0" alt="Get webERP web-based ERP Accounting at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a></td></tr>'; @@ -36,5 +35,4 @@ echo '</body>'; echo '</html>'; - ?> \ No newline at end of file Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-29 09:53:54 UTC (rev 4454) +++ trunk/includes/session.inc 2010-12-29 23:18:49 UTC (rev 4455) @@ -121,8 +121,8 @@ */ $PageSecurity = $_SESSION['PageSecurity'][basename($_SERVER['SCRIPT_NAME'])]; } - -if (($DBVersion>$_SESSION['DBUpdateNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { +/*If the Code $Version - held in ConnectDB.inc is > than the Database VersionNumber held in config table then do upgrades */ +if (($Version>$_SESSION['VersionNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { header('Location: UpgradeDatabase.php'); } Added: trunk/sql/mysql/upgrade2.7-2.8.sql =================================================================== --- trunk/sql/mysql/upgrade2.7-2.8.sql (rev 0) +++ trunk/sql/mysql/upgrade2.7-2.8.sql 2010-12-29 23:18:49 UTC (rev 4455) @@ -0,0 +1,310 @@ +begin; + +ALTER TABLE Locations ADD TaxAuthority tinyint(4) NOT NULL default 1; + +ALTER TABLE StockMaster ADD TaxLevel tinyint(4) NOT NULL default 1; + +CREATE TABLE TaxAuthLevels ( + TaxAuthority tinyint NOT NULL default '1', + DispatchTaxAuthority tinyint NOT NULL default '1', + Level tinyint NOT NULL default '0', + TaxRate double NOT NULL default '0', + PRIMARY KEY (TaxAuthority,DispatchTaxAuthority,Level), + KEY (TaxAuthority), + KEY (DispatchTaxAuthority) +) TYPE=Innodb; + +INSERT INTO TaxAuthLevels VALUES (1, 1, 1, 0.1); +INSERT INTO TaxAuthLevels VALUES (1, 1, 2, 0); + +ALTER TABLE TaxAuthorities DROP COLUMN Rate; +ALTER TABLE TaxAuthorities CHANGE TaxID TaxID tinyint(4) NOT NULL default '0'; + + +ALTER TABLE StockMoves ADD COLUMN TaxRate float NOT NULL default 0; +ALTER TABLE DebtorTrans ADD COLUMN EDISent tinyint(4) NOT NULL default 0; +ALTER TABLE DebtorTrans ADD INDEX(`EDISent`); + +ALTER TABLE CustBranch ADD CustBranchCode VARCHAR(30) NOT NULL default ''; + +ALTER TABLE WWW_Users ADD COLUMN Blocked tinyint(4) NOT NULL default 0; + +ALTER TABLE DebtorsMaster ADD EDIInvoices tinyint(4) NOT NULL default '0'; +ALTER TABLE DebtorsMaster ADD EDIOrders tinyint(4) NOT NULL default '0'; +ALTER TABLE DebtorsMaster ADD EDIReference varchar(20) NOT NULL default ''; +ALTER TABLE DebtorsMaster ADD EDITransport varchar(5) NOT NULL default 'email'; +ALTER TABLE DebtorsMaster ADD EDIAddress varchar(50) NOT NULL default ''; +ALTER TABLE DebtorsMaster ADD EDIServerUser varchar(20) NOT NULL default ''; +ALTER TABLE DebtorsMaster ADD EDIServerPwd varchar(20) NOT NULL default ''; +ALTER TABLE DebtorsMaster ADD INDEX (EDIInvoices); +ALTER TABLE DebtorsMaster ADD INDEX (EDIOrders); + +CREATE TABLE EDIItemMapping ( + SuppOrCust varchar(4) NOT NULL default '', + PartnerCode varchar(10) NOT NULL default '', + StockID varchar(20) NOT NULL default '', + PartnerStockID varchar(50) NOT NULL default '', + PRIMARY KEY (SuppOrCust,PartnerCode,StockID), + KEY PartnerCode (PartnerCode), + KEY StockID (StockID), + KEY PartnerStockID (PartnerStockID), + KEY SuppOrCust (SuppOrCust) +) TYPE=Innodb; + +CREATE TABLE EDIMessageFormat ( + PartnerCode varchar(10) NOT NULL default '', + MessageType varchar(6) NOT NULL default '', + Section varchar(7) NOT NULL default '', + SequenceNo int(11) NOT NULL default '0', + LineText varchar(70) NOT NULL default '', + PRIMARY KEY (PartnerCode,MessageType,SequenceNo), + KEY Section (Section) +) TYPE=Innodb; + + +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 10, 'UNH+[EDITransNo]+INVOIC:D:96A:UN:EAN008\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 20, 'BGM+[InvOrCrd]+[TransNo]+[OrigOrDup]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 30, 'DTM+137:[TranDate]:102\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 60, 'RFF+ON:[OrderNo]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 70, 'NAD+BY+[CustBranchCode]::92\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 80, 'NAD+SU+[CompanyEDIReference]::91\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 90, 'NAD+UD++[BranchName]+[BranchStreet]+[BranchCity]+[BranchState]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 100, 'RFF+AMT:[TaxAuthorityRef]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 110, 'PAT+1++5:3:D:30\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 120, 'DTM+13:[DatePaymentDue]:102\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 130, 'TAX+7+GST+++:::10\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 150, 'MOA+124:[TaxTotal]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 160, 'LIN+[LineNumber]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 170, 'PIA+5+[StockID]:SA+[CustStockID]:IN\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 180, 'IMD+F++:::[ItemDescription]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Heading', 85, 'NAD+IV+[CustEDIReference]::9\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 200, 'QTY+47:[QtyInvoiced]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 220, 'MOA+128:[LineTotalExclTax]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 230, 'PRI+AAA:[UnitPrice]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 240, 'TAX+7+GST+++:::10\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Detail', 250, 'MOA+124:[LineTaxAmount]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 260, 'UNS+S\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 270, 'CNT+2:[NoLines]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 280, 'MOA+128:[TotalAmountExclTax]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 290, 'TAX+7+GST+++:::10\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 300, 'MOA+128:[TaxTotal]\''); +INSERT INTO EDIMessageFormat VALUES ('DEFAULT', 'INVOIC', 'Summary', 310, 'UNT+[NoSegments]+[EDITransNo]\''); + +ALTER TABLE AccountGroups Type=Innodb; +ALTER TABLE Areas Type=Innodb; +ALTER TABLE BOM Type=Innodb; +ALTER TABLE BankAccounts Type=Innodb; +ALTER TABLE BankTrans Type=Innodb; +ALTER TABLE Buckets Type=Innodb; +ALTER TABLE COGSGLPostings Type=Innodb; +ALTER TABLE ChartMaster Type=Innodb; +ALTER TABLE Companies Type=Innodb; +ALTER TABLE ContractBOM Type=Innodb; +ALTER TABLE ContractReqts Type=Innodb; +ALTER TABLE Contracts Type=Innodb; +ALTER TABLE Currencies Type=Innodb; +ALTER TABLE CustBranch Type=Innodb; +ALTER TABLE DebtorsMaster Type=Innodb; +ALTER TABLE DiscountMatrix Type=Innodb; +ALTER TABLE FreightCosts Type=Innodb; +ALTER TABLE HoldReasons Type=Innodb; +ALTER TABLE LastCostRollUp Type=Innodb; +ALTER TABLE PaymentTerms Type=Innodb; +ALTER TABLE Prices Type=Innodb; +ALTER TABLE PurchData Type=Innodb; +ALTER TABLE ReportColumns Type=Innodb; +ALTER TABLE ReportHeaders Type=Innodb; +ALTER TABLE SalesGLPostings Type=Innodb; +ALTER TABLE SalesTypes Type=Innodb; +ALTER TABLE Salesman Type=Innodb; +ALTER TABLE ShipmentCharges Type=Innodb; +ALTER TABLE Shippers Type=Innodb; +ALTER TABLE StockCategory Type=Innodb; +ALTER TABLE StockCheckFreeze Type=Innodb; +ALTER TABLE StockCounts Type=Innodb; +ALTER TABLE SupplierContacts Type=Innodb; +ALTER TABLE Suppliers Type=Innodb; +ALTER TABLE TaxAuthorities Type=Innodb; +ALTER TABLE WORequirements Type=Innodb; +ALTER TABLE WWW_Users Type=Innodb; +ALTER TABLE WorkCentres Type=Innodb; +ALTER TABLE Locations Type=Innodb; + + +ALTER TABLE TaxAuthLevels ADD FOREIGN KEY (TaxAuthority) REFERENCES TaxAuthorities (TaxID); +ALTER TABLE TaxAuthLevels ADD FOREIGN KEY (DispatchTaxAuthority) REFERENCES TaxAuthorities (TaxID); + +ALTER TABLE BOM ADD FOREIGN KEY (Parent) REFERENCES StockMaster (StockID); +ALTER TABLE BOM ADD FOREIGN KEY (Component) REFERENCES StockMaster (StockID); +ALTER TABLE BOM ADD FOREIGN KEY (WorkCentreAdded) REFERENCES WorkCentres (Code); +ALTER TABLE BOM ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); + +ALTER TABLE BankAccounts ADD FOREIGN KEY (AccountCode) REFERENCES ChartMaster (AccountCode); + + +ALTER TABLE BankTrans ADD FOREIGN KEY (Type) REFERENCES SysTypes (TypeID); +ALTER TABLE BankTrans ADD FOREIGN KEY (BankAct) REFERENCES BankAccounts (AccountCode); + + +ALTER TABLE Buckets ADD FOREIGN KEY (WorkCentre) REFERENCES WorkCentres (Code); + +ALTER TABLE ChartDetails ADD FOREIGN KEY (AccountCode) REFERENCES ChartMaster (AccountCode); +ALTER TABLE ChartDetails ADD FOREIGN KEY (Period) REFERENCES Periods (PeriodNo); + + +ALTER TABLE ChartMaster ADD FOREIGN KEY (Group_) REFERENCES AccountGroups (GroupName); + + +ALTER TABLE ContractBOM ADD INDEX (WorkCentreAdded); + +ALTER TABLE ContractBOM ADD FOREIGN KEY (WorkCentreAdded) REFERENCES WorkCentres (Code); + +ALTER TABLE ContractBOM ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); +ALTER TABLE ContractBOM ADD FOREIGN KEY (Component) REFERENCES StockMaster (StockID); + + +ALTER TABLE ContractReqts ADD FOREIGN KEY (Contract) REFERENCES Contracts (ContractRef); + + +ALTER TABLE `Contracts` DROP INDEX `DebtorNo` , DROP INDEX `BranchCode`, ADD INDEX `DebtorNo` ( `DebtorNo` , `BranchCode` ); + +ALTER TABLE Contracts ADD FOREIGN KEY (DebtorNo, BranchCode) REFERENCES CustBranch (DebtorNo, BranchCode); +ALTER TABLE Contracts ADD FOREIGN KEY (CategoryID) REFERENCES StockCategory (CategoryID); + +ALTER TABLE Contracts ADD FOREIGN KEY (TypeAbbrev) REFERENCES SalesTypes (TypeAbbrev); + + +ALTER TABLE CustAllocns ADD FOREIGN KEY (TransID_AllocFrom) REFERENCES DebtorTrans (ID); +ALTER TABLE CustAllocns ADD FOREIGN KEY (TransID_AllocTo) REFERENCES DebtorTrans (ID); + +ALTER TABLE CustBranch ADD FOREIGN KEY (DebtorNo) REFERENCES DebtorsMaster (DebtorNo); + +ALTER TABLE CustBranch ADD INDEX (Area); +ALTER TABLE CustBranch ADD FOREIGN KEY (Area) REFERENCES Areas (AreaCode); +ALTER TABLE CustBranch ADD FOREIGN KEY (Salesman) REFERENCES Salesman (SalesmanCode); + +ALTER TABLE `CustBranch` ADD INDEX ( `DefaultLocation` ); +ALTER TABLE `CustBranch` ADD INDEX ( `TaxAuthority` ); +ALTER TABLE `CustBranch` ADD INDEX ( `DefaultShipVia` ); + +ALTER TABLE CustBranch ADD FOREIGN KEY (DefaultLocation) REFERENCES Locations (LocCode); + +ALTER TABLE `CustBranch` CHANGE `TaxAuthority` `TaxAuthority` TINYINT DEFAULT '1' NOT NULL; + +ALTER TABLE CustBranch ADD FOREIGN KEY (TaxAuthority) REFERENCES TaxAuthorities (TaxID); +ALTER TABLE CustBranch ADD FOREIGN KEY (DefaultShipVia) REFERENCES Shippers (Shipper_ID); + +ALTER TABLE DebtorTrans ADD FOREIGN KEY (DebtorNo) REFERENCES CustBranch (DebtorNo); +ALTER TABLE DebtorTrans ADD FOREIGN KEY (Type) REFERENCES SysTypes (TypeID); +ALTER TABLE DebtorTrans ADD FOREIGN KEY (Prd) REFERENCES Periods (PeriodNo); + +ALTER TABLE DebtorsMaster ADD FOREIGN KEY (HoldReason) REFERENCES HoldReasons (ReasonCode); +ALTER TABLE `DebtorsMaster` CHANGE `CurrCode` `CurrCode` VARCHAR( 3 ) NOT NULL; + +ALTER TABLE DebtorsMaster ADD FOREIGN KEY (CurrCode) REFERENCES Currencies (CurrAbrev); +ALTER TABLE DebtorsMaster ADD FOREIGN KEY (PaymentTerms) REFERENCES PaymentTerms (TermsIndicator); +ALTER TABLE DebtorsMaster ADD FOREIGN KEY (SalesType) REFERENCES SalesTypes (TypeAbbrev); +ALTER TABLE DiscountMatrix ADD FOREIGN KEY (SalesType) REFERENCES SalesTypes (TypeAbbrev); +ALTER TABLE EDIItemMapping ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE FreightCosts ADD FOREIGN KEY (LocationFrom) REFERENCES Locations (LocCode); + +ALTER TABLE FreightCosts ADD FOREIGN KEY (ShipperID) REFERENCES Shippers (Shipper_ID); +ALTER TABLE GLTrans ADD FOREIGN KEY (Account) REFERENCES ChartMaster (AccountCode); +ALTER TABLE GLTrans ADD FOREIGN KEY (Type) REFERENCES SysTypes (TypeID); +ALTER TABLE GLTrans ADD FOREIGN KEY (PeriodNo) REFERENCES Periods (PeriodNo); +ALTER TABLE GRNs ADD FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID); +ALTER TABLE GRNs ADD FOREIGN KEY (PODetailItem) REFERENCES PurchOrderDetails (PODetailItem); + +ALTER TABLE LocStock ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); +ALTER TABLE LocStock ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); + +ALTER TABLE OrderDeliveryDifferencesLog ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); + +ALTER TABLE OrderDeliveryDifferencesLog ADD FOREIGN KEY (DebtorNo,Branch) REFERENCES CustBranch (DebtorNo,BranchCode); +ALTER TABLE `OrderDeliveryDifferencesLog` ADD INDEX ( `OrderNo` ); +ALTER TABLE OrderDeliveryDifferencesLog ADD FOREIGN KEY (OrderNo) REFERENCES SalesOrders (OrderNo); + +ALTER TABLE Prices ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE Prices ADD FOREIGN KEY (CurrAbrev) REFERENCES Currencies (CurrAbrev); +ALTER TABLE Prices ADD FOREIGN KEY (TypeAbbrev) REFERENCES SalesTypes (TypeAbbrev); + +ALTER TABLE PurchData ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE PurchData ADD FOREIGN KEY (SupplierNo) REFERENCES Suppliers (SupplierID); + +ALTER TABLE PurchOrderDetails ADD FOREIGN KEY (OrderNo) REFERENCES PurchOrders (OrderNo); + +ALTER TABLE PurchOrders ADD FOREIGN KEY (SupplierNo) REFERENCES Suppliers (SupplierID); +ALTER TABLE PurchOrders ADD FOREIGN KEY (IntoStockLocation) REFERENCES Locations (LocCode); + +ALTER TABLE ReportColumns ADD FOREIGN KEY (ReportID) REFERENCES ReportHeaders (ReportID); + +ALTER TABLE `SalesAnalysis` CHANGE `PeriodNo` `PeriodNo` SMALLINT( 6 ) DEFAULT '0' NOT NULL ; +ALTER TABLE SalesAnalysis ADD FOREIGN KEY (PeriodNo) REFERENCES Periods (PeriodNo); + +ALTER TABLE SalesOrderDetails ADD FOREIGN KEY (OrderNo) REFERENCES SalesOrders (OrderNo); +ALTER TABLE SalesOrderDetails ADD FOREIGN KEY (StkCode) REFERENCES StockMaster (StockID); + +ALTER TABLE `SalesOrders` DROP INDEX `BranchCode`; +ALTER TABLE `SalesOrders` ADD INDEX ( `BranchCode`,`DebtorNo` ); + +ALTER TABLE SalesOrders ADD FOREIGN KEY (BranchCode, DebtorNo) REFERENCES CustBranch (BranchCode, DebtorNo); +ALTER TABLE `SalesOrders` ADD INDEX ( `ShipVia` ); +ALTER TABLE SalesOrders ADD FOREIGN KEY (ShipVia) REFERENCES Shippers (Shipper_ID); +ALTER TABLE SalesOrders ADD FOREIGN KEY (FromStkLoc) REFERENCES Locations (LocCode); + +ALTER TABLE Shipments CHANGE ShiptRef ShiptRef INT(11) NOT NULL; +ALTER TABLE `ShipmentCharges` CHANGE `ShiptRef` `ShiptRef` INT( 11 ) NOT NULL; +ALTER TABLE ShipmentCharges ADD FOREIGN KEY (ShiptRef) REFERENCES Shipments (ShiptRef); +ALTER TABLE `ShipmentCharges` ADD INDEX ( `TransType` ); +ALTER TABLE ShipmentCharges ADD FOREIGN KEY (TransType) REFERENCES SysTypes (TypeID); +ALTER TABLE ShipmentCharges ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); + +ALTER TABLE `Shipments` ADD FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID); + +ALTER TABLE `StockCheckFreeze` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE `StockCheckFreeze` ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); + +ALTER TABLE `StockCounts` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE `StockCounts` ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); + +ALTER TABLE `StockMaster` ADD FOREIGN KEY (CategoryID) REFERENCES StockCategory (CategoryID); + +ALTER TABLE `StockMoves` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE `StockMoves` ADD FOREIGN KEY (Type) REFERENCES SysTypes (TypeID); +ALTER TABLE `StockMoves` ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); +ALTER TABLE `StockMoves` ADD FOREIGN KEY (Prd) REFERENCES Periods (PeriodNo); + +DELETE FROM SuppAllocs WHERE ID=4; + +ALTER TABLE SuppAllocs ADD FOREIGN KEY (TransID_AllocFrom) REFERENCES SuppTrans (ID); +ALTER TABLE `SuppAllocs` ADD FOREIGN KEY (TransID_AllocTo) REFERENCES SuppTrans (ID); + +ALTER TABLE `SuppTrans` ADD FOREIGN KEY (Type) REFERENCES SysTypes (TypeID); +ALTER TABLE `SuppTrans` ADD FOREIGN KEY (SupplierNo) REFERENCES Suppliers (SupplierID); +ALTER TABLE `SupplierContacts` ADD FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID); +ALTER TABLE `Suppliers` ADD FOREIGN KEY (CurrCode) REFERENCES Currencies (CurrAbrev); +ALTER TABLE `Suppliers` ADD FOREIGN KEY (PaymentTerms) REFERENCES PaymentTerms (TermsIndicator); + +ALTER TABLE `Suppliers` CHANGE `TaxAuthority` `TaxAuthority` TINYINT DEFAULT '1' NOT NULL; + +ALTER TABLE `Suppliers` ADD FOREIGN KEY (TaxAuthority) REFERENCES TaxAuthorities (TaxID); +ALTER TABLE `WOIssues` ADD FOREIGN KEY (WORef) REFERENCES WorksOrders (WORef); +ALTER TABLE `WOIssues` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE `WOIssues` ADD FOREIGN KEY (WorkCentre) REFERENCES WorkCentres (Code); + +ALTER TABLE `WORequirements` ADD FOREIGN KEY (WORef) REFERENCES WorksOrders (WORef); +ALTER TABLE `WORequirements` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE `WORequirements` ADD FOREIGN KEY (WrkCentre) REFERENCES WorkCentres (Code); + +ALTER TABLE `WWW_Users` ADD INDEX ( `DefaultLocation` ); + +ALTER TABLE `WWW_Users` ADD FOREIGN KEY (DefaultLocation) REFERENCES Locations (LocCode); + +ALTER TABLE `WorkCentres` ADD FOREIGN KEY (Location) REFERENCES Locations (LocCode); + +ALTER TABLE `WorksOrders` ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); +ALTER TABLE `WorksOrders` ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); + +ALTER TABLE DebtorsMaster ADD DiscountCode char(2) NOT NULL default ''; + +commit; \ No newline at end of file Added: trunk/sql/mysql/upgrade2.8-2.9.sql =================================================================== --- trunk/sql/mysql/upgrade2.8-2.9.sql (rev 0) +++ trunk/sql/mysql/upgrade2.8-2.9.sql 2010-12-29 23:18:49 UTC (rev 4455) @@ -0,0 +1,397 @@ +BEGIN; + +ALTER TABLE `BankAccounts` CHANGE `AccountCode` `AccountCode` INT( 11 ) NOT NULL; + +ALTER TABLE TaxAuthorities ADD INDEX (TaxGLCode); +ALTER TABLE TaxAuthorities ADD INDEX (PurchTaxGLAccount); + +ALTER TABLE TaxAuthorities ADD FOREIGN KEY ( TaxGLCode ) REFERENCES ChartMaster( AccountCode ); +ALTER TABLE TaxAuthorities ADD FOREIGN KEY ( PurchTaxGLAccount ) REFERENCES ChartMaster( AccountCode ); + +CREATE TABLE `EDI_ORDERS_Segs` ( + `ID` int(11) NOT NULL auto_increment, + `SegTag` char(3) NOT NULL default '', + `SegGroup` tinyint(4) NOT NULL default '0', + `MaxOccurr` tinyint(4) NOT NULL default '0', + PRIMARY KEY (`ID`), + KEY `SegTag` (`SegTag`), + KEY `SegNo` (`SegGroup`) +) TYPE=InnoDB; + +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('UNB', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('UNH', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('BGM', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '0', '35'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PAI', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALI', '0', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('FTX', '0', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RFF', '1', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '1', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('NAD', '2', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('LOC', '2', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('FII', '2', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RFF', '3', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('CTA', '5', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('COM', '5', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TAX', '6', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '6', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('CUX', '7', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '7', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PAT', '8', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '8', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PCD', '8', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '9', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TDT', '10', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('LOC', '11', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '11', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TOD', '12', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('LOC', '12', '2'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PAC', '13', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PCI', '14', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RFF', '14', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '14', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('GIN', '14', '10'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('EQD', '15', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALC', '19', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALI', '19', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '19', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QTY', '20', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '20', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PCD', '21', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '21', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '22', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '22', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RTE', '23', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '23', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TAX', '24', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '24', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('LIN', '28', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PIA', '28', '25'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('IMD', '28', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MEA', '28', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QTY', '28', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALI', '28', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '28', '35'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '28', '10'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('GIN', '28', '1000'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QVR', '28', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('FTX', '28', '99'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PRI', '32', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('CUX', '32', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '32', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RFF', '33', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '33', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PAC', '34', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QTY', '34', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PCI', '36', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RFF', '36', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '36', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('GIN', '36', '10'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('LOC', '37', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QTY', '37', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '37', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TAX', '38', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '38', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('NAD', '39', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('CTA', '42', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('COM', '42', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALC', '43', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('ALI', '43', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('DTM', '43', '5'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('QTY', '44', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '44', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('PCD', '45', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '45', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '46', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '46', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RTE', '47', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('RNG', '47', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TAX', '48', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '48', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('TDT', '49', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('UNS', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('MOA', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('CNT', '0', '1'); +INSERT INTO `EDI_ORDERS_Segs` (`SegTag` , `SegGroup` , `MaxOccurr` ) VALUES ('UNT', '0', '1'); + +CREATE TABLE `EDI_ORDERS_Seg_Groups` ( + `SegGroupNo` tinyint(4) NOT NULL default '0', + `MaxOccurr` int(4) NOT NULL default '0', + `ParentSegGroup` tinyint(4) NOT NULL default '0', + PRIMARY KEY (`SegGroupNo`) +) TYPE=InnoDB; + + +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (0, 1, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (1, 9999, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (2, 99, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (3, 99, 2); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (5, 5, 2); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (6, 5, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (7, 5, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (8, 10, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (9, 9999, 8); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (10, 10, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (11, 10, 10); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (12, 5, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (13, 99, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (14, 5, 13); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (15, 10, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (19, 99, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (20, 1, 19); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (21, 1, 19); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (22, 2, 19); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (23, 1, 19); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (24, 5, 19); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (28, 200000, 0); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (32, 25, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (33, 9999, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (34, 99, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (36, 5, 34); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (37, 9999, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (38, 10, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (39, 999, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (42, 5, 39); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (43, 99, 28); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (44, 1, 43); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (45, 1, 43); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (46, 2, 43); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (47, 1, 43); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (48, 5, 43); +INSERT INTO `EDI_ORDERS_Seg_Groups` VALUES (49, 10, 28); + + +CREATE TABLE `LocTransfers` ( + `Reference` int(11) NOT NULL default '0', + `StockID` varchar(20) NOT NULL default '', + `ShipQty` int(11) NOT NULL default '0', + `RecQty` int(11) NOT NULL default '0', + `ShipDate` date NOT NULL default '0000-00-00', + `RecDate` date NOT NULL default '0000-00-00', + `ShipLoc` varchar(7) NOT NULL default '', + `RecLoc` varchar(7) NOT NULL default '', + KEY `Reference` (`Reference`,`StockID`), + KEY `ShipLoc` (`ShipLoc`), + KEY `RecLoc` (`RecLoc`), + KEY `StockID` (`StockID`) +) TYPE=InnoDB COMMENT='Stores Transfers To Other Locations'; + +ALTER TABLE `LocTransfers` + ADD CONSTRAINT `LocTransfers_ibfk_3` FOREIGN KEY (`StockID`) REFERENCES `StockMaster` (`StockID`), + ADD CONSTRAINT `LocTransfers_ibfk_1` FOREIGN KEY (`ShipLoc`) REFERENCES `Locations` (`LocCode`), + ADD CONSTRAINT `LocTransfers_ibfk_2` FOREIGN KEY (`RecLoc`) REFERENCES `Locations` (`LocCode`); + +CREATE TABLE StockSerialItems ( + LocCode varchar(5) NOT NULL default '', + StockID varchar(20) NOT NULL default '', + SerialNo varchar(30) NOT NULL default '', + Quantity float NOT NULL default 0, + PRIMARY KEY (StockID, SerialNo, LocCode), + KEY (StockID), + KEY (LocCode) +) TYPE=InnoDB; + +CREATE TABLE StockSerialMoves ( + StkItmMoveNo int(11) NOT NULL auto_increment, + StockMoveNo int(11) NOT NULL default '0', + StockID varchar(20) NOT NULL default '', + SerialNo varchar(30) NOT NULL default '', + MoveQty float NOT NULL default '0', + PRIMARY KEY (StkItmMoveNo), + KEY StockMoveNo (StockMoveNo), + KEY StockID_SN (StockID, SerialNo) +) TYPE=InnoDB; + +ALTER TABLE StockSerialMoves ADD FOREIGN KEY (StockMoveNo) REFERENCES StockMoves (StkMoveNo); +ALTER TABLE StockSerialItems ADD FOREIGN KEY (StockID) REFERENCES StockMaster (StockID); +ALTER TABLE StockSerialItems ADD FOREIGN KEY (LocCode) REFERENCES Locations (LocCode); +ALTER TABLE StockSerialMoves ADD FOREIGN KEY (StockID, SerialNo) REFERENCES StockSerialItems (StockID, SerialNo); + +ALTER TABLE `StockMaster` ADD `Serialised` TINYINT DEFAULT '0' NOT NULL ; +ALTER TABLE `StockMaster` ADD `DecimalPlaces` TINYINT DEFAULT '0' NOT NULL ; +ALTER TABLE `StockMoves` DROP `Bundle`; + +CREATE TABLE `Help` ( + ID INT NOT NULL AUTO_INCREMENT, + PageID SMALLINT NOT NULL, + Narrative TEXT NOT NULL, + HelpType CHAR NOT NULL DEFAULT 'U', + PRIMARY KEY (`ID`), + INDEX (`PageID`), + INDEX (`HelpType`) +)TYPE=InnoDB COMMENT='Context Sensitive Help Narrative'; + +CREATE TABLE Scripts ( + PageID smallint(4) NOT NULL default '0', + FileName varchar(50) NOT NULL default '', + PageDescription text NOT NULL, + PRIMARY KEY (PageID), + KEY FileName (FileName) +) TYPE=InnoDB COMMENT='Index of all scripts'; + + +ALTER TABLE Help ADD FOREIGN KEY (PageID) REFERENCES Scripts (PageID); + +INSERT INTO Scripts VALUES (1, 'AccountGroups.php', 'Defines the groupings of general ledger accounts'); +INSERT INTO Scripts VALUES (2, 'AgedDebtors.php', 'Lists customer account balances in detail or summary in selected currency'); +INSERT INTO Scripts VALUES (3, 'AgedSuppliers.php', 'Lists supplier account balances in detail or summary in selected currency'); +INSERT INTO Scripts VALUES (4, 'Areas.php', 'Defines the sales areas - all customers must belong to a sales area for the purposes of sales analysis'); +INSERT INTO Scripts VALUES (5, 'BOMInquiry.php', 'Displays the bill of material with cost information'); +INSERT INTO Scripts VALUES (6, 'BOMListing.php', 'Lists the bills of material for a selected range of items'); +INSERT INTO Scripts VALUES (7, 'BOMs.php', 'Administers the bills of material for a selected item'); +INSERT INTO Scripts VALUES (8, 'BankAccounts.php', 'Defines the general ledger code for bank accounts and specifies that bank transactions be created for these accounts for the purposes of reconciliation'); +INSERT INTO Scripts VALUES (9, 'BankMatching.php', 'Allows payments and receipts to be matched off against bank statements'); +INSERT INTO Scripts VALUES (10, 'BankReconciliation.php', 'Displays the bank reconciliation for a selected bank account'); +INSERT INTO Scripts VALUES (11, 'COGSGLPostings.php', 'Defines the general ledger account to be used for cost of sales entries'); +INSERT INTO Scripts VALUES (12, 'CompanyPreferences.php', 'Defines the settings applicable for the company, including name, address, tax authority reference, whether GL integration used etc.'); +INSERT INTO Scripts VALUES (13, 'ConfirmDispatchControlled_Invoice.php', 'Specifies the batch references/serial numbers of items dispatched that are being invoiced'); +INSERT INTO Scripts VALUES (14, 'ConfirmDispatch_Invoice.php', 'Creates sales invoices from entered sales orders based on the quantities dispatched that can be modified'); +INSERT INTO Scripts VALUES (15, 'CreditItemsControlled.php', 'Specifies the batch references/serial numbers of items being credited back into stock'); +INSERT INTO Scripts VALUES (16, 'CreditStatus.php', 'Defines the credit status records. Each customer account is given a credit status from this table. Some credit status records can prohibit invoicing and new orders being entered.'); +INSERT INTO Scripts VALUES (17, 'Credit_Invoice.php', 'Creates a credit note based on the details of an existing invoice'); +INSERT INTO Scripts VALUES (18, 'Currencies.php', 'Defines the currencies available. Each customer and supplier must be defined as transacting in one of the currencies defined here.'); +INSERT INTO Scripts VALUES (19, 'CustEDISetup.php', 'Allows the set up the customer specified EDI parameters for server, email or ftp.'); +INSERT INTO Scripts VALUES (20, 'CustWhereAlloc.php', 'Shows to which invoices a receipt was allocated to'); +INSERT INTO Scripts VALUES (21, 'CustomerAllocations.php', 'Allows customer receipts and credit notes to be allocated to sales invoices'); +INSERT INTO Scripts VALUES (22, 'CustomerBranches.php', 'Defines the details of customer branches such as delivery address and contact details - also sales area, representative etc'); +INSERT INTO Scripts VALUES (23, 'CustomerInquiry.php', 'Shows the customers account transactions with balances outstanding, links available to drill down to invoice/credit note or email invoices/credit notes'); +INSERT INTO Scripts VALUES (24, 'CustomerReceipt.php', 'Entry of both customer receipts against accounts receivable and also general ledger or nominal receipts'); +INSERT INTO Scripts VALUES (25, 'CustomerTransInquiry.php', 'Lists in html the sequence of customer transactions, invoices, credit notes or receipts by a user entered date range'); +INSERT INTO Scripts VALUES (26, 'Customers.php', 'Defines the setup of a customer account, including payment terms, billing address, credit status, currency etc'); +INSERT INTO Scripts VALUES (27, 'DeliveryDetails.php', 'Used during order entry to allow the entry of delivery addresses other than the defaulted branch delivery address and information about carrier/shipping method etc'); +INSERT INTO Scripts VALUES (28, 'DiscountCategories.php', 'Defines the items belonging to a discount category. Discount Categories are used to allow discounts based on quantities across a range of producs'); +INSERT INTO Scripts VALUES (29, 'DiscountMatrix.php', 'Defines the rates of discount applicable to discount categories and the customer groupings to which the rates are to apply'); +INSERT INTO Scripts VALUES (30, 'EDIMessageFormat.php', 'Specifies the EDI message format used by a customer - administrator use only.'); +INSERT INTO Scripts VALUES (31, 'EDIProcessOrders.php', 'Processes incoming EDI orders into sales orders'); +INSERT INTO Scripts VALUES (32, 'EDISendInvoices.php', 'Processes invoiced EDI customer invoices into EDI messages and sends using the customers preferred method either ftp or email attachments.'); +INSERT INTO Scripts VALUES (33, 'EmailCustTrans.php', 'Emails selected invoice or credit to the customer'); +INSERT INTO Scripts VALUES (34, 'FTP_RadioBeacon.php', 'FTPs sales orders for dispatch to a radio beacon software enabled warehouse dispatching facility'); +INSERT INTO Scripts VALUES (35, 'FreightCosts.php', 'Defines the setup of the freight cost using different shipping methods to different destinations. The system can use this information to calculate applicable freight if the items are defined with the correct kgs and cubic volume'); +INSERT INTO Scripts VALUES (36, 'GLAccountInquiry.php', 'Shows the general ledger transactions for a specified account over a specified range of periods'); +INSERT INTO Scripts VALUES (37, 'GLAccounts.php', 'Defines the general ledger accounts'); +INSERT INTO Scripts VALUES (38, 'GLBalanceSheet.php', 'Shows the balance sheet for the company as at a specified date'); +INSERT INTO Scripts VALUES (39, 'GLCodesInquiry.php', 'Shows the list of general ledger codes defined with account names and groupings'); +INSERT INTO Scripts VALUES (40, 'GLJournal.php', 'Entry of general ledger journals, periods are calculated based on the date entered here'); +INSERT INTO Scripts VALUES (41, 'GLProfit_Loss.php', 'Shows the profit and loss of the company for the range of periods entered'); +INSERT INTO Scripts VALUES (42, 'GLTransInquiry.php', 'Shows the general ledger journal created for the sub ledger transaction specified'); +INSERT INTO Scripts VALUES (43, 'GLTrialBalance.php', 'Shows the trial balance for the month and the for the period selected together with the budgeted trial balances'); +INSERT INTO Scripts VALUES (44, 'GoodsReceived.php', 'Entry of items received against purchase orders'); +INSERT INTO Scripts VALUES (45, 'GoodsReceivedControlled.php', 'Entry of the serial numbers or batch references for controlled items received against purchase orders'); +INSERT INTO Scripts VALUES (46, 'InventoryPlanning.php', 'Creates a pdf report showing the last 4 months use of items including as a component of assemblies together with stock quantity on hand, current demand for the item and current quantity on sales order.'); +INSERT INTO Scripts VALUES (47, 'InventoryValuation.php', 'Creates a pdf report showing the value of stock at standard cost for a range of product categories selected'); +INSERT INTO Scripts VALUES (48, 'Locations.php', 'Defines the inventory stocking locations or warehouses'); +INSERT INTO Scripts VALUES (49, 'Logout.php', 'Shows when the user logs out of webERP'); +INSERT INTO Scripts VALUES (50, 'MailInventoryValuation.php', 'Meant to be run as a scheduled process to email the stock valuation off to a specified person. Creates the same stock valuation report as InventoryValuation.php'); +INSERT INTO Scripts VALUES (51, 'MailSalesReport.php', 'Creates a sales analysis pdf report and emails it to the defined receipients. This script is meant to be run as a scheduled process for daily or weekly sales reporting'); +INSERT INTO Scripts VALUES (52, 'MailSalesReport_csv.php', 'Creates a sales analysis report as a comma separated values (csv) file and emails it to the defined receipients. This script is meant to be run as a scheduled process for daily or weekly sales reporting'); +INSERT INTO Scripts VALUES (53, 'OrderDetails.php', 'Shows the detail of a sales order'); +INSERT INTO Scripts VALUES (54, 'OutstandingGRNs.php', 'Creates a pdf showing all GRNs for which there has been no purchase invoice matched off against.'); +INSERT INTO Scripts VALUES (55, 'PDFBankingSummary.php', 'Creates a pdf showing the amounts entered as receipts on a specified date together with references for the purposes of banking'); +INSERT INTO Scripts VALUES (56, 'PDFChequeListing.php', 'Creates a pdf showing all payments that have been made from a specified bank account over a specified period. This can be emailed to an email account defined in config.php - ie a financial controller'); +INSERT INTO Scripts VALUES (57, 'PDFDeliveryDifferences.php', 'Creates a pdf report listing the delivery differences from what the customer requested as recorded in the order entry. The report calculates a percentage of order fill based on the number of orders filled in full on time'); +INSERT INTO Scripts VALUES (58, 'PDFLowGP.php', 'Creates a pdf report showing the low gross profit sales made in the selected date range. The percentage of gp deemed acceptable can also be entered'); +INSERT INTO Scripts VALUES (59, 'PDFPriceList.php', 'Creates a pdf of the price list applicable to a given sales type and customer. Also allows the listing of prices specific to a customer'); +INSERT INTO Scripts VALUES (60, 'PDFStockCheckComparison.php', 'Creates a pdf comparing the quantites entered as counted at a given range of locations against the quantity stored as on hand as at the time a stock check was initiated.'); +INSERT INTO Scripts VALUES (61, 'PDFStockLocTransfer.php', 'Creates a stock location transfer docket for the selected location transfer reference number'); +INSERT INTO Scripts VALUES (62, 'PO_Chk_ShiptRef_JobRef.php', 'Checks the Shipment of JobReference number is correct during AP invoice entry'); +INSERT INTO Scripts VALUES (63, 'PO_Header.php', 'Entry of a purchase order header record - date, references buyer etc'); +INSERT INTO Scripts VALUES (64, 'PO_Items.php', 'Entry of a purchase order items - allows entry of items with lookup of currency cost from Purchasing Data previously entered also allows entry of nominal items against a general ledger code if the AP is integrated to the GL'); +INSERT INTO Scripts VALUES (65, 'PO_OrderDetails.php', 'Purchase order inquiry shows the quantity received and invoiced of purchase order items as well as the header information'); +INSERT INTO Scripts VALUES (66, 'PO_PDFPurchOrder.php', 'Creates a pdf of the selected purchase order for printing or email to one of the supplier contacts entered'); +INSERT INTO Scripts VALUES (67, 'PO_SelectOSPurchOrder.php', 'Shows the outstanding purchase orders for selecting with links to receive or modify the purchase order header and items'); +INSERT INTO Scripts VALUES (68, 'PO_SelectPurchOrder.php', 'Allows selection of any purchase order with links to the inquiry'); +INSERT INTO Scripts VALUES (69, 'PaymentTerms.php', 'Defines the payment terms records, these can be expressed as either a number of days credit or a day in the following month. All customers and suppliers must have a corresponding payment term recorded against their account'); +INSERT INTO Scripts VALUES (70, 'Payments.php', 'Entry of bank account payments either against an AP account or a general ledger payment - if the AP-GL link in company preferences is set'); +INSERT INTO Scripts VALUES (71, 'PeriodsInquiry.php', 'Shows a list of all the system defined periods'); +INSERT INTO Scripts VALUES (72, 'Prices.php', 'Entry of prices for a selected item also allows selection of sales type and currency for the price'); +INSERT INTO Scripts VALUES (73, 'Prices_Customer.php', 'Entry of prices for a selected item and selected customer/branch. The currency and sales type is defaulted from the customer\'s record'); +INSERT INTO Scripts VALUES (74, 'PrintCustOrder.php', 'Creates a pdf of the dispatch note - by default this is expected to be on two part pre-printed stationery to allow pickers to note discrepancies for the confirmer to update the dispatch at the time of invoicing'); +INSERT INTO Scripts VALUES (75, 'PrintCustOrder_generic.php', 'Creates two copies of a laser printed dispatch note - both copies need to be written on by the pickers with any discrepancies to advise customer of any shortfall and on the office copy to ensure the correct quantites are invoiced'); +INSERT INTO Scripts VALUES (76, 'PrintCustStatements.php', 'Creates a pdf for the customer statements in the selected range'); +INSERT INTO Scripts VALUES (77, 'PrintCustTrans.php', 'Creates either a html invoice or credit note or a pdf. A range of invoices or credit notes can be selected also.'); +INSERT INTO Scripts VALUES (78, 'PurchData.php', 'Entry of supplier purchasing data, the suppliers part reference and the suppliers currency cost of the item'); +INSERT INTO Scripts VALUES (79, 'ReverseGRN.php', 'Reverses the entry of goods received - creating stock movements back out and necessary general ledger journals to effect the reversal'); +INSERT INTO Scripts VALUES (80, 'SalesAnalReptCols.php', 'Entry of the definition of a sales analysis report\'s columns.'); +INSERT INTO Scripts VALUES (81, 'SalesAnalRepts.php', 'Entry of the definition of a sales analysis report headers'); +INSERT INTO Scripts VALUES (82, 'SalesAnalysis_UserDefined.php', 'Creates a pdf of a selected user defined sales analysis report'); +INSERT INTO Scripts VALUES (83, 'SalesGLPostings.php', 'Defines the general ledger accounts used to post sales to based on product categories and sales areas'); +INSERT INTO Scripts VALUES (84, 'SalesPeople.php', 'Defines the sales people of the business'); +INSERT INTO Scripts VALUES (85, 'SalesTypes.php', 'Defines the sales types - prices are held against sales types they can be considered price lists. Sales analysis records are held by sales type too.'); +INSERT INTO Scripts VALUES (86, 'SelectCompletedOrder.php', 'Allows the selection of completed sales orders for inquiries - choices to select by item code or customer'); +INSERT INTO Scripts VALUES (87, 'SelectCreditItems.php', 'Entry of credit notes from scratch, selecting the items in either quick entry mode or searching for them manually'); +INSERT INTO Scripts VALUES (88, 'SelectCustomer.php', 'Selection of customer - from where all customer related maintenance, transactions and inquiries start'); +INSERT INTO Scripts VALUES (89, 'SelectGLAccount.php', 'Selection of general ledger account from where all general ledger account maintenance, or inquiries are initiated'); +INSERT INTO Scripts VALUES (90, 'SelectOrderItems.php', 'Entry of sales order items with both quick entry and part search functions'); +INSERT INTO Scripts VALUES (91, 'SelectProduct.php', 'Selection of items. All item maintenance, transactions and inquiries start with this script'); +INSERT INTO Scripts VALUES (92, 'SelectSalesOrder.php', 'Selects a sales order irrespective of completed or not for inquiries'); +INSERT INTO Scripts VALUES (93, 'SelectSupplier.php', 'Selects a supplier. A supplier is required to be selected before any AP transactions and before any maintenance or inquiry of the supplier'); +INSERT INTO Scripts VALUES (94, 'ShipmentCosting.php', 'Shows the costing of a shipment with all the items invoice values and any shipment costs apportioned. Updating the shipment has an option to update standard costs of all items on the shipment and create any general ledger variance journals'); +INSERT INTO Scripts VALUES (95, 'Shipments.php', 'Entry of shipments from outstanding purchase orders for a selected supplier - changes in the delivery date will cascade into the different purchase orders on the shipment'); +INSERT INTO Scripts VALUES (96, 'Shippers.php', 'Defines the shipping methods available. Each customer branch has a default shipping method associated with it which must match a record from this table'); +INSERT INTO Scripts VALUES (97, 'Shipt_Select.php', 'Selection of a shipment for displaying and modification or updating'); +INSERT INTO Scripts VALUES (98, 'ShiptsList.php', 'Shows a list of all the open shipments for a selected supplier. Linked from POItems.php'); +INSERT INTO Scripts VALUES (99, 'SpecialOrder.php', 'Allows for a sales order to be created and an indent order to be created on a supplier for a one off item that may never be purchased again. A dummy part is created based on the description and cost details given.'); +INSERT INTO Scripts VALUES (100, 'StockAdjustments.php', 'Entry of quantity corrections to stocks in a selected location.'); +INSERT INTO Scripts VALUES (101, 'StockAdjustmentsControlled.php', 'Entry of batch references or serial numbers on controlled stock items being adjusted'); +INSERT INTO Scripts VALUES (102, 'StockCategories.php', 'Defines the stock categories. All items must refer to one of these categories. The category record also allows the specification of the general ledger codes where stock items are to be posted - the balance sheet account and the profit and loss effect of any adjustments and the profit and loss effect of any price variances'); +INSERT INTO Scripts VALUES (103, 'StockCheck.php', 'Allows creation of a stock check file - copying the current quantites in stock for later comparison to the entered counts. Also produces a pdf for the count sheets.'); +INSERT INTO Scripts VALUES (104, 'StockCostUpdate.php', 'Allows update of the standard cost of items producing general ledger journals if the company preferences stock GL interface is active'); +INSERT INTO Scripts VALUES (105, 'StockCounts.php', 'Allows entry of stock counts'); +INSERT INTO Scripts VALUES (106, 'StockLocMovements.php', 'Inquiry shows the Movements of all stock items for a specified location'); +INSERT INTO Scripts VALUES (107, 'StockLocQties_csv.php', 'Makes a comma separated values (CSV)file of the stock item codes and quantities'); +INSERT INTO Scripts VALUES (108, 'StockLocStatus.php', 'Shows the stock on hand together with outstanding sales orders and outstanding purchase orders by stock location for all items in the selected stock category'); +INSERT INTO Scripts VALUES (109, 'StockLocTransfer.php', 'Entry of a bulk stock location transfer for many parts from one location to another.'); +INSERT INTO Scripts VALUES (110, 'StockLocTransferReceive.php', 'Effects the transfer and creates the stock movements for a bulk stock location transfer initiated from StockLocTransfer.php'); +INSERT INTO Scripts VALUES (111, 'StockMovements.php', 'Shows a list of all the stock movements for a selected item and stock location including the price at which they were sold in local currency and the price at which they were purchased for in local currency'); +INSERT INTO Scripts VALUES (112, 'StockQties_csv.php', 'Makes a comma separated values (CSV)file of the stock item codes and quantities'); +INSERT INTO Scripts VALUES (113, 'StockReorderLevel.php', 'Entry and review of the re-order level of items by stocking location'); +INSERT INTO Scripts VALUES (114, 'StockSerialItems.php', 'Shows a list of the serial numbers or the batch references and quantities of controlled items. This inquiry is linked from the stock status inquiry'); +INSERT INTO Scripts VALUES (115, 'StockStatus.php', 'Shows the stock on hand together with outstanding sales orders and outstanding purchase orders by stock location for a selected part. Has a link to show the serial numbers in stock at the location selected if the item is controlled'); +INSERT INTO Scripts VALUES (116, 'StockTransferControlled.php', 'Entry of serial numbers/batch references for controlled items being received on a stock transfer. The script is used by both bulk transfers and point to point transfers'); +INSERT INTO Scripts VALUES (117, 'StockTransfers.php', 'Entry of point to point stock location transfers of a single part'); +INSERT INTO Scripts VALUES (118, 'StockUsage.php', 'Inquiry showing the quantity of stock used by period calculated from the sum of the stock movements over that period - by item and stock location. Also available over all locations'); +INSERT INTO Scripts VALUES (119, 'Stocks.php', 'Defines an item - maintenance and addition of new parts'); +INSERT INTO Scripts VALUES (120, 'SuppCreditGRNs.php', 'Entry of a supplier credit notes (debit notes) against existing GRN which have already been matched in full or in part'); +INSERT INTO Scripts VALUES (121, 'SuppInvGRNs.php', 'Entry of supplier invoices against goods received'); +INSERT INTO Scripts VALUES (122, 'SuppPaymentRun.php', 'Automatic creation of payment records based on calculated amounts due from AP invoices entered'); +INSERT INTO Scripts VALUES (123, 'SuppShiptChgs.php', 'Entry of supplier invoices against shipments as charges against a shipment'); +INSERT INTO Scripts VALUES (124, 'SuppTransGLAnalysis.php', 'Entry of supplier invoices against general ledger codes'); +INSERT INTO Script... [truncated message content] |
From: <dai...@us...> - 2010-12-29 09:54:03
|
Revision: 4454 http://web-erp.svn.sourceforge.net/web-erp/?rev=4454&view=rev Author: daintree Date: 2010-12-29 09:53:54 +0000 (Wed, 29 Dec 2010) Log Message: ----------- upgrade script modification to use single script between version in plain ol SQL Modified Paths: -------------- trunk/InventoryPlanning.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/SelectProduct.php trunk/UpgradeDatabase.php trunk/Z_ChangeBranchCode.php trunk/config.distrib.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/GetConfig.php trunk/includes/session.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Removed Paths: ------------- trunk/sql/mysql/updates/ Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/InventoryPlanning.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -53,26 +53,26 @@ need QOH, QOO, QDem, Sales Mth -1, Sales Mth -2, Sales Mth -3, Sales Mth -4*/ if ($_POST['Location']=='All'){ $SQL = "SELECT stockmaster.categoryid, - stockmaster.description, - stockcategory.categorydescription, - locstock.stockid, - SUM(locstock.quantity) AS qoh - FROM locstock, - stockmaster, - stockcategory - WHERE locstock.stockid=stockmaster.stockid - AND stockmaster.discontinued = 0 - AND stockmaster.categoryid=stockcategory.categoryid - AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') - AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' - AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' - GROUP BY stockmaster.categoryid, - stockmaster.description, - stockcategory.categorydescription, - locstock.stockid, - stockmaster.stockid - ORDER BY stockmaster.categoryid, - stockmaster.stockid"; + stockmaster.description, + stockcategory.categorydescription, + locstock.stockid, + SUM(locstock.quantity) AS qoh + FROM locstock, + stockmaster, + stockcategory + WHERE locstock.stockid=stockmaster.stockid + AND stockmaster.discontinued = 0 + AND stockmaster.categoryid=stockcategory.categoryid + AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') + AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + GROUP BY stockmaster.categoryid, + stockmaster.description, + stockcategory.categorydescription, + locstock.stockid, + stockmaster.stockid + ORDER BY stockmaster.categoryid, + stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.categoryid, locstock.stockid, @@ -261,34 +261,24 @@ } if ($_POST['Location']=='All'){ - $SQL = "SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) as qtyonorder - FROM purchorderdetails - LEFT JOIN purchorders - ON purchorderdetails.orderno = purchorders.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "' - AND purchorderdetails.completed = 0 - AND purchorders.status <> 'Cancelled' - AND purchorders.status <> 'Rejected' - AND purchorders.status <> 'Pending'"; + $SQL = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) as qtyonorder + FROM purchorderdetails INNER JOIN purchorders + ON purchorderdetails.orderno = purchorders.orderno + WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "' + AND purchorderdetails.completed = 0 + AND purchorders.status <> 'Cancelled' + AND purchorders.status <> 'Rejected' + AND purchorders.status <> 'Pending'"; } else { - $SQL = "SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) as qtyonorder - FROM purchorderdetails - LEFT JOIN purchorders - ON purchorderdetails.orderno = purchorders.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "' - AND purchorderdetails.completed = 0 - AND purchorders.intostocklocation= '" . $_POST['Location'] . "' - AND purchorders.status <> 'Cancelled' - AND purchorders.status <> 'Rejected' - AND purchorders.status <> 'Pending'"; + $SQL = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) as qtyonorder + FROM purchorderdetails INNER JOIN purchorders + ON purchorderdetails.orderno = purchorders.orderno + WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "' + AND purchorderdetails.completed = 0 + AND purchorders.intostocklocation= '" . $_POST['Location'] . "' + AND purchorders.status <> 'Cancelled' + AND purchorders.status <> 'Rejected' + AND purchorders.status <> 'Pending'"; } $DemandRow = DB_fetch_array($DemandResult); @@ -300,9 +290,9 @@ $title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('The purchase order quantities could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error'); - echo "<br /><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br />$SQL"; + echo '<br />' . $SQL; } include('includes/footer.inc'); exit; Modified: trunk/InventoryQuantities.php =================================================================== --- trunk/InventoryQuantities.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/InventoryQuantities.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -18,14 +18,14 @@ $line_height=12; $Xpos = $Left_Margin+1; - $wherecategory = " "; - $catdescription = " "; + $WhereCategory = " "; + $CatDescription = " "; if ($_POST['StockCat'] != 'All') { - $wherecategory = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' AND stockcategory.stocktype<>'A'"; + $WhereCategory = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "'"; $sql= "SELECT categoryid, categorydescription FROM stockcategory WHERE categoryid='" . $_POST['StockCat'] . "' "; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - $catdescription = $myrow[1]; + $CatDescription = $myrow[1]; } if ($_POST['Selection'] == 'All') { @@ -47,7 +47,7 @@ AND locstock.loccode=locations.loccode AND locstock.quantity <> 0 AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . " ORDER BY locstock.stockid,locstock.loccode"; + $WhereCategory . " ORDER BY locstock.stockid,locstock.loccode"; } else { // sql to only select parts in more than one location // The SELECT statement at the beginning of the WHERE clause limits the selection to @@ -73,7 +73,7 @@ AND locstock.loccode=locations.loccode AND locstock.quantity <> 0 AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . " ORDER BY locstock.stockid,locstock.loccode"; + $WhereCategory . " ORDER BY locstock.stockid,locstock.loccode"; } @@ -100,7 +100,7 @@ } PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$catdescription); + $Page_Width,$Right_Margin,$CatDescription); $FontSize=8; @@ -128,13 +128,13 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$catdescription); + $Right_Margin,$CatDescription); } } /*end while loop */ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$catdescription); + $Right_Margin,$CatDescription); } /*Print out the grand totals */ @@ -192,7 +192,7 @@ } /*end of else not PrintPDF */ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$catdescription) { + $Page_Width,$Right_Margin,$CatDescription) { /*PDF page header for Reorder Level report */ if ($PageNumber>1){ @@ -212,7 +212,7 @@ $YPos -= $line_height; $pdf->addTextWrap($Left_Margin,$YPos,50,$FontSize,_('Category')); $pdf->addTextWrap(95,$YPos,50,$FontSize,$_POST['StockCat']); - $pdf->addTextWrap(160,$YPos,150,$FontSize,$catdescription,'left'); + $pdf->addTextWrap(160,$YPos,150,$FontSize,$CatDescription,'left'); $YPos -=(2*$line_height); /*set up the headings */ Modified: trunk/InventoryValuation.php =================================================================== --- trunk/InventoryValuation.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/InventoryValuation.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -35,7 +35,6 @@ locstock WHERE stockmaster.stockid=locstock.stockid AND stockmaster.categoryid=stockcategory.categoryid - AND stockcategory.stocktype<>'A' GROUP BY stockmaster.categoryid, stockcategory.categorydescription, unitcost, @@ -68,7 +67,6 @@ AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND locstock.loccode = '" . $_POST['Location'] . "' - AND stockcategory.stocktype<>'A' ORDER BY stockmaster.categoryid, stockmaster.stockid"; } Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/ReorderLevel.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -21,8 +21,8 @@ $wherecategory = " "; $catdescription = " "; if ($_POST['StockCat'] != 'All') { - $wherecategory = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' AND stockcategory.stocktype<>'A'"; - $sql= "SELECT categoryid, categorydescription FROM stockcategory WHERE categoryid='" . $_POST['StockCat'] . "' "; + $wherecategory = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "'"; + $sql= "SELECT categoryid, categorydescription FROM stockcategory WHERE categoryid='" . $_POST['StockCat'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); $catdescription = $myrow[1]; @@ -33,25 +33,25 @@ } $sql = "SELECT locstock.stockid, - stockmaster.description, - locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - stockmaster.decimalplaces, - stockmaster.serialised, - stockmaster.controlled - FROM locstock, - stockmaster - LEFT JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid, - locations - WHERE locstock.stockid=stockmaster.stockid " . - $wherelocation . - "AND locstock.loccode=locations.loccode - AND locstock.reorderlevel > locstock.quantity - AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . " ORDER BY locstock.loccode,locstock.stockid"; + stockmaster.description, + locstock.loccode, + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + stockmaster.decimalplaces, + stockmaster.serialised, + stockmaster.controlled + FROM locstock, + stockmaster + LEFT JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid, + locations + WHERE locstock.stockid=stockmaster.stockid " . + $wherelocation . + "AND locstock.loccode=locations.loccode + AND locstock.reorderlevel > locstock.quantity + AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . + $wherecategory . " ORDER BY locstock.loccode,locstock.stockid"; $result = DB_query($sql,$db,'','',false,true); Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/ReorderLevelLocation.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -3,7 +3,7 @@ /* $Id$*/ // ReorderLevelLocation.php - Report of reorder level by category -//$PageSecurity = 2; +//$PageSecurity = 2; now comes from DB include('includes/session.inc'); @@ -181,14 +181,13 @@ echo '</select></td></tr>'; $SQL="SELECT categoryid, categorydescription - FROM stockcategory - WHERE stocktype<>'A' - ORDER BY categorydescription"; + FROM stockcategory + ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); echo '<tr><td>' . _('Category') . ':</td> - <td><select name="StockCat">'; + <td><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription']; Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/SelectProduct.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -29,10 +29,9 @@ } // Always show the search facilities $SQL = "SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype<>'A' - ORDER BY categorydescription"; + categorydescription + FROM stockcategory + ORDER BY categorydescription"; $result1 = DB_query($SQL, $db); if (DB_num_rows($result1) == 0) { echo '<p><font size=4 color=red>' . _('Problem Report') . ':</font><br />' . _('There are no stock categories currently defined please use the link below to set them up').'</p>'; @@ -50,20 +49,20 @@ $StockID = $_SESSION['SelectedStockItem']; } $result = DB_query("SELECT stockmaster.description, - stockmaster.mbflag, - stockcategory.stocktype, - stockmaster.units, - stockmaster.decimalplaces, - stockmaster.controlled, - stockmaster.serialised, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost, - stockmaster.discontinued, - stockmaster.eoq, - stockmaster.volume, - stockmaster.kgs - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockid='" . $StockID . "'", $db); + stockmaster.mbflag, + stockcategory.stocktype, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.controlled, + stockmaster.serialised, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost, + stockmaster.discontinued, + stockmaster.eoq, + stockmaster.volume, + stockmaster.kgs + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockid='" . $StockID . "'", $db); $myrow = DB_fetch_array($result); $Its_A_Kitset_Assembly_Or_Dummy = false; $Its_A_Dummy = false; @@ -113,20 +112,19 @@ if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { echo '<tr><th colspan="2">' . _('Sell Price') . ':</th><td class="select">'; $PriceResult = DB_query("SELECT typeabbrev, price FROM prices - WHERE currabrev ='" . $_SESSION['CompanyRecord']['currencydefault'] . "' - AND typeabbrev = '" . $_SESSION['DefaultPriceList'] . "' - AND debtorno='' - AND branchcode='' - AND stockid='" . $StockID . "'", $db); + WHERE currabrev ='" . $_SESSION['CompanyRecord']['currencydefault'] . "' + AND typeabbrev = '" . $_SESSION['DefaultPriceList'] . "' + AND debtorno='' + AND branchcode='' + AND stockid='" . $StockID . "'", $db); if ($myrow['mbflag'] == 'K' OR $myrow['mbflag'] == 'A') { - $CostResult = DB_query("SELECT SUM(bom.quantity* - (stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost)) AS cost - FROM bom INNER JOIN - stockmaster - ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $StockID . "' - AND bom.effectiveto > '" . Date("Y-m-d") . "' - AND bom.effectiveafter < '" . Date("Y-m-d") . "'", $db); + $CostResult = DB_query("SELECT SUM(bom.quantity * (stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost)) AS cost + FROM bom INNER JOIN + stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $StockID . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'", $db); $CostRow = DB_fetch_row($CostResult); $Cost = $CostRow[0]; } else { @@ -160,14 +158,13 @@ } } if ($myrow['mbflag'] == 'K' OR $myrow['mbflag'] == 'A') { - $CostResult = DB_query("SELECT SUM(bom.quantity* - (stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost)) AS cost - FROM bom INNER JOIN - stockmaster - ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $StockID . "' - AND bom.effectiveto > '" . Date("Y-m-d") . "' - AND bom.effectiveafter < '" . Date("Y-m-d") . "'", $db); + $CostResult = DB_query("SELECT SUM(bom.quantity * (stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost)) AS cost + FROM bom INNER JOIN + stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $StockID . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'", $db); $CostRow = DB_fetch_row($CostResult); $Cost = $CostRow[0]; } else { @@ -179,26 +176,26 @@ // Item Category Property mod: display the item properties echo '<table align="left">'; $CatValResult = DB_query("SELECT categoryid - FROM stockmaster - WHERE stockid='" . $StockID . "'", $db); + FROM stockmaster + WHERE stockid='" . $StockID . "'", $db); $CatValRow = DB_fetch_row($CatValResult); $CatValue = $CatValRow[0]; $sql = "SELECT stkcatpropid, - label, - controltype, - defaultvalue - FROM stockcatproperties - WHERE categoryid ='" . $CatValue . "' - AND reqatsalesorder =0 - ORDER BY stkcatpropid"; + label, + controltype, + defaultvalue + FROM stockcatproperties + WHERE categoryid ='" . $CatValue . "' + AND reqatsalesorder =0 + ORDER BY stkcatpropid"; $PropertiesResult = DB_query($sql, $db); $PropertyCounter = 0; $PropertyWidth = array(); while ($PropertyRow = DB_fetch_array($PropertiesResult)) { $PropValResult = DB_query("SELECT value - FROM stockitemproperties - WHERE stockid='" . $StockID . "' - AND stkcatpropid ='" . $PropertyRow['stkcatpropid']."'", $db); + FROM stockitemproperties + WHERE stockid='" . $StockID . "' + AND stkcatpropid ='" . $PropertyRow['stkcatpropid']."'", $db); $PropValRow = DB_fetch_row($PropValResult); $PropertyValue = $PropValRow[0]; echo '<tr><th align="right">' . $PropertyRow['label'] . ':</th>'; @@ -247,17 +244,15 @@ WHERE stockid = '" . $StockID . "'", $db); $QOHRow = DB_fetch_row($QOHResult); $QOH = number_format($QOHRow[0], $myrow['decimalplaces']); - $QOOSQL="SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) - FROM purchorders - LEFT JOIN purchorderdetails + $QOOSQL="SELECT SUM(purchorderdetails.quantityord -purchorderdetails.quantityrecd) AS QtyOnOrder + FROM purchorders INNER JOIN purchorderdetails ON purchorders.orderno=purchorderdetails.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid + AND purchorderdetails.itemcode=purchdata.stockid WHERE purchorderdetails.itemcode='" . $StockID . "' - AND (purchorders.status<>'Cancelled' - AND purchorders.status<>'Pending')"; + AND purchorderdetails.completed =0 + AND purchorders.status<>'Cancelled' + AND purchorders.status<>'Pending' + AND purchorders.status<>'Rejected'"; $QOOResult = DB_query($QOOSQL, $db); if (DB_num_rows($QOOResult) == 0) { $QOO = 0; @@ -267,10 +262,10 @@ } //Also the on work order quantities $sql = "SELECT SUM(woitems.qtyreqd-woitems.qtyrecd) AS qtywo - FROM woitems INNER JOIN workorders - ON woitems.wo=workorders.wo - WHERE workorders.closed=0 - AND woitems.stockid='" . $StockID . "'"; + FROM woitems INNER JOIN workorders + ON woitems.wo=workorders.wo + WHERE workorders.closed=0 + AND woitems.stockid='" . $StockID . "'"; $ErrMsg = _('The quantity on work orders for this product cannot be retrieved because'); $QOOResult = DB_query($sql, $db, $ErrMsg); if (DB_num_rows($QOOResult) == 1) { @@ -282,25 +277,25 @@ } $Demand = 0; $DemResult = DB_query("SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails INNER JOIN salesorders - ON salesorders.orderno = salesorderdetails.orderno - WHERE salesorderdetails.completed=0 - AND salesorders.quotation=0 - AND salesorderdetails.stkcode='" . $StockID . "'", $db); + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorderdetails.completed=0 + AND salesorders.quotation=0 + AND salesorderdetails.stkcode='" . $StockID . "'", $db); $DemRow = DB_fetch_row($DemResult); $Demand = $DemRow[0]; $DemAsComponentResult = DB_query("SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A' - AND salesorders.quotation=0", $db); + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A' + AND salesorders.quotation=0", $db); $DemAsComponentRow = DB_fetch_row($DemAsComponentResult); $Demand+= $DemAsComponentRow[0]; //Also the demand for the item as a component of works orders @@ -333,34 +328,30 @@ <th width="10%">' . _('Min Order Qty') . '</th> <th width="5%">' . _('Prefer') . '</th></tr>'; $SuppResult = DB_query("SELECT suppliers.suppname, - suppliers.currcode, - suppliers.supplierid, - purchdata.price, - purchdata.effectivefrom, - purchdata.leadtime, - purchdata.conversionfactor, - purchdata.minorderqty, - purchdata.preferred - FROM purchdata INNER JOIN suppliers - ON purchdata.supplierno=suppliers.supplierid - WHERE purchdata.stockid = '" . $StockID . "' - ORDER BY purchdata.preferred DESC, purchdata.effectivefrom DESC", $db); + suppliers.currcode, + suppliers.supplierid, + purchdata.price, + purchdata.effectivefrom, + purchdata.leadtime, + purchdata.conversionfactor, + purchdata.minorderqty, + purchdata.preferred + FROM purchdata INNER JOIN suppliers + ON purchdata.supplierno=suppliers.supplierid + WHERE purchdata.stockid = '" . $StockID . "' + ORDER BY purchdata.preferred DESC, purchdata.effectivefrom DESC", $db); while ($SuppRow = DB_fetch_array($SuppResult)) { echo '<tr><td class="select">' . $SuppRow['suppname'] . '</td> <td class="select">' . number_format($SuppRow['price'] / $SuppRow['conversionfactor'], 2) . '</td> <td class="select">' . $SuppRow['currcode'] . '</td> <td class="select">' . ConvertSQLDate($SuppRow['effectivefrom']) . '</td> - <td class="select">' . $SuppRow['leadtime'] . '</td> + <td class="select">' . $SuppRow['leadtime'] . '</td> <td class="select">' . $SuppRow['minorderqty'] . '</td>'; - switch ($SuppRow['preferred']) { - /* 2008-08-19 ToPu */ - case 1: - echo '<td class="select">' . _('Yes') . '</td>'; - break; - case 0: - echo '<td class="select">' . _('No') . '</td>'; - break; + if ($SuppRow['preferred']==1) { //then this is the preferred supplier + echo '<td class="select">' . _('Yes') . '</td>'; + } else { + echo '<td class="select">' . _('No') . '</td>'; } echo '<td class="select"><a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'">' . _('Order') . ' </a></td>'; @@ -402,31 +393,23 @@ if ($Its_A_Kitset_Assembly_Or_Dummy == False) { echo '<a href="' . $rootpath . '/StockAdjustments.php?' . SID . '&StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?' . SID . '&StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; - /** - * 2008-08-19 ToPu - * enter a purchase order for this SelectedStockItem and suppliers - * supplierid -- one link for each supplierid. - */ if ($myrow['mbflag'] == 'B') { - /**/ echo '<br />'; $SuppResult = DB_query("SELECT suppliers.suppname, - suppliers.supplierid, - purchdata.preferred, - purchdata.minorderqty - FROM purchdata INNER JOIN suppliers - ON purchdata.supplierno=suppliers.supplierid - WHERE purchdata.stockid = '" . $StockID . "'", $db); + suppliers.supplierid, + purchdata.preferred, + purchdata.minorderqty + FROM purchdata INNER JOIN suppliers + ON purchdata.supplierno=suppliers.supplierid + WHERE purchdata.stockid = '" . $StockID . "'", $db); while ($SuppRow = DB_fetch_array($SuppResult)) { - /**/ - // if ($myrow['eoq'] == 0) { $EOQ = $SuppRow['minorderqty']; } else { $EOQ = $myrow['eoq']; } echo '<a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . - '&StockID=' . $StockID . '&Quantity=' . $EOQ . '">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (default)</a><br />'; + '&StockID=' . $StockID . '&Quantity=' . $EOQ . '">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (' . _('default') . ')</a><br />'; /**/ } /* end of while */ } /* end of $myrow['mbflag'] == 'B' */ @@ -527,65 +510,63 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; if ($_POST['StockCat'] == 'All') { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - stockmaster.units, - stockmaster.mbflag, - stockmaster.decimalplaces - FROM stockmaster - LEFT JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockcategory.stocktype<>'A' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - stockmaster.decimalplaces - ORDER BY stockmaster.stockid"; + stockmaster.description, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM stockmaster + LEFT JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND stockmaster.description " . LIKE . " '$SearchString' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - stockmaster.units, - stockmaster.mbflag, - stockmaster.decimalplaces - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND description " . LIKE . " '$SearchString' - AND categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - stockmaster.decimalplaces - ORDER BY stockmaster.stockid"; + stockmaster.description, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND description " . LIKE . " '$SearchString' + AND categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; } } elseif (isset($_POST['StockCode'])) { $_POST['StockCode'] = strtoupper($_POST['StockCode']); if ($_POST['StockCat'] == 'All') { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - SUM(locstock.quantity) AS qoh, - stockmaster.units, - stockmaster.decimalplaces - FROM stockmaster - LEFT JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockcategory.stocktype<>'A' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.mbflag, - stockmaster.decimalplaces - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.mbflag, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, @@ -618,7 +599,6 @@ ON stockmaster.categoryid=stockcategory.categoryid, locstock WHERE stockmaster.stockid=locstock.stockid - AND stockcategory.stocktype<>'A' GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.units, @@ -720,16 +700,16 @@ $k++; } if ($myrow['mbflag'] == 'D') { - $qoh = 'N/A'; + $qoh = _('N/A'); } else { - $qoh = number_format($myrow["qoh"], $myrow['decimalplaces']); + $qoh = number_format($myrow['qoh'], $myrow['decimalplaces']); } echo "<td><input type='submit' name='Select' value='".$myrow['stockid']."' /></td> <td>".$myrow['description']."</td> <td class='number'>".$qoh."</td> <td>".$myrow['units']."</td> - <td><a target='_blank' href='" . $rootpath . "/StockStatus.php?" . SID . "&StockID=".$myrow['stockid']."'>" . _('View') . "</a></td> - </tr>"; + <td><a target='_blank' href='" . $rootpath . '/StockStatus.php?' . SID . '&StockID=' . $myrow['stockid']."'>" . _('View') . '</a></td> + </tr>'; $j++; if ($j == 20 AND ($RowIndex + 1 != $_SESSION['DisplayRecordsMax'])) { $j = 1; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/UpgradeDatabase.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -1,410 +1,112 @@ <?php - +/* $Id: $*/ $PageSecurity = 15; - include('includes/session.inc'); - -$title = _('Database Upgrade'); - -//ob_start(); /*what is this for? */ - +$title = _('Upgrade webERP Database'); include('includes/header.inc'); -function executeSQL($sql, $db, $TrapErrors=False) { -/* Run an sql statement and return an error code */ - $result = DB_query($sql, $db, '', '', false, $TrapErrors); - return DB_error_no($db); -} -function updateDBNo($NewNumber, $db) { - $sql="UPDATE config SET confvalue='".$NewNumber."' WHERE confname='DBUpdateNumber'"; - executeSQL($sql, $db); - $_SESSION['DBUpdateNumber']=$NewNumber; -} +if (empty($_POST['DoUpgrade'])){ + + prnMsg(_('This script will run perform any modifications to the database since v 3.11 required to allow the additional functionality in later scripts'),'info'); -function CharacterSet($table, $db) { - $sql="SELECT TABLE_COLLATION - FROM information_schema.tables - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$table."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - return $myrow['TABLE_COLLATION']; + echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<div class="centre"><input type="submit" name="DoUpgrade" VALUE="' . _('Perform Database Upgrade') . '"></div>'; + echo '</form>'; } -function AddColumn($Column, $Table, $Type, $Null, $Default, $After, $db) { - $sql="desc ".$Table." ".$Column; - $result = DB_query($sql, $db); - if (DB_num_rows($result)==0) { - if ($Type=='text') { - $response=executeSQL("ALTER TABLE `".$Table."` ADD COLUMN `".$Column."` ".$Type." ".$Null. - " AFTER `".$After."`", $db, False); - } else { - $response=executeSQL("ALTER TABLE `".$Table."` ADD COLUMN `".$Column."` ".$Type." ".$Null." DEFAULT '".$Default. - "' AFTER `".$After."`", $db, False); - } - if ($response==0) { - OutputResult( _('The column').' '.$Column.' '._('has been inserted') , 'success'); - } else { - OutputResult( _('The column').' '.$Column.' '._('could not be inserted') , 'error'); - } - } else { - OutputResult( _('The column').' '.$Column.' '._('already exists') , 'info'); - } -} +if ($_POST['DoUpgrade'] == _('Perform Database Upgrade')){ -function DropColumn($Column, $Table, $db) { - $sql="desc ".$Table." ".$Column; - $result = DB_query($sql, $db); - if (DB_num_rows($result)!=0) { - $response=executeSQL("ALTER TABLE `".$Table."` DROP `".$Column, $db, False); - if ($response==0) { - OutputResult( _('The column').' '.$Column.' '._('has been removed') , 'success'); - } else { - OutputResult( _('The column').' '.$Column.' '._('could not be removed') , 'error'); - } - } else { - OutputResult( _('The column').' '.$Column.' '._('is already removed') , 'info'); - } -} + echo '<br>'; + prnMsg(_('If there are any failures then please check with your system administrator'). + '. '._('Please read all notes carefully to ensure they are expected'),'info'); -function ChangeColumnSize($Column, $Table, $Type, $Null, $Default, $Size, $db) { - $sql="SELECT CHARACTER_MAXIMUM_LENGTH - FROM information_schema.columns - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$Table."' - AND COLUMN_NAME='".$Column."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_row($result); - if ($myrow[0]<>$Size) { - $response=executeSQL("ALTER TABLE ".$Table." CHANGE COLUMN ".$Column." ".$Column." ".$Type." ".$Null." DEFAULT '".$Default."'", $db, False); - if ($response==0) { - OutputResult( _('The column').' '.$Column.' '._('has been changed') , 'success'); - } else { - OutputResult( _('The column').' '.$Column.' '._('could not be changed') , 'error'); + if($_SESSION['DBUpdateNumber']< 1) { /* DBUpdateNumber set to 1 when upgrade3.11.1-4.00.sql is run */ + if ($dbType=='mysql' OR $dbType =='mysqli'){ + $SQLScripts[0] = './sql/mysql/upgrade3.11.1-4.00.sql'; } - } else { - OutputResult( _('The column').' '.$Column.' '._('is already changed') , 'info'); } -} + $result = DB_IgnoreForeignKeys($db); + + foreach ($SQLScripts AS $SQLScriptFile) { + + $SQLEntries = file($SQLScriptFile); + $ScriptFileEntries = sizeof($SQLEntries); + $ErrMsg = _('The script to upgrade the database failed because'); + $sql =''; + $InAFunction = false; + echo '<br><table> + <tr><th colspan=2>' . _('Applying') . ' ' . $SQLScriptFile . '</th></tr>'; -function ChangeColumnName($OldName, $Table, $Type, $Null, $Default, $NewName, $db, $AutoIncrement='') { - $sql="SELECT CHARACTER_MAXIMUM_LENGTH - FROM information_schema.columns - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$Table."' - AND COLUMN_NAME='".$OldName."'"; - $result=DB_query($sql, $db); - if (DB_num_rows($result)>0) { - if ($AutoIncrement=='') { - $response=executeSQL("ALTER TABLE ".$Table." CHANGE COLUMN ".$OldName." ".$NewName." ".$Type." ".$Null." DEFAULT '".$Default."'", $db, False); - } else { - $response=executeSQL("ALTER TABLE ".$Table." CHANGE COLUMN ".$OldName." ".$NewName." ".$Type." ".$Null." ".$AutoIncrement, $db, False); - } - if ($response==0) { - OutputResult( _('The column').' '.$OldName.' '._('has been renamed').' '.$NewName , 'success'); - } else { - OutputResult( _('The column').' '.$OldName.' '._('could not be renamed') , 'error'); - } - } else { - OutputResult( _('The column').' '.$OldName.' '._('is already changed') , 'info'); - } -} + for ($i=0; $i<=$ScriptFileEntries; $i++) { + + $SQLEntries[$i] = trim($SQLEntries[$i]); -function ChangeColumnType($Column, $Table, $Type, $Null, $Default, $db) { - $sql="SELECT DATA_TYPE - FROM information_schema.columns - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$Table."' - AND COLUMN_NAME='".$Column."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_row($result); - if ($myrow[0]<>$Type) { - $response=executeSQL("ALTER TABLE ".$Table." CHANGE COLUMN ".$Column." ".$Column." ".$Type." ".$Null." DEFAULT '".$Default."'", $db, False); - if ($response==0) { - OutputResult( _('The column').' '.$Column.' '._('has been changed') , 'success'); - } else { - OutputResult( _('The column').' '.$Column.' '._('could not be changed') , 'error'); - } - } else { - OutputResult( _('The column').' '.$Column.' '._('is already changed') , 'info'); - } -} - -function ChangeColumnDefault($Column, $Table, $Type, $Null, $Default, $db) { - $sql="SELECT COLUMN_DEFAULT - FROM information_schema.columns - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$Table."' - AND COLUMN_NAME='".$Column."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_row($result); - if ($myrow[0]<>$Default) { - $response=executeSQL("ALTER TABLE ".$Table." CHANGE COLUMN ".$Column." ".$Column." ".$Type." ".$Null." DEFAULT '".$Default."'", $db, False); - if ($response==0) { - OutputResult( _('The column').' '.$Column.' '._('has been changed') , 'success'); - } else { - OutputResult( _('The column').' '.$Column.' '._('could not be changed') , 'error'); - } - } else { - OutputResult( _('The column').' '.$Column.' '._('is already changed') , 'info'); - } -} - -function NewConfigValue($ConfName, $ConfValue, $db) { - $sql="SELECT confvalue - FROM config - WHERE confname='".$ConfName."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_row($result); - if (DB_num_rows($result)==0) { - $response=executeSQL("INSERT INTO `config` (`confname`, `confvalue`) VALUES ('".$ConfName."', '".$ConfValue."')", $db, False); - if ($response==0) { - OutputResult( _('The config value').' '.$ConfName.' '._('has been inserted') , 'success'); - } else { - OutputResult( _('The config value').' '.$ConfName.' '._('could not be inserted') , 'error'); - } - } else { - OutputResult( _('The config value').' '.$ConfName.' '._('is in') , 'info'); - } -} - -function CreateTable($Table, $sql, $db) { - $ShowSQL="SHOW TABLES WHERE Tables_in_".$_SESSION['DatabaseName']."='".$Table."'"; - $result=DB_Query($ShowSQL, $db); - - if (DB_num_rows($result)==0) { - $response=executeSQL($sql, $db, False); - if ($response==0) { - OutputResult( _('The table').' '.$Table.' '._('has been created') , 'success'); - } else { - OutputResult( _('The table').' '.$Table.' '._('could not be created') , 'error'); - } - } else { - OutputResult( _('The table').' '.$Table.' '._('already exists') , 'info'); - } -} - -function ConstraintExists($Table, $Constraint, $db) { - $sql="SELECT CONSTRAINT_NAME - FROM information_schema.TABLE_CONSTRAINTS - WHERE TABLE_SCHEMA='".$_SESSION['DatabaseName']."' - AND TABLE_NAME='".$Table."' - AND CONSTRAINT_NAME='".$Constraint."'"; - $result=DB_query($sql, $db); - if (DB_num_rows($result)==0) { - return false; - } else { - return true; - } -} - -function DropConstraint($Table, $Constraint, $db) { - if (ConstraintExists($Table, $Constraint, $db)) { - $response=executeSQL("ALTER TABLE `".$Table."` DROP FOREIGN KEY `".$Constraint."`", $db, False); - if ($response==0) { - OutputResult( _('The constraint').' '.$Constraint.' '._('has been removed') , 'success'); - } else { - OutputResult( _('The constraint').' '.$Constraint.' '._('could not be removed') , 'error'); - } - } else { - OutputResult( _('The constraint').' '.$Constraint.' '._('does not exist') , 'info'); - } -} - -function AddConstraint($Table, $Constraint, $Field, $ReferenceTable, $ReferenceField, $db) { - if (!ConstraintExists($Table, $Constraint, $db)) { - $response=executeSQL("ALTER TABLE ".$Table. " ADD CONSTRAINT ".$Constraint." FOREIGN KEY (".$Field. - ") REFERENCES ".$ReferenceTable." (".$ReferenceField.")", $db, False); - if ($response==0) { - OutputResult( _('The constraint').' '.$Constraint.' '._('has been added') , 'success'); - } else { - OutputResult( _('The constraint').' '.$Constraint.' '._('could not be added') , 'error'); - } - } else { - OutputResult( _('The constraint').' '.$Constraint.' '._('already exists') , 'info'); - } -} - -function UpdateField($Table, $Field, $NewValue, $Criteria, $db) { - $sql="SELECT ".$Field." FROM ".$Table." WHERE ".$Criteria; - $result=DB_query($sql, $db); - $myrow=DB_fetch_row($result); - if ($myrow[0]!=$NewValue) { - $response=executeSQL("UPDATE ".$Table." SET ".$Field."='".$NewValue."' WHERE ".$Criteria, $db, False); - if ($response==0) { - OutputResult( _('The field').' '.$Field.' '._('has been updated') , 'success'); - } else { - OutputResult( _('The field').' '.$Field.' '._('could not be updated') , 'error'); - } - } else { - OutputResult( _('The field').' '.$Field.' '._('is already correct') , 'info'); - } -} - -function DeleteRecords($Table, $Criteria, $db) { - $sql="SELECT * FROM ".$Table." WHERE ".$Criteria; - $result=DB_query($sql, $db); - if (DB_num_rows($result)>0) { - $response=executeSQL("DELETE FROM ".$Table." WHERE ".$Criteria, $db, False); - if ($response==0) { - OutputResult( _('Rows have been deleted from').' '.$Table , 'success'); - } else { - OutputResult( _('Rows could not be deleted from').' '.$Table , 'error'); - } - } else { - OutputResult( _('There was nothing to delete from').' '.$Table , 'info'); - } -} - -function DropTable($Table, $Field, $db) { - $sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']." ='".$Table."'"; - $result=DB_query($sql, $db); - $CanDrop=False; - if (DB_num_rows($result)>0) { - $CanDrop=True; - $sql="desc ".$Table." ".$Field; - $result = DB_query($sql, $db); - if (DB_num_rows($result)>0) { - $CanDrop=True; - } else { - $CanDrop=False; - } - } - if ($CanDrop) { - $response=executeSQL("DROP TABLE IF EXISTS `".$Table."`", $db); - if ($response==0) { - OutputResult( _('The old table').' '.$Table.' '._('has been removed') , 'success'); - } else { - OutputResult( _('The old table').' '.$Table.' '._('could not be removed') , 'error'); - } - } else { - OutputResult( _('The old table').' '.$Table.' '._('has already been removed') , 'info'); - } -} - -function InsertRecord($Table, $CheckFields, $CheckValues, $Fields, $Values, $db) { - $sql="SELECT * FROM ".$Table." WHERE "; - for ($i=0;$i<sizeOf($CheckFields);$i++) { - $sql = $sql.$CheckFields[$i]."='".$CheckValues[$i]."' AND "; - } - $sql=substr($sql, 0, strlen($sql)-5); - $result=DB_query($sql, $db); - if (DB_num_rows($result)==0) { - $sql="INSERT INTO ".$Table." ("; - for ($i=0;$i<sizeOf($Fields);$i++) { - $sql = $sql.$Fields[$i].","; - } - $sql=substr($sql, 0, strlen($sql)-1).") VALUES ("; - for ($i=0;$i<sizeOf($Values);$i++) { - $sql = $sql."'".$Values[$i]."',"; - } - $sql=substr($sql, 0, strlen($sql)-1).")"; - $response=executeSQL($sql, $db); - if ($response==0) { - OutputResult( _('The record has been inserted') , 'success'); - } else { - OutputResult( _('The record could not be inserted') , 'error'); - } - } else { - OutputResult( _('The record is already in the table') , 'info'); - } -} - -function DropPrimaryKey($Table, $OldKey, $db) { - $Total=0; - foreach ($OldKey as $Field) { - $sql="select * from information_schema.key_column_usage where table_name='".$Table."' and constraint_name='primary' and - table_schema='".$_SESSION['DatabaseName']."' AND COLUMN_NAME='".$Field."'"; - $result = DB_query($sql, $db); - $Total = $Total + DB_num_rows($result); - } - if ($Total==sizeOf($OldKey)) { - $response=executeSQL("ALTER TABLE ".$Table." DROP PRIMARY KEY", $db); - if ($response==0) { - OutputResult( _('The primary key in').' '.$Table.' '._('has been removed') , 'success'); - } else { - OutputResult( _('The primary key in').' '.$Table.' '._('could not be removed') , 'error'); - } - } else { - OutputResult( _('The primary key in').' '.$Table.' '._('has already been removed') , 'info'); - } -} - -function AddPrimaryKey($Table, $Fields, $db) { - $sql="select * from information_schema.key_column_usage where table_name='".$Table."' and constraint_name='primary' and - table_schema='".$_SESSION['DatabaseName']."'"; - $result = DB_query($sql, $db); - if (DB_num_rows($result)!=sizeOf($Fields)) { - $KeyString=implode(",", $Fields); - $response=executeSQL("ALTER TABLE ".$Table." ADD PRIMARY KEY ( ".$KeyString." )", $db); - if ($response==0) { - OutputResult( _('The primary key in').' '.$Table.' '._('has been added') , 'success'); - } else { - OutputResult( _('The primary key in').' '.$Table.' '._('could not be added') , 'error'); - } - } else { - OutputResult( _('The primary key in').' '.$Table.' '._('has already been added') , 'info'); - } -} - -function RenameTable($OldName, $NewName, $db) { - $sql="SHOW TABLES WHERE Tables_in_".$_SESSION['DatabaseName']."='".$OldName."'"; - $result=DB_Query($sql, $db); - - if (DB_num_rows($result)!=0) { - $response=executeSQL("RENAME TABLE ".$OldName." to ".$NewName, $db, False); - if ($response==0) { - OutputResult( _('The table').' '.$OldName.' '._('has been renamed to').' '.$NewName , 'success'); - } else { - OutputResult( _('The table').' '.$OldName.' '._('could not be renamed to').' '.$NewName , 'error'); - } - } else { - OutputResult( _('The table').' '.$NewName.' '._('already exists') , 'info'); - } -} - -function OutputResult($msg, $status) { - if ($status=='error') { - echo '<td style="background-color: #fddbdb;color: red;">'; - } else if ($status=='success') { - echo '<td style="background-color: #b9ecb4;color: #006400;">'; - } else { - echo '<td style="background-color: #c7ccf6;color: navy;">'; - } - echo $msg; - echo '</td>'; -} - -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; - -if (!isset($_POST['continue'])) { - echo '<form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - - echo '<div class="page_help_text">' . _('You have database updates that are required.').'<br />'. - _('Please ensure that you have taken a backup of your current database before continuing.'). '</div><br />'; - - echo '<div class="centre"><input type="submit" name="continue" value="'.('Continue With Updates').'" /></div>'; - echo '</form>'; -} else { - $StartingUpdate=$_SESSION['DBUpdateNumber']+1; - $EndingUpdate=$DBVersion; - //ob_end_flush(); - echo '<table>'; - for($UpdateNumber=$StartingUpdate; $UpdateNumber<=$EndingUpdate; $UpdateNumber++) { - ob_start(); - echo '<tr><td>'.$UpdateNumber.'</td>'; - $sql="SET FOREIGN_KEY_CHECKS=0"; - $result=DB_Query($sql, $db); - include('sql/mysql/updates/'.$UpdateNumber.'.php'); - $sql="SET FOREIGN_KEY_CHECKS=1"; - $result=DB_Query($sql, $db); - echo '</tr>'; - ob_end_flush(); - } + if (substr($SQLEntries[$i], 0, 2) != '--' + AND substr($SQLEntries[$i], 0, 3) != 'USE' + AND strstr($SQLEntries[$i],'/*')==FALSE + AND strlen($SQLEntries[$i])>1){ + + $sql .= ' ' . $SQLEntries[$i]; + + //check if this line kicks off a function definition - pg chokes otherwise + if (substr($SQLEntries[$i],0,15) == 'CREATE FUNCTION'){ + $InAFunction = true; + } + //check if this line completes a function definition - pg chokes otherwise + if (substr($SQLEntries[$i],0,8) == 'LANGUAGE'){ + $InAFunction = false; + } + if (strpos($SQLEntries[$i],';')>0 AND ! $InAFunction){ + $sql = substr($sql,0,strlen($sql)-1); + $result = DB_query($sql, $db, $ErrMsg, $DBMsg, false, false); + switch (DB_error_no($db)) { + case 0: + echo '<tr><td>' . $sql . '</td><td bgcolor="green">'._('Success').'</td></tr>'; + break; + case 1050: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Table has already been created').'</td></tr>'; + break; + case 1060: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Column has already been created').'</td></tr>'; + break; + case 1061: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Index already exists').'</td></tr>'; + break; + case 1062: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Entry has already been done').'</td></tr>'; + break; + case 1068: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Primary key already exists').'</td></tr>'; + break; + case 1091: + echo '<tr><td>' . $sql . '</td><td bgcolor="yellow">'._('Note').' - '. + _('Index already dropped previously').'</td></tr>'; + break; + default: + echo '<tr><td>' . $sql . '</td><td bgcolor="red">'._('Failure').' - '. + _('Error number').' - '.DB_error_no($db) .'</td></tr>'; + break; + } + unset($sql); + } + } //end if its a valid sql line not a comment + } //end of for loop around the lines of the sql script echo '</table>'; -} + } //end of loop around SQLScripts to apply + $result =DB_ReinstateForeignKeys($db); + /*Now get the modified DBUpgradeNumber */ + $result = DB_query('SELECT confvalue FROM config WHERE confname="DBUpdateNumber"',$db); + $myrow = DB_fetch_array($result); + $_SESSION['DBUpdateNumber'] = $myrow['confvalue']; +} /*Dont do upgrade */ + include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/Z_ChangeBranchCode.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -111,18 +111,18 @@ prnMsg (_('Changing customer transaction records'),'info'); $sql = "UPDATE debtortrans SET - branchcode='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; + branchcode='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update debtor transaction records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); prnMsg(_('Changing sales analysis records'),'info'); $sql = "UPDATE salesanalysis - SET custbranch='" . $_POST['NewBranchCode'] . "' - WHERE cust='" . $_POST['DebtorNo'] . "' - AND custbranch='" . $_POST['OldBranchCode'] . "'"; + SET custbranch='" . $_POST['NewBranchCode'] . "' + WHERE cust='" . $_POST['DebtorNo'] . "' + AND custbranch='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update Sales Analysis records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -130,9 +130,9 @@ prnMsg(_('Changing order delivery differences records'),'info'); $sql = "UPDATE orderdeliverydifferenceslog - SET branch='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branch='" . $_POST['OldBranchCode'] . "'"; + SET branch='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branch='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update order delivery differences records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -140,58 +140,59 @@ prnMsg (_('Changing pricing records'),'info'); $sql = "UPDATE prices - SET branchcode='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; + SET branchcode='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update the pricing records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); prnMsg(_('Changing sales orders records'),'info'); $sql = "UPDATE salesorders - SET branchcode='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; + SET branchcode='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update the sales order header records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); prnMsg(_('Changing stock movement records'),'info'); $sql = "UPDATE stockmoves - SET branchcode='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; + SET branchcode='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update the stock movement records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); prnMsg(_('Changing user default customer records'),'info'); $sql = "UPDATE www_users - SET branchcode='" . $_POST['NewBranchCode'] . "' - WHERE customerid='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'";; + SET branchcode='" . $_POST['NewBranchCode'] . "' + WHERE customerid='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'";; $ErrMsg = _('The SQL to update the user records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); prnMsg(_('Changing the customer branch code in contract header records'),'info'); $sql = "UPDATE contracts - SET branchcode='" . $_POST['NewBranchCode'] . "' - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; + SET branchcode='" . $_POST['NewBranchCode'] . "' + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to update contract header records failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); + $result = DB_IgnoreForeignKeyChecks($db); prnMsg(_('Deleting the old customer branch record'),'info'); $sql = "DELETE FROM custbranch - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'"; - + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'"; + $ErrMsg = _('The SQL to delete the old customer branch record failed because'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true,true); + $result = DB_ReinstateForeignKeyChecks($db); - } echo "<form action='" . $_SERVER['PHP_SELF'] . "?=" . $SID . "' method=post>"; Modified: trunk/config.distrib.php =================================================================== --- trunk/config.distrib.php 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/config.distrib.php 2010-12-29 09:53:54 UTC (rev 4454) @@ -55,7 +55,6 @@ //this can be left commented out //$SessionSavePath = '/tmp'; - // which encryption function should be used //$CryptFunction = "md5"; // MD5 Hash $CryptFunction = "sha1"; // SHA1 Hash Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-12-27 11:33:59 UTC (rev 4453) +++ trunk/doc/Change.log.html 2010-12-29 09:53:54 UTC (rev 4454) @@ -1,20 +1,21 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p>/</p> +<p>29/12/10 Phil: Reverted to single SQL upgrade file per release - but retaining Tim's upgrade mechanism if the DBUpgradeNumber is out of date. Removed pseudo SQL language required for upgrade script - just applies plain vanilla SQL from the scripts required</p> +<p>29/12/10 Tim: DB upgrade mechanism with separate sudo SQL for each database change in a separate file + 52 files of updates since 3.11.4</p> <p>21/12/10 Phil : Reworked PDFPrintLabels.php to conform to standards and corrected SQL for prices</p> <p>21/12/10 Ricard Andreu: PDFPrintLabels.php was not checking for end date of prices - fixed</p> -<p>19/12/10 Phil: SelectOrderItems.php ConfirmDispatch_Invoice.php add code to handle asset disposals. +<p>19/12/10 Phil: SelectOrderItems.php ConfirmDispatch_Invoice.php add code to handle asset disposals.</p> <p>14/12/10 Phil: modify purchasing scripts for coding conventions/readability</p> <p>11/12/10 Phil: Have populated the new field stockcheckdate in stockcheckfreeze and modified PDFStockCheckComparison to use this field when posting the GL - stockmoves need to be on the current day otherwise historical balances will all need to be updated. But narrative shows the date of the stock check for which ... [truncated message content] |
From: <tim...@us...> - 2010-12-27 11:34:05
|
Revision: 4453 http://web-erp.svn.sourceforge.net/web-erp/?rev=4453&view=rev Author: tim_schofield Date: 2010-12-27 11:33:59 +0000 (Mon, 27 Dec 2010) Log Message: ----------- Re-apply code wrongly removed, to make the databse upgrade system work properly. Please leave unless you have something better. Modified Paths: -------------- trunk/UpgradeDatabase.php trunk/includes/GetConfig.php trunk/includes/UserLogin.php Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-27 07:30:17 UTC (rev 4452) +++ trunk/UpgradeDatabase.php 2010-12-27 11:33:59 UTC (rev 4453) @@ -1,6 +1,6 @@ <?php -//$PageSecurity = 15; +$PageSecurity = 15; include('includes/session.inc'); Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2010-12-27 07:30:17 UTC (rev 4452) +++ trunk/includes/GetConfig.php 2010-12-27 11:33:59 UTC (rev 4453) @@ -5,7 +5,7 @@ if(isset($ForceConfigReload) and $ForceConfigReload==TRUE OR !isset($_SESSION['CompanyDefaultsLoaded'])) { global $db; // It is global, we may not be. - $sql = 'SELECT confname, confvalue FROM config'; + $sql = 'SELECT confname, confvalue FROM config'; $ErrMsg = _('Could not get the configuration parameters from the database because'); $ConfigResult = DB_query($sql,$db,$ErrMsg); while( $myrow = DB_fetch_row($ConfigResult) ) { @@ -21,7 +21,7 @@ $_SESSION['DBUpdateNumber']=-1; header('Location: UpgradeDatabase.php'); //divert to the db upgrade if the DBUpdateNumber is not in the config table } - + DB_free_result($ConfigResult); // no longer needed /*Maybe we should check config directories exist and try to create if not */ @@ -32,14 +32,21 @@ $sql='SELECT script, security FROM pagesecurity'; $ErrMsg = _('Could not get the page security details from the database because'); $result=DB_query($sql, $db); - } else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { + } else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { header('Location: UpgradeDatabase.php'); //divert to upgrade database if the pagesecurity table does not exist } while ($myrow=DB_fetch_array($result)) { $_SESSION[$myrow['script']]=$myrow['security']; } - + $sql="SELECT confvalue FROM config WHERE confname='DBUpdateNumber'"; + $result=DB_query($sql, $db); + if (DB_num_rows($result)==0) { + $_SESSION['DBUpdateNumber']=-1; + } else { + $myrow=DB_fetch_array($result); + $_SESSION['DBUpdateNumber']=$myrow['confvalue']; + } /* Also reads all the company data set up in the company record and returns an array */ $sql= 'SELECT coyname, @@ -68,7 +75,7 @@ gllink_stock FROM companies WHERE coycode=1'; - + $ErrMsg = _('An error occurred accessing the database to retrieve the company information'); $ReadCoyResult = DB_query($sql,$db,$ErrMsg); @@ -81,26 +88,31 @@ } } //end if force reload or not set already -$sql='SELECT id, - host, - port, - heloaddress, - username, - password, - timeout, - auth - FROM emailsettings'; +$sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']."='emailsettings'"; $result=DB_query($sql, $db); -$myrow=DB_fetch_array($result); +if (DB_num_rows($result)>0) { + $sql='SELECT id, + host, + port, + heloaddress, + username, + password, + timeout, + auth + FROM emailsettings'; + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); -$_SESSION['SMTPSettings']['host']=$myrow['host']; -$_SESSION['SMTPSettings']['port']=$myrow['port']; -$_SESSION['SMTPSettings']['heloaddress']=$myrow['heloaddress']; -$_SESSION['SMTPSettings']['username']=$myrow['username']; -$_SESSION['SMTPSettings']['password']=$myrow['password']; -$_SESSION['SMTPSettings']['timeout']=$myrow['timeout']; -$_SESSION['SMTPSettings']['auth']=$myrow['auth']; - + $_SESSION['SMTPSettings']['host']=$myrow['host']; + $_SESSION['SMTPSettings']['port']=$myrow['port']; + $_SESSION['SMTPSettings']['heloaddress']=$myrow['heloaddress']; + $_SESSION['SMTPSettings']['username']=$myrow['username']; + $_SESSION['SMTPSettings']['password']=$myrow['password']; + $_SESSION['SMTPSettings']['timeout']=$myrow['timeout']; + $_SESSION['SMTPSettings']['auth']=$myrow['auth']; +} else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { + header("Location: UpgradeDatabase.php"); +} /* These variable if required are in config.php Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2010-12-27 07:30:17 UTC (rev 4452) +++ trunk/includes/UserLogin.php 2010-12-27 11:33:59 UTC (rev 4453) @@ -36,21 +36,7 @@ if (!isset($Name) or $Name == '') { return UL_SHOWLOGIN; } - $sql = "SELECT customerid, - lastvisitdate, - pagesize, - defaultlocation, - branchcode, - modulesallowed, - blocked, - realname, - theme, - displayrecordsmax, - userid, - language, - salesman, - pdflanguage, - fullaccess + $sql = "SELECT * FROM www_users WHERE www_users.userid='" . $Name . "' AND (www_users.password='" . CryptPass($Password) . "' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-12-27 07:30:24
|
Revision: 4452 http://web-erp.svn.sourceforge.net/web-erp/?rev=4452&view=rev Author: daintree Date: 2010-12-27 07:30:17 +0000 (Mon, 27 Dec 2010) Log Message: ----------- SET FOREIGN_KEY_CHECKS option in DB_query Modified Paths: -------------- trunk/includes/ConnectDB_mysql.inc Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2010-12-27 04:58:50 UTC (rev 4451) +++ trunk/includes/ConnectDB_mysql.inc 2010-12-27 07:30:17 UTC (rev 4452) @@ -53,11 +53,14 @@ $ErrorMessage='', $DebugMessage= '', $Transaction=false, - $TrapErrors=true){ + $TrapErrors=true, + $IgnoreForeignKeys=false){ global $debug; global $PathPrefix; - + if ($IgnoreForeignKeys) { + $SQL = 'SET FOREIGN_KEY_CHECKS=0; ' . $SQL . ' SET FOREIGN_KEY_CHECKS=1;'; + } $result=mysql_query($SQL,$Conn); $_SESSION['LastInsertId'] = mysql_insert_id($Conn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-12-27 04:58:58
|
Revision: 4451 http://web-erp.svn.sourceforge.net/web-erp/?rev=4451&view=rev Author: daintree Date: 2010-12-27 04:58:50 +0000 (Mon, 27 Dec 2010) Log Message: ----------- modified Z_ChangeBranchCode.php to defeat foreign key checks when deleting the branch code from custbranch Modified Paths: -------------- trunk/Z_ChangeBranchCode.php trunk/includes/ConnectDB_mysqli.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2010-12-26 12:45:46 UTC (rev 4450) +++ trunk/Z_ChangeBranchCode.php 2010-12-27 04:58:50 UTC (rev 4451) @@ -11,10 +11,10 @@ /*First check the customer code exists */ $result=DB_query("SELECT debtorno, - branchcode - FROM custbranch - WHERE debtorno='" . $_POST['DebtorNo'] . "' - AND branchcode='" . $_POST['OldBranchCode'] . "'",$db); + branchcode + FROM custbranch + WHERE debtorno='" . $_POST['DebtorNo'] . "' + AND branchcode='" . $_POST['OldBranchCode'] . "'",$db); if (DB_num_rows($result)==0){ prnMsg (_('The customer branch code') . ': ' . $_POST['DebtorNo'] . ' - ' . $_POST['OldBranchCode'] . ' ' . _('does not currently exist as a customer branch code in the system'),'error'); include('includes/footer.inc'); @@ -189,7 +189,7 @@ AND branchcode='" . $_POST['OldBranchCode'] . "'"; $ErrMsg = _('The SQL to delete the old customer branch record failed because'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true,true); } Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2010-12-26 12:45:46 UTC (rev 4450) +++ trunk/includes/ConnectDB_mysqli.inc 2010-12-27 04:58:50 UTC (rev 4451) @@ -65,7 +65,8 @@ $ErrorMessage='', $DebugMessage= '', $Transaction=false, - $TrapErrors=true){ + $TrapErrors=true, + $IgnoreForeignKeys=false){ global $debug; global $PathPrefix; @@ -74,6 +75,10 @@ 20071102 Change from mysql to mysqli; $result=mysql_query($SQL,$Conn); */ + + if ($IgnoreForeignKeys) { + $SQL = 'SET FOREIGN_KEY_CHECKS=0; ' . $SQL . ' SET FOREIGN_KEY_CHECKS=1;'; + } $result=mysqli_query($Conn, $SQL); $_SESSION['LastInsertId'] = mysqli_insert_id($Conn); Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-26 12:45:46 UTC (rev 4450) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-27 04:58:50 UTC (rev 4451) @@ -474,6 +474,5 @@ ALTER TABLE purchorderdetails ADD COLUMN assetid int NOT NULL DEFAULT 0; INSERT INTO `systypes` (`typeid` ,`typename` ,`typeno`) VALUES ('49', 'Import Fixed Assets', '1'); -ALTER TABLE `debtortrans` DROP FOREIGN KEY `debtortrans_ibfk_1` UPDATE config SET confvalue='4.0-RC2' WHERE confname='VersionName'; \ 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: <tim...@us...> - 2010-12-26 12:45:52
|
Revision: 4450 http://web-erp.svn.sourceforge.net/web-erp/?rev=4450&view=rev Author: tim_schofield Date: 2010-12-26 12:45:46 +0000 (Sun, 26 Dec 2010) Log Message: ----------- Correction to recent changes in UserLogin.php which were preventing the DisplayRecordsMax session variable being set Modified Paths: -------------- trunk/includes/UserLogin.php Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2010-12-26 12:45:31 UTC (rev 4449) +++ trunk/includes/UserLogin.php 2010-12-26 12:45:46 UTC (rev 4450) @@ -84,7 +84,7 @@ $_SESSION['PDFLanguage'] = '0'; //default to latin western languages } - if ($myrow[10] > 0) { + if ($myrow['displayrecordsmax'] > 0) { $_SESSION['DisplayRecordsMax'] = $myrow['displayrecordsmax']; } else { $_SESSION['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax']; // default comes from config.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-12-26 12:45:37
|
Revision: 4449 http://web-erp.svn.sourceforge.net/web-erp/?rev=4449&view=rev Author: tim_schofield Date: 2010-12-26 12:45:31 +0000 (Sun, 26 Dec 2010) Log Message: ----------- Remove errors in sql statement brought in on revision 4447 Revision Links: -------------- http://web-erp.svn.sourceforge.net/web-erp/?rev=4447&view=rev Modified Paths: -------------- trunk/includes/UserLogin.php Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2010-12-26 12:28:47 UTC (rev 4448) +++ trunk/includes/UserLogin.php 2010-12-26 12:45:31 UTC (rev 4449) @@ -7,7 +7,7 @@ define('UL_NOTVALID', 1); /* User/password do not agree */ define('UL_BLOCKED', 2); /* Account locked, too many failed logins */ define('UL_CONFIGERR', 3); /* Configuration error in webERP or server */ -define('UL_SHOWLOGIN', 4); +define('UL_SHOWLOGIN', 4); define('UL_MAINTENANCE', 5); /* UserLogin @@ -18,9 +18,9 @@ */ function userLogin($Name, $Password, $db) { - + global $debug; - + if (!isset($_SESSION['AccessLevel']) OR $_SESSION['AccessLevel'] == '' OR (isset($Name) AND $Name != '')) { /* if not logged in */ @@ -37,19 +37,19 @@ return UL_SHOWLOGIN; } $sql = "SELECT customerid, -- lastvisitdate, -- pagesize, -- defaultlocation, -- branchcode, -- modulesallowed, -- blocked, -- realname, -- theme, -- displayrecordsmax, -- userid, -- language, -- salesman, -- pdflanguage, + lastvisitdate, + pagesize, + defaultlocation, + branchcode, + modulesallowed, + blocked, + realname, + theme, + displayrecordsmax, + userid, + language, + salesman, + pdflanguage, fullaccess FROM www_users WHERE www_users.userid='" . $Name . "' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-12-26 12:28:53
|
Revision: 4448 http://web-erp.svn.sourceforge.net/web-erp/?rev=4448&view=rev Author: tim_schofield Date: 2010-12-26 12:28:47 +0000 (Sun, 26 Dec 2010) Log Message: ----------- Add new database upgrade. Removes constraint from debtortrans Modified Paths: -------------- trunk/includes/session.inc Added Paths: ----------- trunk/sql/mysql/updates/53.php Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-26 08:33:29 UTC (rev 4447) +++ trunk/includes/session.inc 2010-12-26 12:28:47 UTC (rev 4448) @@ -13,7 +13,7 @@ header('Location:' . $rootpath . '/install/index.php'); } include($PathPrefix . 'config.php'); -$DBVersion=52; +$DBVersion=53; if (isset($SessionSavePath)){ session_save_path($SessionSavePath); } @@ -118,7 +118,7 @@ if (isset($_SESSION[basename($_SERVER['SCRIPT_NAME'])])) { $PageSecurity = $_SESSION[basename($_SERVER['SCRIPT_NAME'])]; } - + if (($DBVersion>$_SESSION['DBUpdateNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { header("Location: UpgradeDatabase.php"); } @@ -286,7 +286,7 @@ </tr> </table> </td>'; - + include($PathPrefix . 'includes/footer.inc'); exit; } Added: trunk/sql/mysql/updates/53.php =================================================================== --- trunk/sql/mysql/updates/53.php (rev 0) +++ trunk/sql/mysql/updates/53.php 2010-12-26 12:28:47 UTC (rev 4448) @@ -0,0 +1,10 @@ +<?php + +/* Remove foreign key from debtortrans table + */ + +DropConstraint('debtortrans', 'debtortrans_ibfk_1', $db); + +UpdateDBNo(53, $db); + +?> \ 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...> - 2010-12-26 08:33:35
|
Revision: 4447 http://web-erp.svn.sourceforge.net/web-erp/?rev=4447&view=rev Author: daintree Date: 2010-12-26 08:33:29 +0000 (Sun, 26 Dec 2010) Log Message: ----------- User login fix - SQL Modified Paths: -------------- trunk/Logout.php trunk/UpgradeDatabase.php trunk/UserSettings.php trunk/Z_ChangeBranchCode.php trunk/includes/GetConfig.php trunk/includes/UserLogin.php trunk/includes/class.pdf.php trunk/includes/session.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/Logout.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -2,7 +2,7 @@ /* $Revision: 1.17 $ */ /* $Id$*/ //$PageSecurity =1; -$AllowAnyone=True; /* Allow all users to log off - needed for autoamted runs */ +$AllowAnyone=True; /* Allow all users to log off */ include('includes/session.inc'); Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/UpgradeDatabase.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -6,7 +6,7 @@ $title = _('Database Upgrade'); -ob_start(); +//ob_start(); /*what is this for? */ include('includes/header.inc'); @@ -390,7 +390,7 @@ } else { $StartingUpdate=$_SESSION['DBUpdateNumber']+1; $EndingUpdate=$DBVersion; - ob_end_flush(); + //ob_end_flush(); echo '<table>'; for($UpdateNumber=$StartingUpdate; $UpdateNumber<=$EndingUpdate; $UpdateNumber++) { ob_start(); Modified: trunk/UserSettings.php =================================================================== --- trunk/UserSettings.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/UserSettings.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -12,13 +12,8 @@ _('User Settings') . '" alt="" />' . ' ' . _('User Settings') . '</p>'; $PDFLanguages = array(_('Latin Western Languages'), - _('Eastern European Russian Japanese'), - _('Chinese'), - _('Korean'), - _('Vietnamese'), - _('Hebrew'), - _('Arabic'), - _('Thai')); + _('Eastern European Russian Japanese Korean Hebrew Arabic Thai'), + _('Chinese')); if (isset($_POST['Modify'])) { Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/Z_ChangeBranchCode.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -37,7 +37,7 @@ /*Now check that the new code doesn't already exist */ $result=DB_query("SELECT debtorno FROM custbranch WHERE debtorno='" . $_POST['DebtorNo'] . "' AND branchcode ='" . $_POST['NewBranchCode'] . "'",$db); if (DB_num_rows($result)!=0){ - prmMsg(_('The replacement customer branch code') . ': ' . $_POST['NewBranchCode'] . ' ' . _('already exists as a branch code for the same customer') . ' - ' . _('a unique branch code must be entered for the new code'),'error'); + prnMsg(_('The replacement customer branch code') . ': ' . $_POST['NewBranchCode'] . ' ' . _('already exists as a branch code for the same customer') . ' - ' . _('a unique branch code must be entered for the new code'),'error'); include('includes/footer.inc'); exit; } Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/includes/GetConfig.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -5,8 +5,9 @@ if(isset($ForceConfigReload) and $ForceConfigReload==TRUE OR !isset($_SESSION['CompanyDefaultsLoaded'])) { global $db; // It is global, we may not be. - $sql = 'SELECT confname, confvalue FROM config'; // dont care about the order by - $ConfigResult = DB_query($sql,$db); + $sql = 'SELECT confname, confvalue FROM config'; + $ErrMsg = _('Could not get the configuration parameters from the database because'); + $ConfigResult = DB_query($sql,$db,$ErrMsg); while( $myrow = DB_fetch_row($ConfigResult) ) { if (is_numeric($myrow[1]) and $myrow[0]!='DefaultPriceList'){ //the variable name is given by $myrow[0] @@ -14,64 +15,60 @@ } else { $_SESSION[$myrow[0]] = $myrow[1]; } - } //end loop through all config variables $_SESSION['CompanyDefaultsLoaded'] = true; + if (!isset($_SESSION['DBUpdateNumber'])){ // the config record for DBUpdateNumber is not yet added + $_SESSION['DBUpdateNumber']=-1; + header('Location: UpgradeDatabase.php'); //divert to the db upgrade if the DBUpdateNumber is not in the config table + } + DB_free_result($ConfigResult); // no longer needed /*Maybe we should check config directories exist and try to create if not */ - $sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']."='pagesecurity'"; - $result=DB_query($sql, $db); + $sql='SHOW tables WHERE Tables_in_'.$_SESSION['DatabaseName']."='pagesecurity'"; + $ErrMsg = _('Could not determine if the pagesecurity table is in the database'); + $result=DB_query($sql, $db,$ErrMsg); if (DB_num_rows($result)>0) { - $sql="SELECT script, security FROM pagesecurity"; + $sql='SELECT script, security FROM pagesecurity'; + $ErrMsg = _('Could not get the page security details from the database because'); $result=DB_query($sql, $db); - } else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { - header("Location: UpgradeDatabase.php"); + } else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { + header('Location: UpgradeDatabase.php'); //divert to upgrade database if the pagesecurity table does not exist } while ($myrow=DB_fetch_array($result)) { $_SESSION[$myrow['script']]=$myrow['security']; } - - $sql="SELECT confvalue FROM config WHERE confname='DBUpdateNumber'"; - $result=DB_query($sql, $db); - if (DB_num_rows($result)==0) { - $_SESSION['DBUpdateNumber']=-1; - } else { - $myrow=DB_fetch_array($result); - $_SESSION['DBUpdateNumber']=$myrow['confvalue']; - } - + /* Also reads all the company data set up in the company record and returns an array */ - $sql= 'SELECT - coyname, - gstno, - regoffice1, - regoffice2, - regoffice3, - regoffice4, - regoffice5, - regoffice6, - telephone, - fax, - email, - currencydefault, - debtorsact, - pytdiscountact, - creditorsact, - payrollact, - grnact, - exchangediffact, - purchasesexchangediffact, - retainedearnings, - freightact, - gllink_debtors, - gllink_creditors, - gllink_stock - FROM companies - WHERE coycode=1'; - + $sql= 'SELECT coyname, + gstno, + regoffice1, + regoffice2, + regoffice3, + regoffice4, + regoffice5, + regoffice6, + telephone, + fax, + email, + currencydefault, + debtorsact, + pytdiscountact, + creditorsact, + payrollact, + grnact, + exchangediffact, + purchasesexchangediffact, + retainedearnings, + freightact, + gllink_debtors, + gllink_creditors, + gllink_stock + FROM companies + WHERE coycode=1'; + $ErrMsg = _('An error occurred accessing the database to retrieve the company information'); $ReadCoyResult = DB_query($sql,$db,$ErrMsg); @@ -84,41 +81,32 @@ } } //end if force reload or not set already -$sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']."='emailsettings'"; +$sql='SELECT id, + host, + port, + heloaddress, + username, + password, + timeout, + auth + FROM emailsettings'; $result=DB_query($sql, $db); -if (DB_num_rows($result)>0) { - $sql='SELECT id, - host, - port, - heloaddress, - username, - password, - timeout, - auth - FROM emailsettings'; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); +$myrow=DB_fetch_array($result); - $_SESSION['SMTPSettings']['host']=$myrow['host']; - $_SESSION['SMTPSettings']['port']=$myrow['port']; - $_SESSION['SMTPSettings']['heloaddress']=$myrow['heloaddress']; - $_SESSION['SMTPSettings']['username']=$myrow['username']; - $_SESSION['SMTPSettings']['password']=$myrow['password']; - $_SESSION['SMTPSettings']['timeout']=$myrow['timeout']; - $_SESSION['SMTPSettings']['auth']=$myrow['auth']; -} else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { - header("Location: UpgradeDatabase.php"); -} +$_SESSION['SMTPSettings']['host']=$myrow['host']; +$_SESSION['SMTPSettings']['port']=$myrow['port']; +$_SESSION['SMTPSettings']['heloaddress']=$myrow['heloaddress']; +$_SESSION['SMTPSettings']['username']=$myrow['username']; +$_SESSION['SMTPSettings']['password']=$myrow['password']; +$_SESSION['SMTPSettings']['timeout']=$myrow['timeout']; +$_SESSION['SMTPSettings']['auth']=$myrow['auth']; - /* +/* +These variable if required are in config.php - -Stay in config.php $DefaultLanguage = en_GB $allow_demo_mode = 1 - - $EDIHeaderMsgId = D:01B:UN:EAN010 $EDIReference = WEBERP $EDI_MsgPending = EDI_Pending Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/includes/UserLogin.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -7,9 +7,8 @@ define('UL_NOTVALID', 1); /* User/password do not agree */ define('UL_BLOCKED', 2); /* Account locked, too many failed logins */ define('UL_CONFIGERR', 3); /* Configuration error in webERP or server */ -define('UL_SHOWLOGIN', 4); /* Can this happen? */ -// Following not in use at 18 Nov 09. -define('UL_MAINTENANCE', 5); /* Maintenance mode - no user logins */ +define('UL_SHOWLOGIN', 4); +define('UL_MAINTENANCE', 5); /* UserLogin * Function to validate user name, perform validity checks and initialise @@ -19,7 +18,9 @@ */ function userLogin($Name, $Password, $db) { - + + global $debug; + if (!isset($_SESSION['AccessLevel']) OR $_SESSION['AccessLevel'] == '' OR (isset($Name) AND $Name != '')) { /* if not logged in */ @@ -35,16 +36,32 @@ if (!isset($Name) or $Name == '') { return UL_SHOWLOGIN; } - $sql = "SELECT * + $sql = "SELECT customerid, +- lastvisitdate, +- pagesize, +- defaultlocation, +- branchcode, +- modulesallowed, +- blocked, +- realname, +- theme, +- displayrecordsmax, +- userid, +- language, +- salesman, +- pdflanguage, + fullaccess FROM www_users WHERE www_users.userid='" . $Name . "' AND (www_users.password='" . CryptPass($Password) . "' OR www_users.password='" . $Password . "')"; - $Auth_Result = DB_query($sql, $db); + $ErrMsg = _('Could not retrieve user details on login because'); + $debug =1; + $Auth_Result = DB_query($sql, $db,$ErrMsg); // Populate session variables with data base results if (DB_num_rows($Auth_Result) > 0) { $myrow = DB_fetch_array($Auth_Result); - if ($myrow[7]==1){ + if ($myrow['blocked']==1){ //the account is blocked return UL_BLOCKED; } @@ -64,7 +81,7 @@ if (isset($myrow['pdflanguage'])) { $_SESSION['PDFLanguage'] = $myrow['pdflanguage']; } else { - $_SESSION['PDFLanguage'] = ''; + $_SESSION['PDFLanguage'] = '0'; //default to latin western languages } if ($myrow[10] > 0) { @@ -73,12 +90,12 @@ $_SESSION['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax']; // default comes from config.php } $_SESSION['UserID'] = $myrow['userid']; - $sql = "UPDATE www_users SET lastvisitdate='". date("Y-m-d H:i:s") ."' - WHERE www_users.userid='" . $Name . "'"; + $sql = "UPDATE www_users SET lastvisitdate='". date('Y-m-d H:i:s') ."' + WHERE www_users.userid='" . $Name . "'"; $Auth_Result = DB_query($sql, $db); /*get the security tokens that the user has access to */ $sql = 'SELECT tokenid FROM securitygroups - WHERE secroleid = ' . $_SESSION['AccessLevel']; + WHERE secroleid = ' . $_SESSION['AccessLevel']; $Sec_Result = DB_query($sql, $db); $_SESSION['AllowedPageSecurityTokens'] = array(); if (DB_num_rows($Sec_Result)==0){ @@ -98,8 +115,8 @@ } elseif ($_SESSION['AttemptsCounter'] >= 5 AND isset($Name)) { /*User blocked from future accesses until sysadmin releases */ $sql = "UPDATE www_users - SET blocked=1 - WHERE www_users.userid='" . $Name . "'"; + SET blocked=1 + WHERE www_users.userid='" . $Name . "'"; $Auth_Result = DB_query($sql, $db); return UL_BLOCKED; } Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/includes/class.pdf.php 2010-12-26 08:33:29 UTC (rev 4447) @@ -36,24 +36,19 @@ if (isset($_SESSION['PDFLanguage'])) { - $userpdflang = $_SESSION['PDFLanguage']; + $UserPdfLang = $_SESSION['PDFLanguage']; - switch ($userpdflang) { - case 0: $userpdffont = 'times'; break; - case 1: $userpdffont = 'javierjp'; break; - case 2: $userpdffont = 'javiergb'; break; - case 3: $userpdffont = 'javierjp'; break; - case 4: $userpdffont = 'javierjp'; break; - case 5: $userpdffont = 'javierjp'; break; - case 6: $userpdffont = 'javierjp'; break; - case 7: $userpdffont = 'javierjp'; break; + switch ($UserPdfLang) { + case 0: $UserPdfFont = 'times'; break; + case 1: $UserPdfFont = 'javierjp'; break; + case 2: $UserPdfFont = 'javiergb'; break; } } else { - $userpdffont = 'helvetica'; + $UserPdfFont = 'helvetica'; } - $this->SetFont($userpdffont, '', 11); + $this->SetFont($UserPdfFont, '', 11); // SetFont($family, $style='', $size=0, $fontfile='') } Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/includes/session.inc 2010-12-26 08:33:29 UTC (rev 4447) @@ -4,6 +4,7 @@ if (!isset($PathPrefix)) { $PathPrefix=''; } + if (!file_exists($PathPrefix . 'config.php')){ $rootpath = dirname($_SERVER['PHP_SELF']); if ($rootpath == '/' OR $rootpath == "\\") { @@ -110,13 +111,14 @@ } } /* only do security checks if AllowAnyone is not true */ + /*User is logged in so get configuration parameters - save in session*/ include($PathPrefix . 'includes/GetConfig.php'); if (isset($_SESSION[basename($_SERVER['SCRIPT_NAME'])])) { $PageSecurity = $_SESSION[basename($_SERVER['SCRIPT_NAME'])]; } - + if (($DBVersion>$_SESSION['DBUpdateNumber']) and (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { header("Location: UpgradeDatabase.php"); } @@ -264,7 +266,12 @@ } else { $SupplierLogin=0; } +/* Nasty kludge to allow Supplier only logins as well as Customer logins - .... hmmmmm */ +if ($SupplierLogin==1) { + $_SESSION['AllowedPageSecurityTokens'][0]=9; +} + if (!isset($AllowAnyone)){ if ((!in_array($PageSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PageSecurity))) { $title = _('Security Permissions Problem'); @@ -276,24 +283,20 @@ echo '<b><font style="size:+1; text-align:center;">' . _('The security settings on your account do not permit you to access this function') . '</font></b>'; echo '</td> - </tr> - </table> - </td>'; - + </tr> + </table> + </td>'; + include($PathPrefix . 'includes/footer.inc'); exit; } } -/* Nasty kludge to allow Supplier only logins as well as Customer logins */ -if ($SupplierLogin==1) { - $_SESSION['AllowedPageSecurityTokens'][0]=9; -} -if (in_array(15, $_SESSION['AllowedPageSecurityTokens'])) { - $debug = 1; +if (in_array(15, $_SESSION['AllowedPageSecurityTokens'])) { /*System administrator login */ + $debug = 1; //allow debug messages } else { - $debug = 0; + $debug = 0; //don't allow debug messages } function CryptPass( $Password ) { global $CryptFunction; Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-24 09:53:30 UTC (rev 4446) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-26 08:33:29 UTC (rev 4447) @@ -474,5 +474,6 @@ ALTER TABLE purchorderdetails ADD COLUMN assetid int NOT NULL DEFAULT 0; INSERT INTO `systypes` (`typeid` ,`typename` ,`typeno`) VALUES ('49', 'Import Fixed Assets', '1'); +ALTER TABLE `debtortrans` DROP FOREIGN KEY `debtortrans_ibfk_1` UPDATE config SET confvalue='4.0-RC2' WHERE confname='VersionName'; \ 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: <tim...@us...> - 2010-12-24 09:53:36
|
Revision: 4446 http://web-erp.svn.sourceforge.net/web-erp/?rev=4446&view=rev Author: tim_schofield Date: 2010-12-24 09:53:30 +0000 (Fri, 24 Dec 2010) Log Message: ----------- Take out menu access config settings as not implemented yet Modified Paths: -------------- trunk/includes/GetConfig.php Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2010-12-23 20:37:52 UTC (rev 4445) +++ trunk/includes/GetConfig.php 2010-12-24 09:53:30 UTC (rev 4446) @@ -20,20 +20,6 @@ DB_free_result($ConfigResult); // no longer needed /*Maybe we should check config directories exist and try to create if not */ - $sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']."='usermenurights'"; - $result=DB_query($sql, $db); - if (DB_num_rows($result)>0) { - $sql="SELECT menuid, access FROM usermenurights WHERE userid='".$_SESSION['UserID']."'"; - $result=DB_query($sql, $db); - } else if (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php') { - header("Location: UpgradeDatabase.php"); - } - - - while ($myrow=DB_fetch_array($result)) { - $_SESSION['MenuAccess'][$myrow['menuid']]=$myrow['access']; - } - $sql="SHOW tables WHERE Tables_in_".$_SESSION['DatabaseName']."='pagesecurity'"; $result=DB_query($sql, $db); if (DB_num_rows($result)>0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-12-23 20:37:58
|
Revision: 4445 http://web-erp.svn.sourceforge.net/web-erp/?rev=4445&view=rev Author: tim_schofield Date: 2010-12-23 20:37:52 +0000 (Thu, 23 Dec 2010) Log Message: ----------- New update to correct page security errors Added Paths: ----------- trunk/sql/mysql/updates/52.php Added: trunk/sql/mysql/updates/52.php =================================================================== --- trunk/sql/mysql/updates/52.php (rev 0) +++ trunk/sql/mysql/updates/52.php 2010-12-23 20:37:52 UTC (rev 4445) @@ -0,0 +1,10 @@ +<?php + +/* Correct the MenuAccess.php security level + */ + +UpdateField('pagesecurity', 'script', 'MenuAccess.php', 'script="pagesecurityAccess.php"', $db); + +UpdateDBNo(52, $db); + +?> \ 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: <tim...@us...> - 2010-12-23 20:37:36
|
Revision: 4444 http://web-erp.svn.sourceforge.net/web-erp/?rev=4444&view=rev Author: tim_schofield Date: 2010-12-23 20:37:29 +0000 (Thu, 23 Dec 2010) Log Message: ----------- New update to correct page security errors Modified Paths: -------------- trunk/includes/session.inc Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-23 15:30:30 UTC (rev 4443) +++ trunk/includes/session.inc 2010-12-23 20:37:29 UTC (rev 4444) @@ -12,7 +12,7 @@ header('Location:' . $rootpath . '/install/index.php'); } include($PathPrefix . 'config.php'); -$DBVersion=51; +$DBVersion=52; if (isset($SessionSavePath)){ session_save_path($SessionSavePath); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-12-23 15:30:38
|
Revision: 4443 http://web-erp.svn.sourceforge.net/web-erp/?rev=4443&view=rev Author: tim_schofield Date: 2010-12-23 15:30:30 +0000 (Thu, 23 Dec 2010) Log Message: ----------- Remove unnecessary $PageSecurity assignments Modified Paths: -------------- trunk/AddCustomerTypeNotes.php trunk/Areas.php trunk/BOMInquiry.php trunk/Credit_Invoice.php trunk/Currencies.php trunk/CustWhereAlloc.php trunk/EmailConfirmation.php trunk/FixedAssetRegister.php trunk/FormDesigner.php trunk/GLBudgets.php trunk/GLTags.php trunk/GeocodeSetup.php trunk/GetStockImage.php trunk/Logout.php trunk/PDFTopItems.php trunk/PO_AuthoriseMyOrders.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PricesBasedOnMarkUp.php trunk/Prices_Customer.php trunk/PrintCustTrans.php trunk/SalesGLPostings.php trunk/SalesGraph.php trunk/SelectCustomer.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSupplier.php trunk/StockCheck.php trunk/StockCostUpdate.php trunk/StockUsageGraph.php trunk/SystemCheck.php trunk/TaxGroups.php trunk/UpgradeDatabase.php trunk/Z_ChangeStockCategory.php trunk/Z_CheckDebtorsControl.php trunk/Z_CheckGLTransBalance.php trunk/Z_CurrencyDebtorsBalances.php trunk/Z_CurrencySuppliersBalances.php trunk/Z_ImportStocks.php trunk/Z_PriceChanges.php trunk/Z_Upgrade3.10.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_index.php trunk/geo_displaymap_customers.php trunk/geo_displaymap_suppliers.php trunk/geocode.php trunk/geocode_genxml_customers.php trunk/geocode_genxml_suppliers.php trunk/index.php Modified: trunk/AddCustomerTypeNotes.php =================================================================== --- trunk/AddCustomerTypeNotes.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/AddCustomerTypeNotes.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.3 $ */ /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; include('includes/session.inc'); $title = _('Customer Type (Group) Notes'); include('includes/header.inc'); Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Areas.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.22 $ */ /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; include('includes/session.inc'); Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/BOMInquiry.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.12 $ */ /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); $title = _('Costed Bill Of Material'); Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Credit_Invoice.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.35 $ */ /* $Id$*/ -$PageSecurity =3; +//$PageSecurity =3; /*Functions to get the GL codes to post the transaction to */ Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Currencies.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.20 $ */ /* $Id$*/ -$PageSecurity = 9; +//$PageSecurity = 9; include('includes/session.inc'); $title = _('Currencies Maintenance'); Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/CustWhereAlloc.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.10 $ */ /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); $title = _('Customer How Paid Inquiry'); Modified: trunk/EmailConfirmation.php =================================================================== --- trunk/EmailConfirmation.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/EmailConfirmation.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/FixedAssetRegister.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,5 +1,5 @@ <?php -$PageSecurity = 11; +//$PageSecurity = 11; include ('includes/session.inc'); $title = _('Fixed Asset Register'); $csv_output = ''; Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/FormDesigner.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -$PageSecurity = 14; +//$PageSecurity = 14; include('includes/session.inc'); $title = _('Form Designer'); include('includes/header.inc'); Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/GLBudgets.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 10; +//$PageSecurity = 10; include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/GLTags.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 10; +//$PageSecurity = 10; include('includes/session.inc'); $title = _('Maintain General Ledger Tags'); Modified: trunk/GeocodeSetup.php =================================================================== --- trunk/GeocodeSetup.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/GeocodeSetup.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; include('includes/session.inc'); $title = _('Geocode Maintenance'); include('includes/header.inc'); Modified: trunk/GetStockImage.php =================================================================== --- trunk/GetStockImage.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/GetStockImage.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 1; +//$PageSecurity = 1; include ('includes/session.inc'); /* http://127.0.0.1/~brink/webERP/GetStockImage.php Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Logout.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.17 $ */ /* $Id$*/ -$PageSecurity =1; +//$PageSecurity =1; $AllowAnyone=True; /* Allow all users to log off - needed for autoamted runs */ include('includes/session.inc'); Modified: trunk/PDFTopItems.php =================================================================== --- trunk/PDFTopItems.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PDFTopItems.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.2 $ */ /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include ('includes/session.inc'); include ('includes/PDFStarter.php'); $FontSize = 10; Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PO_AuthoriseMyOrders.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 4; +//$PageSecurity = 4; include('includes/session.inc'); $title = _('Authorise Purchase Orders'); Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PO_PDFPurchOrder.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); include('includes/DefinePOClass.php'); Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PO_SelectOSPurchOrder.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -442,9 +442,9 @@ } else { $PrintPurchOrder = _('Printed'); } - + $PrintPurchOrder2 = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $myrow['orderno'] . '&realorderno=' . $myrow['realorderno'] . '&ViewingOnly=1">' . _('Show') . '</a>'; - + $s2 = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $myrow['orderno'] . '&realorderno=' . $myrow['realorderno'] . '&ViewingOnly=1">' . $myrow['realorderno']. '</a>'; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PO_SelectPurchOrder.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include ('includes/session.inc'); $title = _('Search Purchase Orders'); include ('includes/header.inc'); Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PricesBasedOnMarkUp.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.9 $ */ /* $Id$*/ -$PageSecurity=11; +//$PageSecurity=11; include('includes/session.inc'); Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Prices_Customer.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.11 $ */ /* $Id$*/ -$PageSecurity = 11; +//$PageSecurity = 11; include('includes/session.inc'); Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/PrintCustTrans.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -$PageSecurity = 1; +//$PageSecurity = 1; include ('includes/session.inc'); if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); Modified: trunk/SalesGLPostings.php =================================================================== --- trunk/SalesGLPostings.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SalesGLPostings.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 10; +//$PageSecurity = 10; include('includes/session.inc'); $title = _('Sales GL Postings Set Up'); Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SalesGraph.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 6; +//$PageSecurity = 6; include('includes/session.inc'); include('includes/phplot/phplot.php'); $title=_('Sales Report Graph'); Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SelectCustomer.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include ('includes/session.inc'); $title = _('Search Customers'); include ('includes/header.inc'); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SelectProduct.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; $PricesSecurity = 12; include ('includes/session.inc'); $title = _('Search Inventory Items'); Modified: trunk/SelectRecurringSalesOrder.php =================================================================== --- trunk/SelectRecurringSalesOrder.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SelectRecurringSalesOrder.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); $title = _('Search Recurring Sales Orders'); Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SelectSupplier.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include ('includes/session.inc'); $title = _('Search Suppliers'); include ('includes/header.inc'); Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/StockCheck.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Revision: 1.13 $ */ /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); If (isset($_POST['PrintPDF']) Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/StockCostUpdate.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -4,7 +4,7 @@ //$PageSecurity = 9; /*viewing possible with inquiries but not mods */ -$UpdateSecurity =10; +//$UpdateSecurity =10; include('includes/session.inc'); $title = _('Stock Cost Update'); Modified: trunk/StockUsageGraph.php =================================================================== --- trunk/StockUsageGraph.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/StockUsageGraph.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 2; +//$PageSecurity = 2; include('includes/session.inc'); $result = DB_query("SELECT description FROM stockmaster WHERE stockid='" . trim(strtoupper($_GET['StockID'])) . "'",$db); $myrow = DB_fetch_row($result); Modified: trunk/SystemCheck.php =================================================================== --- trunk/SystemCheck.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/SystemCheck.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity =10; +//$PageSecurity =10; include('includes/session.inc'); $title = _('System Check'); include('includes/header.inc'); Modified: trunk/TaxGroups.php =================================================================== --- trunk/TaxGroups.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/TaxGroups.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//PageSecurity=15; include('includes/session.inc'); Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/UpgradeDatabase.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); Modified: trunk/Z_ChangeStockCategory.php =================================================================== --- trunk/Z_ChangeStockCategory.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_ChangeStockCategory.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$ */ -$PageSecurity = 15; +//$PageSecurity = 15; include ('includes/session.inc'); $title = _('UTILITY PAGE Change A Stock Category'); include ('includes/header.inc'); Modified: trunk/Z_CheckDebtorsControl.php =================================================================== --- trunk/Z_CheckDebtorsControl.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_CheckDebtorsControl.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//$PageSecurity=15; include('includes/session.inc'); $title=_('Debtors Control Integrity'); Modified: trunk/Z_CheckGLTransBalance.php =================================================================== --- trunk/Z_CheckGLTransBalance.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_CheckGLTransBalance.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//$PageSecurity=15; include('includes/session.inc'); $title=_('Check Period Sales Ledger Control Account'); Modified: trunk/Z_CurrencyDebtorsBalances.php =================================================================== --- trunk/Z_CurrencyDebtorsBalances.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_CurrencyDebtorsBalances.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//$PageSecurity=15; include('includes/session.inc'); $title=_('Currency Debtor Balances'); Modified: trunk/Z_CurrencySuppliersBalances.php =================================================================== --- trunk/Z_CurrencySuppliersBalances.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_CurrencySuppliersBalances.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//$PageSecurity=15; include('includes/session.inc'); $title=_('Currency Debtor Balances'); Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_ImportStocks.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -2,7 +2,7 @@ /* $Id: Z_ImportStocks.php 4043 2010-09-30 16:17:53Z tim_schofield $*/ /* Script to make stock locations for all parts that do not have stock location records set up*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Import Items'); include('includes/header.inc'); Modified: trunk/Z_PriceChanges.php =================================================================== --- trunk/Z_PriceChanges.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_PriceChanges.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity=15; +//$PageSecurity=15; include('includes/session.inc'); Modified: trunk/Z_Upgrade3.10.php =================================================================== --- trunk/Z_Upgrade3.10.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade3.10.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP to version 3.10.5'); include('includes/header.inc'); Modified: trunk/Z_Upgrade_3.05-3.06.php =================================================================== --- trunk/Z_Upgrade_3.05-3.06.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade_3.05-3.06.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP 3.06 - 3.07'); include('includes/header.inc'); Modified: trunk/Z_Upgrade_3.07-3.08.php =================================================================== --- trunk/Z_Upgrade_3.07-3.08.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade_3.07-3.08.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP 3.071 - 3.08'); include('includes/header.inc'); Modified: trunk/Z_Upgrade_3.08-3.09.php =================================================================== --- trunk/Z_Upgrade_3.08-3.09.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade_3.08-3.09.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP 3.08 - 3.09'); include('includes/header.inc'); Modified: trunk/Z_Upgrade_3.09-3.10.php =================================================================== --- trunk/Z_Upgrade_3.09-3.10.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade_3.09-3.10.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP 3.09 - 3.10'); include('includes/header.inc'); Modified: trunk/Z_Upgrade_3.10-3.11.php =================================================================== --- trunk/Z_Upgrade_3.10-3.11.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_Upgrade_3.10-3.11.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -$PageSecurity = 15; +//$PageSecurity = 15; include('includes/session.inc'); $title = _('Upgrade webERP 3.10 - 3.11'); include('includes/header.inc'); Modified: trunk/Z_index.php =================================================================== --- trunk/Z_index.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/Z_index.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,6 +1,6 @@ <?php /* $Id$*/ - $PageSecurity = 15; +// $PageSecurity = 15; include('includes/session.inc'); $title = _('Special Fixes and Utilities') . ' - ' . _('Only System Administrator'); Modified: trunk/geo_displaymap_customers.php =================================================================== --- trunk/geo_displaymap_customers.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/geo_displaymap_customers.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; $title = _('Geocoded Customer Branches Report'); include ('includes/session.inc'); Modified: trunk/geo_displaymap_suppliers.php =================================================================== --- trunk/geo_displaymap_suppliers.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/geo_displaymap_suppliers.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; $title = _('Geocoded Supplier Report'); include ('includes/session.inc'); Modified: trunk/geocode.php =================================================================== --- trunk/geocode.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/geocode.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; $title = _('Geocode Generate'); include ('includes/session.inc'); Modified: trunk/geocode_genxml_customers.php =================================================================== --- trunk/geocode_genxml_customers.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/geocode_genxml_customers.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,21 +1,21 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; $title = _('Geocode Generate XML'); include ('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); -function parseToXML($htmlStr) -{ -$xmlStr=str_replace('<','<',$htmlStr); -$xmlStr=str_replace('>','>',$xmlStr); -$xmlStr=str_replace('"','"',$xmlStr); -$xmlStr=str_replace("'",''',$xmlStr); -$xmlStr=str_replace("&",'&',$xmlStr); -return $xmlStr; -} +function parseToXML($htmlStr) +{ +$xmlStr=str_replace('<','<',$htmlStr); +$xmlStr=str_replace('>','>',$xmlStr); +$xmlStr=str_replace('"','"',$xmlStr); +$xmlStr=str_replace("'",''',$xmlStr); +$xmlStr=str_replace("&",'&',$xmlStr); +return $xmlStr; +} $sql = "SELECT * FROM custbranch WHERE 1"; $ErrMsg = _('An error occurred in retrieving the information');; Modified: trunk/geocode_genxml_suppliers.php =================================================================== --- trunk/geocode_genxml_suppliers.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/geocode_genxml_suppliers.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -1,21 +1,21 @@ <?php /* $Id$*/ -$PageSecurity = 3; +//$PageSecurity = 3; $title = _('Geocode Generate XML'); include ('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); -function parseToXML($htmlStr) -{ -$xmlStr=str_replace('<','<',$htmlStr); -$xmlStr=str_replace('>','>',$xmlStr); -$xmlStr=str_replace('"','"',$xmlStr); -$xmlStr=str_replace("'",''',$xmlStr); -$xmlStr=str_replace("&",'&',$xmlStr); -return $xmlStr; -} +function parseToXML($htmlStr) +{ +$xmlStr=str_replace('<','<',$htmlStr); +$xmlStr=str_replace('>','>',$xmlStr); +$xmlStr=str_replace('"','"',$xmlStr); +$xmlStr=str_replace("'",''',$xmlStr); +$xmlStr=str_replace("&",'&',$xmlStr); +return $xmlStr; +} $sql = "SELECT * FROM suppliers WHERE 1"; $ErrMsg = _('An error occurred in retrieving the information');; Modified: trunk/index.php =================================================================== --- trunk/index.php 2010-12-23 10:52:28 UTC (rev 4442) +++ trunk/index.php 2010-12-23 15:30:30 UTC (rev 4443) @@ -4,7 +4,7 @@ /* $Revision: 1.91 $ */ -$PageSecurity = 1; +//$PageSecurity = 1; include('includes/session.inc'); $title=_('Main Menu'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |