[Weberp-svn] SF.net SVN: weberp:[5425] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2011-06-20 14:31:28
|
Revision: 5425 http://weberp.svn.sourceforge.net/weberp/?rev=5425&view=rev Author: tim_schofield Date: 2011-06-20 14:31:21 +0000 (Mon, 20 Jun 2011) Log Message: ----------- Correctly show quantities and price on the invoice Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/PrintCustTrans.php trunk/includes/session.inc Added Paths: ----------- trunk/sql/mysql/updates/85.php Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-06-20 14:25:16 UTC (rev 5424) +++ trunk/ConfirmDispatch_Invoice.php 2011-06-20 14:31:21 UTC (rev 5425) @@ -125,7 +125,8 @@ stockmaster.serialised, stockmaster.volume, stockmaster.kgs, - stockmaster.units, + salesorderdetails.units, + salesorderdetails.conversionfactor, stockmaster.decimalplaces, stockmaster.mbflag, stockmaster.taxcatid, @@ -181,7 +182,11 @@ '', $myrow['itemdue'], $myrow['poline'], - $myrow['standardcost']); /*NB NO Updates to DB */ + $myrow['standardcost'], + 1, + 0, + 1, + $myrow['conversionfactor']); /*NB NO Updates to DB */ /*Calculate the taxes applicable to this line item from the customer branch Tax Group and Item Tax Category */ @@ -943,7 +948,7 @@ $QtyOnHandPrior = 0; } - $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " + $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched/$OrderLine->ConversionFactor . " WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['Items']->Location . "'"; @@ -1050,72 +1055,81 @@ $OrderLine->StandardCost=0; } if ($MBFlag=='B' OR $MBFlag=='M'){ - $SQL = "INSERT INTO stockmoves ( stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - newqoh, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . round($LocalCurrencyPrice,$OrderLine->PriceDecimals) . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', - '" . DB_escape_string($OrderLine->Narrative) . "' )"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh, + narrative, + units, + conversionfactor ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . round($LocalCurrencyPrice,$OrderLine->PriceDecimals) . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched/$OrderLine->ConversionFactor . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched/$OrderLine->ConversionFactor) . "', + '" . DB_escape_string($OrderLine->Narrative) . "', + '" . $OrderLine->Units . "', + '" . $OrderLine->ConversionFactor . "' + )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil 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']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative, + units, + conversionfactor ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched/$OrderLine->ConversionFactor . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "' + '" . $OrderLine->Units . "', + '" . $OrderLine->ConversionFactor . "' + )"; } - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-06-20 14:25:16 UTC (rev 5424) +++ trunk/PrintCustTrans.php 2011-06-20 14:31:21 UTC (rev 5425) @@ -193,12 +193,13 @@ if ($InvOrCredit == 'Invoice') { $sql = "SELECT stockmoves.stockid, stockmaster.description, - -stockmoves.qty as quantity, + -stockmoves.qty*stockmoves.conversionfactor as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, + stockmoves.units, + stockmoves.conversionfactor, stockmaster.decimalplaces FROM stockmoves, stockmaster @@ -210,12 +211,13 @@ /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, stockmaster.description, - stockmoves.qty as quantity, + stockmoves.qty*stockmoves.conversionfactor as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, + stockmoves.units, + stockmoves.conversionfactor, stockmaster.decimalplaces FROM stockmoves, stockmaster @@ -599,12 +601,13 @@ </table>'; $sql = "SELECT stockmoves.stockid, stockmaster.description, - -stockmoves.qty as quantity, + -stockmoves.qty*stockmoves.conversionfactor as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units + stockmoves.units, + stockmoves.conversionfactor FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid @@ -628,10 +631,11 @@ </tr></table>'; $sql = "SELECT stockmoves.stockid, stockmaster.description, - stockmoves.qty as quantity, + stockmoves.qty*stockmoves.conversionfactor as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, - stockmaster.units + stockmoves.units, + stockmoves.conversionfactor FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2011-06-20 14:25:16 UTC (rev 5424) +++ trunk/includes/session.inc 2011-06-20 14:31:21 UTC (rev 5425) @@ -13,7 +13,7 @@ header('Location:' . $rootpath . '/install/index.php'); } include($PathPrefix . 'config.php'); -$DBVersion=84; +$DBVersion=85; if (isset($SessionSavePath)){ session_save_path($SessionSavePath); } Added: trunk/sql/mysql/updates/85.php =================================================================== --- trunk/sql/mysql/updates/85.php (rev 0) +++ trunk/sql/mysql/updates/85.php 2011-06-20 14:31:21 UTC (rev 5425) @@ -0,0 +1,8 @@ +<?php + +AddColumn('units', 'stockmoves', 'varchar(40)', 'NOT NULL', '', 'narrative', $db); +AddColumn('conversionfactor', 'stockmoves', 'double', 'NOT NULL', '1', 'units', $db); + +UpdateDBNo(85, $db); + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |