From: <dai...@us...> - 2011-07-08 10:28:21
|
Revision: 4626 http://web-erp.svn.sourceforge.net/web-erp/?rev=4626&view=rev Author: daintree Date: 2011-07-08 10:28:14 +0000 (Fri, 08 Jul 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PO_Items.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/MiscFunctions.php trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-07-06 09:30:42 UTC (rev 4625) +++ trunk/PO_Items.php 2011-07-08 10:28:14 UTC (rev 4626) @@ -159,39 +159,38 @@ 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 . "' - )"; + 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'); @@ -213,20 +212,19 @@ suppliers_partno, 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->SuppliersUnit . "', - '" . $POLine->Suppliers_PartNo . "', - '" . $POLine->AssetID . "', - '" . $POLine->ConversionFactor . "')"; + VALUES ('" . $_SESSION['PO'.$identifier]->OrderNo . "', + '" . $POLine->StockID . "', + '" . FormatDateForSQL($POLine->ReqDelDate) . "', + '" . $POLine->ItemDescription . "', + '" . $POLine->GLCode . "', + '" . $POLine->Price . "', + '" . $POLine->Quantity . "', + '" . $POLine->ShiptRef . "', + '" . $POLine->JobRef . "', + '" . $POLine->SuppliersUnit . "', + '" . $POLine->Suppliers_PartNo . "', + '" . $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'); @@ -386,7 +384,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(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Qty'])))){ + if (!is_numeric($_POST['Qty'])){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'error'); } @@ -394,7 +392,7 @@ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the ordered item entered must be a positive amount'),'error'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])))){ + if (!is_numeric($_POST['Price'])){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The price entered must be numeric'),'error'); } @@ -465,8 +463,6 @@ if ($AllowUpdate == true){ //adding the non-stock item - $_POST['Price'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])); - $_POST['Qty'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Qty'])); $_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1, '', @@ -505,10 +501,10 @@ foreach ($_POST as $FormVariableName => $Quantity) { if (mb_substr($FormVariableName, 0, 6)=='NewQty') { //if the form variable represents a Qty to add to the order - + $ItemCode = mb_substr($FormVariableName, 6, mb_strlen($FormVariableName)-6); $AlreadyOnThisOrder = 0; - + if ($_SESSION['PO_AllowSameItemMultipleTimes'] ==false){ if (count($_SESSION['PO'.$identifier]->LineItems)!=0){ @@ -530,11 +526,11 @@ decimalplaces, stockact, accountname - FROM stockmaster INNER JOIN stockcategory - ON stockcategory.categoryid = stockmaster.categoryid - INNER JOIN chartmaster - ON chartmaster.accountcode = stockcategory.stockact - WHERE stockmaster.stockid = '". $ItemCode . "'"; + 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'); @@ -661,9 +657,9 @@ // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { - $DisplayPrice = number_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces,'.',''); + $DisplayPrice = number_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); } else { - $DisplayPrice = number_format($POLine->Price,4,'.',''); + $DisplayPrice = number_format($POLine->Price,4); } if ($k==1){ @@ -705,7 +701,7 @@ echo '<br /><table class="selection"><tr> <td>' . _('Item Description') . '</td>'; - echo '<td><input type=text name=ItemDescription size=40></td></tr>'; + echo '<td><input type="text" name="ItemDescription" size="40" /></td></tr>'; echo '<tr><td>' . _('General Ledger Code') . '</td>'; echo '<td><select name="GLCode">'; $sql="SELECT accountcode, @@ -759,29 +755,29 @@ $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<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.description " . LIKE . " '" . $SearchString ."' - ORDER BY stockmaster.stockid - LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '" . $SearchString ."' + ORDER BY stockmaster.stockid + LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; } 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<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.description " . LIKE . " '". $SearchString ."' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '". $SearchString ."' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } } elseif ($_POST['StockCode']){ @@ -792,29 +788,29 @@ $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<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid - LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } 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<>'K' - AND stockmaster.mbflag<>'G' - and stockmaster.discontinued<>1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + and stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } } else { @@ -822,27 +818,27 @@ $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<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; } 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<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; } } @@ -865,10 +861,10 @@ if (!isset($_GET['Edit'])) { $sql="SELECT categoryid, categorydescription - FROM stockcategory - WHERE stocktype<>'L' - AND stocktype<>'D' - ORDER BY categorydescription"; + FROM stockcategory + WHERE stocktype<>'L' + AND stocktype<>'D' + ORDER BY categorydescription"; $ErrMsg = _('The supplier category details could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -926,13 +922,13 @@ echo '<table cellpadding="1" colspan="7" class="selection">'; $TableHeader = '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Our Units') . '</th> - <th>' . _('Conversion') . '<br />' ._('Factor') . '</th> - <th>' . _('Supplier/Order') . '<br />' . _('Units') . '</th> - <th colspan=2><a href="#end">'._('Go to end of list').'</a></th> - </tr>'; + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Our Units') . '</th> + <th>' . _('Conversion') . '<br />' ._('Factor') . '</th> + <th>' . _('Supplier/Order') . '<br />' . _('Units') . '</th> + <th colspan=2><a href="#end">'._('Go to end of list').'</a></th> + </tr>'; echo $TableHeader; $j = 1; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-07-06 09:30:42 UTC (rev 4625) +++ trunk/SelectOrderItems.php 2011-07-08 10:28:14 UTC (rev 4626) @@ -897,6 +897,7 @@ $ExRate = 1; } + /*Process Quick Entry */ /* If enter is pressed on the quick entry screen, the default button may be Recalculate */ if (isset($_POST['order_items']) @@ -906,8 +907,8 @@ /* get the item details from the database and hold them in the cart object */ /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */ - $Discount = 0; - + $Discount = 0; + $AlreadyWarnedAboutCredit = false; $i=1; while ($i<=$_SESSION['QuickEntries'] and isset($_POST['part_' . $i]) and $_POST['part_' . $i]!='') { $QuickEntryCode = 'part_' . $i; @@ -1053,14 +1054,14 @@ taxcatid, materialcost) VALUES ('" . $AssetStockID . "', - '" . $AssetRow['description'] . "', - '" . $AssetRow['longdescription'] . "', - 'ASSETS', - 'D', - '0', - '0', - '" . $_SESSION['DefaultTaxCategory'] . "', - '". $NBV . "')" , $db); + '" . $AssetRow['description'] . "', + '" . $AssetRow['longdescription'] . "', + 'ASSETS', + 'D', + '0', + '0', + '" . $_SESSION['DefaultTaxCategory'] . "', + '". $NBV . "')" , $db); /*not forgetting the location records too */ $InsertStkLocRecsResult = DB_query("INSERT INTO locstock (loccode, stockid) @@ -1091,7 +1092,9 @@ $_SESSION['Items'.$identifier]->LineItems[$_GET['Delete']]->Quantity = $QuantityAlreadyDelivered; } } - + + $AlreadyWarnedAboutCredit = false; + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ @@ -1142,18 +1145,20 @@ $WithinCreditLimit = true; - if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn - and 2 for prohibit sales */ + if ($_SESSION['CheckCreditLimits'] > 0 AND $AlreadyWarnedAboutCredit==false){ /*Check credit limits is 1 for warn + breach their credit limit and 2 for prohibit sales */ $DifferenceInOrderValue = ($Quantity*$Price*(1-$DiscountPercentage/100)) - ($OrderLine->Quantity*$OrderLine->Price*(1-$OrderLine->DiscountPercentage)); $_SESSION['Items'.$identifier]->CreditAvailable -= $DifferenceInOrderValue; if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('The customer account will breach their credit limit'),'warn'); + $AlreadyWarnedAboutCredit = true; } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('This change would put the customer over their credit limit and is prohibited'),'warn'); $WithinCreditLimit = false; $_SESSION['Items'.$identifier]->CreditAvailable += $DifferenceInOrderValue; + $AlreadyWarnedAboutCredit = true; } } @@ -1170,8 +1175,39 @@ } //within credit limit so make changes } //there are changes to the order line to process } //page not called from itself - POST variables not set - } - } + } // Loop around all items on the order + + + /* Now Run through each line of the order again to work out the appropriate discount from the discount matrix */ + $DiscCatsDone = array(); + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { + + if ($OrderLine->DiscCat !='' AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){ + $DiscCatsDone[]=$OrderLine->DiscCat; + $QuantityOfDiscCat = 0; + + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { + /* add up total quantity of all lines of this DiscCat */ + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $QuantityOfDiscCat += $OrderLine_2->Quantity; + } + } + $result = DB_query("SELECT MAX(discountrate) AS discount + FROM discountmatrix + WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' + AND discountcategory ='" . $OrderLine->DiscCat . "' + AND quantitybreak <" . $QuantityOfDiscCat,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]!=0){ /* need to update the lines affected */ + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $myrow[0]; + } + } + }//a none zero discount percentage was returned + } + } /* end of discount matrix lookup code */ + } // the order session is started or there is a new item being added if (isset($_POST['DeliveryDetails'])){ echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/DeliveryDetails.php?' . SID .'identifier='.$identifier . '">'; prnMsg(_('You should automatically be forwarded to the entry of the delivery details page') . '. ' . _('if this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . @@ -1229,6 +1265,7 @@ if (isset($NewItem_array) AND isset($_POST['order_items'])){ /* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */ /*Now figure out if the item is a kit set - the field MBFlag='K'*/ + $AlreadyWarnedAboutCredit = false; foreach($NewItem_array as $NewItem => $NewItemQty) { if($NewItemQty > 0) { $sql = "SELECT stockmaster.mbflag @@ -1245,11 +1282,11 @@ if ($myrow=DB_fetch_array($KitResult)){ if ($myrow['mbflag']=='K'){ /*It is a kit set item */ $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + bom.quantity + FROM bom + WHERE bom.parent='" . $NewItem . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$db,$ErrMsg); @@ -1300,8 +1337,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]!=0){ /* need to update the lines affected */ foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { - /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat AND $StkItems_2->DiscountPercent == 0){ + if ($StkItems_2->DiscCat==$OrderLine->DiscCat){ $_SESSION['Items'.$identifier]->LineItems[$StkItems_2->LineNumber]->DiscountPercent = $myrow[0]; } } @@ -1415,12 +1451,13 @@ $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - $ColSpanNumber = 3; + $ColSpanNumber = 2; } else { $ColSpanNumber = 1; } - echo '<tr class="EvenTableRows"><td class="number" colspan=7><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> - <td colspan="' . $ColSpanNumber . '" class=number>' . $DisplayTotal . '</td></tr></table>'; + echo '<tr class="EvenTableRows"> + <td class="number" colspan=7><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> + <td colspan="' . $ColSpanNumber . '" class=number>' . $DisplayTotal . '</td></tr></table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); @@ -1431,8 +1468,10 @@ </tr></table>'; - echo '<br /><div class="centre"><input type=submit name="Recalculate" Value="' . _('Re-Calculate') . '"> - <input type=submit name="DeliveryDetails" value="' . _('Enter Delivery Details and Confirm Order') . '"></div><hr>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="Recalculate" value="' . _('Re-Calculate') . '"> + <input type="submit" name="DeliveryDetails" value="' . _('Enter Delivery Details and Confirm Order') . '"></div><hr />'; } # end of if lines /* Now show the stock item selection search stuff below */ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-07-06 09:30:42 UTC (rev 4625) +++ trunk/doc/Change.log 2011-07-08 10:28:14 UTC (rev 4626) @@ -1,5 +1,7 @@ webERP Change Log +8/7/11 Phil: Trap codes with decimal point "." in them in the IllegalCharacters function +8/7/11 Phil: Fix discount matrix calculations on order entry and amendment 5/7/11 Phil: Amend menu to use PDFStockLocTransfer.php to reprint transfer list - as reported by Ron Wong 3/7/11 Phil: changed all strpos to mb_strpos 3/7/11 Phil: changed all strtoupper to mb_strtoupper Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-07-06 09:30:42 UTC (rev 4625) +++ trunk/includes/MiscFunctions.php 2011-07-08 10:28:14 UTC (rev 4626) @@ -112,6 +112,7 @@ if (strstr($CheckVariable,"'") OR strstr($CheckVariable,'+') OR strstr($CheckVariable,'?') + OR strstr($CheckVariable,'.') OR strstr($CheckVariable,"\"") OR strstr($CheckVariable,'&') OR strstr($CheckVariable,"\\") Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-07-06 09:30:42 UTC (rev 4625) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-07-08 10:28:14 UTC (rev 4626) @@ -89,7 +89,7 @@ $NewLineNo = -1; /* this is ok b/c CartClass will change to the correct line no */ } - if (isset($StockItem) and $myItemRow['discountcategory'] != "" ){ + if (isset($StockItem) and $myItemRow['discountcategory'] != '' ){ $DiscCatsDone[$Counter]=$StockItem->DiscCat; $QuantityOfDiscCat =0; $result = DB_query("SELECT MAX(discountrate) AS discount @@ -114,15 +114,17 @@ if ($_SESSION['Items'.$identifier]->SpecialInstructions) { prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); } - if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn + if ($_SESSION['CheckCreditLimits'] > 0 AND $AlreadyWarnedAboutCredit==false){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items'.$identifier]->CreditAvailable -= round(($NewItemQty * $Price * (1- $Discount)),2); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('The customer account will breach their credit limit'),'warn'); + $AlreadyWarnedAboutCredit = true; } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('No more lines can be added to this order the customer account is currently at or over their credit limit'),'warn'); $WithinCreditLimit = false; + $AlreadyWarnedAboutCredit = true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |