|
From: <dai...@us...> - 2011-03-27 01:50:41
|
Revision: 4519
http://web-erp.svn.sourceforge.net/web-erp/?rev=4519&view=rev
Author: daintree
Date: 2011-03-27 01:50:33 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
purchasing mods
Modified Paths:
--------------
trunk/PO_Header.php
trunk/PO_Items.php
trunk/doc/Change.log.html
trunk/includes/DefinePOClass.php
Modified: trunk/PO_Header.php
===================================================================
--- trunk/PO_Header.php 2011-03-26 22:11:47 UTC (rev 4518)
+++ trunk/PO_Header.php 2011-03-27 01:50:33 UTC (rev 4519)
@@ -66,9 +66,9 @@
} elseif ($_SESSION['PO'.$identifier]->Status !=$_POST['Status']) { //the old status != new status
$OKToUpdateStatus = 1;
$AuthSQL ="SELECT authlevel
- FROM purchorderauth
- WHERE userid='".$_SESSION['UserID']."'
- AND currabrev='".$_SESSION['PO'.$identifier]->CurrCode."'";
+ FROM purchorderauth
+ WHERE userid='".$_SESSION['UserID']."'
+ AND currabrev='".$_SESSION['PO'.$identifier]->CurrCode."'";
$AuthResult=DB_query($AuthSQL,$db);
$myrow=DB_fetch_array($AuthResult);
@@ -148,10 +148,10 @@
$AllowPrint=0;
}
$SQL = "UPDATE purchorders SET status='" . $_POST['Status']. "',
- stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."',
- allowprint='".$AllowPrint."'
- WHERE purchorders.orderno ='" . $_SESSION['ExistingOrder'] ."'";
-
+ stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."',
+ allowprint='".$AllowPrint."'
+ WHERE purchorders.orderno ='" . $_SESSION['ExistingOrder'] ."'";
+
$ErrMsg = _('The order status could not be updated because');
$UpdateResult=DB_query($SQL,$db,$ErrMsg);
}
@@ -230,16 +230,16 @@
$_POST['RePrint'] = 0;
}
- echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?' . SID . 'identifier='.$identifier. "'>";
+ echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>";
echo '<p>';
prnMsg(_('You should automatically be forwarded to the entry of the purchase order line items page') . '. ' .
_('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' .
- "<a href='$rootpath/PO_Items.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info');
+ '<a href="' . $rootpath . '/PO_Items.php?identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'),'info');
include('includes/footer.inc');
exit;
} /* end of if isset _POST'EnterLines' */
-echo '<span style="float:left"><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . "identifier=".$identifier.'">'. _('Back to Purchase Orders'). '</a></span>';
+echo '<span style="float:left"><a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?identifier='.$identifier.'">'. _('Back to Purchase Orders'). '</a></span>';
/*The page can be called with ModifyOrderNumber=x where x is a purchase
* order number. The page then looks up the details of order x and allows
@@ -303,31 +303,31 @@
$SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%';
$SQL = "SELECT suppliers.supplierid,
- suppliers.suppname,
- suppliers.address1,
- suppliers.address2,
- suppliers.address3,
- suppliers.address4,
- suppliers.address5,
- suppliers.address6,
- suppliers.currcode
- FROM suppliers
- WHERE suppliers.suppname LIKE '". $SearchString ."'
- ORDER BY suppliers.suppname";
+ suppliers.suppname,
+ suppliers.address1,
+ suppliers.address2,
+ suppliers.address3,
+ suppliers.address4,
+ suppliers.address5,
+ suppliers.address6,
+ suppliers.currcode
+ FROM suppliers
+ WHERE suppliers.suppname LIKE '". $SearchString ."'
+ ORDER BY suppliers.suppname";
} elseif (strlen($_POST['SuppCode'])>0){
$SQL = "SELECT suppliers.supplierid,
- suppliers.suppname,
- suppliers.address1,
- suppliers.address2,
- suppliers.address3,
- suppliers.address4,
- suppliers.address5,
- suppliers.address6,
- suppliers.currcode
- FROM suppliers
- WHERE suppliers.supplierid LIKE '%" . $_POST['SuppCode'] . "%'
- 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 LIKE '%" . $_POST['SuppCode'] . "%'
+ ORDER BY suppliers.supplierid";
}
$ErrMsg = _('The searched supplier records requested cannot be retrieved because');
@@ -376,20 +376,20 @@
*/
$sql = "SELECT suppliers.suppname,
- suppliers.currcode,
- currencies.rate,
- suppliers.paymentterms,
- suppliers.address1,
- suppliers.address2,
- suppliers.address3,
- suppliers.address4,
- suppliers.address5,
- suppliers.address6,
- suppliers.telephone,
- suppliers.port
- FROM suppliers INNER JOIN currencies
- ON suppliers.currcode=currencies.currabrev
- WHERE supplierid='" . $_POST['Select'] . "'";
+ suppliers.currcode,
+ currencies.rate,
+ suppliers.paymentterms,
+ suppliers.address1,
+ suppliers.address2,
+ suppliers.address3,
+ suppliers.address4,
+ suppliers.address5,
+ suppliers.address6,
+ suppliers.telephone,
+ suppliers.port
+ FROM suppliers INNER JOIN currencies
+ ON suppliers.currcode=currencies.currabrev
+ WHERE supplierid='" . $_POST['Select'] . "'";
$ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' .
_('cannot be retrieved because');
@@ -399,9 +399,9 @@
// added for suppliers lookup fields
$AuthSql="SELECT cancreate
- FROM purchorderauth
- WHERE userid='". $_SESSION['UserID'] . "'
- AND currabrev='". $myrow['currcode'] . "'";
+ FROM purchorderauth
+ WHERE userid='". $_SESSION['UserID'] . "'
+ AND currabrev='". $myrow['currcode'] . "'";
$AuthResult=DB_query($AuthSql,$db);
@@ -444,20 +444,20 @@
} else {
$_POST['Select'] = $_SESSION['PO'.$identifier]->SupplierID;
$sql = "SELECT suppliers.suppname,
- suppliers.currcode,
- suppliers.paymentterms,
- suppliers.address1,
- suppliers.address2,
- suppliers.address3,
- suppliers.address4,
- suppliers.address5,
- suppliers.address6,
- suppliers.telephone,
- suppliers.port
- FROM suppliers INNER JOIN currencies
- ON suppliers.currcode=currencies.currabrev
- WHERE supplierid='" . $_POST['Select'] . "'";
-
+ suppliers.currcode,
+ suppliers.paymentterms,
+ suppliers.address1,
+ suppliers.address2,
+ suppliers.address3,
+ suppliers.address4,
+ suppliers.address5,
+ suppliers.address6,
+ suppliers.telephone,
+ suppliers.port
+ FROM suppliers INNER JOIN currencies
+ ON suppliers.currcode=currencies.currabrev
+ WHERE supplierid='" . $_POST['Select'] . "'";
+
$ErrMsg = _('The supplier record of the supplier selected') . ': ' . $_POST['Select'] . ' ' .
_('cannot be retrieved because');
$DbgMsg = _('The SQL used to retrieve the supplier details and failed was');
@@ -528,11 +528,11 @@
echo '<br><table cellpadding=3 colspan=7 class=selection>';
$tableheader = '<tr>
- <th>' . _('Code') . '</th>
- <th>' . _('Supplier Name') . '</th>
- <th>' . _('Address') . '</th>
- <th>' . _('Currency') . '</th>
- </tr>';
+ <th>' . _('Code') . '</th>
+ <th>' . _('Supplier Name') . '</th>
+ <th>' . _('Address') . '</th>
+ <th>' . _('Currency') . '</th>
+ </tr>';
echo $tableheader;
@@ -576,9 +576,9 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text">
- <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt="">
- ' . $_SESSION['PO'.$identifier]->SupplierName . ' - ' . _('All amounts stated in') . '
- ' . $_SESSION['PO'.$identifier]->CurrCode . '<br />';
+ <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt="">
+ ' . $_SESSION['PO'.$identifier]->SupplierName . ' - ' . _('All amounts stated in') . '
+ ' . $_SESSION['PO'.$identifier]->CurrCode . '<br />';
if ($_SESSION['ExistingOrder']) {
echo _(' Modify Purchase Order Number') . ' ' . $_SESSION['PO'.$identifier]->OrderNo;
@@ -603,15 +603,15 @@
}
$sql="SELECT stockmaster.controlled,
- stockmaster.serialised,
- stockmaster.description,
- stockmaster.units ,
- stockmaster.decimalplaces,
- purchdata.price,
- purchdata.suppliersuom,
- purchdata.suppliers_partno,
- purchdata.conversionfactor,
- stockcategory.stockact
+ stockmaster.serialised,
+ stockmaster.description,
+ stockmaster.units ,
+ stockmaster.decimalplaces,
+ purchdata.price,
+ purchdata.suppliersuom,
+ purchdata.suppliers_partno,
+ purchdata.conversionfactor,
+ stockcategory.stockact
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
LEFT JOIN purchdata
@@ -626,36 +626,36 @@
}
$_SESSION['PO'.$identifier]->add_to_order( 1,
- $Purch_Item,
- $PurchItemRow['serialised'],
- $PurchItemRow['controlled'],
- $Qty,
- $PurchItemRow['description'],
- $PurchItemRow['price'],
- $PurchItemRow['units'],
- $PurchItemRow['stockact'],
- date($_SESSION['DefaultDateFormat']),
- 0,
- 0,
- '',
- 0,
- 0,
- '',
- $PurchItemRow['decimalplaces'],
- $Purch_Item,
- $PurchItemRow['suppliersuom'],
- $PurchItemRow['conversionfactor'],
- $PurchItemRow['suppliers_partno'],
- $Qty*$PurchItemRow['price'],
- '',
- 0,
- 0,
- 0,
- 0,
- $Qty,
- $Qty*$PurchItemRow['price']);
+ $Purch_Item,
+ $PurchItemRow['serialised'],
+ $PurchItemRow['controlled'],
+ $Qty,
+ $PurchItemRow['description'],
+ $PurchItemRow['price'],
+ $PurchItemRow['units'],
+ $PurchItemRow['stockact'],
+ date($_SESSION['DefaultDateFormat']),
+ 0,
+ 0,
+ '',
+ 0,
+ 0,
+ '',
+ $PurchItemRow['decimalplaces'],
+ $Purch_Item,
+ $PurchItemRow['suppliersuom'],
+ $PurchItemRow['conversionfactor'],
+ $PurchItemRow['suppliers_partno'],
+ $Qty*$PurchItemRow['price'],
+ '',
+ 0,
+ 0,
+ 0,
+ 0,
+ $Qty,
+ $Qty*$PurchItemRow['price']);
- echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?' . SID . 'identifier='.$identifier. "'>";
+ echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>";
}
/*Set up form for entry of order header stuff */
@@ -733,10 +733,6 @@
echo '<tr><td>' . _('Requisition Ref') . ':</td>
<td><input type="text" name="Requisition" size="16" maxlength="15" value="' . $_POST['Requisition'] . '" /></td></tr>';
-// echo '<tr><td>' . _('Exchange Rate') . ":</td>
-// <td><input type=TEXT name='ExRate' size=16 maxlength=15 VALUE=" . $_POST['ExRate'] . '></td>
-// echo "<input type='hidden' name='ExRate' size=16 maxlength=15 value=" . $_POST['ExRate'] . "></td>";
-// </tr>';
echo '<tr><td>' . _('Date Printed') . ':</td><td>';
if (isset($_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted) AND strlen($_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted)>6){
echo ConvertSQLDate($_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted);
@@ -780,29 +776,31 @@
switch ($_SESSION['PO'.$identifier]->Status) {
case 'Pending':
echo '<option selected value="Pending">' . _('Pending') . '</option>
- <option value="Authorised">' . _('Authorised') . '</option>
- <option value="Rejected">' . _('Rejected') . '</option>';
+ <option value="Authorised">' . _('Authorised') . '</option>
+ <option value="Rejected">' . _('Rejected') . '</option>';
break;
case 'Authorised':
echo '<option value="Pending">' . _('Pending') . '</option>
- <option selected value="Authorised">' . _('Authorised') . '</option>';
+ <option selected value="Authorised">' . _('Authorised') . '</option>
+ <option value="Cancelled">' . _('Cancelled') . '</option>';
break;
case 'Printed':
echo '<option value="Pending">' . _('Pending') . '</option>
- <option selected value="Printed">' . _('Printed') . '</option>';
+ <option selected value="Printed">' . _('Printed') . '</option>
+ <option value="Cancelled">' . _('Cancelled') . '</option>';
break;
case 'Completed':
echo '<option selected value="Completed">' . _('Completed') . '</option>';
break;
case 'Rejected':
echo '<option selected value="Rejected">' . _('Rejected') . '</option>
- <option value="Pending">' . _('Pending') . '</option>
- <option value="Authorised">' . _('Authorised') . '</option>';
+ <option value="Pending">' . _('Pending') . '</option>
+ <option value="Authorised">' . _('Authorised') . '</option>';
break;
case 'Cancelled':
echo '<option selected value="Cancelled">' . _('Cancelled') . '</option>
- <option value="Authorised">' . _('Authorised') . '</option>
- <option value="Pending">' . _('Pending') . '</option>';
+ <option value="Authorised">' . _('Authorised') . '</option>
+ <option value="Pending">' . _('Pending') . '</option>';
break;
}
@@ -856,15 +854,15 @@
$_POST['StkLocation'] = $_SESSION['UserStockLocation'];
$sql = "SELECT deladd1,
- deladd2,
- deladd3,
- deladd4,
- deladd5,
- deladd6,
- tel,
- contact
- FROM locations
- WHERE loccode='" . $_POST['StkLocation'] . "'";
+ deladd2,
+ deladd3,
+ deladd4,
+ deladd5,
+ deladd6,
+ tel,
+ contact
+ FROM locations
+ WHERE loccode='" . $_POST['StkLocation'] . "'";
$LocnAddrResult = DB_query($sql,$db);
if (DB_num_rows($LocnAddrResult)==1){
@@ -899,15 +897,15 @@
} elseif (isset($_POST['LookupDeliveryAddress'])){
$sql = "SELECT deladd1,
- deladd2,
- deladd3,
- deladd4,
- deladd5,
- deladd6,
- tel,
- contact
- FROM locations
- WHERE loccode='" . $_POST['StkLocation'] . "'";
+ deladd2,
+ deladd3,
+ deladd4,
+ deladd5,
+ deladd6,
+ tel,
+ contact
+ FROM locations
+ WHERE loccode='" . $_POST['StkLocation'] . "'";
$LocnAddrResult = DB_query($sql,$db);
if (DB_num_rows($LocnAddrResult)==1){
@@ -992,9 +990,9 @@
echo '<input type="submit" name="SearchSuppliers" value=' . _('Select Now') . '"></td></tr>';
echo '</td></tr><tr><td>' . _('Supplier Contact') . ':</td><td>
- <select name=SupplierContact>';
+ <select name="SupplierContact">';
- $sql = 'SELECT contact FROM suppliercontacts WHERE supplierid="' . $_POST['Select'] .'"';
+ $sql = "SELECT contact FROM suppliercontacts WHERE supplierid='" . $_POST['Select'] ."'";
$SuppCoResult = DB_query($sql,$db);
while ( $SuppCoRow=DB_fetch_array($SuppCoResult)){
@@ -1043,7 +1041,9 @@
DB_data_seek($result, 0);
echo '</select></td></tr>';
- $result=DB_query('SELECT loccode, locationname FROM locations WHERE loccode="' . $_SESSION['PO'.$identifier]->Port.'"', $db);
+ $result=DB_query("SELECT loccode,
+ locationname
+ FROM locations WHERE loccode='" . $_SESSION['PO'.$identifier]->Port."'", $db);
$myrow = DB_fetch_array($result);
$_POST['Port'] = $myrow['locationname'];
Modified: trunk/PO_Items.php
===================================================================
--- trunk/PO_Items.php 2011-03-26 22:11:47 UTC (rev 4518)
+++ trunk/PO_Items.php 2011-03-27 01:50:33 UTC (rev 4519)
@@ -2,8 +2,6 @@
/* $Id PO_Items.php 4183 2010-12-14 09:30:20Z daintree $ */
-//$PageSecurity = 4; Now retrieved from database
-
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
@@ -73,7 +71,7 @@
prnMsg( _('The purchase order can not be committed to the database because there are no lines entered on this order'),'error');
$InputError=1;
}
-
+
/*If all clear then proceed to update the database
*/
if ($InputError!=1){
@@ -103,7 +101,7 @@
if (DB_num_rows($AuthResult) ==0){
$AuthMessage = _('Your authority to approve purchase orders in') . ' ' . $_SESSION['PO'.$identifier]->CurrCode . ' ' . _('has not yet been set up') . '<br />';
} else {
- $AuthMessage = _('You can only authorise up to').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br />';
+ $AuthMessage = _('You can only authorise up to').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthRow['authlevel'] .'.<br />';
}
prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '.
@@ -131,71 +129,71 @@
/*Insert to purchase order header record */
$sql = "INSERT INTO purchorders ( orderno,
- supplierno,
- comments,
- orddate,
- rate,
- initiator,
- requisitionno,
- intostocklocation,
- deladd1,
- deladd2,
- deladd3,
- deladd4,
- deladd5,
- deladd6,
- tel,
- suppdeladdress1,
- suppdeladdress2,
- suppdeladdress3,
- suppdeladdress4,
- suppdeladdress5,
- suppdeladdress6,
- suppliercontact,
- supptel,
- contact,
- version,
- revised,
- deliveryby,
- status,
- stat_comment,
- deliverydate,
- paymentterms,
- allowprint)
- VALUES( '" . $_SESSION['PO'.$identifier]->OrderNo . "',
- '" . $_SESSION['PO'.$identifier]->SupplierID . "',
- '" . $_SESSION['PO'.$identifier]->Comments . "',
- '" . Date('Y-m-d') . "',
- '" . $_SESSION['PO'.$identifier]->ExRate . "',
- '" . $_SESSION['PO'.$identifier]->Initiator . "',
- '" . $_SESSION['PO'.$identifier]->RequisitionNo . "',
- '" . $_SESSION['PO'.$identifier]->Location . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd1 . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd2 . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd3 . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd4 . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd5 . "',
- '" . $_SESSION['PO'.$identifier]->DelAdd6 . "',
- '" . $_SESSION['PO'.$identifier]->Tel . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "',
- '" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "',
- '" . $_SESSION['PO'.$identifier]->SupplierContact . "',
- '" . $_SESSION['PO'.$identifier]->SuppTel. "',
- '" . $_SESSION['PO'.$identifier]->Contact . "',
- '" . $_SESSION['PO'.$identifier]->Version . "',
- '" . Date('Y-m-d') . "',
- '" . $_SESSION['PO'.$identifier]->DeliveryBy . "',
- '" . $_SESSION['PO'.$identifier]->Status . "',
- '" . $StatusComment . "',
- '" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "',
- '" . $_SESSION['PO'.$identifier]->PaymentTerms. "',
- '" . $_SESSION['PO'.$identifier]->AllowPrintPO . "'
- )";
-
+ supplierno,
+ comments,
+ orddate,
+ rate,
+ initiator,
+ requisitionno,
+ intostocklocation,
+ deladd1,
+ deladd2,
+ deladd3,
+ deladd4,
+ deladd5,
+ deladd6,
+ tel,
+ suppdeladdress1,
+ suppdeladdress2,
+ suppdeladdress3,
+ suppdeladdress4,
+ suppdeladdress5,
+ suppdeladdress6,
+ suppliercontact,
+ supptel,
+ contact,
+ version,
+ revised,
+ deliveryby,
+ status,
+ stat_comment,
+ deliverydate,
+ paymentterms,
+ allowprint)
+ VALUES( '" . $_SESSION['PO'.$identifier]->OrderNo . "',
+ '" . $_SESSION['PO'.$identifier]->SupplierID . "',
+ '" . $_SESSION['PO'.$identifier]->Comments . "',
+ '" . Date('Y-m-d') . "',
+ '" . $_SESSION['PO'.$identifier]->ExRate . "',
+ '" . $_SESSION['PO'.$identifier]->Initiator . "',
+ '" . $_SESSION['PO'.$identifier]->RequisitionNo . "',
+ '" . $_SESSION['PO'.$identifier]->Location . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd1 . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd2 . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd3 . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd4 . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd5 . "',
+ '" . $_SESSION['PO'.$identifier]->DelAdd6 . "',
+ '" . $_SESSION['PO'.$identifier]->Tel . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "',
+ '" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "',
+ '" . $_SESSION['PO'.$identifier]->SupplierContact . "',
+ '" . $_SESSION['PO'.$identifier]->SuppTel. "',
+ '" . $_SESSION['PO'.$identifier]->Contact . "',
+ '" . $_SESSION['PO'.$identifier]->Version . "',
+ '" . Date('Y-m-d') . "',
+ '" . $_SESSION['PO'.$identifier]->DeliveryBy . "',
+ '" . $_SESSION['PO'.$identifier]->Status . "',
+ '" . $StatusComment . "',
+ '" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "',
+ '" . $_SESSION['PO'.$identifier]->PaymentTerms. "',
+ '" . $_SESSION['PO'.$identifier]->AllowPrintPO . "'
+ )";
+
$ErrMsg = _('The purchase order header record could not be inserted into the database because');
$DbgMsg = _('The SQL statement used to insert the purchase order header record and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true);
@@ -204,50 +202,50 @@
foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) {
if ($POLine->Deleted==False) {
$sql = "INSERT INTO purchorderdetails ( orderno,
- itemcode,
- deliverydate,
- itemdescription,
- glcode,
- unitprice,
- quantityord,
- shiptref,
- jobref,
- itemno,
- suppliersunit,
- suppliers_partno,
- subtotal_amount,
- package,
- pcunit,
- netweight,
- kgs,
- cuft,
- total_quantity,
- total_amount,
- assetid,
- conversionfactor )
- VALUES (
- '" . $_SESSION['PO'.$identifier]->OrderNo . "',
- '" . $POLine->StockID . "',
- '" . FormatDateForSQL($POLine->ReqDelDate) . "',
- '" . $POLine->ItemDescription . "',
- '" . $POLine->GLCode . "',
- '" . $POLine->Price . "',
- '" . $POLine->Quantity . "',
- '" . $POLine->ShiptRef . "',
- '" . $POLine->JobRef . "',
- '" . $POLine->ItemNo . "',
- '" . $POLine->SuppliersUnit . "',
- '" . $POLine->Suppliers_PartNo . "',
- '" . $POLine->SubTotal_Amount . "',
- '" . $POLine->Package . "',
- '" . $POLine->PcUnit . "',
- '" . $POLine->NetWeight . "',
- '" . $POLine->KGs . "',
- '" . $POLine->CuFt . "',
- '" . $POLine->Total_Quantity . "',
- '" . $POLine->Total_Amount . "',
- '" . $POLine->AssetID . "',
- '" . $POLine->ConversionFactor . "')";
+ itemcode,
+ deliverydate,
+ itemdescription,
+ glcode,
+ unitprice,
+ quantityord,
+ shiptref,
+ jobref,
+ itemno,
+ suppliersunit,
+ suppliers_partno,
+ subtotal_amount,
+ package,
+ pcunit,
+ netweight,
+ kgs,
+ cuft,
+ total_quantity,
+ total_amount,
+ assetid,
+ conversionfactor )
+ VALUES (
+ '" . $_SESSION['PO'.$identifier]->OrderNo . "',
+ '" . $POLine->StockID . "',
+ '" . FormatDateForSQL($POLine->ReqDelDate) . "',
+ '" . $POLine->ItemDescription . "',
+ '" . $POLine->GLCode . "',
+ '" . $POLine->Price . "',
+ '" . $POLine->Quantity . "',
+ '" . $POLine->ShiptRef . "',
+ '" . $POLine->JobRef . "',
+ '" . $POLine->ItemNo . "',
+ '" . $POLine->SuppliersUnit . "',
+ '" . $POLine->Suppliers_PartNo . "',
+ '" . $POLine->SubTotal_Amount . "',
+ '" . $POLine->Package . "',
+ '" . $POLine->PcUnit . "',
+ '" . $POLine->NetWeight . "',
+ '" . $POLine->KGs . "',
+ '" . $POLine->CuFt . "',
+ '" . $POLine->Total_Quantity . "',
+ '" . $POLine->Total_Amount . "',
+ '" . $POLine->AssetID . "',
+ '" . $POLine->ConversionFactor . "')";
$ErrMsg =_('One of the purchase order detail records could not be inserted into the database because');
$DbgMsg =_('The SQL statement used to insert the purchase order detail record and failed was');
@@ -262,35 +260,35 @@
/*Update the purchase order header with any changes */
$sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' ,
- comments='" . $_SESSION['PO'.$identifier]->Comments . "',
- rate='" . $_SESSION['PO'.$identifier]->ExRate . "',
- initiator='" . $_SESSION['PO'.$identifier]->Initiator . "',
- requisitionno= '" . $_SESSION['PO'.$identifier]->RequisitionNo . "',
- version= '" . $_SESSION['PO'.$identifier]->Version . "',
- deliveryby='" . $_SESSION['PO'.$identifier]->DeliveryBy . "',
- deliverydate='" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "',
- revised= '" . Date('Y-m-d') . "',
- intostocklocation='" . $_SESSION['PO'.$identifier]->Location . "',
- deladd1='" . $_SESSION['PO'.$identifier]->DelAdd1 . "',
- deladd2='" . $_SESSION['PO'.$identifier]->DelAdd2 . "',
- deladd3='" . $_SESSION['PO'.$identifier]->DelAdd3 . "',
- deladd4='" . $_SESSION['PO'.$identifier]->DelAdd4 . "',
- deladd5='" . $_SESSION['PO'.$identifier]->DelAdd5 . "',
- deladd6='" . $_SESSION['PO'.$identifier]->DelAdd6 . "',
- deladd6='" . $_SESSION['PO'.$identifier]->Tel . "',
- suppdeladdress1='" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "',
- suppdeladdress2='" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "',
- suppdeladdress3='" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "',
- suppdeladdress4='" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "',
- suppdeladdress5='" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "',
- suppdeladdress6='" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "',
- suppliercontact='" . $_SESSION['PO'.$identifier]->SupplierContact . "',
- supptel='" . $_SESSION['PO'.$identifier]->SuppTel . "',
- contact='" . $_SESSION['PO'.$identifier]->Contact . "',
- paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "',
- allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "',
- status = '" . $_SESSION['PO'.$identifier]->Status . "'
- WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'";
+ comments='" . $_SESSION['PO'.$identifier]->Comments . "',
+ rate='" . $_SESSION['PO'.$identifier]->ExRate . "',
+ initiator='" . $_SESSION['PO'.$identifier]->Initiator . "',
+ requisitionno= '" . $_SESSION['PO'.$identifier]->RequisitionNo . "',
+ version= '" . $_SESSION['PO'.$identifier]->Version . "',
+ deliveryby='" . $_SESSION['PO'.$identifier]->DeliveryBy . "',
+ deliverydate='" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "',
+ revised= '" . Date('Y-m-d') . "',
+ intostocklocation='" . $_SESSION['PO'.$identifier]->Location . "',
+ deladd1='" . $_SESSION['PO'.$identifier]->DelAdd1 . "',
+ deladd2='" . $_SESSION['PO'.$identifier]->DelAdd2 . "',
+ deladd3='" . $_SESSION['PO'.$identifier]->DelAdd3 . "',
+ deladd4='" . $_SESSION['PO'.$identifier]->DelAdd4 . "',
+ deladd5='" . $_SESSION['PO'.$identifier]->DelAdd5 . "',
+ deladd6='" . $_SESSION['PO'.$identifier]->DelAdd6 . "',
+ deladd6='" . $_SESSION['PO'.$identifier]->Tel . "',
+ suppdeladdress1='" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "',
+ suppdeladdress2='" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "',
+ suppdeladdress3='" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "',
+ suppdeladdress4='" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "',
+ suppdeladdress5='" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "',
+ suppdeladdress6='" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "',
+ suppliercontact='" . $_SESSION['PO'.$identifier]->SupplierContact . "',
+ supptel='" . $_SESSION['PO'.$identifier]->SuppTel . "',
+ contact='" . $_SESSION['PO'.$identifier]->Contact . "',
+ paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "',
+ allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "',
+ status = '" . $_SESSION['PO'.$identifier]->Status . "'
+ WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'";
$ErrMsg = _('The purchase order could not be updated because');
$DbgMsg = _('The SQL statement used to update the purchase order header record, that failed was');
@@ -309,99 +307,99 @@
} else if ($POLine->PODetailRec=='') {
$sql = "INSERT INTO purchorderdetails ( orderno,
- itemcode,
- deliverydate,
- itemdescription,
- glcode,
- unitprice,
- quantityord,
- shiptref,
- jobref,
- itemno,
- suppliersunit,
- suppliers_partno,
- subtotal_amount,
- package,
- pcunit,
- netweight,
- kgs,
- cuft,
- total_quantity,
- total_amount,
- assetid,
- conversionfactor)
- VALUES (
- '" . $_SESSION['PO'.$identifier]->OrderNo . "',
- '" . $POLine->StockID . "',
- '" . FormatDateForSQL($POLine->ReqDelDate) . "',
- '" . $POLine->ItemDescription . "',
- '" . $POLine->GLCode . "',
- '" . $POLine->Price . "',
- '" . $POLine->Quantity . "',
- '" . $POLine->ShiptRef . "',
- '" . $POLine->JobRef . "',
- '" . $POLine->ItemNo . "',
- '" . $POLine->SuppliersUnit . "',
- '" . $POLine->Suppliers_PartNo . "',
- '" . $POLine->SubTotal_Amount . "',
- '" . $POLine->Package . "',
- '" . $POLine->PcUnit . "',
- '" . $POLine->NetWeight . "',
- '" . $POLine->KGs . "',
- '" . $POLine->CuFt . "',
- '" . $POLine->Total_Quantity . "',
- '" . $POLine->Total_Amount . "',
- '" . $POLine->AssetID . "',
- '" . $POLine->ConversionFactor . "')";
+ itemcode,
+ deliverydate,
+ itemdescription,
+ glcode,
+ unitprice,
+ quantityord,
+ shiptref,
+ jobref,
+ itemno,
+ suppliersunit,
+ suppliers_partno,
+ subtotal_amount,
+ package,
+ pcunit,
+ netweight,
+ kgs,
+ cuft,
+ total_quantity,
+ total_amount,
+ assetid,
+ conversionfactor)
+ VALUES (
+ '" . $_SESSION['PO'.$identifier]->OrderNo . "',
+ '" . $POLine->StockID . "',
+ '" . FormatDateForSQL($POLine->ReqDelDate) . "',
+ '" . $POLine->ItemDescription . "',
+ '" . $POLine->GLCode . "',
+ '" . $POLine->Price . "',
+ '" . $POLine->Quantity . "',
+ '" . $POLine->ShiptRef . "',
+ '" . $POLine->JobRef . "',
+ '" . $POLine->ItemNo . "',
+ '" . $POLine->SuppliersUnit . "',
+ '" . $POLine->Suppliers_PartNo . "',
+ '" . $POLine->SubTotal_Amount . "',
+ '" . $POLine->Package . "',
+ '" . $POLine->PcUnit . "',
+ '" . $POLine->NetWeight . "',
+ '" . $POLine->KGs . "',
+ '" . $POLine->CuFt . "',
+ '" . $POLine->Total_Quantity . "',
+ '" . $POLine->Total_Amount . "',
+ '" . $POLine->AssetID . "',
+ '" . $POLine->ConversionFactor . "')";
} else {
if ($POLine->Quantity==$POLine->QtyReceived){
$sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "',
- deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "',
- itemdescription='" . $POLine->ItemDescription . "',
- glcode='" . $POLine->GLCode . "',
- unitprice='" . $POLine->Price . "',
- quantityord='" . $POLine->Quantity . "',
- shiptref='" . $POLine->ShiptRef . "',
- jobref='" . $POLine->JobRef . "',
- itemno='" . $POLine->ItemNo . "',
- suppliersunit='" . $POLine->SuppliersUnit . "',
- suppliers_partno='" . $POLine->Suppliers_PartNo . "',
- subtotal_amount='" . $POLine->SubTotal_Amount . "',
- package='" . $POLine->Package . "',
- pcunit='" . $POLine->PcUnit . "',
- netweight='" . $POLine->NetWeight . "',
- kgs='" . $POLine->KGs . "',
- cuft='" . $POLine->CuFt . "',
- total_quantity='" . $POLine->Total_Quantity . "',
- total_amount='" . $POLine->Total_Amount . "',
- completed=1,
- assetid='" . $POLine->AssetID . "',
- conversionfactor = '" . $POLine->ConversionFactor . "'
- WHERE podetailitem='" . $POLine->PODetailRec . "'";
+ deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "',
+ itemdescription='" . $POLine->ItemDescription . "',
+ glcode='" . $POLine->GLCode . "',
+ unitprice='" . $POLine->Price . "',
+ quantityord='" . $POLine->Quantity . "',
+ shiptref='" . $POLine->ShiptRef . "',
+ jobref='" . $POLine->JobRef . "',
+ itemno='" . $POLine->ItemNo . "',
+ suppliersunit='" . $POLine->SuppliersUnit . "',
+ suppliers_partno='" . $POLine->Suppliers_PartNo . "',
+ subtotal_amount='" . $POLine->SubTotal_Amount . "',
+ package='" . $POLine->Package . "',
+ pcunit='" . $POLine->PcUnit . "',
+ netweight='" . $POLine->NetWeight . "',
+ kgs='" . $POLine->KGs . "',
+ cuft='" . $POLine->CuFt . "',
+ total_quantity='" . $POLine->Total_Quantity . "',
+ total_amount='" . $POLine->Total_Amount . "',
+ completed=1,
+ assetid='" . $POLine->AssetID . "',
+ conversionfactor = '" . $POLine->ConversionFactor . "'
+ WHERE podetailitem='" . $POLine->PODetailRec . "'";
} else {
$sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "',
- deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "',
- itemdescription='" . $POLine->ItemDescription . "',
- glcode='" . $POLine->GLCode . "',
- unitprice='" . $POLine->Price . "',
- quantityord='" . $POLine->Quantity . "',
- shiptref='" . $POLine->ShiptRef . "',
- jobref='" . $POLine->JobRef . "',
- itemno='" . $POLine->ItemNo . "',
- suppliersunit='" . $POLine->SuppliersUnit . "',
- suppliers_partno='" . $POLine->Suppliers_PartNo . "',
- subtotal_amount='" . $POLine->SubTotal_Amount . "',
- package='" . $POLine->Package . "',
- pcunit='" . $POLine->PcUnit . "',
- netweight='" . $POLine->NetWeight . "',
- kgs='" . $POLine->KGs . "',
- cuft='" . $POLine->CuFt . "',
- total_quantity='" . $POLine->Total_Quantity . "',
- total_amount='" . $POLine->Total_Amount . "',
- assetid='" . $POLine->AssetID . "',
- conversionfactor = '" . $POLine->ConversionFactor . "'
- WHERE podetailitem='" . $POLine->PODetailRec . "'";
+ deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "',
+ itemdescription='" . $POLine->ItemDescription . "',
+ glcode='" . $POLine->GLCode . "',
+ unitprice='" . $POLine->Price . "',
+ quantityord='" . $POLine->Quantity . "',
+ shiptref='" . $POLine->ShiptRef . "',
+ jobref='" . $POLine->JobRef . "',
+ itemno='" . $POLine->ItemNo . "',
+ suppliersunit='" . $POLine->SuppliersUnit . "',
+ suppliers_partno='" . $POLine->Suppliers_PartNo . "',
+ subtotal_amount='" . $POLine->SubTotal_Amount . "',
+ package='" . $POLine->Package . "',
+ pcunit='" . $POLine->PcUnit . "',
+ netweight='" . $POLine->NetWeight . "',
+ kgs='" . $POLine->KGs . "',
+ cuft='" . $POLine->CuFt . "',
+ total_quantity='" . $POLine->Total_Quantity . "',
+ total_amount='" . $POLine->Total_Amount . "',
+ assetid='" . $POLine->AssetID . "',
+ conversionfactor = '" . $POLine->ConversionFactor . "'
+ WHERE podetailitem='" . $POLine->PODetailRec . "'";
}
}
@@ -433,6 +431,7 @@
if(isset($_GET['Delete'])){
if($_SESSION['PO'.$identifier]->Some_Already_Received($_GET['Delete'])==0){
$_SESSION['PO'.$identifier]->LineItems[$_GET['Delete']]->Deleted=True;
+ $_SESSION['PO'.$identifier]->LinesOnOrder --;
include ('includes/PO_UnsetFormVbls.php');
} else {
prnMsg( _('This item cannot be deleted because some of it has already been received'),'warn');
@@ -442,8 +441,7 @@
if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */
$AllowUpdate = true; /*always assume the best */
-
- if (!is_numeric($_POST['Qty'])){
+ if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Qty'])))){
$AllowUpdate = false;
prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'error');
}
@@ -495,12 +493,12 @@
}
if ($_POST['AssetID'] !='Not an Asset'){
$ValidAssetResult = DB_query("SELECT assetid,
- description,
- costact
- FROM fixedassets
- INNER JOIN fixedassetcategories
- ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
- WHERE assetid='" . $_POST['AssetID'] . "'",$db);
+ description,
+ costact
+ FROM fixedassets
+ INNER JOIN fixedassetcategories
+ ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
+ WHERE assetid='" . $_POST['AssetID'] . "'",$db);
if (DB_num_rows($ValidAssetResult)==0){ // then the asset id entered doesn't exist
$AllowUpdate = false;
prnMsg(_('An asset code was entered but it does not yet exist. Only pre-existing asset ids can be entered when ordering a fixed asset'),'error');
@@ -526,36 +524,36 @@
$_POST['Qty'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Qty']));
$_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1,
- '',
- 0, /*Serialised */
- 0, /*Controlled */
- $_POST['Qty'],
- $_POST['ItemDescription'],
- $_POST['Price'],
- $_POST['SuppliersUnit'],
- $_POST['GLCode'],
- $_POST['ReqDelDate'],
- '',
- 0,
- '',
- 0,
- 0,
- $GLAccountName,
- 2,
- '',
- $_POST['SuppliersUnit'],
- 1,
- '',
- '',
- ($_POST['Qty']*$_POST['Price']),
- '',
- '',
- '',
- '',
- '',
- $_POST['Qty'],
- ($_POST['Qty']*$_POST['Price']),
- $_POST['AssetID']);
+ '',
+ 0, /*Serialised */
+ 0, /*Controlled */
+ $_POST['Qty'],
+ $_POST['ItemDescription'],
+ $_POST['Price'],
+ $_POST['SuppliersUnit'],
+ $_POST['GLCode'],
+ $_POST['ReqDelDate'],
+ '',
+ 0,
+ '',
+ 0,
+ 0,
+ $GLAccountName,
+ 2,
+ '',
+ $_POST['SuppliersUnit'],
+ 1,
+ '',
+ '',
+ ($_POST['Qty']*$_POST['Price']),
+ '',
+ '',
+ '',
+ '',
+ '',
+ $_POST['Qty'],
+ ($_POST['Qty']*$_POST['Price']),
+ $_POST['AssetID']);
include ('includes/PO_UnsetFormVbls.php');
}
}
@@ -591,18 +589,18 @@
}
if ($AlreadyOnThisOrder!=1 AND $Quantity > 0){
$sql = "SELECT description,
- stockid,
- units,
- decimalplaces,
- kgs,
- netweight,
- stockact,
- accountname
- FROM stockmaster INNER JOIN stockcategory
- ON stockcategory.categoryid = stockmaster.categoryid
- INNER JOIN chartmaster
- ON chartmaster.accountcode = stockcategory.stockact
- WHERE stockmaster.stockid = '". $ItemCode . "'";
+ stockid,
+ units,
+ decimalplaces,
+ kgs,
+ netweight,
+ stockact,
+ accountname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockcategory.categoryid = stockmaster.categoryid
+ INNER JOIN chartmaster
+ ON chartmaster.accountcode = stockcategory.stockact
+ WHERE stockmaster.stockid = '". $ItemCode . "'";
$ErrMsg = _('The item details for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because');
$DbgMsg = _('The SQL used to retrieve the item details but failed was');
@@ -611,26 +609,26 @@
$ItemRow = DB_fetch_array($ItemResult);
$sql = "SELECT price,
- conversionfactor,
- supplierdescription,
- suppliersuom,
- unitname,
- suppliers_partno,
- leadtime,
- MAX(purchdata.effectivefrom) AS latesteffectivefrom
- FROM purchdata LEFT JOIN unitsofmeasure
- ON purchdata.suppliersuom=unitsofmeasure.unitid
- WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "'
- AND purchdata.effectivefrom <='" . Date('Y-m-d') . "'
- AND purchdata.stockid = '". $ItemCode . "'
- GROUP BY purchdata.price,
- purchdata.conversionfactor,
- purchdata.supplierdescription,
- purchdata.suppliersuom,
- unitsofmeasure.unitname,
- purchdata.suppliers_partno,
- purchdata.leadtime";
-
+ conversionfactor,
+ supplierdescription,
+ suppliersuom,
+ unitname,
+ suppliers_partno,
+ leadtime,
+ MAX(purchdata.effectivefrom) AS latesteffectivefrom
+ FROM purchdata LEFT JOIN unitsofmeasure
+ ON purchdata.suppliersuom=unitsofmeasure.unitid
+ WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "'
+ AND purchdata.effectivefrom <='" . Date('Y-m-d') . "'
+ AND purchdata.stockid = '". $ItemCode . "'
+ GROUP BY purchdata.price,
+ purchdata.conversionfactor,
+ purchdata.supplierdescription,
+ purchdata.suppliersuom,
+ unitsofmeasure.unitname,
+ purchdata.suppliers_partno,
+ purchdata.leadtime";
+
$ErrMsg = _('The purchasing data for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because');
$DbgMsg = _('The SQL used to retrieve the purchasing data but failed was');
$PurchDataResult = DB_query($sql,$db,$ErrMsg,$DbgMsg);
@@ -652,35 +650,35 @@
}
$_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1,
- $ItemCode,
- 0, /*Serialised */
- 0, /*Controlled */
- $Quantity*$ConversionFactor, /* Qty */
- $SupplierDescription,
- $PurchPrice,
- $ItemRow['units'],
- $ItemRow['stockact'],
- $_SESSION['PO'.$identifier]->DeliveryDate,
- 0,
- 0,
- 0,
- 0,
- 0,
- $Itemrow['accountname'],
- $ItemRow['decimalplaces'],
- $ItemCode,
- $SuppliersUnitOfMeasure,
- $ConversionFactor,
- $LeadTime,
- $SuppliersPartNo,
- $Quantity*$PurchPrice,
- '',
- 0,
- $ItemRow['netweight'],
- $ItemRow['kgs'],
- '',
- $Quantity,
- $Quantity*$PurchPrice );
+ $ItemCode,
+ 0, /*Serialised */
+ 0, /*Controlled */
+ $Quantity*$ConversionFactor, /* Qty */
+ $SupplierDescription,
+ $PurchPrice,
+ $ItemRow['units'],
+ $ItemRow['stockact'],
+ $_SESSION['PO'.$identifier]->DeliveryDate,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ $Itemrow['accountname'],
+ $ItemRow['decimalplaces'],
+ $ItemCode,
+ $SuppliersUnitOfMeasure,
+ $ConversionFactor,
+ $LeadTime,
+ $SuppliersPartNo,
+ $Quantity*$PurchPrice,
+ '',
+ 0,
+ $ItemRow['netweight'],
+ $ItemRow['kgs'],
+ '',
+ $Quantity,
+ $Quantity*$PurchPrice );
} else { //no rows returned by the SQL to get the item
prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'),'error');
if ($debug==1){
@@ -832,45 +830,47 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units,
- unitsofmeasure.unitname
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- LEFT JOIN purchdata
- ON stockmaster.stockid=purchdata.stockid
- LEFT JOIN unitsofmeasure
- ON unitsofmeasure.unitid=purchdata.suppliersuom
- WHERE stockmaster.mbflag<>'D'
- AND stockmaster.mbflag<>'K'
- AND stockmaster.mbflag<>'G'
- AND stockmaster.discontinued<>1
- AND stockmaster.description " . LIKE . " '" . $SearchString ."'
- AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
- OR purchdata.supplierno IS NULL)
- ORDER BY stockmaster.stockid
- LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
+ stockmaster.description,
+ stockmaster.units,
+ purchdata.conversionfactor,
+ unitsofmeasure.unitname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ LEFT JOIN purchdata
+ ON stockmaster.stockid=purchdata.stockid
+ LEFT JOIN unitsofmeasure
+ ON unitsofmeasure.unitid=purchdata.suppliersuom
+ WHERE stockmaster.mbflag<>'D'
+ AND stockmaster.mbflag<>'K'
+ AND stockmaster.mbflag<>'G'
+ AND stockmaster.discontinued<>1
+ AND stockmaster.description " . LIKE . " '" . $SearchString ."'
+ AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ OR purchdata.supplierno IS NULL)
+ ORDER BY stockmaster.stockid
+ LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units,
- unitsofmeasure.unitname
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- LEFT JOIN purchdata
- ON stockmaster.stockid=purchdata.stockid
- LEFT JOIN unitsofmeasure
- ON unitsofmeasure.unitid=purchdata.suppliersuom
- WHERE stockmaster.mbflag<>'D'
- AND stockmaster.mbflag<>'K'
- AND stockmaster.mbflag<>'G'
- AND stockmaster.discontinued<>1
- AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
- OR purchdata.supplierno IS NULL)
- AND stockmaster.description " . LIKE . " '". $SearchString ."'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid
- LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
+ stockmaster.description,
+ stockmaster.units,
+ purchdata.conversionfactor,
+ unitsofmeasure.unitname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ LEFT JOIN purchdata
+ ON stockmaster.stockid=purchdata.stockid
+ LEFT JOIN unitsofmeasure
+ ON unitsofmeasure.unitid=purchdata.suppliersuom
+ WHERE stockmaster.mbflag<>'D'
+ AND stockmaster.mbflag<>'K'
+ AND stockmaster.mbflag<>'G'
+ AND stockmaster.discontinued<>1
+ AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ OR purchdata.supplierno IS NULL)
+ AND stockmaster.description " . LIKE . " '". $SearchString ."'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid
+ LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
}
} elseif ($_POST['StockCode']){
@@ -879,87 +879,91 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units,
- unitsofmeasure.unitname
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- LEFT JOIN purchdata
- ON stockmaster.stockid=purchdata.stockid
- LEFT JOIN unitsofmeasure
- ON unitsofmeasure.unitid=purchdata.suppliersuom
- WHERE stockmaster.mbflag<>'D'
- AND stockmaster.mbflag<>'K'
- AND stockmaster.mbflag<>'G'
- AND stockmaster.discontinued<>1
- AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
- OR purchdata.supplierno IS NULL)
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- ORDER BY stockmaster.stockid
- LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
+ stockmaster.description,
+ stockmaster.units,
+ purchdata.conversionfactor,
+ unitsofmeasure.unitname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ LEFT JOIN purchdata
+ ON stockmaster.stockid=purchdata.stockid
+ LEFT JOIN unitsofmeasure
+ ON unitsofmeasure.unitid=purchdata.suppliersuom
+ WHERE stockmaster.mbflag<>'D'
+ AND stockmaster.mbflag<>'K'
+ AND stockmaster.mbflag<>'G'
+ AND stockmaster.discontinued<>1
+ AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ OR purchdata.supplierno IS NULL)
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ ORDER BY stockmaster.stockid
+ LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units,
- unitsofmeasure.unitname
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- LEFT JOIN purchdata
- ON stockmaster.stockid=purchdata.stockid
- LEFT JOIN unitsofmeasure
- ON unitsofmeasure.unitid=purchdata.suppliersuom
- WHERE stockmaster.mbflag<>'D'
- AND stockmaster.mbflag<>'K'
- AND stockmaster.mbflag<>'G'
- and stockmaster.discontinued<>1
- AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
- OR purchdata.supplierno IS NULL)
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid
- LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
+ stockmaster.description,
+ stockmaster.units,
+ purchdata.conversionfactor,
+ unitsofmeasure.unitname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ LEFT JOIN purchdata
+ ON stockmaster.stockid=purchdata.stockid
+ LEFT JOIN unitsofmeasure
+ ON unitsofmeasure.unitid=purchdata.suppliersuom
+ WHERE stockmaster.mbflag<>'D'
+ AND stockmaster.mbflag<>'K'
+ AND stockmaster.mbflag<>'G'
+ and stockmaster.discontinued<>1
+ AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ OR purchdata.supplierno IS NULL)
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid
+ LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
}
} else {
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units,
- unitsofmeasure.unitname
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- LEFT JOIN purchdata
- ON stockmaster.stockid=purchdata.stockid
- LEFT JOIN unitsofmeasure
- ON unitsofmeasure.unitid=purchdata.suppliersuom
- WHERE stockmaster.mbflag<>'D'
- AND stockmaster.mbflag<>'K'
- AND stockmaster.mbflag<>'G'
- AND stockmaster.discontinued<>1
- AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
- OR purchdata.supplierno IS NULL)
- ORDER BY stockmaster.stockid
- LIMIT " . $_SESSION['DefaultDisplayRecordsMax'];
+ stockmaster.description,
+ stockmaster.units,
+ purchdata.conversionfactor,
+ unitsofmeasure.unitname
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ LEFT JOIN purchdata
+ ON stockmaster.stockid=purchdata.stockid
+ LEFT JOIN unitsofmeasure
+ ON unitsofmeasure.unitid=purchdata.suppliersuom
+ WHERE stockmaster.mbflag<>'D'
+ AND stockmaster.mbflag<>'K'
+ AND stockmaster.mbflag<>'G'
+ AND stockmaster.discontinued<>1
+ AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."'
+ OR purchdata.supplierno IS NULL)
+ ORDER BY stockmaster.stockid
+ LIMIT " . $_SESSION['DefaultDisplayRec...
[truncated message content] |