|
From: <dai...@us...> - 2011-03-31 09:12:16
|
Revision: 4528
http://web-erp.svn.sourceforge.net/web-erp/?rev=4528&view=rev
Author: daintree
Date: 2011-03-31 09:12:09 +0000 (Thu, 31 Mar 2011)
Log Message:
-----------
more SQL fixes - Purchase order creation from SelectProduct link
Modified Paths:
--------------
trunk/GLTrialBalance_csv.php
trunk/PDFPrintLabel.php
trunk/PO_Header.php
trunk/PurchData.php
trunk/StockReorderLevel.php
trunk/doc/Change.log.html
trunk/includes/GetConfig.php
trunk/includes/GetPaymentMethods.php
trunk/includes/MiscFunctions.php
trunk/includes/PO_ReadInOrder.inc
trunk/includes/SQL_CommonFunctions.inc
trunk/locale/zh_CN.utf8/Manual/ManualAPIFunctions.php
Modified: trunk/GLTrialBalance_csv.php
===================================================================
--- trunk/GLTrialBalance_csv.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/GLTrialBalance_csv.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -1,6 +1,6 @@
<?php
-/* $Id*/
+/* $Id$*/
/*Through deviousness and cunning, this system allows trial balances for any date range that recalcuates the p & l balances
and shows the balance sheets as at the end of the period selected - so first off need to show the input of criteria screen
@@ -9,10 +9,9 @@
/*Needs to have FromPeriod and ToPeriod sent with URL
* also need to work on authentication with username and password sent too*/
-//$PageSecurity = 8;
+
$AllowAnyone =true;
-//$_POST['UserNameEntryField'] = $_GET['Identifier'];
-//$_POST['Password'] = $_GET['IdentifierCheck'];
+
//Page must be called with GLTrialBalance_csv.php?CompanyName=XXXXX&FromPeriod=Y&ToPeriod=Z
$_POST['CompanyNameField'] = $_GET['CompanyName'];
//$_SERVER['PHP_SELF'] = dirname($_SERVER['PHP_SELF']) .'/GLTrialBalance_csv.php?ToPeriod=' . $_GET['ToPeriod'] . '&FromPeriod=' . $_GET['FromPeriod'];
@@ -26,17 +25,17 @@
$RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings'];
-$SQL = 'SELECT accountgroups.groupname,
+$SQL = "SELECT accountgroups.groupname,
accountgroups.parentgroupname,
accountgroups.pandl,
chartdetails.accountcode ,
chartmaster.accountname,
- Sum(CASE WHEN chartdetails.period=' . $_GET['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd,
- Sum(CASE WHEN chartdetails.period=' . $_GET['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd,
- Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd,
- Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.actual ELSE 0 END) AS monthactual,
- Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.budget ELSE 0 END) AS monthbudget,
- Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd
+ Sum(CASE WHEN chartdetails.period='" . $_GET['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd,
+ Sum(CASE WHEN chartdetails.period='" . $_GET['FromPeriod'] . "' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd,
+ Sum(CASE WHEN chartdetails.period='" . $_GET['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd,
+ Sum(CASE WHEN chartdetails.period='" . $_GET['ToPeriod'] . "' THEN chartdetails.actual ELSE 0 END) AS monthactual,
+ Sum(CASE WHEN chartdetails.period='" . $_GET['ToPeriod'] . "' THEN chartdetails.budget ELSE 0 END) AS monthbudget,
+ Sum(CASE WHEN chartdetails.period='" . $_GET['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd
FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname
INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode
GROUP BY accountgroups.groupname,
@@ -48,7 +47,7 @@
ORDER BY accountgroups.pandl desc,
accountgroups.sequenceintb,
accountgroups.groupname,
- chartdetails.accountcode';
+ chartdetails.accountcode";
$AccountsResult = DB_query($SQL,$db);
@@ -78,15 +77,6 @@
function stripcomma($str) { //because we're using comma as a delimiter
return str_replace(",", "", $str);
}
-/*
-$len = strlen($CSV_File);
-header('Content-type: application/csv');
-header('Content-Length: ' . $len );
-header('Content-Disposition: inline; filename=GLTrialBalance.csv');
-header('Expires: 0');
-header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-header('Pragma: public');
-*/
echo $CSV_File;
?>
\ No newline at end of file
Modified: trunk/PDFPrintLabel.php
===================================================================
--- trunk/PDFPrintLabel.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/PDFPrintLabel.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -1,9 +1,8 @@
<?php
-/* $Revision: 1.2 $ */
-//$PageSecurity = 10;
+/* $Id: PDFPrintLabel.php 4285 2010-12-22 16:01:51Z tim_schofield $*/
-$Version_adds= "1.2";
+$Version_adds= '1.2';
include('includes/session.inc');
require_once('includes/DefineLabelClass.php');
@@ -19,7 +18,7 @@
// If there is no label templates, the user could select to set up a new one
if ($AllLabels==null) {
echo '<br/><br/>';
- abortMsg( _("There isn't any label template to select for printing. Click") .
+ abortMsg( _('There isn\'t any label template to select for printing. Click') .
' <a href="Labels.php"><b>' . _('HERE'). '</b></a> '. _('to set up a new one') );
}
@@ -189,15 +188,15 @@
}
function selSalesType($type) {
- return selectTable("SELECT typeabbrev, sales_type FROM salestypes ORDER BY sales_type", $type);
+ return selectTable('SELECT typeabbrev, sales_type FROM salestypes ORDER BY sales_type', $type);
}
function selCurrency($curr) {
- return selectTable("SELECT currabrev, currency FROM currencies", $curr);
+ return selectTable('SELECT currabrev, currency FROM currencies', $curr);
}
function selCategory(&$categ) {
- return selectTable("SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription", $categ);
+ return selectTable('SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription', $categ);
}
function selectTable($sql, &$currentKey) {
Modified: trunk/PO_Header.php
===================================================================
--- trunk/PO_Header.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/PO_Header.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -46,8 +46,8 @@
if (isset($_POST['Select']) and empty($_POST['SupplierContact'])) {
$sql = "SELECT contact
- FROM suppliercontacts
- WHERE supplierid='". $_POST['Select'] ."'";
+ FROM suppliercontacts
+ WHERE supplierid='". $_POST['Select'] ."'";
$SuppCoResult = DB_query($sql,$db);
if (DB_num_rows($SuppCoResult)>0) {
@@ -158,8 +158,8 @@
} //end if there is actually a status change the class Status != the POST['Status']
}
-
-if (isset($_GET['NewOrder']) and isset($_GET['StockID']) and isset($_GET['SelectedSupplier'])) {
+/*New order initiated by user clicking on supplier purchasing data from items page */
+if (isset($_GET['NewOrder']) AND isset($_GET['StockID']) AND isset($_GET['SelectedSupplier'])) {
/*
* initialise a new order
*/
@@ -312,7 +312,7 @@
suppliers.address6,
suppliers.currcode
FROM suppliers
- WHERE suppliers.suppname LIKE '". $SearchString ."'
+ WHERE suppliers.suppname " . LIKE . " '". $SearchString ."'
ORDER BY suppliers.suppname";
} elseif (strlen($_POST['SuppCode'])>0){
@@ -326,7 +326,7 @@
suppliers.address6,
suppliers.currcode
FROM suppliers
- WHERE suppliers.supplierid LIKE '%" . $_POST['SuppCode'] . "%'
+ WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SuppCode'] . "%'
ORDER BY suppliers.supplierid";
}
@@ -371,7 +371,7 @@
if (isset($_POST['Select'])) {
-/* will only be true if page called from supplier selection form
+/* will only be true if page called from supplier selection form or item purchasing data order link
* or set because only one supplier record returned from a search
*/
@@ -501,8 +501,9 @@
}
// part of step 1
-if ($_SESSION['RequireSupplierSelection'] ==1 OR !isset($_SESSION['PO'.$identifier]->SupplierID) OR
- $_SESSION['PO'.$identifier]->SupplierID=='' ) {
+if ($_SESSION['RequireSupplierSelection'] ==1
+ OR !isset($_SESSION['PO'.$identifier]->SupplierID)
+ OR $_SESSION['PO'.$identifier]->SupplierID=='' ) {
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' .
_('Purchase Order') . '" alt="">' . ' ' . _('Purchase Order: Select Supplier') . '';
@@ -586,13 +587,14 @@
}
if (isset($Purch_Item)) {
+ /*This is set if the user hits the link from the supplier purchasing info shown on SelectProduct.php */
prnMsg(_('Purchase Item(s) with this code') . ': ' . $Purch_Item,'info');
echo '<div class="centre">';
echo '<br><table class="table_index"><tr><td class="menu_group_item">';
/* the link */
- echo '<li><a href="'.$rootpath.'/PO_Items.php?' . SID . 'NewItem=' . $Purch_Item . '&identifier=' . $identifier . '">' . _('Enter Line Item to this purchase order') . '</a></li>';
+ echo '<li><a href="'.$rootpath.'/PO_Items.php?NewItem=' . $Purch_Item . '&identifier=' . $identifier . '">' . _('Enter Line Item to this purchase order') . '</a></li>';
echo '</td></tr></table></div><br>';
@@ -629,9 +631,9 @@
$Purch_Item,
$PurchItemRow['serialised'],
$PurchItemRow['controlled'],
- $Qty,
+ $Qty*$PurchItemRow['conversionfactor'],
$PurchItemRow['description'],
- $PurchItemRow['price'],
+ $PurchItemRow['price']/$PurchItemRow['conversionfactor'],
$PurchItemRow['units'],
$PurchItemRow['stockact'],
date($_SESSION['DefaultDateFormat']),
Modified: trunk/PurchData.php
===================================================================
--- trunk/PurchData.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/PurchData.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -1,8 +1,6 @@
<?php
/* $Id$*/
-//$PageSecurity = 4; Now comes from DB
-
include ('includes/session.inc');
$title = _('Supplier Purchasing Data');
@@ -60,50 +58,49 @@
if (!is_numeric($_POST['ConversionFactor'])) {
$InputError = 1;
unset($_POST['ConversionFactor']);
- prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br>' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br><br>' . _('No changes will be made to the database'), 'error');
+ prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error');
}
if ($InputError == 0 AND isset($_POST['AddRecord'])) {
$sql = "INSERT INTO purchdata (supplierno,
- stockid,
- price,
- effectivefrom,
- suppliersuom,
- conversionfactor,
- supplierdescription,
- suppliers_partno,
- leadtime,
- minorderqty,
- preferred)
- VALUES ('" . $SupplierID . "',
- '" . $StockID . "',
- '" . $_POST['Price'] . "',
- '" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
- '" . $_POST['SuppliersUOM'] . "',
- '" . $_POST['ConversionFactor'] . "',
- '" . $_POST['SupplierDescription'] . "',
- '" . $_POST['SupplierCode'] . "',
- '" . $_POST['LeadTime'] . "',
- '" . $_POST['MinOrderQty'] . "',
- '" . $_POST['Preferred'] . "')";
+ stockid,
+ price,
+ effectivefrom,
+ suppliersuom,
+ conversionfactor,
+ supplierdescription,
+ suppliers_partno,
+ leadtime,
+ minorderqty,
+ preferred)
+ VALUES ('" . $SupplierID . "',
+ '" . $StockID . "',
+ '" . $_POST['Price'] . "',
+ '" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
+ '" . $_POST['SuppliersUOM'] . "',
+ '" . $_POST['ConversionFactor'] . "',
+ '" . $_POST['SupplierDescription'] . "',
+ '" . $_POST['SupplierCode'] . "',
+ '" . $_POST['LeadTime'] . "',
+ '" . $_POST['MinOrderQty'] . "',
+ '" . $_POST['Preferred'] . "')";
$ErrMsg = _('The supplier purchasing details could not be added to the database because');
$DbgMsg = _('The SQL that failed was');
$AddResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
prnMsg(_('This supplier purchasing data has been added to the database'), 'success');
}
if ($InputError == 0 AND isset($_POST['UpdateRecord'])) {
- $sql = "UPDATE purchdata SET
- price='" . $_POST['Price'] . "',
- effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
- suppliersuom='" . $_POST['SuppliersUOM'] . "',
- conversionfactor='" . $_POST['ConversionFactor'] . "',
- supplierdescription='" . $_POST['SupplierDescription'] . "',
- suppliers_partno='" . $_POST['SupplierCode'] . "',
- leadtime='" . $_POST['LeadTime'] . "',
- minorderqty='" . $_POST['MinOrderQty'] . "',
- preferred='" . $_POST['Preferred'] . "'
+ $sql = "UPDATE purchdata SET price='" . $_POST['Price'] . "',
+ effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "',
+ suppliersuom='" . $_POST['SuppliersUOM'] . "',
+ conversionfactor='" . $_POST['ConversionFactor'] . "',
+ supplierdescription='" . $_POST['SupplierDescription'] . "',
+ suppliers_partno='" . $_POST['SupplierCode'] . "',
+ leadtime='" . $_POST['LeadTime'] . "',
+ minorderqty='" . $_POST['MinOrderQty'] . "',
+ preferred='" . $_POST['Preferred'] . "'
WHERE purchdata.stockid='".$StockID."'
AND purchdata.supplierno='".$SupplierID."'
- AND purchdata.effectivefrom='" . $_POST['WasEffectiveFrom'] . "'";
+ AND purchdata.effectivefrom='" . $_POST['WasEffectiveFrom'] . "'";
$ErrMsg = _('The supplier purchasing details could not be update because');
$DbgMsg = _('The SQL that failed was');
$UpdResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
@@ -195,38 +192,36 @@
$DisplayPreferred = _('No');
}
printf("<td>%s</td>
- <td class=number>%s</td>
- <td>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s " . _('days') . "</td>
- <td>%s</td>
- <td><a href='%s?%s&StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td>
- <td><a href='%s?%s&StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td>
- </tr>",
- $myrow['suppname'],
- number_format($myrow['price'], 3),
- $myrow['unitname'],
- $myrow['conversionfactor'],
- number_format($myrow['price']/$myrow['conversionfactor'],2),
- $myrow['currcode'],
- ConvertSQLDate($myrow['effectivefrom']),
- $myrow['minorderqty'],
- $myrow['leadtime'],
- $DisplayPreferred,
- $_SERVER['PHP_SELF'],
- SID,
- $StockID,
- $myrow['supplierno'],
- $myrow['effectivefrom'],
- $_SERVER['PHP_SELF'],
- SID,
- $StockID,
- $myrow['supplierno'],
- $myrow['effectivefrom']);
+ <td class=number>%s</td>
+ <td>%s</td>
+ <td class=number>%s</td>
+ <td class=number>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s " . _('days') . "</td>
+ <td>%s</td>
+ <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td>
+ <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td>
+ </tr>",
+ $myrow['suppname'],
+ number_format($myrow['price'], 3),
+ $myrow['unitname'],
+ $myrow['conversionfactor'],
+ number_format($myrow['price']/$myrow['conversionfactor'],2),
+ $myrow['currcode'],
+ ConvertSQLDate($myrow['effectivefrom']),
+ $myrow['minorderqty'],
+ $myrow['leadtime'],
+ $DisplayPreferred,
+ $_SERVER['PHP_SELF'],
+ $StockID,
+ $myrow['supplierno'],
+ $myrow['effectivefrom'],
+ $_SERVER['PHP_SELF'],
+ $StockID,
+ $myrow['supplierno'],
+ $myrow['effectivefrom']);
} //end of while loop
echo '</table><br/>';
if ($CountPreferreds > 1) {
@@ -278,7 +273,7 @@
if (isset($_POST['SearchSupplier'])) {
if (isset($_POST['Keywords']) AND isset($_POST['SupplierCode'])) {
prnMsg( _('Supplier Name keywords have been used in preference to the Supplier Code extract entered') . '.', 'info' );
- echo '<br>';
+ echo '<br />';
}
if ($_POST['Keywords'] == '' AND $_POST['SupplierCode'] == '') {
$_POST['Keywords'] = ' ';
@@ -293,7 +288,7 @@
suppliers.address1,
suppliers.address2,
suppliers.address3
- FROM suppliers WHERE suppliers.suppname LIKE " ."'".$SearchString."'";
+ FROM suppliers WHERE suppliers.suppname " . LIKE . " '".$SearchString."'";
} elseif (strlen($_POST['SupplierCode']) > 0) {
$SQL = "SELECT suppliers.supplierid,
suppliers.suppname,
@@ -302,7 +297,7 @@
suppliers.address2,
suppliers.address3
FROM suppliers
- WHERE suppliers.supplierid LIKE '%" . $_POST['SupplierCode'] . "%'";
+ WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'";
} //one of keywords or SupplierCode was more than a zero length string
$ErrMsg = _('The suppliers matching the criteria entered could not be retrieved because');
$DbgMsg = _('The SQL to retrieve supplier details that failed was');
@@ -324,7 +319,7 @@
include ('includes/footer.inc');
exit;
} else {
- // echo '<br><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . ' </b> (' . _('In Units of') . ' ' . $myrow[1] . ' )</font>';
+ // echo '<br /><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . ' </b> (' . _('In Units of') . ' ' . $myrow[1] . ' )</font>';
}
} else {
prnMsg(_('Stock Item') . ' - ' . $StockID . ' ' . _('is not defined in the database'), 'warn');
@@ -383,11 +378,14 @@
purchdata.suppliers_partno,
purchdata.minorderqty,
purchdata.preferred,
- stockmaster.units
+ stockmaster.units,
+ currencies.decimalplaces
FROM purchdata INNER JOIN suppliers
ON purchdata.supplierno=suppliers.supplierid
INNER JOIN stockmaster
ON purchdata.stockid=stockmaster.stockid
+ INNER JOIN currencies
+ ON suppliers.currcode = currencies.currabrev
WHERE purchdata.supplierno='".$SupplierID."'
AND purchdata.stockid='".$StockID."'
AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'";
@@ -405,9 +403,9 @@
$_POST['Preferred'] = $myrow['preferred'];
$_POST['MinOrderQty'] = $myrow['minorderqty'];
$_POST['SupplierCode'] = $myrow['suppliers_partno'];
- $StockUOM=$myrow['units'];
+ $StockUOM=$myrow['units'];
}
- echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table class=selection>';
+ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><table class=selection>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if (!isset($SupplierID)) {
$SupplierID = '';
@@ -453,7 +451,7 @@
echo '<tr><td>' . _('Currency') . ':</td>
<td><input type=hidden name="CurrCode" . VALUE="' . $CurrCode . '">' . $CurrCode . '</td></tr>';
echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td>
- <td><input type="text" class="number" name="Price" maxlength=12 size=12 VALUE=' . number_format($_POST['Price'], DecimalPlaces($CurrCode, $db),'.','') . '></td></tr>';
+ <td><input type="text" class="number" name="Price" maxlength=12 size=12 VALUE=' . number_format($_POST['Price'], $myrow['decimalplaces'] ,'.','') . '></td></tr>';
echo '<tr><td>' . _('Date Updated') . ':</td>
<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 VALUE="' . $_POST['EffectiveFrom'] . '"></td></tr>';
echo '<tr><td>' . _('Our Unit of Measure') . ':</td>';
@@ -491,13 +489,13 @@
echo '<tr><td>' . _('Preferred Supplier') . ':</td>
<td><select name="Preferred">';
if ($_POST['Preferred'] == 1) {
- echo '<option selected VALUE=1>' . _('Yes');
- echo '<option VALUE=0>' . _('No');
+ echo '<option selected VALUE=1>' . _('Yes') . '</option>';
+ echo '<option VALUE=0>' . _('No') . '</option>';
} else {
- echo '<option VALUE=1>' . _('Yes');
- echo '<option selected VALUE=0>' . _('No');
+ echo '<option VALUE=1>' . _('Yes') . '</option>';
+ echo '<option selected VALUE=0>' . _('No') . '</option>';
}
- echo '</select></td></tr></table><br><div class="centre">';
+ echo '</select></td></tr></table><br /><div class="centre">';
if (isset($_GET['Edit'])) {
echo '<input type=submit name="UpdateRecord" VALUE="' . _('Update') . '">';
} else {
@@ -506,10 +504,10 @@
echo '</div>';
echo '<div class="centre">';
if (isset($StockLocation) and isset($StockID) AND strlen($StockID) != 0) {
- echo '<br><a href="' . $rootpath . '/StockStatus.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Status') . '</a>';
- echo '<br><a href="' . $rootpath . '/StockMovements.php?' . SID . '&StockID=' . $StockID . '&StockLocation=' . $StockLocation . '">' . _('Show Stock Movements') . '</a>';
- echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '&StockLocation=' . $StockLocation . '">' . _('Search Outstanding Sales Orders') . '</a>';
- echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '&StockLocation=' . $StockLocation . '">' . _('Show Stock Movements') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $StockLocation . '">' . _('Search Outstanding Sales Orders') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>';
}
echo '</form></div>';
}
Modified: trunk/StockReorderLevel.php
===================================================================
--- trunk/StockReorderLevel.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/StockReorderLevel.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -2,8 +2,6 @@
/* $Id$*/
-//$PageSecurity = 4;
-
include('includes/session.inc');
$title = _('Stock Re-Order Level Maintenance');
include('includes/header.inc');
@@ -14,7 +12,7 @@
$StockID = trim(strtoupper($_POST['StockID']));
}
-echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a>';
+echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a>';
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') .
'" alt="" /><b>' . $title. '</b></p>';
@@ -22,17 +20,19 @@
$result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='$StockID'", $db);
$myrow = DB_fetch_row($result);
-echo "<form action='" . $_SERVER['PHP_SELF'] . "?" . SID . "' method=post>";
+echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
$sql = "SELECT locstock.loccode,
locations.locationname,
locstock.quantity,
- locstock.reorderlevel
- FROM locstock,
- locations
- WHERE locstock.loccode=locations.loccode
- AND locstock.stockid = '" . $StockID . "'
+ locstock.reorderlevel,
+ stockmaster.decimalplaces
+ FROM locstock INNER JOIN locations
+ ON locstock.loccode=locations.loccode
+ INNER JOIN stockmaster
+ ON locstock.stockid=stockmaster.stockid
+ WHERE locstock.stockid = '" . $StockID . "'
ORDER BY locstock.loccode";
$ErrMsg = _('The stock held at each location cannot be retrieved because');
@@ -40,16 +40,16 @@
$LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
-echo "<table cellpadding=2 class=selection>";
+echo '<table cellpadding="2" class="selection">';
echo '<tr><th colspan=3'._('Stock Code') . ":<input type=TEXT name='StockID' size=21 VALUE='$StockID' maxlength=20>";
echo " <input type=submit name='Show' VALUE='" . _('Show Re-Order Levels') . "'></th></tr>";
echo '<tr><th colspan=3><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th></tr>';
-$TableHeader = "<tr>
- <th>" . _('Location') . "</th>
- <th>" . _('Quantity On Hand') . "</th>
- <th>" . _('Re-Order Level') . "</th>
- </tr>";
+$TableHeader = '<tr>
+ <th>' . _('Location') . '</th>
+ <th>' . _('Quantity On Hand') . '</th>
+ <th>' . _('Re-Order Level') . '</th>
+ </tr>';
echo $TableHeader;
$j = 1;
@@ -92,10 +92,10 @@
//end of while loop
echo "</table><br /><div class='centre'><input type=submit name='UpdateData' VALUE='" . _('Update') . "'><br /><br />";
-echo "<a href='$rootpath/StockMovements.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Movements') . '</a>';
-echo "<br><a href='$rootpath/StockUsage.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Usage') . '</a>';
-echo "<br><a href='$rootpath/SelectSalesOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Outstanding Sales Orders') . '</a>';
-echo "<br><a href='$rootpath/SelectCompletedOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</a>';
+echo "<a href='$rootpath/StockMovements.php?StockID=$StockID'>" . _('Show Stock Movements') . '</a>';
+echo "<br /><a href='$rootpath/StockUsage.php?StockID=$StockID'>" . _('Show Stock Usage') . '</a>';
+echo "<br /><a href='$rootpath/SelectSalesOrder.php?SelectedStockItem=$StockID'>" . _('Search Outstanding Sales Orders') . '</a>';
+echo "<br /><a href='$rootpath/SelectCompletedOrder.php?SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</a>';
echo '</div></form>';
include('includes/footer.inc');
Modified: trunk/doc/Change.log.html
===================================================================
--- trunk/doc/Change.log.html 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/doc/Change.log.html 2011-03-31 09:12:09 UTC (rev 4528)
@@ -1,6 +1,6 @@
<p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p>
<p />
-
+<p>31/3/11 Phil:Fix link to create purchase order from purchasing data link on SelectProduct.php - thanks Brian May for pointing out the bug</p>
<p>31/3/11 Phil: Updated all tranlations from the launchpad site</p>
<p>31/3/11 Tim: Fix to make languages display immediately on change - session.inc moved includes/LanguageSetup.php down</p>
<p>30/3/11 Tim: New ReprintGRN.php script takes a purchase order and allows any line received to have GRN(s) reprinted</p>
Modified: trunk/includes/GetConfig.php
===================================================================
--- trunk/includes/GetConfig.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/includes/GetConfig.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -40,31 +40,31 @@
/* Also reads all the company data set up in the company record and returns an array */
$sql= 'SELECT coyname,
- gstno,
- regoffice1,
- regoffice2,
- regoffice3,
- regoffice4,
- regoffice5,
- regoffice6,
- telephone,
- fax,
- email,
- currencydefault,
- debtorsact,
- pytdiscountact,
- creditorsact,
- payrollact,
- grnact,
- exchangediffact,
- purchasesexchangediffact,
- retainedearnings,
- freightact,
- gllink_debtors,
- gllink_creditors,
- gllink_stock
- FROM companies
- WHERE coycode=1';
+ gstno,
+ regoffice1,
+ regoffice2,
+ regoffice3,
+ regoffice4,
+ regoffice5,
+ regoffice6,
+ telephone,
+ fax,
+ email,
+ currencydefault,
+ debtorsact,
+ pytdiscountact,
+ creditorsact,
+ payrollact,
+ grnact,
+ exchangediffact,
+ purchasesexchangediffact,
+ retainedearnings,
+ freightact,
+ gllink_debtors,
+ gllink_creditors,
+ gllink_stock
+ FROM companies
+ WHERE coycode=1';
$ErrMsg = _('An error occurred accessing the database to retrieve the company information');
$ReadCoyResult = DB_query($sql,$db,$ErrMsg);
Modified: trunk/includes/GetPaymentMethods.php
===================================================================
--- trunk/includes/GetPaymentMethods.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/includes/GetPaymentMethods.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -1,6 +1,6 @@
<?php
/* $Id$*/
-// I Figure This is the fastest and safest way to load the Sections
+
$PaytTypes = array();
$ReceiptTypes = array();
@@ -9,12 +9,15 @@
receipttype
FROM paymentmethods
ORDER by paymentname';
+
$PMResult = DB_query($sql,$db);
while( $PMrow = DB_fetch_array($PMResult) ) {
- if ($PMrow['paymenttype']==1)
+ if ($PMrow['paymenttype']==1) {
$PaytTypes[] = $PMrow['paymentname'];
- if ($PMrow['receipttype']==1)
+ }
+ if ($PMrow['receipttype']==1) {
$ReceiptTypes[] = $PMrow['paymentname'];
+ }
}
DB_free_result($PMResult); // no longer needed
?>
\ No newline at end of file
Modified: trunk/includes/MiscFunctions.php
===================================================================
--- trunk/includes/MiscFunctions.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/includes/MiscFunctions.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -2,9 +2,9 @@
/* $Id$*/
-/********************************************/
+/* ****************************************** */
/** STANDARD MESSAGE HANDLING & FORMATTING **/
-/********************************************/
+/* ****************************************** */
function prnMsg($Msg,$Type='info', $Prefix=''){
@@ -231,21 +231,7 @@
}//wikiLink
-function DecimalPlaces($currcode, $db) {
- $sql='SELECT decimalplaces FROM currencies WHERE currabrev="'.$currcode.'"';
- $result=DB_query($sql, $db);
- $myrow=DB_fetch_array($result);
- return $myrow['decimalplaces'];
-}
-function StockDecimalPlaces($StockID, $db) {
- $sql='SELECT decimalplaces FROM stockmaster WHERE stockid="'.$StockID.'"';
- $result=DB_query($sql, $db);
- $myrow=DB_fetch_array($result);
- return $myrow['decimalplaces'];
-}
-
-
// Lindsay debug stuff
function LogBackTrace( $dest = 0 ) {
error_log( "***BEGIN STACK BACKTRACE***", $dest );
Modified: trunk/includes/PO_ReadInOrder.inc
===================================================================
--- trunk/includes/PO_ReadInOrder.inc 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/includes/PO_ReadInOrder.inc 2011-03-31 09:12:09 UTC (rev 4528)
@@ -15,45 +15,45 @@
/*read in all the guff from the selected order into the PO PurchOrder Class variable */
- $OrderHeaderSQL = 'SELECT purchorders.supplierno,
- suppliers.suppname,
- purchorders.comments,
- purchorders.orddate,
- purchorders.rate,
- purchorders.dateprinted,
- purchorders.deladd1,
- purchorders.deladd2,
- purchorders.deladd3,
- purchorders.deladd4,
- purchorders.deladd5,
- purchorders.deladd6,
- purchorders.tel,
- purchorders.suppdeladdress1,
- purchorders.suppdeladdress2,
- purchorders.suppdeladdress3,
- purchorders.suppdeladdress4,
- purchorders.suppdeladdress5,
- purchorders.suppdeladdress6,
- purchorders.suppliercontact,
- purchorders.supptel,
- purchorders.contact,
- purchorders.allowprint,
- purchorders.requisitionno,
- purchorders.intostocklocation,
- purchorders.initiator,
- purchorders.version,
- purchorders.status,
- purchorders.stat_comment,
- purchorders.deliverydate,
- purchorders.port,
- suppliers.currcode,
- locations.managed ,
- purchorders.paymentterms
- FROM purchorders
- INNER JOIN locations ON purchorders.intostocklocation=locations.loccode,
- suppliers
- WHERE purchorders.supplierno = suppliers.supplierid
- AND purchorders.orderno = ' . $_GET['ModifyOrderNumber'];
+ $OrderHeaderSQL = "SELECT purchorders.supplierno,
+ suppliers.suppname,
+ purchorders.comments,
+ purchorders.orddate,
+ purchorders.rate,
+ purchorders.dateprinted,
+ purchorders.deladd1,
+ purchorders.deladd2,
+ purchorders.deladd3,
+ purchorders.deladd4,
+ purchorders.deladd5,
+ purchorders.deladd6,
+ purchorders.tel,
+ purchorders.suppdeladdress1,
+ purchorders.suppdeladdress2,
+ purchorders.suppdeladdress3,
+ purchorders.suppdeladdress4,
+ purchorders.suppdeladdress5,
+ purchorders.suppdeladdress6,
+ purchorders.suppliercontact,
+ purchorders.supptel,
+ purchorders.contact,
+ purchorders.allowprint,
+ purchorders.requisitionno,
+ purchorders.intostocklocation,
+ purchorders.initiator,
+ purchorders.version,
+ purchorders.status,
+ purchorders.stat_comment,
+ purchorders.deliverydate,
+ purchorders.port,
+ suppliers.currcode,
+ locations.managed ,
+ purchorders.paymentterms
+ FROM purchorders
+ INNER JOIN locations ON purchorders.intostocklocation=locations.loccode,
+ suppliers
+ WHERE purchorders.supplierno = suppliers.supplierid
+ AND purchorders.orderno = '" . $_GET['ModifyOrderNumber'] . "'";
$ErrMsg = _('The order cannot be retrieved because');
$DbgMsg = _('The SQL statement that was used and failed was');
@@ -100,17 +100,17 @@
$_SESSION['PO'.$identifier]->PaymentTerms= $myrow['paymentterms'];
$SupplierSQL = "SELECT suppliers.supplierid,
- suppliers.suppname,
- suppliers.address1,
- suppliers.address2,
- suppliers.address3,
- suppliers.address4,
- suppliers.address5,
- suppliers.address6,
- suppliers.currcode
- FROM suppliers
- WHERE suppliers.supplierid='" . $_SESSION['PO'.$identifier]->SupplierID."'
- ORDER BY suppliers.supplierid";
+ suppliers.suppname,
+ suppliers.address1,
+ suppliers.address2,
+ suppliers.address3,
+ suppliers.address4,
+ suppliers.address5,
+ suppliers.address6,
+ suppliers.currcode
+ FROM suppliers
+ WHERE suppliers.supplierid='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ ORDER BY suppliers.supplierid";
$ErrMsg = _('The searched supplier records requested cannot be retrieved because');
$result_SuppSelect = DB_query($SupplierSQL,$db,$ErrMsg);
@@ -125,47 +125,47 @@
/*now populate the line PO array with the purchase order details records */
$LineItemsSQL = "SELECT podetailitem,
- purchorderdetails.itemcode,
- stockmaster.description,
- purchorderdetails.deliverydate,
- purchorderdetails.itemdescription,
- glcode,
- accountname,
- purchorderdetails.qtyinvoiced,
- purchorderdetails.unitprice,
- stockmaster.units,
- purchorderdetails.quantityord,
- purchorderdetails.quantityrecd,
- purchorderdetails.shiptref,
- purchorderdetails.completed,
- purchorderdetails.jobref,
- purchorderdetails.stdcostunit,
- purchorderdetails.itemno,
- stockmaster.controlled,
- stockmaster.serialised,
- stockmaster.decimalplaces,
- purchorderdetails.subtotal_amount,
- purchorderdetails.package,
- purchorderdetails.pcunit,
- purchorderdetails.netweight,
- purchorderdetails.kgs,
- purchorderdetails.cuft,
- purchorderdetails.total_quantity,
- purchorderdetails.total_amount,
- purchorderdetails.assetid,
- purchorderdetails.conversionfactor,
- purchorderdetails.suppliersunit,
- purchorderdetails.suppliers_partno
- FROM purchorderdetails
- LEFT JOIN stockmaster
- ON purchorderdetails.itemcode=stockmaster.stockid
- INNER JOIN purchorders
- ON purchorders.orderno=purchorderdetails.orderno
- LEFT JOIN chartmaster
- ON purchorderdetails.glcode=chartmaster.accountcode
- WHERE purchorderdetails.completed=0
- AND purchorderdetails.orderno ='" . $_GET['ModifyOrderNumber'] . "'
- ORDER BY podetailitem";
+ purchorderdetails.itemcode,
+ stockmaster.description,
+ purchorderdetails.deliverydate,
+ purchorderdetails.itemdescription,
+ glcode,
+ accountname,
+ purchorderdetails.qtyinvoiced,
+ purchorderdetails.unitprice,
+ stockmaster.units,
+ purchorderdetails.quantityord,
+ purchorderdetails.quantityrecd,
+ purchorderdetails.shiptref,
+ purchorderdetails.completed,
+ purchorderdetails.jobref,
+ purchorderdetails.stdcostunit,
+ purchorderdetails.itemno,
+ stockmaster.controlled,
+ stockmaster.serialised,
+ stockmaster.decimalplaces,
+ purchorderdetails.subtotal_amount,
+ purchorderdetails.package,
+ purchorderdetails.pcunit,
+ purchorderdetails.netweight,
+ purchorderdetails.kgs,
+ purchorderdetails.cuft,
+ purchorderdetails.total_quantity,
+ purchorderdetails.total_amount,
+ purchorderdetails.assetid,
+ purchorderdetails.conversionfactor,
+ purchorderdetails.suppliersunit,
+ purchorderdetails.suppliers_partno
+ FROM purchorderdetails
+ LEFT JOIN stockmaster
+ ON purchorderdetails.itemcode=stockmaster.stockid
+ INNER JOIN purchorders
+ ON purchorders.orderno=purchorderdetails.orderno
+ LEFT JOIN chartmaster
+ ON purchorderdetails.glcode=chartmaster.accountcode
+ WHERE purchorderdetails.completed=0
+ AND purchorderdetails.orderno ='" . $_GET['ModifyOrderNumber'] . "'
+ ORDER BY podetailitem";
$ErrMsg = _('The lines on the purchase order cannot be retrieved because');
$DbgMsg = _('The SQL statement that was used to retrieve the purchase order lines was');
@@ -192,36 +192,36 @@
}
$_SESSION['PO'.$identifier]->add_to_order($_SESSION['PO'.$identifier]->LinesOnOrder+1,
- $StockID,
- $myrow['serialised'],
- $myrow['controlled'],
- $myrow['quantityord'],
- stripslashes($myrow['itemdescription']),
- $myrow['unitprice'],
- $Units,
- $GLCode,
- ConvertSQLDate($myrow['deliverydate']),
- $myrow['shiptref'],
- $myrow['completed'],
- $myrow['jobref'],
- $myrow['qtyinvoiced'],
- $myrow['quantityrecd'],
- $myrow['accountname'],
- $myrow['decimalplaces'],
- $myrow['itemno'],
- $myrow['suppliersunit'],
- $myrow['conversionfactor'],
- $myrow['suppliers_partno'],
- $myrow['subtotal_amount'],
- 0,
- $myrow['package'],
- $myrow['pcunit'],
- $myrow['netweight'],
- $myrow['kgs'],
- $myrow['cuft'],
- $myrow['total_quantity'],
- $myrow['total_amount'],
- $myrow['assetid'] );
+ $StockID,
+ $myrow['serialised'],
+ $myrow['controlled'],
+ $myrow['quantityord'],
+ stripslashes($myrow['itemdescription']),
+ $myrow['unitprice'],
+ $Units,
+ $GLCode,
+ ConvertSQLDate($myrow['deliverydate']),
+ $myrow['shiptref'],
+ $myrow['completed'],
+ $myrow['jobref'],
+ $myrow['qtyinvoiced'],
+ $myrow['quantityrecd'],
+ $myrow['accountname'],
+ $myrow['decimalplaces'],
+ $myrow['itemno'],
+ $myrow['suppliersunit'],
+ $myrow['conversionfactor'],
+ $myrow['suppliers_partno'],
+ $myrow['subtotal_amount'],
+ 0,
+ $myrow['package'],
+ $myrow['pcunit'],
+ $myrow['netweight'],
+ $myrow['kgs'],
+ $myrow['cuft'],
+ $myrow['total_quantity'],
+ $myrow['total_amount'],
+ $myrow['assetid'] );
$_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->PODetailRec = $myrow['podetailitem'];
$_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->StandardCost = $myrow['stdcostunit']; /*Needed for receiving goods and GL interface */
Modified: trunk/includes/SQL_CommonFunctions.inc
===================================================================
--- trunk/includes/SQL_CommonFunctions.inc 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/includes/SQL_CommonFunctions.inc 2011-03-31 09:12:09 UTC (rev 4528)
@@ -18,7 +18,7 @@
DB_query('LOCK TABLES systypes WRITE',$db);
- $SQL = 'SELECT typeno FROM systypes WHERE typeid = ' . $TransType;
+ $SQL = "SELECT typeno FROM systypes WHERE typeid = '" . $TransType . "'";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': <BR>' . _('The next transaction number could not be retrieved from the database because');
$DbgMsg = _('The following SQL to retrieve the transaction number was used');
@@ -26,12 +26,12 @@
$myrow = DB_fetch_row($GetTransNoResult);
- $SQL = 'UPDATE systypes SET typeno = ' . ($myrow[0] + 1) . ' WHERE typeid = ' . $TransType;
+ $SQL = "UPDATE systypes SET typeno = '" . ($myrow[0] + 1) . "' WHERE typeid = '" . $TransType . "'";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The transaction number could not be incremented');
$DbgMsg = _('The following SQL to increment the transaction number was used');
$UpdTransNoResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg);
- DB_query("UNLOCK TABLES",$db);
+ DB_query('UNLOCK TABLES',$db);
return $myrow[0] + 1;
}
@@ -41,14 +41,13 @@
/*Gets the GL Codes relevant to the stock item account from the stock category record */
$QuerySQL = "SELECT stockact,
- adjglact,
- purchpricevaract,
- materialuseagevarac,
- wipact
- FROM stockmaster,
- stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND stockmaster.stockid = '" . $StockID . "'";
+ adjglact,
+ purchpricevaract,
+ materialuseagevarac,
+ wipact
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.stockid = '" . $StockID . "'";
$ErrMsg = _('The stock GL codes could not be retrieved because');
$GetStkGLResult = DB_query($QuerySQL, $db, $ErrMsg);
@@ -62,10 +61,10 @@
/*Gets the Tax rate applicable to an item from the TaxAuthority of the branch and TaxLevel of the item */
$QuerySQL = "SELECT taxrate
- FROM taxauthrates
- WHERE taxauthority='" . $TaxAuthority . "'
- AND dispatchtaxprovince='" . $DispatchTaxProvince . "'
- AND taxcatid = '" . $TaxCategory . "'";
+ FROM taxauthrates
+ WHERE taxauthority='" . $TaxAuthority . "'
+ AND dispatchtaxprovince='" . $DispatchTaxProvince . "'
+ AND taxcatid = '" . $TaxCategory . "'";
$ErrMsg = _('The tax rate for this item could not be retrieved because');
$GetTaxRateResult = DB_query($QuerySQL,$db,$ErrMsg);
@@ -168,19 +167,19 @@
$ValueOfChange = $QOH * ($NewCost - $OldCost);
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
- VALUES (35,
- " . $CostUpdateNo . ",
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
+ VALUES ('35',
+ '" . $CostUpdateNo . "',
'" . Date('Y-m-d') . "',
- " . $PeriodNo . ",
- " . $StockGLCode['adjglact'] . ",
+ '" . $PeriodNo . "',
+ '" . $StockGLCode['adjglact'] . "',
'" . $StockID . ' ' . _('cost was') . ' ' . $OldCost . ' ' . _('changed to') . ' ' . $NewCost . ' x ' . _('Quantity on hand of') . ' ' . $QOH . "',
- " . (-$ValueOfChange) . ")";
+ '" . (-$ValueOfChange) . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL credit for the stock cost adjustment posting could not be inserted because');
$DbgMsg = _('The following SQL to insert the GLTrans record was used');
@@ -193,13 +192,13 @@
account,
narrative,
amount)
- VALUES (35,
- " . $CostUpdateNo . ",
+ VALUES ('35',
+ '" . $CostUpdateNo . "',
'" . Date('Y-m-d') . "',
- " . $PeriodNo . ",
- " . $StockGLCode['stockact'] . ",
+ '" . $PeriodNo . "',
+ '" . $StockGLCode['stockact'] . "',
'" . $StockID . ' ' . _('cost was') . ' ' . $OldCost . ' ' . _('changed to') .' ' . $NewCost . ' x ' . _('Quantity on hand of') . ' ' . $QOH . "',
- " . $ValueOfChange . ")";
+ '" . $ValueOfChange . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL debit for stock cost adjustment posting could not be inserted because');
$DbgMsg = _('The following SQL to insert the GLTrans record was used');
@@ -231,10 +230,10 @@
}
/*Iterates through the levels of the bom, recalculating each bom it meets*/
-function UpdateCost($db, $item) {
- $SQL = "SELECT parent FROM bom where component = '" . $item . "'";
- $result = DB_query($SQL, $db);
- while ($MyRow=DB_fetch_array($result)){
+function UpdateCost($db, $Item) {
+ $SQL = "SELECT parent FROM bom where component = '" . $Item . "'";
+ $Result = DB_query($SQL, $db);
+ while ($MyRow=DB_fetch_array($Result)){
$NewParent = $MyRow['parent'];
$MaterialCost = BomMaterialCost($NewParent, $db);
$SQL = 'UPDATE stockmaster SET materialcost=' . $MaterialCost . " WHERE stockid='" . $NewParent . "'";
@@ -264,7 +263,7 @@
qtypu,
stdcost,
autoissue)
- SELECT " . $WO . ",
+ SELECT '" . $WO . "',
'" . $ParentID . "',
bom.component,
bom.quantity*" . $Qty . ",
@@ -278,7 +277,7 @@
AND bom.component NOT IN (
SELECT stockid
FROM worequirements
- WHERE wo = " . $WO . "
+ WHERE wo = '" . $WO . "'
AND parentstockid = '" . $ParentID . "'
)";
$result = DB_query($sql, $db);
@@ -304,7 +303,7 @@
AND bom.component IN (
SELECT stockid
FROM worequirements
- WHERE wo = " . $WO . "
+ WHERE wo = '" . $WO . "'
AND parentstockid = '". $ParentID . "'
)
) AS g ON g.wo=worequirements.wo
Modified: trunk/locale/zh_CN.utf8/Manual/ManualAPIFunctions.php
===================================================================
--- trunk/locale/zh_CN.utf8/Manual/ManualAPIFunctions.php 2011-03-31 08:32:24 UTC (rev 4527)
+++ trunk/locale/zh_CN.utf8/Manual/ManualAPIFunctions.php 2011-03-31 09:12:09 UTC (rev 4528)
@@ -19,7 +19,7 @@
echo '<body>';
$weberpuser = $_SESSION['UserID'];
-$sql='SELECT password FROM www_users WHERE userid="'.$weberpuser.'"';
+$sql="SELECT password FROM www_users WHERE userid='" . $weberpuser."'";
$result=DB_query($sql, $db);
$myrow=DB_fetch_array($result);
$weberppassword = $myrow[0];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|