|
From: <dai...@us...> - 2012-01-20 23:10:26
|
Revision: 4824
http://web-erp.svn.sourceforge.net/web-erp/?rev=4824&view=rev
Author: daintree
Date: 2012-01-20 23:10:18 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/SupplierTenderCreate.php
trunk/SupplierTenders.php
trunk/UpgradeDatabase.php
trunk/api/api_stock.php
trunk/api/api_xml-rpc.php
trunk/includes/DefineOfferClass.php
trunk/includes/DefineTenderClass.php
trunk/sql/mysql/upgrade4.05-4.06.sql
Modified: trunk/SupplierTenderCreate.php
===================================================================
--- trunk/SupplierTenderCreate.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/SupplierTenderCreate.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -1,5 +1,5 @@
<?php
-/* $Id$*/
+/* $Id: SupplierTenderCreate.php 4821 2012-01-20 13:48:53Z tim_schofield $ */
include('includes/DefineTenderClass.php');
include('includes/SQL_CommonFunctions.inc');
@@ -7,11 +7,11 @@
$Maximum_Number_Of_Parts_To_Show=50;
-if (isset($_GET['New']) and isset($_SESSION['tender'])) {
+if (isset($_GET['New']) AND isset($_SESSION['tender'])) {
unset($_SESSION['tender']);
}
-if (isset($_GET['New']) and $_SESSION['CanCreateTender']==0) {
+if (isset($_GET['New']) AND $_SESSION['CanCreateTender']==0) {
$title = _('Authorisation Problem');
include('includes/header.inc');
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>';
@@ -21,7 +21,7 @@
exit;
}
-if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) {
+if (isset($_GET['Edit']) AND $_SESSION['CanCreateTender']==0) {
$title = _('Authorisation Problem');
include('includes/header.inc');
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>';
@@ -188,7 +188,7 @@
$ShowTender = 1;
}
-if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) {
+if (isset($_POST['NewItem']) AND !isset($_POST['Refresh'])) {
foreach ($_POST as $key => $value) {
if (mb_substr($key,0,7)=='StockID') {
$Index = mb_substr($key,7,mb_strlen($key)-7);
@@ -315,7 +315,7 @@
$LocnResult = DB_query($sql,$db);
while ($LocnRow=DB_fetch_array($LocnResult)){
- if ((isset($_SESSION['tender']->Location) and $_SESSION['tender']->Location == $LocnRow['loccode'])){
+ if ((isset($_SESSION['tender']->Location) AND $_SESSION['tender']->Location == $LocnRow['loccode'])){
echo '<option selected="True" value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>';
} else {
echo '<option value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>';
@@ -402,7 +402,7 @@
echo '<div class="centre"><input type="submit" name="Suppliers" value="' . _('Select Suppliers') . '" />';
echo '<input type="submit" name="Items" value="' . _('Select Item Details') . '" /></div><br />';
- if ($_SESSION['tender']->LinesOnTender > 0 and $_SESSION['tender']->SuppliersOnTender > 0) {
+ if ($_SESSION['tender']->LinesOnTender > 0 AND $_SESSION['tender']->SuppliersOnTender > 0) {
echo '<div class="centre"><input type="submit" name="Save" value="' . _('Save Tender') . '" /></div>';
}
echo '</form>';
@@ -527,18 +527,20 @@
echo '<br />';
}
echo '<input type="hidden" name="Search" value="' . _('Search Now') . '" />';
- echo '<br /><br />';
- echo '<br /><table cellpadding="2" colspan="7">';
- $tableheader = '<tr>
- <th>' . _('Code') . '</th>
- <th>' . _('Supplier Name') . '</th>
- <th>' . _('Currency') . '</th>
- <th>' . _('Address 1') . '</th>
- <th>' . _('Address 2') . '</th>
- <th>' . _('Address 3') . '</th>
- <th>' . _('Address 4') . '</th>
- </tr>';
- echo $tableheader;
+ echo '<br />
+ <br />
+ <br />
+ <table cellpadding="2" colspan="7">';
+ $TableHeader = '<tr>
+ <th>' . _('Code') . '</th>
+ <th>' . _('Supplier Name') . '</th>
+ <th>' . _('Currency') . '</th>
+ <th>' . _('Address 1') . '</th>
+ <th>' . _('Address 2') . '</th>
+ <th>' . _('Address 3') . '</th>
+ <th>' . _('Address 4') . '</th>
+ </tr>';
+ echo $TableHeader;
$j = 1;
$k = 0; //row counter to determine background colour
$RowIndex = 0;
@@ -575,9 +577,9 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items') . '</p>';
$sql = "SELECT categoryid,
- categorydescription
- FROM stockcategory
- ORDER BY categorydescription";
+ categorydescription
+ FROM stockcategory
+ ORDER BY categorydescription";
$result = DB_query($sql, $db);
if (DB_num_rows($result) == 0) {
echo '<br /><font size="4" color="red">' . _('Problem Report') . ':</font><br />' .
@@ -585,11 +587,11 @@
echo '<br /><a href="' . $rootpath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>';
exit;
}
- echo '<table class="selection"><tr>';
- echo '<td>' . _('In Stock Category') . ':';
- echo '<select name="StockCat">';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('In Stock Category') . ':<select name="StockCat">';
if (!isset($_POST['StockCat'])) {
- $_POST['StockCat'] = "";
+ $_POST['StockCat'] = '';
}
if ($_POST['StockCat'] == 'All') {
echo '<option selected="True" value="All">' . _('All') . '</option>';
@@ -603,25 +605,34 @@
echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>';
}
}
- echo '</select>';
- echo '<td>' . _('Enter partial') . '<b> ' . _('Description') . '</b>:</td><td>';
+ echo '</select></td>
+ <td>' . _('Enter partial') . '<b> ' . _('Description') . '</b>:</td>
+ <td>';
if (isset($_POST['Keywords'])) {
echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />';
} else {
echo '<input type="text" name="Keywords" size="20" maxlength="25" />';
}
- echo '</td></tr><tr><td></td>';
- echo '<td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>';
- echo '<td>';
+ echo '</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>
+ <td>';
if (isset($_POST['StockCode'])) {
echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />';
} else {
echo '<input type="text" name="StockCode" size="15" maxlength="18" />';
}
- echo '</td></tr></table><br />';
- echo '<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /></div><br /></form>';
+ echo '</td></tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input type="submit" name="Search" value="' . _('Search Now') . '" />
+ </div>
+ <br />
+ </form>';
echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>';
- echo '</form>';
}
if (isset($_POST['Search'])){ /*ie seach for stock items */
@@ -638,29 +649,29 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.description " . LIKE . " '$SearchString'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.description " . LIKE . " '$SearchString'
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.description " . LIKE . " '$SearchString'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.description " . LIKE . " '$SearchString'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} elseif ($_POST['StockCode']){
@@ -669,55 +680,55 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} else {
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
}
@@ -725,7 +736,7 @@
$DbgMsg = _('The SQL statement that failed was');
$SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg);
- if (DB_num_rows($SearchResult)==0 and $debug==1){
+ if (DB_num_rows($SearchResult)==0 AND $debug==1){
prnMsg( _('There are no products to display matching the criteria provided'),'warn');
}
if (DB_num_rows($SearchResult)==1){
@@ -739,14 +750,14 @@
echo '<table cellpadding="1" colspan="7">';
- $tableheader = '<tr>
- <th>' . _('Code') . '</th>
- <th>' . _('Description') . '</th>
- <th>' . _('Units') . '</th>
- <th>' . _('Image') . '</th>
- <th>' . _('Quantity') . '</th>
- </tr>';
- echo $tableheader;
+ $TableHeader = '<tr>
+ <th>' . _('Code') . '</th>
+ <th>' . _('Description') . '</th>
+ <th>' . _('Units') . '</th>
+ <th>' . _('Image') . '</th>
+ <th>' . _('Quantity') . '</th>
+ </tr>';
+ echo $TableHeader;
$i = 0;
$k = 0; //row colour counter
@@ -761,8 +772,8 @@
$k=1;
}
- $filename = $myrow['stockid'] . '.jpg';
- if (file_exists( $_SESSION['part_pics_dir'] . '/' . $filename) ) {
+ $FileName = $myrow['stockid'] . '.jpg';
+ if (file_exists( $_SESSION['part_pics_dir'] . '/' . $FileName) ) {
$ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.jpg" width="50" height="50" />';
@@ -770,14 +781,13 @@
$ImageSource = '<i>'._('No Image').'</i>';
}
- $uom=$myrow['units'];
echo '<td>'.$myrow['stockid'].'</td>
<td>'.$myrow['description'].'</td>
- <td>'.$uom.'</td>
+ <td>'.$myrow['units'].'</td>
<td>'.$ImageSource.'</td>
<td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /></td>
- <input type="hidden" value="'.$uom.'" name="UOM'.$i.'" />
+ <input type="hidden" value="'.$myrow['units'].'" name="UOM'.$i.'" />
<input type="hidden" value="'.$myrow['stockid'].'" name="StockID'.$i.'" />
</tr>';
@@ -797,7 +807,11 @@
prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' .
_('Please restrict your search to only the parts required'),'info');
}
- echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Add to Tender" /></div>';
+ echo '<a name="end"></a>
+ <br />
+ <div class="centre">
+ <input type="submit" name="NewItem" value="' . _('Add to Tender') . '" />
+ </div>';
}#end if SearchResults to show
echo '</form>';
Modified: trunk/SupplierTenders.php
===================================================================
--- trunk/SupplierTenders.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/SupplierTenders.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -64,15 +64,14 @@
$ItemCode=$value;
$Quantity=$_POST['Qty'.$Index];
$Price=$_POST['Price'.$Index];
- $_SESSION['offer']->add_to_offer(
- $LineNo,
- $ItemCode,
- $Quantity,
- $_POST['ItemDescription'.$Index],
- $Price,
- $_POST['UOM'.$Index],
- $_POST['DecimalPlaces'.$Index],
- $_POST['RequiredByDate'.$Index]);
+ $_SESSION['offer']->add_to_offer($LineNo,
+ $ItemCode,
+ $Quantity,
+ $_POST['ItemDescription'.$Index],
+ $Price,
+ $_POST['UOM'.$Index],
+ $_POST['DecimalPlaces'.$Index],
+ $_POST['RequiredByDate'.$Index]);
$LineNo++;
}
}
@@ -91,16 +90,18 @@
address6,
telephone
FROM tenders
- LEFT JOIN locations
+ INNER JOIN locations
ON tenders.location=locations.loccode
WHERE closed=0
AND tenderid='".$_SESSION['offer']->TenderID."'";
$LocationResult=DB_query($LocationSQL, $db);
$MyLocationRow=DB_fetch_row($LocationResult);
- $CurrencySQL="SELECT decimalplaces from currencies WHERE currabrev='".$_SESSION['offer']->CurrCode."'";
+ $CurrencySQL="SELECT decimalplaces FROM currencies WHERE currabrev='".$_SESSION['offer']->CurrCode."'";
$CurrencyResult=DB_query($CurrencySQL, $db);
$CurrencyRow=DB_fetch_array($CurrencyResult);
- echo '<tr><td valign="top" style="background-color:#cccce5">' . _('Deliver To') . ':</td><td valign="top" style="background-color:#cccce5">';
+ echo '<tr>
+ <td valign="top" style="background-color:#cccce5">' . _('Deliver To') . ':</td>
+ <td valign="top" style="background-color:#cccce5">';
for ($i=1; $i<8; $i++) {
if ($MyLocationRow[$i]!='') {
echo $MyLocationRow[$i] . '<br />';
@@ -109,28 +110,38 @@
echo '</td>';
echo '<th colspan="8" style="vertical-align:top"><font size="2" color="#616161">' . _('Tender Number') . ': ' .$_SESSION['offer']->TenderID . '</font></th>';
echo '<input type="hidden" value="' . $_SESSION['offer']->TenderID . '" name="Tender" />';
- echo '<tr><th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Item Code') . '</th>';
- echo '<th>' . _('Item Description') . '</th>';
- echo '<th>' . _('Quantity') . '<br />' . _('Offered') . '</th>';
- echo '<th>' . $Supplier . '<br />' . _('Units of Measure') . '</th>';
- echo '<th>' . _('Currency') . '</th>';
- echo '<th>' . $Supplier . '<br />' . _('Price') . '</th>';
- echo '<th>' . _('Line Value') . '</th>';
- echo '<th>' . _('Delivery By') . '</th>';
+ echo '<tr>
+ <th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Item Code') . '</th>
+ <th>' . _('Item Description') . '</th>
+ <th>' . _('Quantity') . '<br />' . _('Offered') . '</th>
+ <th>' . $Supplier . '<br />' . _('Units of Measure') . '</th>
+ <th>' . _('Currency') . '</th>
+ <th>' . $Supplier . '<br />' . _('Price') . '</th>
+ <th>' . _('Line Value') . '</th>
+ <th>' . _('Delivery By') . '</th>
+ </tr>';
+
foreach ($_SESSION['offer']->LineItems as $LineItem) {
- echo '<tr><td>' . $LineItem->StockID . '</td>';
- echo '<td>' . $LineItem->ItemDescription . '</td>';
- echo '<td class="number"> ' .locale_number_format($LineItem->Quantity, $LineItem->DecimalPlaces) . '</td>';
- echo '<td>' . $LineItem->Units . '</td>';
- echo '<td>' . $_SESSION['offer']->CurrCode . '</td>';
- echo '<td class="number">' . locale_number_format($LineItem->Price, $CurrencyRow['decimalplaces']) . '</td>';
- echo '<td class="number">' . locale_number_format($LineItem->Price*$LineItem->Quantity,$CurrencyRow['decimalplaces']) . '</td>';
- echo '<td>' . $LineItem->ExpiryDate . '</td>';
+ echo '<tr>
+ <td>' . $LineItem->StockID . '</td>
+ <td>' . $LineItem->ItemDescription . '</td>
+ <td class="number"> ' .locale_number_format($LineItem->Quantity, $LineItem->DecimalPlaces) . '</td>
+ <td>' . $LineItem->Units . '</td>
+ <td>' . $_SESSION['offer']->CurrCode . '</td>
+ <td class="number">' . locale_number_format($LineItem->Price, $CurrencyRow['decimalplaces']) . '</td>
+ <td class="number">' . locale_number_format($LineItem->Price*$LineItem->Quantity,$CurrencyRow['decimalplaces']) . '</td>
+ <td>' . $LineItem->ExpiryDate . '</td>
+ </tr>';
}
- echo '</table><br />';
- echo '<div class="centre"><input type="submit" name="Confirm" value="' . _('Confirm and Send Email') . '" /><br />';
- echo '<br /><input type="submit" name="Cancel" value="' . _('Cancel Offer') . '" /></div>';
- echo '</form>';
+ echo '</table>
+ <br />
+ <div class="centre">
+ <input type="submit" name="Confirm" value="' . _('Confirm and Send Email') . '" />
+ <br />
+ <br />
+ <input type="submit" name="Cancel" value="' . _('Cancel Offer') . '" />
+ </div>
+ </form>';
include('includes/footer.inc');
exit;
}
@@ -138,7 +149,7 @@
/* If the supplierID is set then it must be a login from the supplier but if nothing else is
* set then the supplier must have just logged in so show them the choices.
*/
-if (isset($_POST['SupplierID']) and empty($_POST['TenderType']) and empty($_POST['Search']) and empty($_POST['NewItem']) and empty($_GET['Delete'])) {
+if (isset($_POST['SupplierID']) AND empty($_POST['TenderType']) AND empty($_POST['Search']) AND empty($_POST['NewItem']) AND empty($_GET['Delete'])) {
if (isset($_SESSION['offer'])) {
unset($_SESSION['offer']);
}
@@ -146,18 +157,27 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Tenders') . '" alt="" />' . ' ' . _('Create or View Offers from') . ' '.$Supplier.'</p>';
echo '<table class="selection">';
- echo'<tr><td>'._('Select option for tendering').'</td>';
- echo '<td><select name="TenderType">';
- echo '<option value="1">'._('View or Amend outstanding offers from').' '.$Supplier .'</option>';
- echo '<option value="2">'._('Create a new offer from').' '.$Supplier .'</option>';
- echo '<option value="3">'._('View any open tenders without an offer from').' '.$Supplier .'</option>';
- echo '</select></td></tr>';
+ echo'<tr>
+ <td>'._('Select option for tendering').'</td>
+ <td><select name="TenderType">
+ <option value="1">'._('View or Amend outstanding offers from').' '.$Supplier .'</option>
+ <option value="2">'._('Create a new offer from').' '.$Supplier .'</option>
+ <option value="3">'._('View any open tenders without an offer from').' '.$Supplier .'</option>
+ </select></td>
+ </tr>';
echo '<input type="hidden" name="SupplierID" value="'.$_POST['SupplierID'].'" />';
- echo '<tr><td colspan="2"><div class="centre"><input type="submit" name="submit" value="' . _('Select') . '" /></div></td></tr>';
- echo '</table></form>';
+ echo '<tr>
+ <td colspan="2">
+ <div class="centre">
+ <input type="submit" name="submit" value="' . _('Select') . '" />
+ </div>
+ </td>
+ </tr>
+ </table>
+ </form>';
}
-if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) {
+if (isset($_POST['NewItem']) AND !isset($_POST['Refresh'])) {
foreach ($_POST as $key => $value) {
if (mb_substr($key,0,7)=='StockID') {
$Index = mb_substr($key,7,mb_strlen($key)-7);
@@ -165,7 +185,7 @@
$Quantity=filter_number_format($_POST['Qty'.$Index]);
$Price=filter_number_format($_POST['Price'.$Index]);
$UOM=$_POST['uom'.$Index];
- if (isset($UOM) and $Quantity>0) {
+ if (isset($UOM) AND $Quantity>0) {
$sql="SELECT description, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'";
$result=DB_query($sql, $db);
$myrow=DB_fetch_array($result);
@@ -183,7 +203,7 @@
}
}
-if (isset($_POST['Refresh']) and !isset($_POST['NewItem'])) {
+if (isset($_POST['Refresh']) AND !isset($_POST['NewItem'])) {
foreach ($_POST as $key => $value) {
if (mb_substr($key,0,7)=='StockID') {
$Index = mb_substr($key,7,mb_strlen($key)-7);
@@ -193,11 +213,10 @@
$ExpiryDate=$_POST['expirydate'.$Index];
}
if (isset($ExpiryDate)) {
- $_SESSION['offer']->update_offer_item(
- $Index,
- $Quantity,
- $Price,
- $ExpiryDate);
+ $_SESSION['offer']->update_offer_item($Index,
+ $Quantity,
+ $Price,
+ $ExpiryDate);
unset($ExpiryDate);
}
}
@@ -216,11 +235,10 @@
$ExpiryDate=$value;
}
if (isset($ExpiryDate)) {
- $_SESSION['offer']->update_offer_item(
- $LineNo,
- $Quantity,
- $Price,
- $ExpiryDate);
+ $_SESSION['offer']->update_offer_item($LineNo,
+ $Quantity,
+ $Price,
+ $ExpiryDate);
unset($ExpiryDate);
}
}
@@ -244,11 +262,10 @@
$ExpiryDate=$value;
}
if (isset($ExpiryDate)) {
- $_SESSION['offer']->update_offer_item(
- $LineNo,
- $Quantity,
- $Price,
- $ExpiryDate);
+ $_SESSION['offer']->update_offer_item($LineNo,
+ $Quantity,
+ $Price,
+ $ExpiryDate);
unset($ExpiryDate);
}
}
@@ -261,7 +278,7 @@
/*The supplier has chosen option 1
*/
-if (isset($_POST['TenderType']) and $_POST['TenderType']==1 and !isset($_POST['Refresh'])) {
+if (isset($_POST['TenderType']) AND $_POST['TenderType']==1 AND !isset($_POST['Refresh'])) {
$sql="SELECT offers.offerid,
offers.stockid,
stockmaster.description,
@@ -278,24 +295,23 @@
$_SESSION['offer']=new Offer($_POST['SupplierID']);
$_SESSION['offer']->CurrCode=$Currency;
while ($myrow=DB_fetch_array($result)) {
- $_SESSION['offer']->add_to_offer(
- $myrow['offerid'],
- $myrow['stockid'],
- $myrow['quantity'],
- $myrow['description'],
- $myrow['price'],
- $myrow['uom'],
- $myrow['decimalplaces'],
- ConvertSQLDate($myrow['expirydate']));
+ $_SESSION['offer']->add_to_offer($myrow['offerid'],
+ $myrow['stockid'],
+ $myrow['quantity'],
+ $myrow['description'],
+ $myrow['price'],
+ $myrow['uom'],
+ $myrow['decimalplaces'],
+ ConvertSQLDate($myrow['expirydate']));
}
}
-if (isset($_POST['TenderType']) and $_POST['TenderType']!=3 and isset($_SESSION['offer']) and $_SESSION['offer']->LinesOnOffer>0 or isset($_POST['Update'])) {
+if (isset($_POST['TenderType']) AND $_POST['TenderType']!=3 AND isset($_SESSION['offer']) AND $_SESSION['offer']->LinesOnOffer>0 or isset($_POST['Update'])) {
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Items to offer from').' '.$Supplier .'</p>';
- echo '<table>';
- echo '<tr>
+ echo '<table>
+ <tr>
<th>'._('Stock ID').'</th>
<th>'._('Description').'</th>
<th>'._('Quantity').'</th>
@@ -307,43 +323,53 @@
$k=0;
foreach ($_SESSION['offer']->LineItems as $LineItems) {
if ($LineItems->Deleted==False) {
- if ($k==1){
+ if ($LineItems->ExpiryDate < date('Y-m-d')) {
+ echo '<tr bgcolor="#F7A9A9">';
+ } elseif ($k==1){
echo '<tr class="EvenTableRows">';
$k=0;
} else {
echo '<tr class="OddTableRows">';
$k=1;
}
- if ($LineItems->ExpiryDate < date('Y-m-d')) {
- echo '<tr bgcolor="#F7A9A9">';
- }
+
echo '<input type="hidden" name="StockID'.$LineItems->LineNo.'" value="'.$LineItems->StockID.'" />';
- echo '<td>'.$LineItems->StockID.'</td>';
- echo '<td>'.$LineItems->ItemDescription.'</td>';
- echo '<td><input type="text" class="number" name="Qty'.$LineItems->LineNo.'" value="'.locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'" /></td>';
- echo '<td>'.$LineItems->Units.'</td>';
- echo '<td><input type="text" class="number" name="Price'.$LineItems->LineNo.'" value="'.locale_number_format($LineItems->Price,2,'.','').'" /></td>';
- echo '<td class="number">'.locale_number_format($LineItems->Price*$LineItems->Quantity,2).'</td>';
- echo '<td><input type="text" size="11" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="expirydate'.$LineItems->LineNo.'" value="'.$LineItems->ExpiryDate.'" /></td>';
- echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $LineItems->LineNo . '&Type=' . $_POST['TenderType'] . '">' . _('Remove') . '</a></td></tr>';
- echo '</tr>';
+ echo '<td>'.$LineItems->StockID.'</td>
+ <td>'.$LineItems->ItemDescription.'</td>
+ <td><input type="text" class="number" name="Qty'.$LineItems->LineNo.'" value="'.locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'" /></td>
+ <td>'.$LineItems->Units.'</td>
+ <td><input type="text" class="number" name="Price'.$LineItems->LineNo.'" value="'.locale_number_format($LineItems->Price,2,'.','').'" /></td>
+ <td class="number">'.locale_number_format($LineItems->Price*$LineItems->Quantity,2).'</td>
+ <td><input type="text" size="11" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="expirydate'.$LineItems->LineNo.'" value="'.$LineItems->ExpiryDate.'" /></td>
+ <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $LineItems->LineNo . '&Type=' . $_POST['TenderType'] . '">' . _('Remove') . '</a></td>
+ </tr>';
}
}
echo '</table>';
echo '<input type="hidden" name="TenderType" value="'.$_POST['TenderType'].'" />';
if ($_POST['TenderType']==1) {
- echo '<br /><div class="centre"><input type="submit" name="Update" value="Update offer" />';
- echo '<input type="submit" name="Refresh" value="Refresh screen" /></div>';
+ echo '<br />
+ <div class="centre">
+ <input type="submit" name="Update" value="Update offer" />
+ <input type="submit" name="Refresh" value="Refresh screen" />
+ </div>';
} else if ($_POST['TenderType']==2) {
- echo '<br /><div class="centre"><input type="submit" name="Save" value="Save offer">';
- echo '<input type="submit" name="Refresh" value="Refresh screen" /></div>';
+ echo '<br />
+ <div class="centre">
+ <input type="submit" name="Save" value="Save offer">
+ <input type="submit" name="Refresh" value="Refresh screen" />
+ </div>';
}
echo '</form>';
}
/*The supplier has chosen option 2
*/
-if (isset($_POST['TenderType']) and $_POST['TenderType']==2 and !isset($_POST['Search']) or isset($_GET['Delete'])) {
+if (isset($_POST['TenderType'])
+ AND $_POST['TenderType']==2
+ AND !isset($_POST['Search'])
+ OR isset($_GET['Delete'])) {
+
if (!isset($_SESSION['offer'])) {
$_SESSION['offer']=new Offer($_POST['SupplierID']);
}
@@ -352,9 +378,9 @@
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items') . '</p>';
$sql = "SELECT categoryid,
- categorydescription
- FROM stockcategory
- ORDER BY categorydescription";
+ categorydescription
+ FROM stockcategory
+ ORDER BY categorydescription";
$result = DB_query($sql, $db);
if (DB_num_rows($result) == 0) {
@@ -390,23 +416,37 @@
}
echo '<input type="hidden" name="TenderType" value="'.$_POST['TenderType'].'" />';
echo '<input type="hidden" name="SupplierID" value="'.$_POST['SupplierID'].'" />';
- echo '</td></tr><tr><td></td>';
- echo '<td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>';
- echo '<td>';
+ echo '</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>
+ <td>';
if (isset($_POST['StockCode'])) {
echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />';
} else {
echo '<input type="text" name="StockCode" size="15" maxlength="18" />';
}
- echo '</td></tr></table><br />';
- echo '<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /></div><br /></form>';
+ echo '</td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input type="submit" name="Search" value="' . _('Search Now') . '" />
+ </div>
+ <br />
+ </form>';
echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>';
echo '</form>';
}
/*The supplier has chosen option 3
*/
-if (isset($_POST['TenderType']) and $_POST['TenderType']==3 and !isset($_POST['Search']) or isset($_GET['Delete'])) {
+if (isset($_POST['TenderType'])
+ AND $_POST['TenderType']==3
+ AND !isset($_POST['Search'])
+ OR isset($_GET['Delete'])) {
+
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Tenders') . '" alt="" />' . ' ' . _('Tenders Waiting For Offers').'</p>';
$sql="SELECT DISTINCT tendersuppliers.tenderid,
suppliers.currcode
@@ -421,7 +461,9 @@
ORDER BY tendersuppliers.tenderid";
$result=DB_query($sql, $db);
echo '<table class="selection">';
- echo '<tr><th colspan="13"><font size="3" color="#616161">' . _('Outstanding Tenders Waiting For Offer') . '</font></th></tr>';
+ echo '<tr>
+ <th colspan="13"><font size="3" color="#616161">' . _('Outstanding Tenders Waiting For Offer') . '</font></th>
+ </tr>';
while ($myrow=DB_fetch_row($result)) {
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
@@ -436,13 +478,15 @@
address6,
telephone
FROM tenders
- LEFT JOIN locations
+ INNER JOIN locations
ON tenders.location=locations.loccode
WHERE closed=0
AND tenderid='".$myrow[0]."'";
$LocationResult=DB_query($LocationSQL, $db);
$MyLocationRow=DB_fetch_row($LocationResult);
- echo '<tr><td valign="top" style="background-color:#cccce5">' . _('Deliver To') . ':</td><td valign="top" style="background-color:#cccce5">';
+ echo '<tr>
+ <td valign="top" style="background-color:#cccce5">' . _('Deliver To') . ':</td>
+ <td valign="top" style="background-color:#cccce5">';
for ($i=1; $i<8; $i++) {
if ($MyLocationRow[$i]!='') {
echo $MyLocationRow[$i] . '<br />';
@@ -451,7 +495,8 @@
echo '</td>';
echo '<th colspan="8" style="vertical-align:top"><font size="2" color="#616161">' . _('Tender Number') . ': ' .$myrow[0] . '</font></th>';
echo '<input type="hidden" value="' . $myrow[0] . '" name="Tender" />';
- echo '<th><input type="submit" value="' . _('Process') . "\n" . _('Tender') . '" name="Process" /></th></tr>';
+ echo '<th><input type="submit" value="' . _('Process') . "\n" . _('Tender') . '" name="Process" /></th>
+ </tr>';
$ItemSQL="SELECT tenderitems.tenderid,
tenderitems.stockid,
stockmaster.description,
@@ -471,37 +516,42 @@
ON tenders.tenderid=tenderitems.tenderid
WHERE tenderitems.tenderid='" . $myrow[0] . "'";
$ItemResult=DB_query($ItemSQL, $db);
- echo '<tr><th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Item Code') . '</th>';
- echo '<th>' . _('Item Description') . '</th>';
- echo '<th>' . $Supplier . '<br />' . _('Item Code') . '</th>';
- echo '<th>' . _('Quantity') . '<br />' . _('Required') . '</th>';
- echo '<th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Units of Measure') . '</th>';
- echo '<th>' . _('Required By') . '</th>';
- echo '<th>' . _('Quantity') . '<br />' . _('Offered') . '</th>';
- echo '<th>' . $Supplier . '<br />' . _('Units of Measure') . '</th>';
- echo '<th>' . _('Currency') . '</th>';
- echo '<th>' . $Supplier . '<br />' . _('Price') . '</th>';
- echo '<th>' . _('Delivery By') . '</th>';
+ echo '<tr>
+ <th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Item Code') . '</th>
+ <th>' . _('Item Description') . '</th>
+ <th>' . $Supplier . '<br />' . _('Item Code') . '</th>
+ <th>' . _('Quantity') . '<br />' . _('Required') . '</th>
+ <th>' . stripslashes($_SESSION['CompanyRecord']['coyname']) . '<br />' . _('Units of Measure') . '</th>
+ <th>' . _('Required By') . '</th>
+ <th>' . _('Quantity') . '<br />' . _('Offered') . '</th>
+ <th>' . $Supplier . '<br />' . _('Units of Measure') . '</th>
+ <th>' . _('Currency') . '</th>
+ <th>' . $Supplier . '<br />' . _('Price') . '</th>
+ <th>' . _('Delivery By') . '</th>
+ </tr>';
$i=0;
while ($MyItemRow=DB_fetch_array($ItemResult)) {
- echo '<tr><td>' . $MyItemRow['stockid'] . '</td>';
- echo '<td>' . $MyItemRow['description'] . '</td>';
- echo '<input type="hidden" name="StockID'. $i . '" value="' . $MyItemRow['stockid'] . '" />';
- echo '<input type="hidden" name="ItemDescription'. $i . '" value="' . $MyItemRow['description'] . '" />';
- echo '<td>' . $MyItemRow['suppliers_partno'] . '</td>';
- echo '<td class="number">' . locale_number_format($MyItemRow['quantity'], $MyItemRow['decimalplaces']) . '</td>';
- echo '<td>' . $MyItemRow['units'] . '</td>';
- echo '<td>' . ConvertSQLDate($MyItemRow['requiredbydate']) . '</td>';
+ echo '<tr>
+ <td>' . $MyItemRow['stockid'] . '</td>
+ <td>' . $MyItemRow['description'] . '</td>
+ <input type="hidden" name="StockID'. $i . '" value="' . $MyItemRow['stockid'] . '" />
+ <input type="hidden" name="ItemDescription'. $i . '" value="' . $MyItemRow['description'] . '" />
+ <td>' . $MyItemRow['suppliers_partno'] . '</td>
+ <td class="number">' . locale_number_format($MyItemRow['quantity'], $MyItemRow['decimalplaces']) . '</td>
+ <td>' . $MyItemRow['units'] . '</td>
+ <td>' . ConvertSQLDate($MyItemRow['requiredbydate']) . '</td>';
+
if ($MyItemRow['suppliersuom']=='') {
$MyItemRow['suppliersuom']=$MyItemRow['units'];
}
- echo '<td><input type="text" class="number" size="10" name="Qty'. $i . '" value="' . locale_number_format($MyItemRow['quantity'], $MyItemRow['decimalplaces']) . '" /></td>';
- echo '<input type="hidden" name="UOM'. $i . '" value="' . $MyItemRow['units'] . '" />';
- echo '<input type="hidden" name="DecimalPlaces'. $i . '" value="' . $MyItemRow['decimalplaces'] . '" />';
- echo '<td>' . $MyItemRow['suppliersuom'] . '</td>';
- echo '<td>' . $myrow[1] . '</td>';
- echo '<td><input type="text" class="number" size="10" name="Price'. $i . '" value="0.00" /></td>';
- echo '<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="RequiredByDate'. $i . '" size="11" value="' . ConvertSQLDate($MyItemRow['requiredbydate']) . '" /></td>';
+ echo '<td><input type="text" class="number" size="10" name="Qty'. $i . '" value="' . locale_number_format($MyItemRow['quantity'], $MyItemRow['decimalplaces']) . '" /></td>
+ <input type="hidden" name="UOM'. $i . '" value="' . $MyItemRow['units'] . '" />
+ <input type="hidden" name="DecimalPlaces'. $i . '" value="' . $MyItemRow['decimalplaces'] . '" />
+ <td>' . $MyItemRow['suppliersuom'] . '</td>
+ <td>' . $myrow[1] . '</td>
+ <td><input type="text" class="number" size="10" name="Price'. $i . '" value="0.00" /></td>
+ <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="RequiredByDate'. $i . '" size="11" value="' . ConvertSQLDate($MyItemRow['requiredbydate']) . '" /></td>
+ </tr>';
}
echo '</form>';
}
@@ -513,7 +563,7 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Tenders') . '" alt="" />' . ' ' . _('Select items to offer from').' '.$Supplier .'</p>';
- if ($_POST['Keywords'] and $_POST['StockCode']) {
+ if ($_POST['Keywords'] AND $_POST['StockCode']) {
prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' );
}
if ($_POST['Keywords']) {
@@ -522,29 +572,29 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.description " . LIKE . " '$SearchString'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.description " . LIKE . " '$SearchString'
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.description " . LIKE . " '$SearchString'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.description " . LIKE . " '$SearchString'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} elseif ($_POST['StockCode']){
@@ -553,55 +603,55 @@
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} else {
if ($_POST['StockCat']=='All'){
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ ORDER BY stockmaster.stockid";
} else {
$sql = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE stockmaster.mbflag!='D'
- AND stockmaster.mbflag!='A'
- AND stockmaster.mbflag!='K'
- and stockmaster.discontinued!=1
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.mbflag!='D'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.discontinued!=1
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
}
@@ -609,7 +659,7 @@
$DbgMsg = _('The SQL statement that failed was');
$SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg);
- if (DB_num_rows($SearchResult)==0 and $debug==1){
+ if (DB_num_rows($SearchResult)==0 AND $debug==1){
prnMsg( _('There are no products to display matching the criteria provided'),'warn');
}
if (DB_num_rows($SearchResult)==1){
@@ -623,7 +673,7 @@
echo '<table cellpadding="1" colspan="7">';
- $tableheader = '<tr>
+ $TableHeader = '<tr>
<th>' . _('Code') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Units') . '</th>
@@ -631,7 +681,7 @@
<th>' . _('Quantity') . '</th>
<th>' . _('Price') .' ('.$Currency.')</th>
</tr>';
- echo $tableheader;
+ echo $TableHeader;
$i = 0;
$k = 0; //row colour counter
@@ -646,8 +696,8 @@
$k=1;
}
- $filename = $myrow['stockid'] . '.jpg';
- if (file_exists( $_SESSION['part_pics_dir'] . '/' . $filename) ) {
+ $FileName = $myrow['stockid'] . '.jpg';
+ if (file_exists( $_SESSION['part_pics_dir'] . '/' . $FileName) ) {
$ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.jpg" width="50" height="50" />';
@@ -655,7 +705,7 @@
$ImageSource = '<i>'._('No Image').'</i>';
}
- $uomsql="SELECT conversionfactor,
+ $UOMsql="SELECT conversionfactor,
suppliersuom,
unitsofmeasure.unitname
FROM purchdata
@@ -664,25 +714,25 @@
WHERE supplierno='".$_POST['SupplierID']."'
AND stockid='" . $myrow['stockid'] . "'";
- $uomresult=DB_query($uomsql, $db);
- if (DB_num_rows($uomresult)>0) {
- $uomrow=DB_fetch_array($uomresult);
- if (mb_strlen($uomrow['suppliersuom'])>0) {
- $uom=$uomrow['unitname'];
+ $UOMresult=DB_query($UOMsql, $db);
+ if (DB_num_rows($UOMresult)>0) {
+ $UOMrow=DB_fetch_array($UOMresult);
+ if (mb_strlen($UOMrow['suppliersuom'])>0) {
+ $UOM=$UOMrow['unitname'];
} else {
- $uom=$myrow['units'];
+ $UOM=$myrow['units'];
}
} else {
- $uom=$myrow['units'];
+ $UOM=$myrow['units'];
}
echo '<td>'.$myrow['stockid'].'</td>
<td>'.$myrow['description'].'</td>
- <td>'.$uom.'</td>
+ <td>'.$UOM.'</td>
<td>'.$ImageSource.'</td>
<td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /></td>
<td><input class="number" type="text" size="12" value="0" name="Price'.$i.'" /></td>
<input type="hidden" size="12" value="'.$myrow['stockid'].'" name="StockID'.$i.'" />
- <input type="hidden" value="'.$uom.'" name="uom'.$i.'" />
+ <input type="hidden" value="'.$UOM.'" name="uom'.$i.'" />
</tr>';
$i++;
$PartsDisplayed++;
@@ -696,11 +746,14 @@
if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){
/*$Maximum_Number_Of_Parts_To_Show defined in config.php */
-
prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' .
_('Please restrict your search to only the parts required'),'info');
}
- echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Add to Offer" /></div>';
+ echo '<a name="end"></a>
+ <br />
+ <div class="centre">
+ <input type="submit" name="NewItem" value="Add to Offer" />
+ </div>';
}#end if SearchResults to show
echo '<input type="hidden" name="TenderType" value="'.$_POST['TenderType'].'" />';
echo '<input type="hidden" name="SupplierID" value="'.$_POST['SupplierID'].'" />';
Modified: trunk/UpgradeDatabase.php
===================================================================
--- trunk/UpgradeDatabase.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/UpgradeDatabase.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -132,8 +132,8 @@
case '4.06.5':
$SQLScripts[] = './sql/mysql/upgrade4.05-4.06.sql';
case '4.06.6':
- $SQLScripts[] = './sql/mysql/upgrade4.05-4.06.sql';
- case '4.06.7':
+ $SQLScripts[] = './sql/mysql/upgrade4.06-4.07.sql';
+ case '4.07.0':
break;
} //end switch
}
Modified: trunk/api/api_stock.php
===================================================================
--- trunk/api/api_stock.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/api/api_stock.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -1,5 +1,5 @@
<?php
-
+
/* Check that the stock code*/
function VerifyStockCode($StockCode, $i, $Errors, $db) {
$Searchsql = "SELECT count(stockid)
@@ -734,8 +734,8 @@
WHERE stockid='" .$StockID. "'
AND typeabbrev='" .$SalesType. "'
AND currabrev='".$Currency. "'
- AND startdate>='". Date('Y-m-d') . "'
- (AND enddate<='" . Date('Y-m-d') . "' OR enddate='0000-00-00')";
+ AND startdate<='". Date('Y-m-d') . "'
+ AND (enddate>'" . Date('Y-m-d') . "' OR enddate='0000-00-00')";
$result = DB_Query($sql, $db);
$myrow = DB_fetch_row($result);
if ($myrow[0]==0) {
@@ -746,8 +746,8 @@
WHERE stockid='" .$StockID. "'
AND typeabbrev='" .$SalesType. "'
AND currabrev='".$Currency. "'
- AND startdate>='". Date('Y-m-d') . "'
- (AND enddate<='" . Date('Y-m-d') . "' OR enddate='0000-00-00')";
+ AND startdate<='". Date('Y-m-d') . "'
+ AND (enddate>'" . Date('Y-m-d') . "' OR enddate='0000-00-00')";
}
$result = DB_Query($sql, $db);
$myrow = DB_fetch_row($result);
Modified: trunk/api/api_xml-rpc.php
===================================================================
--- trunk/api/api_xml-rpc.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/api/api_xml-rpc.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -1048,7 +1048,7 @@
/*x*/ $xmlrpcmsg->getParam( 2 )->scalarval( ),
/*x*/ $xmlrpcmsg->getParam( 3 )->scalarval( ),
/*x*/ $xmlrpcmsg->getParam( 4 )->scalarval( ))) );
-/*x*/ } else {
+/*x*/ } else { //only 3 parameters if login already in session
$rtn = new xmlrpcresp( php_xmlrpc_encode(GetStockPrice($xmlrpcmsg->getParam( 0 )->scalarval( ),
$xmlrpcmsg->getParam( 1 )->scalarval( ),
/*e*/ $xmlrpcmsg->getParam( 2 )->scalarval( ), '', '')));
Modified: trunk/includes/DefineOfferClass.php
===================================================================
--- trunk/includes/DefineOfferClass.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/includes/DefineOfferClass.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -30,32 +30,31 @@
FROM suppliers
WHERE supplierid='" . $this->SupplierID . "'";
$result=DB_query($sql, $db);
- $myrow=DB_fetch_row($result);
- $this->SupplierName = $myrow[0];
- $this->EmailAddress = $myrow[1];
- $this->CurrCode = $myrow[2];
+ $myrow=DB_fetch_array($result);
+ $this->SupplierName = $myrow['suppname'];
+ $this->EmailAddress = $myrow['email'];
+ $this->CurrCode = $myrow['currcode'];
}
- function add_to_offer(
- $LineNo,
- $StockID,
- $Qty,
- $ItemDescr,
- $Price,
- $UOM,
- $DecimalPlaces,
- $ExpiryDate){
+ function add_to_offer( $LineNo,
+ $StockID,
+ $Qty,
+ $ItemDescr,
+ $Price,
+ $UOM,
+ $DecimalPlaces,
+ $ExpiryDate){
if (isset($Qty) and $Qty!=0){
$this->LineItems[$LineNo] = new LineDetails($LineNo,
- $StockID,
- $Qty,
- $ItemDescr,
- $Price,
- $UOM,
- $DecimalPlaces,
- $ExpiryDate);
+ $StockID,
+ $Qty,
+ $ItemDescr,
+ $Price,
+ $UOM,
+ $DecimalPlaces,
+ $ExpiryDate);
$this->LinesOnOffer++;
Return 1;
}
@@ -74,25 +73,22 @@
if ($Update=='') {
foreach ($this->LineItems as $LineItems) {
if ($LineItems->Deleted==False) {
- $sql="INSERT INTO offers (
- supplierid,
- tenderid,
- stockid,
- quantity,
- uom,
- price,
- expirydate,
- currcode)
- VALUES (
- '".$this->SupplierID."',
- '".$this->TenderID."',
- '".$LineItems->StockID."',
- '".$LineItems->Quantity."',
- '".$LineItems->Units."',
- '".$LineItems->Price."',
- '".FormatDateForSQL($LineItems->ExpiryDate)."',
- '".$this->CurrCode."'
- )";
+ $sql="INSERT INTO offers ( supplierid,
+ tenderid,
+ stockid,
+ quantity,
+ uom,
+ price,
+ expirydate,
+ currcode)
+ VALUES ('".$this->SupplierID."',
+ '".$this->TenderID."',
+ '".$LineItems->StockID."',
+ '".$LineItems->Quantity."',
+ '".$LineItems->Units."',
+ '".$LineItems->Price."',
+ '".FormatDateForSQL($LineItems->ExpiryDate)."',
+ '".$this->CurrCode."')";
$ErrMsg = _('The suppliers offer could not be inserted into the database because');
$DbgMsg = _('The SQL statement used to insert the suppliers offer record and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true);
@@ -109,11 +105,10 @@
}
} else {
foreach ($_SESSION['offer']->LineItems as $LineItems) {
- $sql="UPDATE offers SET
- quantity='".$LineItems->Quantity."',
- price='".$LineItems->Price."',
- expirydate='".FormatDateForSQL($LineItems->ExpiryDate)."'
- WHERE offerid='".$LineItems->LineNo . "'";
+ $sql="UPDATE offers SET quantity='".$LineItems->Quantity."',
+ price='".$LineItems->Price."',
+ expirydate='".FormatDateForSQL($LineItems->ExpiryDate)."'
+ WHERE offerid='".$LineItems->LineNo . "'";
$ErrMsg = _('The suppliers offer could not be updated on the database because');
$DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true);
@@ -140,9 +135,9 @@
}
function update_offer_item($LineNo,
- $Qty,
- $Price,
- $ExpiryDate){
+ $Qty,
+ $Price,
+ $ExpiryDate){
$this->LineItems[$LineNo]->Quantity = $Qty;
$this->LineItems[$LineNo]->Price = $Price;
@@ -175,23 +170,21 @@
var $Deleted;
var $ExpiryDate;
- function LineDetails (
- $LineNo,
- $StockItem,
- $Qty,
- $ItemDescr,
- $Prc,
- $UOM,
- $DecimalPlaces,
- $ExpiryDate)
- {
+ function LineDetails ($LineNo,
+ $StockItem,
+ $Qty,
+ $ItemDescr,
+ $Price,
+ $UOM,
+ $DecimalPlaces,
+ $ExpiryDate) {
/* Constructor function to add a new LineDetail object with passed params */
$this->LineNo = $LineNo;
$this->StockID =$StockItem;
$this->ItemDescription = $ItemDescr;
$this->Quantity = $Qty;
- $this->Price = $Prc;
+ $this->Price = $Price;
$this->Units = $UOM;
$this->DecimalPlaces = $DecimalPlaces;
$this->ExpiryDate = $ExpiryDate;
Modified: trunk/includes/DefineTenderClass.php
===================================================================
--- trunk/includes/DefineTenderClass.php 2012-01-20 22:55:59 UTC (rev 4823)
+++ trunk/includes/DefineTenderClass.php 2012-01-20 23:10:18 UTC (rev 4824)
@@ -1,9 +1,8 @@
<?php
-/* $Id$ */
+/* $Id: DefineTenderClass.php 4821 2012-01-20 13:48:53Z tim_schofield $ */
/* Definition of the tender class to hold all the information for a supplier tender
*/
-
Class Tender {
var $TenderId;
@@ -58,62 +57,55 @@
*/
if ($this->TenderId=='') {
$this->TenderId = GetNextTransNo(37, $db);
- $HeaderSQL="INSERT INTO tenders (
- tenderid,
- location,
- address1,
- address2,
- address3,
- address4,
- address5,
- address6,
- telephone,
- requiredbydate)
- VALUES (
- '" . $this->TenderId . "',
- '" . $this->Location . "',
- '" . $this->DelAdd1 . "',
- '" . $this->DelAdd2 . "',
- '" . $this->DelAdd3 . "',
- '" . $this->DelAdd4 . "',
- '" . $this->DelAdd5 . "',
- '" . $this->DelAdd6 . "',
- '" . $this->Telephone . "',
- '" . FormatDateForSQL($this->RequiredByDate) . "')";
+ $HeaderSQL="INSERT INTO tenders (tenderid,
+ location,
+ address1,
+ address2,
+ address3,
+ address4,
+ address5,
+ address6,
+ telephone,
+ requiredbydate)
+ VALUES ('" . $this->TenderId . "',
+ '" . $this->Location . "',
+ '" . $this->DelAdd1 . "',
+ '" . $this->DelAdd2 . "',
+ '" . $this->DelAdd3 . "',
+ '" . $this->DelAdd4 . "',
+ '" . $this->DelAdd5 . "',
+ '" . $this->DelAdd6 . "',
+ '" . $this->Telephone . "',
+ '" . FormatDateForSQL($this->RequiredByDate) . "')";
foreach ($this->Suppliers as $Supplier) {
- $SuppliersSQL[]="INSERT INTO tendersuppliers (
- tenderid,
- supplierid,
- email)
- VALUES (
- '" . $this->TenderId . "',
- '" . $Supplier->SupplierCode . "',
- '" . $Supplier->EmailAddress . "')";
+ $SuppliersSQL[]="INSERT INTO tendersuppliers (tenderid,
+ supplierid,
+ email)
+ VALUES ('" . $this->TenderId . "',
+ '" . $Supplier->SupplierCode . "',
+ '" . $Supplier->EmailAddress . "')";
}
foreach ($this->LineItems as $LineItem) {
- $ItemsSQL[]="INSERT INTO tenderitems (
- tenderid,
- stockid,
- quantity,
- units)
- VALUES (
- '" . $this->TenderId . "',
- '" . $LineItem->StockID . "',
- '" . $LineItem->Quantity . "',
- '" . $LineItem->Units . "')";
+ $ItemsSQL[]="INSERT INTO tenderitems (tenderid,
+ stockid,
+ quantity,
+ units)
+ VALUES ('" . $this->TenderId . "',
+ '" . $LineItem->StockID . "',
+ '" . $LineItem->Quantity . "',
+ '" . $LineItem->Units . "')";
}
} else {
- $HeaderSQL="UPDATE tenders
- SET location='" . $this->Location . "',
- address1='" . $this->DelAdd1 . "',
- address2='" . $this->DelAdd2 . "',
- address3='" . $this->DelAdd3 . "',
- address4='" . $this->DelAdd4 . "',
- address5='" . $this->DelAdd5 . "',
- address6='" . $this->DelAdd6 . "',
- telephone='" . $this->Telephone . "',
- requiredbydate='" . FormatDateForSQL($this->RequiredByDate) . "'
- WHERE tenderid = '" . $this->TenderId . "'";
+ $HeaderSQL="UPDATE tenders SET location='" . $this->Location . "',
+ address1='" . $this->DelAdd1 . "',
+ address2='" . $this->DelAdd2 . "',
+ address3='" . $this->DelAdd3 . "',
+ address4='" . $this->DelAdd4 . "',
+ address5='" . $this->DelAdd5 . "',
+ address6='" . $this->DelAdd6 . "',
+ telephone='" . $this->Telephone . "',
+ requiredbydate='" . FormatDateForSQL($this->RequiredByDate) . "'
+ WHERE tenderid = '" . $this->TenderId . "'";
foreach ($this->Suppliers as $Supplier) {
$sql="DELETE FROM tendersuppliers
WHERE tenderid='" . $this->TenderId . "'";
@@ -122,25 +114,22 @@
tenderid,
supplierid,
email)
- VALUES (
- '" . $this->TenderId . "',
- '" . $Supplier->SupplierCode . "',
- '" . $Supplier->EmailAddress . "')";
+ VALUES ('" . $this->TenderId . "',
+ '" . $Supplier->SupplierCode . "',
+ '" . $Supplier->EmailAddress . "')";
}
foreach ($this->LineItems as $LineItem) {
$sql="DELETE FROM tenderitems
- WHERE tenderid='" . $this->TenderId . "'";
+ WHERE tenderid='" . $this->TenderId . "'";
$result=DB_query($sql, $db);
- $ItemsSQL[]="INSERT INTO tenderitems (
- tenderid,
- stockid,
- quantity,
- units)
- VALUES (
- '" . $this->TenderId . "',
- '" . $LineItem->StockID . "',
- '" . $LineItem->Quantity . "',
- '" . $LineItem->Units . "')";
+ $ItemsSQL[]="INSERT INTO tenderitems (tenderid,
+ stockid,
+ quantity,
+ units)
+ ...
[truncated message content] |