|
From: <ex...@us...> - 2014-04-29 12:54:59
|
Revision: 6700
http://sourceforge.net/p/web-erp/reponame/6700
Author: exsonqu
Date: 2014-04-29 12:54:54 +0000 (Tue, 29 Apr 2014)
Log Message:
-----------
29/4/2014 Exson: Make price matrix workable including GetPrice.inc, MainMenuLinksArray.php,SelectOrderItems_IntoCart.inc,PriceMatrix.php, SelectProduct.php,StockDispatch.php.
Modified Paths:
--------------
trunk/PriceMatrix.php
trunk/SelectProduct.php
trunk/StockDispatch.php
trunk/includes/GetPrice.inc
trunk/includes/MainMenuLinksArray.php
trunk/includes/SelectOrderItems_IntoCart.inc
trunk/sql/mysql/upgrade4.11-4.12.sql
Modified: trunk/PriceMatrix.php
===================================================================
--- trunk/PriceMatrix.php 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/PriceMatrix.php 2014-04-29 12:54:54 UTC (rev 6700)
@@ -19,48 +19,112 @@
//initialise no input errors assumed initially before we test
$InputError = 0;
-
+ if(isset($_POST['StockID'])){
+ $StockID = trim(strtoupper($_POST['StockID']));
+ }
if (!is_numeric(filter_number_format($_POST['QuantityBreak']))){
prnMsg( _('The quantity break must be entered as a positive number'),'error');
$InputError =1;
- $Errors[$i] = 'QuantityBreak';
- $i++;
}
if (filter_number_format($_POST['QuantityBreak'])<=0){
- prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $_POST['StockID'] . ' ' . _('at which the price will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn');
+ prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $StockID . ' ' . _('at which the price will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn');
$InputError =1;
- $Errors[$i] = 'QuantityBreak';
- $i++;
}
if (!is_numeric(filter_number_format($_POST['Price']))){
prnMsg( _('The price must be entered as a positive number'),'warn');
$InputError =1;
- $Errors[$i] = 'Price';
- $i++;
}
+ if (!Is_Date($_POST['StartDate'])){
+ $InputError = 1;
+ prnMsg(_('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error');
+ }
+ if (!Is_Date($_POST['EndDate'])){
+ $InputError = 1;
+ prnMsg(_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error');
+ if (Date1GreaterThanDate2($_POST['StartDate'],$_POST['EndDate'])){
+ $InputError = 1;
+ prnMsg(_('The end date is expected to be after the start date, enter an end date after the start date for this price'),'error');
+ }
+ }
+
+ if(Is_Date($_POST['EndDate'])){
+ $SQLEndDate = FormatDateForSQL($_POST['EndDate']);
+ }
+ if(Is_Date($_POST['StartDate'])){
+ $SQLStartDate = FormatDateForSQL($_POST['StartDate']);
+ }
+ $sql = "SELECT COUNT(salestype)
+ FROM pricematrix
+ WHERE stockid='".$StockID."'
+ AND startdate='".$SQLStartDate."'
+ AND enddate='".$SQLEndDate."'
+ AND salestype='".$_POST['TypeAbbrev']."'
+ AND currabrev='".$_POST['currabrev']."'
+ AND quantitybreak='".$_POST['quantitybreak']."'";
+ $result = DB_query($sql,$db);
+ $myrow = DB_fetch_row($result);
+ if ($myrow[0]!=0 AND !isset($_POST['OldTypeAbbrev']) AND !isset($_POST['OldCurrAbrev'])){
+ prnMsg(_('This price has already been entered. To change it you should edit it'),'warn');
+ $InputError = 1;
+ }
+
+ if (isset($_POST['OldTypeAbbrev']) AND isset($_POST['OldCurrAbrev']) AND mb_strlen($StockID)>1 AND $InputError !=1){
+
+ /* Update existing prices */
+ $sql = "UPDATE pricematrix SET
+ salestype='" . $_POST['SalesType'] . "',
+ currabrev='" . $_POST['CurrAbrev'] . "',
+ price='" . filter_number_format($_POST['Price']) . "',
+ startdate='" . $SQLStartDate . "',
+ enddate='" . $SQLEndDate . "',
+ quantitybreak='" . filter_number_format($_POST['QuantityBreak']) . "'
+ WHERE stockid='" . $StockID . "'
+ AND startdate='" . $_POST['OldStartDate'] . "'
+ AND enddate='" . $_POST['OldEndDate'] . "'
+ AND salestype='" . $_POST['OldTypeAbbrev'] . "'
+ AND currabrev='" . $_POST['OldCurrAbrev'] . "'
+ AND quantitybreak='" . filter_number_format($_POST['OldQuantityBreak']) . "'";
+
+ $ErrMsg = _('Could not be update the existing prices');
+ $result = DB_query($sql,$db,$ErrMsg);
+
+ ReSequenceEffectiveDates ($StockID, $_POST['SalesType'],$_POST['CurrAbrev'],$_POST['QuantityBreak'],$db);
+
+ prnMsg(_('The price has been updated'),'success');
+ } elseif ($InputError != 1) {
+
/* actions to take once the user has clicked the submit button
ie the page has called itself with some user input */
- if ($InputError !=1) {
-
$sql = "INSERT INTO pricematrix (salestype,
stockid,
quantitybreak,
- price)
+ price,
+ currabrev,
+ startdate,
+ enddate)
VALUES('" . $_POST['SalesType'] . "',
'" . $_POST['StockID'] . "',
'" . filter_number_format($_POST['QuantityBreak']) . "',
- '" . filter_number_format($_POST['Price']) . "')";
-
- $result = DB_query($sql,$db);
+ '" . filter_number_format($_POST['Price']) . "',
+ '" . $_POST['CurrAbrev'] . "',
+ '" . $SQLStartDate . "',
+ '" . $SQLEndDate . "')";
+ $ErrMsg = _('Failed to insert price data');
+ $result = DB_query($sql,$db,$ErrMsg);
prnMsg( _('The price matrix record has been added'),'success');
echo '<br />';
unset($_POST['StockID']);
unset($_POST['SalesType']);
unset($_POST['QuantityBreak']);
unset($_POST['Price']);
+ unset($_POST['CurrAbrev']);
+ unset($_POST['StartDate']);
+ unset($_POST['EndDate']);
+ unset($SQLEndDate);
+ unset($SQLStartDate);
}
} elseif (isset($_GET['Delete']) and $_GET['Delete']=='yes') {
/*the link to delete a selected record was clicked instead of the submit button */
@@ -68,9 +132,12 @@
$sql="DELETE FROM pricematrix
WHERE stockid='" .$_GET['StockID'] . "'
AND salestype='" . $_GET['SalesType'] . "'
- AND quantitybreak='" . $_GET['QuantityBreak']."'";
-
- $result = DB_query($sql,$db);
+ AND quantitybreak='" . $_GET['QuantityBreak']."'
+ AND price='" . $_GET['Price'] . "'
+ AND startdate='" . $_GET['StartDate'] . "'
+ AND enddate='" . $_GET['EndDate'] . "'";
+ $ErrMsg = _('Failed to delete price data');
+ $result = DB_query($sql,$db,$ErrMsg);
prnMsg( _('The price matrix record has been deleted'),'success');
echo '<br />';
}
@@ -78,9 +145,35 @@
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
-
-
+if (isset($_GET['Edit'])){
+ echo '<input type="hidden" name="OldTypeAbbrev" value="' . $_GET['TypeAbbrev'] . '" />';
+ echo '<input type="hidden" name="OldCurrAbrev" value="' . $_GET['CurrAbrev'] . '" />';
+ echo '<input type="hidden" name="OldStartDate" value="' . $_GET['StartDate'] . '" />';
+ echo '<input type="hidden" name="OldEndDate" value="' . $_GET['EndDate'] . '" />';
+ echo '<input type="hidden" name="OldQuantityBreak" value="' . $_GET['QuantityBreak'] . '" />';
+ $_POST['StartDate'] = $_GET['StartDate'];
+ $_POST['TypeAbbrev'] = $_GET['TypeAbbrev'];
+ $_POST['Price'] = $_GET['Price'];
+ $_POST['CurrAbrev'] = $_GET['CurrAbrev'];
+ $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']);
+ $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']);
+ $_POST['QuantityBreak'] = $_GET['QuantityBreak'];
+}
+$SQL = "SELECT currabrev FROM currencies";
+$result = DB_query($SQL,$db);
+require_once('includes/CurrenciesArray.php');
echo '<table class="selection">';
+echo '<tr><td>' . _('Currency') . ':</td>
+ <td><select name="CurrAbrev">';
+while ($myrow = DB_fetch_array($result)){
+ echo '<option';
+ if ($myrow['currabrev']==$_POST['CurrAbrev']){
+ echo ' selected="selected"';
+ }
+ echo ' value="' . $myrow['currabrev'] . '">' . $CurrencyName[$myrow['currabrev']] . '</option>';
+} // End while loop
+DB_free_result($result);
+echo '</select></td>';
$sql = "SELECT typeabbrev,
sales_type
@@ -101,31 +194,35 @@
}
echo '</select></td></tr>';
+if(isset($_GET['StockID'])){
+ $StockID = trim($_GET['StockID']);
+}elseif(isset($_POST['StockID'])){
+ $StockID = trim(strtoupper($_POST['StockID']));
+}elseif(!isset($StockID)){
+ prnMsg(_('You must select a stock item first before set a price maxtrix'),'error');
+ include('includes/footer.inc');
+ exit;
+}
+echo '<input type="hidden" name="StockID" value="' . $StockID . '" />';
+if (!isset($_POST['StartDate'])){
+ $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']);
+}
+if (!isset($_POST['EndDate'])){
+ $_POST['EndDate'] = GetMySQLMaxDate();
+}
+echo '<tr><td>'. _('Price Effective From Date') . ':</td>
+ <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="StartDate" required="required" size="10" maxlength="10" title="' . _('Enter the date from which this price should take effect.') . '" value="' . $_POST['StartDate'] . '" /></td></tr>';
+echo '<tr><td>' . _('Price Effective To Date') . ':</td>
+ <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="EndDate" size="10" maxlength="10" title="' . _('Enter the date to which this price should be in effect to, or leave empty if the price should continue indefinitely') . '" value="' . $_POST['EndDate'] . '" />';
-$sql = "SELECT stockid FROM stockmaster WHERE stockid <>'' LIMIT 300";//if the quantity is over, users have to input it himselves
-$result = DB_query($sql, $db);
-if (DB_num_rows($result) > 0) {
- echo '<tr>
- <td>' . _('Stock Code') .': </td>
- <td><input type="text" name="StockID" list="StockList" /></td>';
- echo '<datalist id="StockList">';
-
- while ($myrow = DB_fetch_array($result)){
- echo '<option value="' . $myrow['stockid'] . '">' . $myrow['stockid'] . '</option>';
- }
- echo '</datalist>';
-} else {
- echo '<tr><td><input type="hidden" name="StockID" value="" /></td></tr>';
-}
-
echo '<tr>
<td>' . _('Quantity Break') . '</td>
- <td><input class="integer' . (in_array('QuantityBreak',$Errors) ? ' inputerror' : '') . '" tabindex="3" required="required" type="number" name="QuantityBreak" size="10" maxlength="10" /></td>
+ <td><input class="integer' . (in_array('QuantityBreak',$Errors) ? ' inputerror' : '') . '" tabindex="3" required="required" type="number" name="QuantityBreak" size="10" value="'. $_POST['QuantityBreak'].'" maxlength="10" /></td>
</tr>
<tr>
<td>' . _('Price') . ' :</td>
- <td><input class="number' . (in_array('Price',$Errors) ? ' inputerror' : '') . '" tabindex="4" type="text" required="required" name="Price" title="' . _('The price to apply to orders where the quantity exceeds the specified quantity') . '" size="5" maxlength="5" /></td>
+ <td><input class="number' . (in_array('Price',$Errors) ? ' inputerror' : '') . '" tabindex="4" type="text" required="required" name="Price" value="'.$_POST['Price'].'" title="' . _('The price to apply to orders where the quantity exceeds the specified quantity') . '" size="5" maxlength="5" /></td>
</tr>
</table>
<br />
@@ -137,11 +234,20 @@
$sql = "SELECT sales_type,
salestype,
stockid,
+ startdate,
+ enddate,
quantitybreak,
- price
+ price,
+ currencies.currabrev,
+ currencies.currency,
+ currencies.decimalplaces AS currdecimalplace
FROM pricematrix INNER JOIN salestypes
ON pricematrix.salestype=salestypes.typeabbrev
- ORDER BY salestype,
+ INNER JOIN currencies
+ ON pricematrix.currabrev=currencies.currabrev
+ WHERE pricematrix.stockid='" . $StockID . "'
+ ORDER BY pricematrix.currabrev,
+ salestype,
stockid,
quantitybreak";
@@ -149,10 +255,12 @@
echo '<table class="selection">';
echo '<tr>
+ <th>' . _('Currency') . '</th>
<th>' . _('Sales Type') . '</th>
- <th>' . _('Price Matrix Category') . '</th>
+ <th>' . _('Price Effective From Date') . '</th>
+ <th>' . _('Price Effective To Date') .'</th>
<th>' . _('Quantity Break') . '</th>
- <th>' . _('Sell Price') . ' %' . '</th>
+ <th>' . _('Sell Price') . '</th>
</tr>';
$k=0; //row colour counter
@@ -165,20 +273,44 @@
echo '<tr class="OddTableRows">';
$k=1;
}
- $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&StockID=' . $myrow['stockid'] . '&QuantityBreak=' . $myrow['quantitybreak'];
+ $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&StockID=' . $myrow['stockid'] . '&QuantityBreak=' . $myrow['quantitybreak'].'&Price=' . $myrow['price'] . '&currabrev=' . $myrow['currabrev'].'&StartDate='.$myrow['startdate'].'&EndDate='.$myrow['enddate'];
+ $EditURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Edit=yes&StockID=' . $myrow['stockid'] . '&TypeAbbrev=' . $myrow['salestype'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . locale_number_format($myrow['price'], $myrow['currdecimalplaces']) . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'].'&QuantityBreak=' . $myrow['quantitybreak'];
- printf('<td>%s</td>
+ if (in_array(5, $_SESSION['AllowedPageSecurityTokens'])){
+ printf('<td>%s</td>
+ <td>%s</td>
<td>%s</td>
+ <td>%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
<td><a href="%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this discount matrix record?') . '\');">' . _('Delete') . '</a></td>
+ <td><a href="%s">'._('Edit').'</a></td>
</tr>',
+ $myrow['currency'],
$myrow['sales_type'],
- $myrow['stockid'],
+ ConvertSQLDate($myrow['startdate']),
+ ConvertSQLDate($myrow['enddate']),
$myrow['quantitybreak'],
$myrow['price'] ,
- $DeleteURL);
+ $DeleteURL,
+ $EditURL);
+ }else {
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ </tr>',
+ $myrow['currency'],
+ $myrow['sales_type'],
+ ConvertSQLDate($myrow['startdate']),
+ ConvertSQLDate($myrow['enddate']),
+ $myrow['quantitybreak'],
+ $myrow['price']);
+ }
+
}
echo '</table>
@@ -186,4 +318,68 @@
</form>';
include('includes/footer.inc');
+
+function GetMySQLMaxDate () {
+ switch ($_SESSION['DefaultDateFormat']){
+ case 'd/m/Y':
+ return '31/12/9999';
+ case 'd.m.Y':
+ return '31.12.9999';
+ case 'm/d/Y':
+ return '12/31/9999';
+ case 'Y-m-d':
+ return '9999-12-31';
+ case 'Y/m/d':
+ return '9999/12/31';
+ }
+}
+function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $QuantityBreak,$db) {
+
+ /*This is quite complicated - the idea is that prices set up should be unique and there is no way two prices could be returned as valid - when getting a price in includes/GetPrice.inc the logic is to first look for a price of the salestype/currency within the effective start and end dates - then if not get the price with a start date prior but a blank end date (the default price). We would not want two prices where one price falls inside another effective date range except in the case of a blank end date - ie no end date - the default price for the currency/salestype.
+ I first thought that we would need to update the previous default price (blank end date), when a new default price is entered, to have an end date of the startdate of this new default price less 1 day - but this is converting a default price into a special price which could result in having two special prices over the same date range - best to leave it unchanged and use logic in the GetPrice.inc to ensure the correct default price is returned
+ *
+ * After further discussion (Ricard) if the new price has a blank end date - i.e. no end then the pre-existing price with no end date should be changed to have an end date just prior to the new default (no end date) price commencing
+ */
+ //this is just the case where debtorno='' - see the Prices_Customer.php script for customer special prices
+ $SQL = "SELECT price,
+ startdate,
+ enddate
+ FROM pricematrix
+ WHERE stockid='" . $Item . "'
+ AND currabrev='" . $CurrAbbrev . "'
+ AND salestype='" . $PriceList . "'
+ AND quantitybreak='".$QuantityBreak."'
+ ORDER BY startdate, enddate";
+ $result = DB_query($SQL,$db);
+
+ while ($myrow = DB_fetch_array($result)){
+ if (isset($NextStartDate)){
+ if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']),$NextStartDate)){
+ $NextStartDate = ConvertSQLDate($myrow['startdate']);
+ //Only if the previous enddate is after the new start date do we need to look at updates
+ if (Date1GreaterThanDate2(ConvertSQLDate($EndDate),ConvertSQLDate($myrow['startdate']))) {
+ /*Need to make the end date the new start date less 1 day */
+ $SQL = "UPDATE pricematrix SET enddate = '" . FormatDateForSQL(DateAdd($NextStartDate,'d',-1)) . "'
+ WHERE stockid ='" .$Item . "'
+ AND currabrev='" . $CurrAbbrev . "'
+ AND salestype='" . $PriceList . "'
+ AND startdate ='" . $StartDate . "'
+ AND enddate = '" . $EndDate . "'
+ AND quantitybreak ='" . $QuantityBreak . "'";
+ $UpdateResult = DB_query($SQL,$db);
+ }
+ } //end of if startdate after NextStartDate - we have a new NextStartDate
+ } //end of if set NextStartDate
+ else {
+ $NextStartDate = ConvertSQLDate($myrow['startdate']);
+ }
+ $StartDate = $myrow['startdate'];
+ $EndDate = $myrow['enddate'];
+ $Price = $myrow['price'];
+ } // end of loop around all prices
+
+
+
+} // end function ReSequenceEffectiveDates
+
?>
\ No newline at end of file
Modified: trunk/SelectProduct.php
===================================================================
--- trunk/SelectProduct.php 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/SelectProduct.php 2014-04-29 12:54:54 UTC (rev 6700)
@@ -501,6 +501,7 @@
}
echo '<a href="' . $RootPath . '/DiscountCategories.php?StockID=' . $StockID . '">' . _('Maintain Discount Category') . '</a><br />';
echo '<a href="' . $RootPath . '/StockClone.php?OldStockID=' . $StockID . '">' . _('Clone This Item') . '</a><br />';
+ echo '<a href="' . $RootPath . '/PriceMatrix.php?StockID=' . $StockID . '">' . _('Maintain Price Matrix') . '</a><br />';
}
echo '</td></tr></table>';
} else {
Modified: trunk/StockDispatch.php
===================================================================
--- trunk/StockDispatch.php 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/StockDispatch.php 2014-04-29 12:54:54 UTC (rev 6700)
@@ -233,7 +233,7 @@
$pdf->addTextWrap(510,$YPos,40,$FontSize,'_________','right',0,$fill);
if($template=='fullprices'){
// looking for price info
- $DefaultPrice = GetPrice($myrow['stockid'], $ToCustomer, $ToBranch, $db, false);
+ $DefaultPrice = GetPrice($myrow['stockid'],$ToCustomer, $ToBranch, $db,$ShipQty, false);
if ($myrow['discountcategory'] != "")
{
$DiscountLine = ' -> ' . _('Discount Category') . ':' . $myrow['discountcategory'];
Modified: trunk/includes/GetPrice.inc
===================================================================
--- trunk/includes/GetPrice.inc 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/includes/GetPrice.inc 2014-04-29 12:54:54 UTC (rev 6700)
@@ -1,16 +1,8 @@
<?php
/* $Id$*/
-function GetPrice ($StockID, $DebtorNo, $BranchCode, $db, $ReportZeroPrice=1){
+function GetPrice ($StockID, $DebtorNo, $BranchCode, $db, $OrderLineQty,$ReportZeroPrice=1){
$Price = 0;
- //get the price from price matrix
- $sql = "SELECT pricematrix.price FROM pricematrix,debtorsmaster
- WHERE debtorsmaster.salestype=pricematrix.salestype
- AND debtorsmaster.debtorno = '".$DebtorNo."'
- AND pricematrix.stockid = '".$StockID."'";
- $ErrorMsg = _('Failed to retrieve price from price matrix');
- $result = DB_query($sql,$db,$ErrMsg);
- if (DB_num_rows($result) == 0){
/*Search by branch and customer for a date specified price */
$sql="SELECT prices.price
@@ -27,7 +19,6 @@
$ErrMsg = _('There is a problem in retrieving the pricing information for part') . ' ' . $StockID . ' ' . _('and for Customer') . ' ' . $DebtorNo . ' ' . _('the error message returned by the SQL server was');
$result = DB_query($sql, $db,$ErrMsg);
- }
if (DB_num_rows($result)==0){
/*Need to try same specific search but for a default price with a zero end date */
$sql="SELECT prices.price,
@@ -149,6 +140,19 @@
$result = DB_query($sql, $db,$ErrMsg);
if (DB_num_rows($result)==0){
+ /* Now check the price matrix */
+ $sql = "SELECT max(pricematrix.price) FROM pricematrix,
+ debtorsmaster
+ WHERE pricematrix.stockid = '".$StockID . "'
+ AND pricematrix.currabrev = debtorsmaster.currcode
+ AND pricematrix.salestype = debtorsmaster.salestype
+ AND pricematrix.quantitybreak >= '".$OrderLineQty."'
+ AND pricematrix.startdate <= '" . Date('Y-m-d') . "'
+ AND pricematrix.enddate >='" . Date('Y-m-d')."'";
+ $ErrMsg = _('There is an error to retrieve price from price matrix for stock '.$StockID.' and the error message returned by SQL server is ');
+ $result = DB_query($sql,$db,$ErrMsg);
+ }
+ if (DB_num_rows($result)==0){
/*Not even a price set up in the default price list so return 0 */
if ($ReportZeroPrice ==1){
prnMsg(_('There are no prices set up for') . ' ' . $StockID,'warn');
Modified: trunk/includes/MainMenuLinksArray.php
===================================================================
--- trunk/includes/MainMenuLinksArray.php 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/includes/MainMenuLinksArray.php 2014-04-29 12:54:54 UTC (rev 6700)
@@ -483,8 +483,7 @@
_('Sales GL Interface Postings'),
_('COGS GL Interface Postings'),
_('Freight Costs Maintenance'),
- _('Discount Matrix'),
- _('Price Matrix'));
+ _('Discount Matrix'));
$MenuItems['system']['Reports']['URL'] = array( '/SalesTypes.php',
'/CustomerTypes.php',
@@ -499,8 +498,7 @@
'/SalesGLPostings.php',
'/COGSGLPostings.php',
'/FreightCosts.php',
- '/DiscountMatrix.php',
- '/PriceMatrix.php');
+ '/DiscountMatrix.php');
$MenuItems['system']['Maintenance']['Caption'] = array( _('Inventory Categories Maintenance'),
_('Inventory Locations Maintenance'),
@@ -579,4 +577,4 @@
'/Z_RePostGLFromPeriod.php',
'/Z_DeleteOldPrices.php',
'/Z_ImportPriceList.php');
-?>
+?>
\ No newline at end of file
Modified: trunk/includes/SelectOrderItems_IntoCart.inc
===================================================================
--- trunk/includes/SelectOrderItems_IntoCart.inc 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/includes/SelectOrderItems_IntoCart.inc 2014-04-29 12:54:54 UTC (rev 6700)
@@ -109,7 +109,7 @@
$Discount = 0;
}
- $Price = GetPrice($NewItem, $_SESSION['Items'.$identifier]->DebtorNo,$_SESSION['Items'.$identifier]->Branch, $db);
+ $Price = GetPrice($NewItem, $_SESSION['Items'.$identifier]->DebtorNo,$_SESSION['Items'.$identifier]->Branch, $db,$NewItemQty);
/* Need to check for sell through support deals */
Modified: trunk/sql/mysql/upgrade4.11-4.12.sql
===================================================================
--- trunk/sql/mysql/upgrade4.11-4.12.sql 2014-04-26 03:49:49 UTC (rev 6699)
+++ trunk/sql/mysql/upgrade4.11-4.12.sql 2014-04-29 12:54:54 UTC (rev 6700)
@@ -20,6 +20,15 @@
CONSTRAINT ` custitem _ibfk_1` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`),
CONSTRAINT ` custitem _ibfk_2` FOREIGN KEY (`debtorno`) REFERENCES `debtorsmaster` (`debtorno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER table pricematrix ADD column currabrev char(3) NOT NULL DEFAULT '';
+ALTER table pricematrix ADD column startdate date NOT NULL DEFAULT '0000-00-00';
+ALTER table pricematrix ADD column enddate date NOT NULL DEFAULT '9999-12-31';
+ALTER table pricematrix DROP PRIMARY KEY;
+ALTER table pricematrix ADD PRIMARY KEY (`salestype`,`stockid`,`currabrev`,`quantitybreak`,`startdate`,`enddate`);
+ALTER table pricematrix DROP KEY `DiscountCategory`;
+ALTER table pricematrix ADD KEY currabrev(`currabrev`);
+ALTER table pricematrix ADD KEY stockid(`stockid`);
+ALTER TABLE `debtortrans` CHANGE `consignment` `consignment` VARCHAR( 20 ) NOT NULL DEFAULT '';
UPDATE config SET confvalue='4.12' WHERE confname='VersionNumber';
-ALTER TABLE `debtortrans` CHANGE `consignment` `consignment` VARCHAR( 20 ) NOT NULL DEFAULT '';
+
|