From: <dai...@us...> - 2012-07-12 10:09:56
|
Revision: 5496 http://web-erp.svn.sourceforge.net/web-erp/?rev=5496&view=rev Author: daintree Date: 2012-07-12 10:09:49 +0000 (Thu, 12 Jul 2012) Log Message: ----------- Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/api/api_webERPsettings.php trunk/doc/Change.log trunk/includes/GetConfig.php trunk/includes/Z_POSDataCreation.php trunk/includes/session.inc Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/PO_Header.php 2012-07-12 10:09:49 UTC (rev 5496) @@ -179,7 +179,7 @@ /* set the SupplierID we got */ $_SESSION['PO'.$identifier]->SupplierID = $_GET['SelectedSupplier']; $_SESSION['PO'.$identifier]->DeliveryDate = date($_SESSION['DefaultDateFormat']); - + $_SESSION['PO'.$identifier]->Initiator = $_SESSION['UsersRealName']; $_SESSION['RequireSupplierSelection'] = 0; $_POST['Select'] = $_GET['SelectedSupplier']; @@ -760,7 +760,7 @@ <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="DeliveryDate" size="11" value="' . $_POST['DeliveryDate'] . '" /></td></tr>'; if (!isset($_POST['Initiator'])) { - $_POST['Initiator'] = $_SESSION['UserID']; + $_POST['Initiator'] = $_SESSION['UsersRealName']; $_POST['Requisition'] = ''; } Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/PO_Items.php 2012-07-12 10:09:49 UTC (rev 5496) @@ -596,6 +596,13 @@ $SuppliersUnitOfMeasure = $PurchRow['suppliersuom']; $SuppliersPartNo = $PurchRow['suppliers_partno']; $LeadTime = $PurchRow['leadtime']; + /* Work out the delivery date based on today + lead time + * if > header DeliveryDate then set DeliveryDate to today + leadtime + */ + $DeliveryDate = DateAdd(Date($_SESSION['DefaultDateFormat']),'d',$LeadTime); + if (! Date1GreaterThanDate2($DeliveryDate,$_SESSION['PO'.$identifier]->DeliveryDate)){ + $DeliveryDate = $_SESSION['PO'.$identifier]->DeliveryDate; + } } else { // no purchasing data setup $PurchPrice = 0; $ConversionFactor = 1; @@ -603,6 +610,7 @@ $SuppliersUnitOfMeasure = $ItemRow['units']; $SuppliersPartNo = ''; $LeadTime = 1; + $DeliveryDate = $_SESSION['PO'.$identifier]->DeliveryDate; } $_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1, @@ -614,7 +622,7 @@ $PurchPrice, $ItemRow['units'], $ItemRow['stockact'], - $_SESSION['PO'.$identifier]->DeliveryDate, + $DeliveryDate, 0, 0, 0, Modified: trunk/api/api_webERPsettings.php =================================================================== --- trunk/api/api_webERPsettings.php 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/api/api_webERPsettings.php 2012-07-12 10:09:49 UTC (rev 5496) @@ -108,6 +108,7 @@ } return $ReturnValue; } + function DeletePOSData($User, $Password) { $Errors = array(); $db = db($User, $Password); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/doc/Change.log 2012-07-12 10:09:49 UTC (rev 5496) @@ -1,6 +1,7 @@ webERP Change Log -9/7/12 Tim/Ricard: Add Z_ChangeSupplierCode.php - +10/7/12 Phil: Made purchase order lines look at the purchasing data lead time and set the delivery date of the line to today + the lead time if this is beyond the delivery date specified in the PO header. +9/7/12 Tim/Ricard: Add Z_ChangeSupplierCode.php 6/7/12 Phil: Add stable versions to UpgradeDatabase.php script 6/7/12 Phil: Added new Z_DeleteOldPrices.php script to purge prices which are past their end date 30/6/12 Phil: Attempt at quicker price retrieval Modified: trunk/includes/GetConfig.php =================================================================== --- trunk/includes/GetConfig.php 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/includes/GetConfig.php 2012-07-12 10:09:49 UTC (rev 5496) @@ -3,7 +3,7 @@ // $ForceConfigReload to true /* $Id$*/ -if(isset($ForceConfigReload) and $ForceConfigReload==TRUE OR !isset($_SESSION['CompanyDefaultsLoaded'])) { +if(isset($ForceConfigReload) AND $ForceConfigReload==true OR !isset($_SESSION['CompanyDefaultsLoaded'])) { global $db; // It is global, we may not be. $sql = "SELECT confname, confvalue FROM config"; $ErrMsg = _('Could not get the configuration parameters from the database because'); Modified: trunk/includes/Z_POSDataCreation.php =================================================================== --- trunk/includes/Z_POSDataCreation.php 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/includes/Z_POSDataCreation.php 2012-07-12 10:09:49 UTC (rev 5496) @@ -36,7 +36,7 @@ fwrite($FileHandle,"DELETE FROM salestypes;\n"); - $result = DB_query('SELECT typeabbrev, sales_type FROM salestypes',$db); + $result = DB_query("SELECT typeabbrev, sales_type FROM salestypes",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO salestypes VALUES ('" . $myrow['typeabbrev'] . "', '" . SQLite_Escape ($myrow['sales_type']) . "');\n"); @@ -44,7 +44,7 @@ } fwrite($FileHandle,"DELETE FROM holdreasons;\n"); - $result = DB_query('SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons',$db); + $result = DB_query("SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO holdreasons VALUES ('" . $myrow['reasoncode'] . "', '" . SQLite_Escape ($myrow['reasondescription']) . "', '" . $myrow['dissallowinvoices'] . "');\n"); @@ -52,7 +52,7 @@ } fwrite($FileHandle,"DELETE FROM paymentterms;\n"); - $result = DB_query('SELECT termsindicator, terms FROM paymentterms',$db); + $result = DB_query("SELECT termsindicator, terms FROM paymentterms",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO paymentterms VALUES ('" . $myrow['termsindicator'] . "', '" . SQLite_Escape ($myrow['terms']) . "');\n"); @@ -60,7 +60,7 @@ } fwrite($FileHandle,"DELETE FROM paymentmethods;\n"); - $result = DB_query('SELECT paymentid, paymentname,opencashdrawer FROM paymentmethods',$db); + $result = DB_query("SELECT paymentid, paymentname,opencashdrawer FROM paymentmethods",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO paymentmethods VALUES ('" . $myrow['paymentid'] . "', '" . SQLite_Escape ($myrow['paymentname']) . "', '" . $myrow['opencashdrawer'] . "');\n"); @@ -68,7 +68,7 @@ } fwrite($FileHandle,"DELETE FROM locations;\n"); - $result = DB_query('SELECT loccode, locationname,taxprovinceid FROM locations',$db); + $result = DB_query("SELECT loccode, locationname,taxprovinceid FROM locations",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO locations VALUES ('" . $myrow['loccode'] . "', '" . SQLite_Escape ($myrow['locationname']) . "', '" . $myrow['taxprovinceid'] . "');\n"); @@ -76,14 +76,14 @@ } fwrite($FileHandle,"DELETE FROM stockcategory;\n"); - $result = DB_query('SELECT categoryid, categorydescription FROM stockcategory',$db); + $result = DB_query("SELECT categoryid, categorydescription FROM stockcategory",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO stockcategory VALUES ('" . $myrow['categoryid'] . "', '" . SQLite_Escape ($myrow['categorydescription']) . "');\n"); } fwrite($FileHandle,"DELETE FROM taxgroups;\n"); - $result = DB_query('SELECT taxgroupid, taxgroupdescription FROM taxgroups',$db); + $result = DB_query("SELECT taxgroupid, taxgroupdescription FROM taxgroups",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO taxgroups VALUES ('" . $myrow['taxgroupid'] . "', '" . SQLite_Escape ($myrow['taxgroupdescription']) . "');\n"); @@ -91,21 +91,21 @@ } fwrite($FileHandle,"DELETE FROM taxgrouptaxes;\n"); - $result = DB_query('SELECT taxgroupid, taxauthid, calculationorder, taxontax FROM taxgrouptaxes',$db); + $result = DB_query("SELECT taxgroupid, taxauthid, calculationorder, taxontax FROM taxgrouptaxes",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO taxgrouptaxes VALUES ('" . $myrow['taxgroupid'] . "', '" . $myrow['taxauthid'] . "', '" . $myrow['calculationorder'] . "', '" . $myrow['taxontax'] . "');\n"); } fwrite($FileHandle,"DELETE FROM taxauthorities;\n"); - $result = DB_query('SELECT taxid, description FROM taxauthorities',$db); + $result = DB_query("SELECT taxid, description FROM taxauthorities",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO taxauthorities VALUES ('" . $myrow['taxid'] . "', '" . SQLite_Escape ($myrow['description']) . "');\n"); } fwrite($FileHandle,"DELETE FROM taxauthrates;\n"); - $result = DB_query('SELECT taxauthority, dispatchtaxprovince, taxcatid, taxrate FROM taxauthrates',$db); + $result = DB_query("SELECT taxauthority, dispatchtaxprovince, taxcatid, taxrate FROM taxauthrates",$db); while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO taxauthrates VALUES ('" . $myrow['taxauthority'] . "', '" . $myrow['dispatchtaxprovince'] . "', '" . $myrow['taxcatid'] . "', '" . $myrow['taxrate'] . "');\n"); @@ -116,7 +116,10 @@ while ($myrow = DB_fetch_array($result)) { fwrite($FileHandle,"INSERT INTO stockmaster VALUES ('" . SQLite_Escape ($myrow['stockid']) . "', '" . SQLite_Escape ($myrow['categoryid']) . "', '" . SQLite_Escape ($myrow['description']) . "', '" . SQLite_Escape (str_replace("\n", '', $myrow['longdescription'])) . "', '" . SQLite_Escape ($myrow['units']) . "', '" . SQLite_Escape ($myrow['barcode']) . "', '" . $myrow['taxcatid'] . "', '" . $myrow['decimalplaces'] . "');\n"); - $Price = GetPriceQuick ($myrow['stockid'], $_POST['POSDebtorNo'], $_POST['POSBranchCode'], $DefaultPriceList, $db); + + fwrite($FileHandle,"DELETE FROM prices WHERE stockid='" . $myrow['stockid'] . "';\n"); + + $Price = GetPriceQuick ($myrow['stockid'], $POSDebtorNo, $POSBranchCode, $DefaultPriceList, $db); if ($Price!=0) { fwrite($FileHandle,"INSERT INTO prices (stockid, currabrev, typeabbrev, price) VALUES('" . $myrow['stockid'] . "', '" . $CurrCode . "', '" . $SalesType . "', '" . $Price . "');\n"); } @@ -154,7 +157,7 @@ } function SQLite_Escape($String) { - $SearchCharacters = array('&', '"', "'",'<', '>',"\n","\r" ); + $SearchCharacters = array('&', '"', "'",'<', '>',"\n","\r"); $ReplaceWith = array('&', '""', "''", '<', '>', '', ' '); $String = str_replace($SearchCharacters, $ReplaceWith, $String); Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2012-07-11 07:15:36 UTC (rev 5495) +++ trunk/includes/session.inc 2012-07-12 10:09:49 UTC (rev 5496) @@ -31,7 +31,7 @@ include($PathPrefix . 'includes/ConnectDB.inc'); include($PathPrefix . 'includes/DateFunctions.inc'); -// Un comment to turn off attempts counter +// Uncomment to turn off attempts counter //$_SESSION['AttemptsCounter'] = 0; if (!isset($_SESSION['AttemptsCounter'])){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |