From: <dai...@us...> - 2011-08-12 11:01:42
|
Revision: 4657 http://web-erp.svn.sourceforge.net/web-erp/?rev=4657&view=rev Author: daintree Date: 2011-08-12 11:01:35 +0000 (Fri, 12 Aug 2011) Log Message: ----------- 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes Modified Paths: -------------- trunk/CounterSales.php trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/CounterSales.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -665,38 +665,43 @@ } -/* Run through each line of the order and work out the appropriate discount from the discount matrix */ +/* Now Run through each line of the order again to work out the appropriate discount from the discount matrix */ $DiscCatsDone = array(); -$counter =0; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if ($OrderLine->DiscCat !='' AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){ - $DiscCatsDone[$counter]=$OrderLine->DiscCat; - $QuantityOfDiscCat =0; + $DiscCatsDone[]=$OrderLine->DiscCat; + $QuantityOfDiscCat = 0; - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat){ - $QuantityOfDiscCat += $StkItems_2->Quantity; + 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); + AND quantitybreak <= '" . $QuantityOfDiscCat ."'",$db); $myrow = DB_fetch_row($result); + if ($myrow[0]==NULL){ + $DiscountMatrixRate = 0; + } else { + $DiscountMatrixRate = $myrow[0]; + } 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){ - $_SESSION['Items'.$identifier]->LineItems[$StkItems_2->LineNumber]->DiscountPercent = $myrow[0]; + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); } } } } } /* end of discount matrix lookup code */ + if (count($_SESSION['Items'.$identifier]->LineItems)>0 AND !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */ /* @@ -877,7 +882,7 @@ * Invoice Processing Here * ********************************** * */ -if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ""){ +if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ''){ $InputError = false; //always assume the best //but check for the worst @@ -952,7 +957,7 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia + defaultshipvia FROM custbranch WHERE custbranch.debtorno ='". $_SESSION['Items'.$identifier]->DebtorNo . "' AND custbranch.branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "'"; @@ -1358,35 +1363,33 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', - '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', - '" . $AssParts['standard'] . "', - 0, - newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " - )"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh + ) VALUES ( + '" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', + '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', + '" . $AssParts['standard'] . "', + 0, + newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1451,35 +1454,34 @@ if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost = 0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $OrderNo . "', - '" . -$OrderLine->Quantity . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $OrderNo . "', + '" . -$OrderLine->Quantity . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/SelectProduct.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -303,17 +303,17 @@ $DemRow = DB_fetch_row($DemResult); $Demand = $DemRow[0]; $DemAsComponentResult = DB_query("SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A' - AND salesorders.quotation=0", $db); + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A' + AND salesorders.quotation=0", $db); $DemAsComponentRow = DB_fetch_row($DemAsComponentResult); $Demand+= $DemAsComponentRow[0]; //Also the demand for the item as a component of works orders @@ -417,7 +417,7 @@ wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ -if ($Its_A_Kitset_Assembly_Or_Dummy == false AND $myrow['discontinued']==0) { +if ($Its_A_Kitset_Assembly_Or_Dummy == false) { echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/doc/Change.log 2011-08-12 11:01:35 UTC (rev 4657) @@ -1,5 +1,7 @@ webERP Change Log +12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete +12/8/11 Phil: CounterSales.php apply discountmatrix fixes 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |