From: <dai...@us...> - 2014-05-16 09:44:34
|
Revision: 6711 http://sourceforge.net/p/web-erp/reponame/6711 Author: daintree Date: 2014-05-16 09:44:30 +0000 (Fri, 16 May 2014) Log Message: ----------- renamed file css/wood/images/user.png and error trap 0 exrates for sales analysis Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/CounterReturns.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/MRP.php trunk/SelectCreditItems.php Added Paths: ----------- trunk/css/wood/images/user.png Removed Paths: ------------- trunk/css/wood/images/User.png Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/ConfirmDispatch_Invoice.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -1208,6 +1208,11 @@ /*Insert Sales Analysis records */ + $SalesValue = 0; + if ($_SESSION['CurrencyRate']>0){ + $SalesValue = $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']; + } + $SQL="SELECT COUNT(*), salesanalysis.stockid, salesanalysis.stkcategory, @@ -1248,10 +1253,10 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ - $SQL = "UPDATE salesanalysis SET amt=amt+" . round(($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . ", + $SQL = "UPDATE salesanalysis SET amt=amt+" . round(($SalesValue),$_SESSION['CompanyRecord']['decimalplaces']) . ", cost=cost+" . round(($OrderLine->StandardCost * $OrderLine->QtyDispatched),$_SESSION['CompanyRecord']['decimalplaces']) . ", qty=qty +" . $OrderLine->QtyDispatched . ", - disc=disc+" . round(($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . " + disc=disc+" . round(($OrderLine->DiscountPercent * $SalesValue),$_SESSION['CompanyRecord']['decimalplaces']) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' @@ -1279,12 +1284,12 @@ stkcategory ) SELECT '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . round(($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . round(($SalesValue),$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . round(($OrderLine->StandardCost * $OrderLine->QtyDispatched),$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', '" . ($OrderLine->QtyDispatched) . "', - '" . round(($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . round(($OrderLine->DiscountPercent * $SalesValue),$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $OrderLine->StockID . "', custbranch.area, 1, Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/CounterReturns.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -1193,6 +1193,10 @@ /*Insert Sales Analysis records */ + $SalesValue = 0; + if ($ExRate>0){ + $SalesValue = $ReturnItemLine->Price * $ReturnItemLine->Quantity / $ExRate; + } $SQL="SELECT COUNT(*), salesanalysis.stockid, @@ -1236,10 +1240,10 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis - SET amt=amt-" . ($ReturnItemLine->Price * $ReturnItemLine->Quantity / $ExRate) . ", + SET amt=amt-" . ($SalesValue) . ", cost=cost-" . ($ReturnItemLine->StandardCost * $ReturnItemLine->Quantity) . ", qty=qty -" . $ReturnItemLine->Quantity . ", - disc=disc-" . ($ReturnItemLine->DiscountPercent * $ReturnItemLine->Price * $ReturnItemLine->Quantity / $ExRate) . " + disc=disc-" . ($ReturnItemLine->DiscountPercent * $SalesValue) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $_SESSION['Items' . $identifier]->SalesPerson . "' AND typeabbrev ='" . $_SESSION['Items' . $identifier]->DefaultSalesType . "' @@ -1267,12 +1271,12 @@ stkcategory ) SELECT '" . $_SESSION['Items' . $identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -($ReturnItemLine->Price * $ReturnItemLine->Quantity / $ExRate) . "', + '" . -($SalesValue) . "', '" . -($ReturnItemLine->StandardCost * $ReturnItemLine->Quantity) . "', '" . $_SESSION['Items' . $identifier]->DebtorNo . "', '" . $_SESSION['Items' . $identifier]->Branch . "', '" . -$ReturnItemLine->Quantity . "', - '" . -($ReturnItemLine->DiscountPercent * $ReturnItemLine->Price * $ReturnItemLine->Quantity / $ExRate) . "', + '" . -($ReturnItemLine->DiscountPercent * $SalesValue) . "', '" . $ReturnItemLine->StockID . "', custbranch.area, 1, Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/CounterSales.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -1647,8 +1647,11 @@ End of controlled stuff not currently handled by counter orders */ + $SalesValue = 0; + if ($ExRate>0){ + $SalesValue = $OrderLine->Price * $OrderLine->Quantity / $ExRate; + } - /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), @@ -1693,10 +1696,10 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis - SET amt=amt+" . ($OrderLine->Price * $OrderLine->Quantity / $ExRate) . ", + SET amt=amt+" . ($SalesValue) . ", cost=cost+" . ($OrderLine->StandardCost * $OrderLine->Quantity) . ", qty=qty +" . $OrderLine->Quantity . ", - disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . " + disc=disc+" . ($OrderLine->DiscountPercent * $SalesValue) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $_SESSION['Items'.$identifier]->SalesPerson . "' AND typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' @@ -1724,12 +1727,12 @@ stkcategory ) SELECT '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . ($OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', + '" . ($SalesValue) . "', '" . ($OrderLine->StandardCost * $OrderLine->Quantity) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', '" . $OrderLine->Quantity . "', - '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', + '" . ($OrderLine->DiscountPercent * $SalesValue) . "', '" . $OrderLine->StockID . "', custbranch.area, 1, Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/Credit_Invoice.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -1124,6 +1124,10 @@ } /*Insert Sales Analysis records */ + $SalesValue = 0; + if ($_SESSION['CurrencyRate']>0){ + $SalesValue = $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate']; + } $SQL="SELECT COUNT(*), stkcategory, @@ -1157,7 +1161,7 @@ if ($_POST['CreditType']=='ReverseOverCharge'){ $SQL = "UPDATE salesanalysis - SET amt=amt-" . $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . ", + SET amt=amt-" . $SalesValue . ", disc=disc-" . ($CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate']) . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $_SESSION['CreditItems' . $identifier]->SalesPerson . "' @@ -1172,10 +1176,10 @@ } else { $SQL = "UPDATE salesanalysis - SET amt=amt-" . $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . ", + SET amt=amt-" . $SalesValue . ", cost=cost-" . $CreditLine->StandardCost * $CreditLine->QtyDispatched . ", qty=qty-" . $CreditLine->QtyDispatched . ", - disc=disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . " + disc=disc-" . $CreditLine->DiscountPercent * $SalesValue . " WHERE salesanalysis.area='" . $myrow[2] . "' AND salesanalysis.salesperson='" . $_SESSION['CreditItems' . $identifier]->SalesPerson . "' AND typeabbrev ='" . $_SESSION['CreditItems' . $identifier]->DefaultSalesType . "' @@ -1209,7 +1213,7 @@ '" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "', '" . $_SESSION['CreditItems' . $identifier]->Branch . "', 0, - '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->DiscountPercent * $SalesValue . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1237,12 +1241,12 @@ stkcategory) SELECT '" . $_SESSION['CreditItems' . $identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -$CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . "', + '" . -$SalesValue . "', '" . -$CreditLine->StandardCost * $CreditLine->QtyDispatched . "', '" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "', '" . $_SESSION['CreditItems' . $identifier]->Branch . "', '" . -$CreditLine->QtyDispatched . "', - '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->QtyDispatched / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->DiscountPercent * $SalesValue . "', '" . $CreditLine->StockID . "', custbranch.area, 1, Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/MRP.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -116,13 +116,13 @@ $sql = "SELECT * FROM tempbom"; $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)) { - $parts = explode('%',$myrow['sortpart']); + $Parts = explode('%',$myrow['sortpart']); $Level = $myrow['level']; $ctr = 0; - foreach ($parts as $part) { + foreach ($Parts as $Part) { $ctr++; $newlevel = $Level - $ctr; - $sql = "INSERT INTO bomlevels (part, level) VALUES('" . $part . "','" . $newlevel . "')"; + $sql = "INSERT INTO bomlevels (part, level) VALUES('" . $Part . "','" . $newlevel . "')"; $result2 = DB_query($sql,$db); } // End of foreach } //end of while loop @@ -640,20 +640,20 @@ -function LevelNetting(&$db,$part,$eoq,$PanSize,$ShrinkFactor, $LeadTime) { +function LevelNetting(&$db,$Part,$eoq,$PanSize,$ShrinkFactor, $LeadTime) { // Create an array of mrprequirements and an array of mrpsupplies, then read through // them seeing if all requirements are covered by supplies. Create a planned order // for any unmet requirements. Change dates if necessary for the supplies. - //echo '<br />Part is ' . "$part" . '<br />'; + //echo '<br />Part is ' . "$Part" . '<br />'; // Get decimal places from stockmaster for rounding of shrinkage factor - $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'"; + $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $Part . "'"; $result = DB_query($sql,$db); $myrow=DB_fetch_row($result); $DecimalPlaces = $myrow[0]; // Load mrprequirements into $Requirements array - $sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired"; + $sql = "SELECT * FROM mrprequirements WHERE part = '" .$Part. "' ORDER BY daterequired"; $result = DB_query($sql,$db); $Requirements = array(); $i = 0; @@ -663,7 +663,7 @@ } //end of while loop // Load mrpsupplies into $Supplies array - $sql = "SELECT * FROM mrpsupplies WHERE part = '" .$part. "' ORDER BY duedate"; + $sql = "SELECT * FROM mrpsupplies WHERE part = '" . $Part. "' ORDER BY duedate"; $result = DB_query($sql,$db); $Supplies = array(); $i = 0; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2014-05-15 05:22:56 UTC (rev 6710) +++ trunk/SelectCreditItems.php 2014-05-16 09:44:30 UTC (rev 6711) @@ -1636,6 +1636,11 @@ set up. Considered just getting the area and salesman from the branch table but these can alter and the sales analysis needs to reflect the sales made before and after the changes*/ + $SalesValue = 0; + if ($_SESSION['CurrencyRate']>0){ + $SalesValue = $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate']; + } + $SQL="SELECT COUNT(*), salesanalysis.stkcategory, salesanalysis.area @@ -1670,8 +1675,8 @@ /*No updates to qty or cost data */ - $SQL = "UPDATE salesanalysis SET amt=amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", - disc=disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " + $SQL = "UPDATE salesanalysis SET amt=amt-" . $SalesValue . ", + disc=disc-" . $CreditLine->DiscountPercent * $SalesValue . " WHERE salesanalysis.area='" . $myrow['area'] . "' AND salesanalysis.salesperson='" . $_SESSION['CreditItems'.$identifier]->SalesPerson . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1684,10 +1689,10 @@ } else { - $SQL = "UPDATE salesanalysis SET Amt=Amt-" . $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . ", + $SQL = "UPDATE salesanalysis SET Amt=Amt-" . $SalesValue . ", Cost=Cost-" . $CreditLine->StandardCost * $CreditLine->Quantity . ", Qty=Qty-" . $CreditLine->Quantity . ", - Disc=Disc-" . $CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . " + Disc=Disc-" . $CreditLine->DiscountPercent * $SalesValue . " WHERE salesanalysis.area='" . $myrow['area'] . "' AND salesanalysis.salesperson='" . $_SESSION['CreditItems'.$identifier]->SalesPerson . "' AND salesanalysis.typeabbrev ='" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "' @@ -1717,11 +1722,11 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$SalesValue . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', 0, - '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->DiscountPercent * $SalesValue . "', '" . $CreditLine->StockID . "', custbranch.area, 1, @@ -1749,12 +1754,12 @@ stkcategory) SELECT '" . $_SESSION['CreditItems'.$identifier]->DefaultSalesType . "', '" . $PeriodNo . "', - '" . -$CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$SalesValue . "', '" . -$CreditLine->StandardCost * $CreditLine->Quantity . "', '" . $_SESSION['CreditItems'.$identifier]->DebtorNo . "', '" . $_SESSION['CreditItems'.$identifier]->Branch . "', '" . -$CreditLine->Quantity . "', - '" . -$CreditLine->DiscountPercent * $CreditLine->Price * $CreditLine->Quantity / $_SESSION['CurrencyRate'] . "', + '" . -$CreditLine->DiscountPercent * $SalesValue . "', '" . $CreditLine->StockID . "', custbranch.area, 1, Deleted: trunk/css/wood/images/User.png =================================================================== (Binary files differ) Copied: trunk/css/wood/images/user.png (from rev 6702, trunk/css/wood/images/User.png) =================================================================== (Binary files differ) |