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-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-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-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] |