This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 2011-12-14 08:50:43
|
Revision: 4775 http://web-erp.svn.sourceforge.net/web-erp/?rev=4775&view=rev Author: daintree Date: 2011-12-14 08:50:36 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-14 08:39:49 UTC (rev 4774) +++ trunk/doc/Change.log 2011-12-14 08:50:36 UTC (rev 4775) @@ -1,6 +1,5 @@ webERP Change Log -14/12/11 Phil test 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-14 08:50:42
|
Revision: 4775 http://web-erp.svn.sourceforge.net/web-erp/?rev=4775&view=rev Author: daintree Date: 2011-12-14 08:50:36 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-14 08:39:49 UTC (rev 4774) +++ trunk/doc/Change.log 2011-12-14 08:50:36 UTC (rev 4775) @@ -1,6 +1,5 @@ webERP Change Log -14/12/11 Phil test 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-14 08:39:55
|
Revision: 4774 http://web-erp.svn.sourceforge.net/web-erp/?rev=4774&view=rev Author: daintree Date: 2011-12-14 08:39:49 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-14 05:37:28 UTC (rev 4773) +++ trunk/doc/Change.log 2011-12-14 08:39:49 UTC (rev 4774) @@ -1,5 +1,6 @@ webERP Change Log +14/12/11 Phil test 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-14 08:39:55
|
Revision: 4774 http://web-erp.svn.sourceforge.net/web-erp/?rev=4774&view=rev Author: daintree Date: 2011-12-14 08:39:49 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-14 05:37:28 UTC (rev 4773) +++ trunk/doc/Change.log 2011-12-14 08:39:49 UTC (rev 4774) @@ -1,5 +1,6 @@ webERP Change Log +14/12/11 Phil test 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-14 05:37:35
|
Revision: 4773 http://web-erp.svn.sourceforge.net/web-erp/?rev=4773&view=rev Author: daintree Date: 2011-12-14 05:37:28 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Added Paths: ----------- trunk/build/check_syntax.sh Added: trunk/build/check_syntax.sh =================================================================== --- trunk/build/check_syntax.sh (rev 0) +++ trunk/build/check_syntax.sh 2011-12-14 05:37:28 UTC (rev 4773) @@ -0,0 +1,17 @@ +#!/bin/bash + +ROOT_DIR=$PWD +cd $ROOT_DIR/.. +for f in `find . -name "*.php" -o -name "*.inc"` +do + newname=`echo $f | cut -c3-` + filename="$ROOT_DIR/../$newname" + echo $filename + output=$((php5 -l $filename ) 2>&1) + + if [ $? != 0 ] + then + echo '**Error** '$output >> ~/weberp$(date +%Y%m%d).log + echo '' >> ~/weberp$(date +%Y%m%d).log + fi +done Property changes on: trunk/build/check_syntax.sh ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-14 05:37:34
|
Revision: 4773 http://web-erp.svn.sourceforge.net/web-erp/?rev=4773&view=rev Author: daintree Date: 2011-12-14 05:37:28 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Added Paths: ----------- trunk/build/check_syntax.sh Added: trunk/build/check_syntax.sh =================================================================== --- trunk/build/check_syntax.sh (rev 0) +++ trunk/build/check_syntax.sh 2011-12-14 05:37:28 UTC (rev 4773) @@ -0,0 +1,17 @@ +#!/bin/bash + +ROOT_DIR=$PWD +cd $ROOT_DIR/.. +for f in `find . -name "*.php" -o -name "*.inc"` +do + newname=`echo $f | cut -c3-` + filename="$ROOT_DIR/../$newname" + echo $filename + output=$((php5 -l $filename ) 2>&1) + + if [ $? != 0 ] + then + echo '**Error** '$output >> ~/weberp$(date +%Y%m%d).log + echo '' >> ~/weberp$(date +%Y%m%d).log + fi +done Property changes on: trunk/build/check_syntax.sh ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 08:55:50
|
Revision: 4772 http://web-erp.svn.sourceforge.net/web-erp/?rev=4772&view=rev Author: daintree Date: 2011-12-13 08:55:38 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Additional changes to ExistingOrder Modified Paths: -------------- trunk/CounterSales.php trunk/Credit_Invoice.php trunk/DeliveryDetails.php trunk/RecurringSalesOrders.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesTopItemsInquiry.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/CounterSales.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -63,7 +63,7 @@ set to 1. The delivery check screen is where the details of the order are either updated or inserted depending on the value of ExistingOrder */ - $_SESSION['ExistingOrder'] = 0; + $_SESSION['ExistingOrder'. $identifier] = 0; $_SESSION['Items'.$identifier] = new cart; $_SESSION['PrintedPackingSlip'] = 0; /*Of course 'cos the order ain't even started !!*/ /*Get the default customer-branch combo from the user's default location record */ Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/Credit_Invoice.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -156,8 +156,8 @@ '', '', '', - $myrow['standardcost'] - ); + $myrow['standardcost']); + $_SESSION['CreditItems']->GetExistingTaxes($LineNumber, $myrow['stkmoveno']); if ($myrow['controlled']==1){/* Populate the SerialItems array too*/ Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/DeliveryDetails.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -855,11 +855,11 @@ echo '<td>'.$StockItem->StockID.'</td> <td>'.$StockItem->ItemDescription.'</td> - <td class=number>'.$DisplayQuantity.'</td> + <td class="number">'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class=number>'.$DisplayPrice.'</td> - <td class=number>'.$DisplayDiscount.'</td> - <td class=number>'.$DisplayLineTotal.'</td> + <td class="number">'.$DisplayPrice.'</td> + <td class="number">'.$DisplayDiscount.'</td> + <td class="number">'.$DisplayLineTotal.'</td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -869,25 +869,30 @@ $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); echo '<tr class="EvenTableRows"> - <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class=number>'.$DisplayTotal.'</td> - </tr></table>'; + <td colspan="6" class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class="number">'.$DisplayTotal.'</td> + </tr> + </table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<br /><table><tr class="EvenTableRows"> - <td>'. _('Total Weight') .':</td> - <td class="number">'.$DisplayWeight.'</td> - <td>'. _('Total Volume') .':</td> - <td class="number">'.$DisplayVolume.'</td> - </tr></table>'; + echo '<br /> + <table> + <tr class="EvenTableRows"> + <td>'. _('Total Weight') .':</td> + <td class="number">'.$DisplayWeight.'</td> + <td>'. _('Total Volume') .':</td> + <td class="number">'.$DisplayVolume.'</td> + </tr> + </table>'; } else { /*Display the order without discount */ echo '<div class="centre"><b>' . _('Order Summary') . '</b></div> - <table cellpadding=2 colspan=7 border=1><tr> + <table class="selection"> + <tr> <th>'. _('Item Description') .'</th> <th>'. _('Quantity') .'</th> <th>'. _('Unit') .'</th> @@ -914,10 +919,10 @@ $k=1; } echo '<td>'.$StockItem->ItemDescription.'</td> - <td class=number>'. $DisplayQuantity.'</td> + <td class="number">'. $DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class=number>'. $DisplayPrice.'</td> - <td class=number>'. $DisplayLineTotal .'</font></td> + <td class="number">'. $DisplayPrice.'</td> + <td class="number">'. $DisplayLineTotal .'</font></td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -927,12 +932,14 @@ } $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - echo '<table class=selection><tr> - <td>'. _('Total Weight') .':</td> - <td>'.$DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'.$DisplayVolume .'</td> - </tr></table>'; + echo '<table class="selection"> + <tr> + <td>'. _('Total Weight') .':</td> + <td>'.$DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'.$DisplayVolume .'</td> + </tr> + </table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); @@ -945,10 +952,12 @@ } -echo '<br /><table class=selection><tr> - <td>'. _('Deliver To') .':</td> - <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> -</tr>'; +echo '<br /> + <table class="selection"> + <tr> + <td>'. _('Deliver To') .':</td> + <td><input type="text" size="42" maxlength="40" name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '" /></td> + </tr>'; echo '<tr> <td>'. _('Deliver from the warehouse at') .':</td> @@ -986,66 +995,59 @@ // The estimated Dispatch date or Delivery date for this order echo '<tr> - <td>'. _('Estimated Delivery Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> + <td>'. _('Estimated Delivery Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> </tr>'; // The date when a quote was issued to the customer echo '<tr> - <td>'. _('Quote Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '"></td> + <td>'. _('Quote Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size="15" maxlength="14" name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '" /></td> </tr>'; // The date when the customer confirmed their order echo '<tr> - <td>'. _('Confirmed Order Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '"></td> + <td>'. _('Confirmed Order Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size="15" maxlength="14" name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 1') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 2') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd2" value="' . $_SESSION['Items'.$identifier]->DelAdd2 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 3') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd3" value="' . $_SESSION['Items'.$identifier]->DelAdd3 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 4') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd4" value="' . $_SESSION['Items'.$identifier]->DelAdd4 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 5') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd5" value="' . $_SESSION['Items'.$identifier]->DelAdd5 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 6') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd6" value="' . $_SESSION['Items'.$identifier]->DelAdd6 . '" /></td> + </tr> + <tr> + <td>'. _('Contact Phone Number') .':</td> + <td><input type="text" size=25 maxlength=25 name="PhoneNo" value="' . $_SESSION['Items'.$identifier]->PhoneNo . '"></td> + </tr> + <tr> + <td>' . _('Contact Email') . ':</td><td><input type="text" size=40 maxlength=38 name="Email" value="' . $_SESSION['Items'.$identifier]->Email . '"></td> + </tr> + <tr> + <td>'. _('Customer Reference') .':</td> + <td><input type="text" size=25 maxlength=25 name="CustRef" value="' . $_SESSION['Items'.$identifier]->CustRef . '"></td> + </tr> + <tr> + <td>'. _('Comments') .':</td> + <td><textarea name="Comments" cols="31" rows="5">' . $_SESSION['Items'.$identifier]->Comments .'</textarea></td> </tr>'; -echo '<tr> - <td>'. _('Delivery Address 1') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 2') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd2" value="' . $_SESSION['Items'.$identifier]->DelAdd2 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 3') . ':</td> - <td><input type="text" size="42" maxlength="40" name="BrAdd3" value="' . $_SESSION['Items'.$identifier]->DelAdd3 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 4') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd4" value="' . $_SESSION['Items'.$identifier]->DelAdd4 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 5') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd5" value="' . $_SESSION['Items'.$identifier]->DelAdd5 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 6') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd6" value="' . $_SESSION['Items'.$identifier]->DelAdd6 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Contact Phone Number') .':</td> - <td><input type="text" size=25 maxlength=25 name="PhoneNo" value="' . $_SESSION['Items'.$identifier]->PhoneNo . '"></td> -</tr>'; - -echo '<tr><td>' . _('Contact Email') . ':</td><td><input type="text" size=40 maxlength=38 name="Email" value="' . $_SESSION['Items'.$identifier]->Email . '"></td></tr>'; - -echo '<tr><td>'. _('Customer Reference') .':</td> - <td><input type="text" size=25 maxlength=25 name="CustRef" value="' . $_SESSION['Items'.$identifier]->CustRef . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Comments') .':</td> - <td><textarea name="Comments" cols=31 rows=5>' . $_SESSION['Items'.$identifier]->Comments .'</textarea></td> -</tr>'; - /* This field will control whether or not to display the company logo and address on the packlist */ @@ -1061,7 +1063,7 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['PrintedPackingSlip']) and $_SESSION['PrintedPackingSlip']==1){ +if (isset($_SESSION['PrintedPackingSlip']) AND $_SESSION['PrintedPackingSlip']==1){ echo '<tr> <td>'. _('Reprint packing slip') .':</td> @@ -1073,19 +1075,22 @@ echo '<input type=hidden name="ReprintPackingSlip" value=0>'; } -echo '<tr><td>'. _('Charge Freight Cost inc tax') .':</td>'; -echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '"></td>'; +echo '<tr> + <td>'. _('Charge Freight Cost inc tax') .':</td> + <td><input type="text" class="number" size="10" maxlength="12" name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '" /></td>'; if ($_SESSION['DoFreightCalc']==true){ - echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '"></td></tr>'; + echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '" /></td> + </tr>'; } if ((!isset($_POST['ShipVia']) OR $_POST['ShipVia']=='') AND isset($_SESSION['Items'.$identifier]->ShipVia)){ $_POST['ShipVia'] = $_SESSION['Items'.$identifier]->ShipVia; } -echo '<tr><td>'. _('Freight/Shipper Method') .':</td> - <td><select name="ShipVia">'; +echo '<tr> + <td>'. _('Freight/Shipper Method') .':</td> + <td><select name="ShipVia">'; $ErrMsg = _('The shipper details could not be retrieved'); $DbgMsg = _('SQL used to retrieve the shipper details was') . ':'; @@ -1123,7 +1128,7 @@ echo '<br /><br /><input type=submit name="ProcessOrder" value="' . _('Place Order') . '">'; echo '<br /><br /><input type=submit name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '">'; } else { - echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; + echo '<br /><input type="submit" name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; } echo '</div></form>'; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/RecurringSalesOrders.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -128,22 +128,22 @@ while ($myrow=db_fetch_array($LineItemsResult)) { $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], - $myrow['quantity'], - $myrow['description'], - $myrow['unitprice'], - $myrow['discountpercent'], - $myrow['units'], - $myrow['volume'], - $myrow['kgs'], - $myrow['qohatloc'], - $myrow['mbflag'], - '', - 0, - $myrow['discountcategory'], - 0, /*Controlled*/ - 0, /*Serialised */ - $myrow['decimalplaces'], - $myrow['narrative']); + $myrow['quantity'], + $myrow['description'], + $myrow['unitprice'], + $myrow['discountpercent'], + $myrow['units'], + $myrow['volume'], + $myrow['kgs'], + $myrow['qohatloc'], + $myrow['mbflag'], + '', + 0, + $myrow['discountcategory'], + 0, /*Controlled*/ + 0, /*Serialised */ + $myrow['decimalplaces'], + $myrow['narrative']); /*Just populating with existing order - no DBUpdates */ } /* line items from sales order details */ Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesByTypePeriodInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,8 +5,8 @@ include('includes/session.inc'); $title = _('Sales Report'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Report') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesCategoryPeriodInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('Sales Category Report'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; Modified: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesTopItemsInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('Top Sales Inquiry'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Inquiry') . '" alt="" />' . ' ' . _('Top Sales Items Inquiry') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; @@ -214,13 +213,13 @@ echo '<table cellpadding=2 class="selection">'; echo'<tr> - <th>' . _('Rank') . '</th> - <th>' . _('Item') . '</th> - <th>' . _('Category') . '</th> - <th>' . _('Sales Value') . '</th> - <th>' . _('Refunds') . '</th> - <th>' . _('Net Sales') . '</th> - <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> + <th>' . _('Rank') . '</th> + <th>' . _('Item') . '</th> + <th>' . _('Category') . '</th> + <th>' . _('Sales Value') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> </tr>'; $CumulativeTotalSales = 0; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SelectOrderItems.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -249,7 +249,8 @@ $myrow['standardcost'], $myrow['eoq'], $myrow['nextserialno'], - $ExRate ); + $ExRate, + $identifier ); /*Just populating with existing order - no DBUpdates */ } @@ -1046,7 +1047,7 @@ //page called attempting to delete a line - GET['Delete'] = the line number to delete $QuantityAlreadyDelivered = $_SESSION['Items'.$identifier]->Some_Already_Delivered($_GET['Delete']); if($QuantityAlreadyDelivered == 0){ - $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete'], 'Yes'); /*Do update DB */ + $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete'], 'Yes', $identifier); /*Do update DB */ } else { $_SESSION['Items'.$identifier]->LineItems[$_GET['Delete']]->Quantity = $QuantityAlreadyDelivered; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/doc/Change.log 2011-12-13 08:55:38 UTC (rev 4772) @@ -2,6 +2,7 @@ 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim +13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? 10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/includes/DefineCartClass.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -67,7 +67,7 @@ $this->total=0; $this->ItemsOrdered=0; $this->LineCounter=0; - $this->DefaultSalesType=""; + $this->DefaultSalesType=''; $this->FreightCost =0; $this->FreightTaxes = array(); $this->CurrDecimalPlaces=2; //default @@ -99,7 +99,8 @@ $StandardCost=0, $EOQ=1, $NextSerialNo=0, - $ExRate=1){ + $ExRate=1, + $identifier=0){ if (isset($StockID) AND $StockID!="" AND $Qty>0 AND isset($Qty)){ @@ -157,7 +158,7 @@ itemdue, poline) VALUES(" . $this->LineCounter . ", - " . $_SESSION['ExistingOrder'] . ", + " . $_SESSION['ExistingOrder' . $identifier] . ", '" . trim(mb_strtoupper($StockID)) ."', " . $Qty . ", " . $Price . ", @@ -209,7 +210,7 @@ } } - function remove_from_cart($LineNumber, $UpdateDB='No'){ + function remove_from_cart($LineNumber, $UpdateDB='No', $identifier=0){ if (!isset($LineNumber) OR $LineNumber=='' OR $LineNumber < 0){ /* over check it */ prnMsg(_('No Line Number passed to remove_from_cart, so nothing has been removed.'), 'error'); @@ -220,12 +221,12 @@ if ($this->Some_Already_Delivered($LineNumber)==0){ /* nothing has been delivered, delete it. */ $result = DB_query("DELETE FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "' AND orderlineno='" . $LineNumber . "'", $db, _('The order line could not be deleted because') ); - prnMsg( _('Deleted Line Number'). ' ' . $LineNumber . ' ' . _('from existing Order Number').' ' . $_SESSION['ExistingOrder'], 'success'); + prnMsg( _('Deleted Line Number'). ' ' . $LineNumber . ' ' . _('from existing Order Number').' ' . $_SESSION['ExistingOrder' . $identifier], 'success'); } else { /* something has been delivered. Clear the remaining Qty and Mark Completed */ $result = DB_query("UPDATE salesorderdetails SET quantity=qtyinvoiced, Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-12-13 08:55:38 UTC (rev 4772) @@ -76,9 +76,9 @@ /*these checks above ensure that the item has a cost if the config.php variable AllowSalesOfZeroCostItems is set to false */ - if ($_SESSION['ExistingOrder']!=0){ + if ($_SESSION['ExistingOrder' . $identifier]!=0){ $UpdateDB = 'Yes'; - $result = DB_query("SELECT MAX(orderlineno) AS newlineno FROM salesorderdetails WHERE orderno='" . $_SESSION['ExistingOrder'] . "'",$db); + $result = DB_query("SELECT MAX(orderlineno) AS newlineno FROM salesorderdetails WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "'",$db); $MaxNumRow = DB_fetch_row($result); if ($MaxNumRow[0] != '' AND $MaxNumRow[0] > 0) { $NewLineNo = $MaxNumRow[0]+1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 08:55:48
|
Revision: 4772 http://web-erp.svn.sourceforge.net/web-erp/?rev=4772&view=rev Author: daintree Date: 2011-12-13 08:55:38 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Additional changes to ExistingOrder Modified Paths: -------------- trunk/CounterSales.php trunk/Credit_Invoice.php trunk/DeliveryDetails.php trunk/RecurringSalesOrders.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesTopItemsInquiry.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/CounterSales.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -63,7 +63,7 @@ set to 1. The delivery check screen is where the details of the order are either updated or inserted depending on the value of ExistingOrder */ - $_SESSION['ExistingOrder'] = 0; + $_SESSION['ExistingOrder'. $identifier] = 0; $_SESSION['Items'.$identifier] = new cart; $_SESSION['PrintedPackingSlip'] = 0; /*Of course 'cos the order ain't even started !!*/ /*Get the default customer-branch combo from the user's default location record */ Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/Credit_Invoice.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -156,8 +156,8 @@ '', '', '', - $myrow['standardcost'] - ); + $myrow['standardcost']); + $_SESSION['CreditItems']->GetExistingTaxes($LineNumber, $myrow['stkmoveno']); if ($myrow['controlled']==1){/* Populate the SerialItems array too*/ Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/DeliveryDetails.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -855,11 +855,11 @@ echo '<td>'.$StockItem->StockID.'</td> <td>'.$StockItem->ItemDescription.'</td> - <td class=number>'.$DisplayQuantity.'</td> + <td class="number">'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class=number>'.$DisplayPrice.'</td> - <td class=number>'.$DisplayDiscount.'</td> - <td class=number>'.$DisplayLineTotal.'</td> + <td class="number">'.$DisplayPrice.'</td> + <td class="number">'.$DisplayDiscount.'</td> + <td class="number">'.$DisplayLineTotal.'</td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -869,25 +869,30 @@ $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); echo '<tr class="EvenTableRows"> - <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class=number>'.$DisplayTotal.'</td> - </tr></table>'; + <td colspan="6" class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class="number">'.$DisplayTotal.'</td> + </tr> + </table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<br /><table><tr class="EvenTableRows"> - <td>'. _('Total Weight') .':</td> - <td class="number">'.$DisplayWeight.'</td> - <td>'. _('Total Volume') .':</td> - <td class="number">'.$DisplayVolume.'</td> - </tr></table>'; + echo '<br /> + <table> + <tr class="EvenTableRows"> + <td>'. _('Total Weight') .':</td> + <td class="number">'.$DisplayWeight.'</td> + <td>'. _('Total Volume') .':</td> + <td class="number">'.$DisplayVolume.'</td> + </tr> + </table>'; } else { /*Display the order without discount */ echo '<div class="centre"><b>' . _('Order Summary') . '</b></div> - <table cellpadding=2 colspan=7 border=1><tr> + <table class="selection"> + <tr> <th>'. _('Item Description') .'</th> <th>'. _('Quantity') .'</th> <th>'. _('Unit') .'</th> @@ -914,10 +919,10 @@ $k=1; } echo '<td>'.$StockItem->ItemDescription.'</td> - <td class=number>'. $DisplayQuantity.'</td> + <td class="number">'. $DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class=number>'. $DisplayPrice.'</td> - <td class=number>'. $DisplayLineTotal .'</font></td> + <td class="number">'. $DisplayPrice.'</td> + <td class="number">'. $DisplayLineTotal .'</font></td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -927,12 +932,14 @@ } $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - echo '<table class=selection><tr> - <td>'. _('Total Weight') .':</td> - <td>'.$DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'.$DisplayVolume .'</td> - </tr></table>'; + echo '<table class="selection"> + <tr> + <td>'. _('Total Weight') .':</td> + <td>'.$DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'.$DisplayVolume .'</td> + </tr> + </table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); @@ -945,10 +952,12 @@ } -echo '<br /><table class=selection><tr> - <td>'. _('Deliver To') .':</td> - <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> -</tr>'; +echo '<br /> + <table class="selection"> + <tr> + <td>'. _('Deliver To') .':</td> + <td><input type="text" size="42" maxlength="40" name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '" /></td> + </tr>'; echo '<tr> <td>'. _('Deliver from the warehouse at') .':</td> @@ -986,66 +995,59 @@ // The estimated Dispatch date or Delivery date for this order echo '<tr> - <td>'. _('Estimated Delivery Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> + <td>'. _('Estimated Delivery Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> </tr>'; // The date when a quote was issued to the customer echo '<tr> - <td>'. _('Quote Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '"></td> + <td>'. _('Quote Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size="15" maxlength="14" name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '" /></td> </tr>'; // The date when the customer confirmed their order echo '<tr> - <td>'. _('Confirmed Order Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '"></td> + <td>'. _('Confirmed Order Date') .':</td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size="15" maxlength="14" name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 1') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 2') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd2" value="' . $_SESSION['Items'.$identifier]->DelAdd2 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 3') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd3" value="' . $_SESSION['Items'.$identifier]->DelAdd3 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 4') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd4" value="' . $_SESSION['Items'.$identifier]->DelAdd4 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 5') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd5" value="' . $_SESSION['Items'.$identifier]->DelAdd5 . '" /></td> + </tr> + <tr> + <td>'. _('Delivery Address 6') . ':</td> + <td><input type="text" size="42" maxlength="40" name="BrAdd6" value="' . $_SESSION['Items'.$identifier]->DelAdd6 . '" /></td> + </tr> + <tr> + <td>'. _('Contact Phone Number') .':</td> + <td><input type="text" size=25 maxlength=25 name="PhoneNo" value="' . $_SESSION['Items'.$identifier]->PhoneNo . '"></td> + </tr> + <tr> + <td>' . _('Contact Email') . ':</td><td><input type="text" size=40 maxlength=38 name="Email" value="' . $_SESSION['Items'.$identifier]->Email . '"></td> + </tr> + <tr> + <td>'. _('Customer Reference') .':</td> + <td><input type="text" size=25 maxlength=25 name="CustRef" value="' . $_SESSION['Items'.$identifier]->CustRef . '"></td> + </tr> + <tr> + <td>'. _('Comments') .':</td> + <td><textarea name="Comments" cols="31" rows="5">' . $_SESSION['Items'.$identifier]->Comments .'</textarea></td> </tr>'; -echo '<tr> - <td>'. _('Delivery Address 1') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 2') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd2" value="' . $_SESSION['Items'.$identifier]->DelAdd2 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 3') . ':</td> - <td><input type="text" size="42" maxlength="40" name="BrAdd3" value="' . $_SESSION['Items'.$identifier]->DelAdd3 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 4') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd4" value="' . $_SESSION['Items'.$identifier]->DelAdd4 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 5') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd5" value="' . $_SESSION['Items'.$identifier]->DelAdd5 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Delivery Address 6') . ':</td> - <td><input type="text" size=42 maxlength=40 name="BrAdd6" value="' . $_SESSION['Items'.$identifier]->DelAdd6 . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Contact Phone Number') .':</td> - <td><input type="text" size=25 maxlength=25 name="PhoneNo" value="' . $_SESSION['Items'.$identifier]->PhoneNo . '"></td> -</tr>'; - -echo '<tr><td>' . _('Contact Email') . ':</td><td><input type="text" size=40 maxlength=38 name="Email" value="' . $_SESSION['Items'.$identifier]->Email . '"></td></tr>'; - -echo '<tr><td>'. _('Customer Reference') .':</td> - <td><input type="text" size=25 maxlength=25 name="CustRef" value="' . $_SESSION['Items'.$identifier]->CustRef . '"></td> -</tr>'; - -echo '<tr> - <td>'. _('Comments') .':</td> - <td><textarea name="Comments" cols=31 rows=5>' . $_SESSION['Items'.$identifier]->Comments .'</textarea></td> -</tr>'; - /* This field will control whether or not to display the company logo and address on the packlist */ @@ -1061,7 +1063,7 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['PrintedPackingSlip']) and $_SESSION['PrintedPackingSlip']==1){ +if (isset($_SESSION['PrintedPackingSlip']) AND $_SESSION['PrintedPackingSlip']==1){ echo '<tr> <td>'. _('Reprint packing slip') .':</td> @@ -1073,19 +1075,22 @@ echo '<input type=hidden name="ReprintPackingSlip" value=0>'; } -echo '<tr><td>'. _('Charge Freight Cost inc tax') .':</td>'; -echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '"></td>'; +echo '<tr> + <td>'. _('Charge Freight Cost inc tax') .':</td> + <td><input type="text" class="number" size="10" maxlength="12" name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '" /></td>'; if ($_SESSION['DoFreightCalc']==true){ - echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '"></td></tr>'; + echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '" /></td> + </tr>'; } if ((!isset($_POST['ShipVia']) OR $_POST['ShipVia']=='') AND isset($_SESSION['Items'.$identifier]->ShipVia)){ $_POST['ShipVia'] = $_SESSION['Items'.$identifier]->ShipVia; } -echo '<tr><td>'. _('Freight/Shipper Method') .':</td> - <td><select name="ShipVia">'; +echo '<tr> + <td>'. _('Freight/Shipper Method') .':</td> + <td><select name="ShipVia">'; $ErrMsg = _('The shipper details could not be retrieved'); $DbgMsg = _('SQL used to retrieve the shipper details was') . ':'; @@ -1123,7 +1128,7 @@ echo '<br /><br /><input type=submit name="ProcessOrder" value="' . _('Place Order') . '">'; echo '<br /><br /><input type=submit name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '">'; } else { - echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; + echo '<br /><input type="submit" name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; } echo '</div></form>'; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/RecurringSalesOrders.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -128,22 +128,22 @@ while ($myrow=db_fetch_array($LineItemsResult)) { $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], - $myrow['quantity'], - $myrow['description'], - $myrow['unitprice'], - $myrow['discountpercent'], - $myrow['units'], - $myrow['volume'], - $myrow['kgs'], - $myrow['qohatloc'], - $myrow['mbflag'], - '', - 0, - $myrow['discountcategory'], - 0, /*Controlled*/ - 0, /*Serialised */ - $myrow['decimalplaces'], - $myrow['narrative']); + $myrow['quantity'], + $myrow['description'], + $myrow['unitprice'], + $myrow['discountpercent'], + $myrow['units'], + $myrow['volume'], + $myrow['kgs'], + $myrow['qohatloc'], + $myrow['mbflag'], + '', + 0, + $myrow['discountcategory'], + 0, /*Controlled*/ + 0, /*Serialised */ + $myrow['decimalplaces'], + $myrow['narrative']); /*Just populating with existing order - no DBUpdates */ } /* line items from sales order details */ Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesByTypePeriodInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,8 +5,8 @@ include('includes/session.inc'); $title = _('Sales Report'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Report') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesCategoryPeriodInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('Sales Category Report'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; Modified: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SalesTopItemsInquiry.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('Top Sales Inquiry'); include('includes/header.inc'); -include('includes/DefineCartClass.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Inquiry') . '" alt="" />' . ' ' . _('Top Sales Items Inquiry') . '</p>'; echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br />'; @@ -214,13 +213,13 @@ echo '<table cellpadding=2 class="selection">'; echo'<tr> - <th>' . _('Rank') . '</th> - <th>' . _('Item') . '</th> - <th>' . _('Category') . '</th> - <th>' . _('Sales Value') . '</th> - <th>' . _('Refunds') . '</th> - <th>' . _('Net Sales') . '</th> - <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> + <th>' . _('Rank') . '</th> + <th>' . _('Item') . '</th> + <th>' . _('Category') . '</th> + <th>' . _('Sales Value') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> </tr>'; $CumulativeTotalSales = 0; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/SelectOrderItems.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -249,7 +249,8 @@ $myrow['standardcost'], $myrow['eoq'], $myrow['nextserialno'], - $ExRate ); + $ExRate, + $identifier ); /*Just populating with existing order - no DBUpdates */ } @@ -1046,7 +1047,7 @@ //page called attempting to delete a line - GET['Delete'] = the line number to delete $QuantityAlreadyDelivered = $_SESSION['Items'.$identifier]->Some_Already_Delivered($_GET['Delete']); if($QuantityAlreadyDelivered == 0){ - $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete'], 'Yes'); /*Do update DB */ + $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete'], 'Yes', $identifier); /*Do update DB */ } else { $_SESSION['Items'.$identifier]->LineItems[$_GET['Delete']]->Quantity = $QuantityAlreadyDelivered; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/doc/Change.log 2011-12-13 08:55:38 UTC (rev 4772) @@ -2,6 +2,7 @@ 13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim +13/12/11 Phil: Fixed other scripts affected and send $identifier to add_to_cart function 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? 10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/includes/DefineCartClass.php 2011-12-13 08:55:38 UTC (rev 4772) @@ -67,7 +67,7 @@ $this->total=0; $this->ItemsOrdered=0; $this->LineCounter=0; - $this->DefaultSalesType=""; + $this->DefaultSalesType=''; $this->FreightCost =0; $this->FreightTaxes = array(); $this->CurrDecimalPlaces=2; //default @@ -99,7 +99,8 @@ $StandardCost=0, $EOQ=1, $NextSerialNo=0, - $ExRate=1){ + $ExRate=1, + $identifier=0){ if (isset($StockID) AND $StockID!="" AND $Qty>0 AND isset($Qty)){ @@ -157,7 +158,7 @@ itemdue, poline) VALUES(" . $this->LineCounter . ", - " . $_SESSION['ExistingOrder'] . ", + " . $_SESSION['ExistingOrder' . $identifier] . ", '" . trim(mb_strtoupper($StockID)) ."', " . $Qty . ", " . $Price . ", @@ -209,7 +210,7 @@ } } - function remove_from_cart($LineNumber, $UpdateDB='No'){ + function remove_from_cart($LineNumber, $UpdateDB='No', $identifier=0){ if (!isset($LineNumber) OR $LineNumber=='' OR $LineNumber < 0){ /* over check it */ prnMsg(_('No Line Number passed to remove_from_cart, so nothing has been removed.'), 'error'); @@ -220,12 +221,12 @@ if ($this->Some_Already_Delivered($LineNumber)==0){ /* nothing has been delivered, delete it. */ $result = DB_query("DELETE FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "' AND orderlineno='" . $LineNumber . "'", $db, _('The order line could not be deleted because') ); - prnMsg( _('Deleted Line Number'). ' ' . $LineNumber . ' ' . _('from existing Order Number').' ' . $_SESSION['ExistingOrder'], 'success'); + prnMsg( _('Deleted Line Number'). ' ' . $LineNumber . ' ' . _('from existing Order Number').' ' . $_SESSION['ExistingOrder' . $identifier], 'success'); } else { /* something has been delivered. Clear the remaining Qty and Mark Completed */ $result = DB_query("UPDATE salesorderdetails SET quantity=qtyinvoiced, Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-12-13 07:50:19 UTC (rev 4771) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-12-13 08:55:38 UTC (rev 4772) @@ -76,9 +76,9 @@ /*these checks above ensure that the item has a cost if the config.php variable AllowSalesOfZeroCostItems is set to false */ - if ($_SESSION['ExistingOrder']!=0){ + if ($_SESSION['ExistingOrder' . $identifier]!=0){ $UpdateDB = 'Yes'; - $result = DB_query("SELECT MAX(orderlineno) AS newlineno FROM salesorderdetails WHERE orderno='" . $_SESSION['ExistingOrder'] . "'",$db); + $result = DB_query("SELECT MAX(orderlineno) AS newlineno FROM salesorderdetails WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "'",$db); $MaxNumRow = DB_fetch_row($result); if ($MaxNumRow[0] != '' AND $MaxNumRow[0] > 0) { $NewLineNo = $MaxNumRow[0]+1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:50:26
|
Revision: 4771 http://web-erp.svn.sourceforge.net/web-erp/?rev=4771&view=rev Author: daintree Date: 2011-12-13 07:50:19 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Vitaly fix to Z_ChangeStockCode.php Modified Paths: -------------- trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-12-13 07:31:31 UTC (rev 4770) +++ trunk/Z_ChangeStockCode.php 2011-12-13 07:50:19 UTC (rev 4771) @@ -134,7 +134,7 @@ //check if MRP tables exist before assuming $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db,'','',false,false); - if ($DB_error_no==0) { + if ($DB_error_no($db)==0) { echo '<br />' . _('Changing MRP planned orders information'); $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); @@ -238,8 +238,9 @@ $ErrMsg = _('The SQL to update the BOM records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + + DB_IgnoreForeignKeys($db); - echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; $ErrMsg = _('The SQL to update the BOM parent records failed'); @@ -264,8 +265,6 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo '<br />' . _('Changing work order requirements information'); @@ -297,10 +296,9 @@ $ErrMsg = _('The SQL to update the stockserialitem records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - + + DB_ReinstateForeignKeys($db); + $result = DB_Txn_Commit($db); echo '<br />' . _('Deleting the old stock master record'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:31:31 UTC (rev 4770) +++ trunk/doc/Change.log 2011-12-13 07:50:19 UTC (rev 4771) @@ -1,5 +1,6 @@ webERP Change Log +13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:50:25
|
Revision: 4771 http://web-erp.svn.sourceforge.net/web-erp/?rev=4771&view=rev Author: daintree Date: 2011-12-13 07:50:19 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Vitaly fix to Z_ChangeStockCode.php Modified Paths: -------------- trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-12-13 07:31:31 UTC (rev 4770) +++ trunk/Z_ChangeStockCode.php 2011-12-13 07:50:19 UTC (rev 4771) @@ -134,7 +134,7 @@ //check if MRP tables exist before assuming $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db,'','',false,false); - if ($DB_error_no==0) { + if ($DB_error_no($db)==0) { echo '<br />' . _('Changing MRP planned orders information'); $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); @@ -238,8 +238,9 @@ $ErrMsg = _('The SQL to update the BOM records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + + DB_IgnoreForeignKeys($db); - echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; $ErrMsg = _('The SQL to update the BOM parent records failed'); @@ -264,8 +265,6 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo '<br />' . _('Changing work order requirements information'); @@ -297,10 +296,9 @@ $ErrMsg = _('The SQL to update the stockserialitem records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - + + DB_ReinstateForeignKeys($db); + $result = DB_Txn_Commit($db); echo '<br />' . _('Deleting the old stock master record'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:31:31 UTC (rev 4770) +++ trunk/doc/Change.log 2011-12-13 07:50:19 UTC (rev 4771) @@ -1,5 +1,6 @@ webERP Change Log +13/12/11 Vitaly Shevkunov: Z_ChangeStockCode.php fixed call to DB_error_no had missing ($db) - also turned off FOREIGN KEY CHECKS before updating the BOM. 13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:31:37
|
Revision: 4770 http://web-erp.svn.sourceforge.net/web-erp/?rev=4770&view=rev Author: daintree Date: 2011-12-13 07:31:31 +0000 (Tue, 13 Dec 2011) Log Message: ----------- fix Exsons commit that was working on an older version of SelectOrderItems.php Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:28:55 UTC (rev 4769) +++ trunk/doc/Change.log 2011-12-13 07:31:31 UTC (rev 4770) @@ -1,5 +1,6 @@ webERP Change Log +13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? 10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:31:37
|
Revision: 4770 http://web-erp.svn.sourceforge.net/web-erp/?rev=4770&view=rev Author: daintree Date: 2011-12-13 07:31:31 +0000 (Tue, 13 Dec 2011) Log Message: ----------- fix Exsons commit that was working on an older version of SelectOrderItems.php Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-13 07:28:55 UTC (rev 4769) +++ trunk/doc/Change.log 2011-12-13 07:31:31 UTC (rev 4770) @@ -1,5 +1,6 @@ webERP Change Log +13/12/11 Exson: Fix SelectOrderItems.php and DeliveryDetails.php for where an order is modified while another order is being created in a different tab of the browser - $_SESSION['ExistingOrder'] now modified to $_SESSION['ExistingOrder' .$identifier] as suggested by Tim 11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? 10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:29:02
|
Revision: 4769 http://web-erp.svn.sourceforge.net/web-erp/?rev=4769&view=rev Author: daintree Date: 2011-12-13 07:28:55 +0000 (Tue, 13 Dec 2011) Log Message: ----------- fix Exsons commit that was working on an older version of SelectOrderItems.php Modified Paths: -------------- trunk/DeliveryDetails.php trunk/SelectOrderItems.php trunk/StockLocTransfer.php Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 + /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/DeliveryDetails.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -311,7 +311,7 @@ } #end if else freight charge not altered } #end if process order -if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ +if (isset($OK_to_PROCESS) AND $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ /* finally write the order header to the database and then the order line details */ Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/SelectOrderItems.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -50,7 +50,7 @@ unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder'.$identifier]=0; + $_SESSION['ExistingOrder' .$identifier]=0; $_SESSION['Items'.$identifier] = new cart; if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon @@ -651,11 +651,11 @@ if (isset($_POST['CancelOrder'])) { $OK_to_delete=1; //assume this in the first instance - if($_SESSION['ExistingOrder'.$identifier]!=0) { //need to check that not already dispatched + if($_SESSION['ExistingOrder' . $identifier]!=0) { //need to check that not already dispatched $sql = "SELECT qtyinvoiced FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' + WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "' AND qtyinvoiced>0"; $InvQties = DB_query($sql,$db); @@ -669,17 +669,17 @@ } if ($OK_to_delete==1){ - if($_SESSION['ExistingOrder'.$identifier]!=0){ + if($_SESSION['ExistingOrder' . $identifier]!=0){ - $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'.$identifier] . "'"; + $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder' . $identifier] . "'"; $ErrMsg =_('The order detail lines could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "'"; + $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder' . $identifier] . "'"; $ErrMsg = _('The order header could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $_SESSION['ExistingOrder'.$identifier]=0; + $_SESSION['ExistingOrder' . $identifier]=0; } unset($_SESSION['Items'.$identifier]->LineItems); Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/StockLocTransfer.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -88,7 +88,18 @@ } //end if there is a CSV file to import else { // process the manually input lines $ErrorMessage=''; + if (isset($_POST['ClearAll'])){ + unset($_POST['EnterMoreItems']); + for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + unset($_POST['StockID' . $i]); + unset($_POST['StockQTY' . $i]); + } + } for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + if (isset($_POST['Delete' . $i])){ + unset($_POST['StockID' . $i]); + unset($_POST['StockQTY' . $i]); + } if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); @@ -257,25 +268,36 @@ echo '<table class="selection">'; - $tableheader = '<tr><th>'. _('Item Code'). '</th> - <th>'. _('Quantity'). '</th></tr>'; - echo $tableheader; + $TableHeader = '<tr> + <th>'. _('Item Code'). '</th> + <th>'. _('Quantity'). '</th> + <th>' . _('Clear All') . ':<input type="checkbox" name="ClearAll" /></th> + </tr>'; + echo $TableHeader; - $k=0; /* row counter */ + $k=0; /* page heading row counter */ + $j=0; /* row counter for reindexing */ if(isset($_POST['LinesCounter'])){ - for ($i=0;$i < $_POST['LinesCounter'] AND $_POST['StockID' . $i] !='';$i++){ - + for ($i=0;$i < $_POST['LinesCounter'];$i++){ + if (!isset($_POST['StockID'. $i])){ + continue; + } + if ($_POST['StockID' . $i] ==''){ + break; + } if ($k==18){ - echo $tableheader; + echo $TableHeader; $k=0; } $k++; echo '<tr> - <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> - <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> + <td><input type="text" name="StockID' . $j .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $j .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> + <td>' . _('Delete') . '<input type="checkbox" name="Delete' . $j .'" /></td> </tr>'; + $j++; } }else { $i = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-13 07:29:02
|
Revision: 4769 http://web-erp.svn.sourceforge.net/web-erp/?rev=4769&view=rev Author: daintree Date: 2011-12-13 07:28:55 +0000 (Tue, 13 Dec 2011) Log Message: ----------- fix Exsons commit that was working on an older version of SelectOrderItems.php Modified Paths: -------------- trunk/DeliveryDetails.php trunk/SelectOrderItems.php trunk/StockLocTransfer.php Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 + /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/DeliveryDetails.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -311,7 +311,7 @@ } #end if else freight charge not altered } #end if process order -if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ +if (isset($OK_to_PROCESS) AND $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ /* finally write the order header to the database and then the order line details */ Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/SelectOrderItems.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -50,7 +50,7 @@ unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder'.$identifier]=0; + $_SESSION['ExistingOrder' .$identifier]=0; $_SESSION['Items'.$identifier] = new cart; if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon @@ -651,11 +651,11 @@ if (isset($_POST['CancelOrder'])) { $OK_to_delete=1; //assume this in the first instance - if($_SESSION['ExistingOrder'.$identifier]!=0) { //need to check that not already dispatched + if($_SESSION['ExistingOrder' . $identifier]!=0) { //need to check that not already dispatched $sql = "SELECT qtyinvoiced FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' + WHERE orderno='" . $_SESSION['ExistingOrder' . $identifier] . "' AND qtyinvoiced>0"; $InvQties = DB_query($sql,$db); @@ -669,17 +669,17 @@ } if ($OK_to_delete==1){ - if($_SESSION['ExistingOrder'.$identifier]!=0){ + if($_SESSION['ExistingOrder' . $identifier]!=0){ - $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'.$identifier] . "'"; + $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder' . $identifier] . "'"; $ErrMsg =_('The order detail lines could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "'"; + $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder' . $identifier] . "'"; $ErrMsg = _('The order header could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $_SESSION['ExistingOrder'.$identifier]=0; + $_SESSION['ExistingOrder' . $identifier]=0; } unset($_SESSION['Items'.$identifier]->LineItems); Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-12-13 01:34:17 UTC (rev 4768) +++ trunk/StockLocTransfer.php 2011-12-13 07:28:55 UTC (rev 4769) @@ -88,7 +88,18 @@ } //end if there is a CSV file to import else { // process the manually input lines $ErrorMessage=''; + if (isset($_POST['ClearAll'])){ + unset($_POST['EnterMoreItems']); + for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + unset($_POST['StockID' . $i]); + unset($_POST['StockQTY' . $i]); + } + } for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + if (isset($_POST['Delete' . $i])){ + unset($_POST['StockID' . $i]); + unset($_POST['StockQTY' . $i]); + } if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); @@ -257,25 +268,36 @@ echo '<table class="selection">'; - $tableheader = '<tr><th>'. _('Item Code'). '</th> - <th>'. _('Quantity'). '</th></tr>'; - echo $tableheader; + $TableHeader = '<tr> + <th>'. _('Item Code'). '</th> + <th>'. _('Quantity'). '</th> + <th>' . _('Clear All') . ':<input type="checkbox" name="ClearAll" /></th> + </tr>'; + echo $TableHeader; - $k=0; /* row counter */ + $k=0; /* page heading row counter */ + $j=0; /* row counter for reindexing */ if(isset($_POST['LinesCounter'])){ - for ($i=0;$i < $_POST['LinesCounter'] AND $_POST['StockID' . $i] !='';$i++){ - + for ($i=0;$i < $_POST['LinesCounter'];$i++){ + if (!isset($_POST['StockID'. $i])){ + continue; + } + if ($_POST['StockID' . $i] ==''){ + break; + } if ($k==18){ - echo $tableheader; + echo $TableHeader; $k=0; } $k++; echo '<tr> - <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> - <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> + <td><input type="text" name="StockID' . $j .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $j .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> + <td>' . _('Delete') . '<input type="checkbox" name="Delete' . $j .'" /></td> </tr>'; + $j++; } }else { $i = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ex...@us...> - 2011-12-13 01:34:23
|
Revision: 4768 http://web-erp.svn.sourceforge.net/web-erp/?rev=4768&view=rev Author: exsonqu Date: 2011-12-13 01:34:17 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Bug fix for $_SESSION['ExistingOrder'] to $_SESSION['ExistingOrder'.$identifier] Solution from Tim Modified Paths: -------------- trunk/SelectOrderItems.php Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 01:32:32 UTC (rev 4767) +++ trunk/SelectOrderItems.php 2011-12-13 01:34:17 UTC (rev 4768) @@ -50,7 +50,7 @@ unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; $_SESSION['Items'.$identifier] = new cart; if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon @@ -72,7 +72,7 @@ unset ($_SESSION['Items'.$identifier]->LineItems); unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder']=$_GET['ModifyOrderNumber']; + $_SESSION['ExistingOrder'.$identifier]=$_GET['ModifyOrderNumber']; $_SESSION['RequireCustomerSelection'] = 0; $_SESSION['Items'.$identifier] = new cart; @@ -267,7 +267,7 @@ set to 1. The delivery check screen is where the details of the order are either updated or inserted depending on the value of ExistingOrder */ - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; $_SESSION['Items'.$identifier] = new cart; $_SESSION['PrintedPackingSlip'] =0; /*Of course cos the order aint even started !!*/ @@ -651,11 +651,11 @@ if (isset($_POST['CancelOrder'])) { $OK_to_delete=1; //assume this in the first instance - if($_SESSION['ExistingOrder']!=0) { //need to check that not already dispatched + if($_SESSION['ExistingOrder'.$identifier]!=0) { //need to check that not already dispatched $sql = "SELECT qtyinvoiced FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' AND qtyinvoiced>0"; $InvQties = DB_query($sql,$db); @@ -669,17 +669,17 @@ } if ($OK_to_delete==1){ - if($_SESSION['ExistingOrder']!=0){ + if($_SESSION['ExistingOrder'.$identifier]!=0){ - $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'] . "'"; + $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'.$identifier] . "'"; $ErrMsg =_('The order detail lines could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] . "'"; + $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "'"; $ErrMsg = _('The order header could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; } unset($_SESSION['Items'.$identifier]->LineItems); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ex...@us...> - 2011-12-13 01:34:23
|
Revision: 4768 http://web-erp.svn.sourceforge.net/web-erp/?rev=4768&view=rev Author: exsonqu Date: 2011-12-13 01:34:17 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Bug fix for $_SESSION['ExistingOrder'] to $_SESSION['ExistingOrder'.$identifier] Solution from Tim Modified Paths: -------------- trunk/SelectOrderItems.php Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-12-13 01:32:32 UTC (rev 4767) +++ trunk/SelectOrderItems.php 2011-12-13 01:34:17 UTC (rev 4768) @@ -50,7 +50,7 @@ unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; $_SESSION['Items'.$identifier] = new cart; if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon @@ -72,7 +72,7 @@ unset ($_SESSION['Items'.$identifier]->LineItems); unset ($_SESSION['Items'.$identifier]); } - $_SESSION['ExistingOrder']=$_GET['ModifyOrderNumber']; + $_SESSION['ExistingOrder'.$identifier]=$_GET['ModifyOrderNumber']; $_SESSION['RequireCustomerSelection'] = 0; $_SESSION['Items'.$identifier] = new cart; @@ -267,7 +267,7 @@ set to 1. The delivery check screen is where the details of the order are either updated or inserted depending on the value of ExistingOrder */ - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; $_SESSION['Items'.$identifier] = new cart; $_SESSION['PrintedPackingSlip'] =0; /*Of course cos the order aint even started !!*/ @@ -651,11 +651,11 @@ if (isset($_POST['CancelOrder'])) { $OK_to_delete=1; //assume this in the first instance - if($_SESSION['ExistingOrder']!=0) { //need to check that not already dispatched + if($_SESSION['ExistingOrder'.$identifier]!=0) { //need to check that not already dispatched $sql = "SELECT qtyinvoiced FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' AND qtyinvoiced>0"; $InvQties = DB_query($sql,$db); @@ -669,17 +669,17 @@ } if ($OK_to_delete==1){ - if($_SESSION['ExistingOrder']!=0){ + if($_SESSION['ExistingOrder'.$identifier]!=0){ - $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'] . "'"; + $SQL = "DELETE FROM salesorderdetails WHERE salesorderdetails.orderno ='" . $_SESSION['ExistingOrder'.$identifier] . "'"; $ErrMsg =_('The order detail lines could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] . "'"; + $SQL = "DELETE FROM salesorders WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "'"; $ErrMsg = _('The order header could not be deleted because'); $DelResult=DB_query($SQL,$db,$ErrMsg); - $_SESSION['ExistingOrder']=0; + $_SESSION['ExistingOrder'.$identifier]=0; } unset($_SESSION['Items'.$identifier]->LineItems); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ex...@us...> - 2011-12-13 01:32:39
|
Revision: 4767 http://web-erp.svn.sourceforge.net/web-erp/?rev=4767&view=rev Author: exsonqu Date: 2011-12-13 01:32:32 +0000 (Tue, 13 Dec 2011) Log Message: ----------- bug fix for $_SESSION['ExistingOrder'] to $_SESSION['ExistingOrder'.$identifier] by Tim Modified Paths: -------------- trunk/DeliveryDetails.php Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-11 09:52:20 UTC (rev 4766) +++ trunk/DeliveryDetails.php 2011-12-13 01:32:32 UTC (rev 4767) @@ -44,13 +44,13 @@ /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ - $OldFreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $OldFreightCost = round($_POST['FreightCost'],2); } if (isset($_POST['Update']) - OR isset($_POST['BackToLineDetails']) - OR isset($_POST['MakeRecurringOrder'])) { + or isset($_POST['BackToLineDetails']) + or isset($_POST['MakeRecurringOrder'])) { $InputErrors =0; if (mb_strlen($_POST['DeliverTo'])<=1){ @@ -64,7 +64,7 @@ // if (mb_strpos($_POST['BrAdd1'],_('Box'))>0){ // prnMsg(_('You have entered the word') . ' "' . _('Box') . '" ' . _('in the street address') . '. ' . _('Items cannot be delivered to') . ' ' ._('box') . ' ' . _('addresses'),'warn'); // } - if (!is_numeric(filter_number_format($_POST['FreightCost']))){ + if (!is_numeric($_POST['FreightCost'])){ $InputErrors =1; prnMsg( _('The freight cost entered is expected to be numeric'),'error'); } @@ -119,7 +119,7 @@ if ($_SESSION['DoFreightCalc']==True){ list ($_POST['FreightCost'], $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_POST['BrAdd2'], $_POST['BrAdd3'], $_SESSION['Items'.$identifier]->totalVolume, $_SESSION['Items'.$identifier]->totalWeight, $_SESSION['Items'.$identifier]->Location, $db); if ( !empty($BestShipper) ){ - $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_POST['FreightCost'] = round($_POST['FreightCost'],2); $_POST['ShipVia'] = $BestShipper; } else { prnMsg(_($_POST['FreightCost']),'warn'); @@ -148,7 +148,7 @@ $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)==0){ - prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); + prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_POST['Select'] . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); if ($debug==1){ echo '<br />' . _('The SQL that failed to get the branch details was') . ':<br />' . $sql; @@ -183,11 +183,10 @@ $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_SESSION['Items'.$identifier]->FreightCost = round($_POST['FreightCost'],2); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } else { $_SESSION['Items'.$identifier]->DeliverTo = $_POST['DeliverTo']; - $_SESSION['Items'.$identifier]->BuyerName = $_POST['BuyerName']; $_SESSION['Items'.$identifier]->DelAdd1 = $_POST['BrAdd1']; $_SESSION['Items'.$identifier]->DelAdd2 = $_POST['BrAdd2']; $_SESSION['Items'.$identifier]->DelAdd3 = $_POST['BrAdd3']; @@ -200,13 +199,13 @@ $_SESSION['Items'.$identifier]->ShipVia = $_POST['ShipVia']; $_SESSION['Items'.$identifier]->DeliverBlind = $_POST['DeliverBlind']; $_SESSION['Items'.$identifier]->SpecialInstructions = $_POST['SpecialInstructions']; - $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format($_POST['DeliveryDays']); + $_SESSION['Items'.$identifier]->DeliveryDays = $_POST['DeliveryDays']; $_SESSION['Items'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['Items'.$identifier]->QuoteDate = $_POST['QuoteDate']; $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_SESSION['Items'.$identifier]->FreightCost = round($_POST['FreightCost'],2); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } /*$_SESSION['DoFreightCalc'] is a setting in the config.php file that the user can set to false to turn off freight calculations if necessary */ @@ -219,7 +218,7 @@ and show a link to set them up - if shippers defined but the default shipper is bogus then use the first shipper defined */ - if ((isset($BestShipper) and $BestShipper=='') AND ($_POST['ShipVia']=='' OR !isset($_POST['ShipVia']))){ + if ((isset($BestShipper) and $BestShipper=='') AND ($_POST['ShipVia']=='' || !isset($_POST['ShipVia']))){ $sql = "SELECT shipper_id FROM shippers WHERE shipper_id='" . $_SESSION['Default_Shipper']."'"; @@ -277,9 +276,9 @@ if ($InputErrors ==0) { $OK_to_PROCESS = 1; } - If (filter_number_format($_POST['FreightCost']) != $OldFreightCost AND $_SESSION['DoFreightCalc']==true){ + If ($_POST['FreightCost'] != $OldFreightCost && $_SESSION['DoFreightCalc']==True){ $OK_to_PROCESS = 0; - prnMsg(_('The freight charge has been updated') . '. ' . _('Please reconfirm that the order and the freight charges are acceptable and then confirm the order again if OK') .' <br /> '. _('The new freight cost is') .' ' .filter_number_format($_POST['FreightCost']) . ' ' . _('and the previously calculated freight cost was') .' '. $OldFreightCost,'warn'); + prnMsg(_('The freight charge has been updated') . '. ' . _('Please reconfirm that the order and the freight charges are acceptable and then confirm the order again if OK') .' <br /> '. _('The new freight cost is') .' ' . $_POST['FreightCost'] . ' ' . _('and the previously calculated freight cost was') .' '. $OldFreightCost,'warn'); } else { /*check the customer's payment terms */ @@ -312,7 +311,7 @@ } #end if else freight charge not altered } #end if process order -if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder']==0){ +if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ /* finally write the order header to the database and then the order line details */ @@ -334,7 +333,6 @@ ordertype, shipvia, deliverto, - buyername, deladd1, deladd2, deladd3, @@ -354,19 +352,18 @@ '". $OrderNo . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', - '". $_SESSION['Items'.$identifier]->CustRef ."', - '". $_SESSION['Items'.$identifier]->Comments ."', - '" . Date('Y-m-d H:i') . "', + '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', + '" . Date("Y-m-d H:i") . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_POST['ShipVia'] ."', - '". $_SESSION['Items'.$identifier]->DeliverTo . "', - '" . $_SESSION['Items'.$identifier]->BuyerName . "', - '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd2 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd3 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd4 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd5 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd6 . "', + '". DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', '" . $_SESSION['Items'.$identifier]->PhoneNo . "', '" . $_SESSION['Items'.$identifier]->Email . "', '" . $_SESSION['Items'.$identifier]->FreightCost ."', @@ -403,7 +400,7 @@ '" . $StockItem->Price . "', '" . $StockItem->Quantity . "', '" . floatval($StockItem->DiscountPercent) . "', - '" . $StockItem->Narrative . "', + '" . DB_escape_string($StockItem->Narrative) . "', '" . $StockItem->POLine . "', '" . FormatDateForSQL($StockItem->ItemDue) . "' )"; @@ -591,20 +588,20 @@ } else { /*link to print the quotation */ - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Landscape)') .'</a></td> </tr> </table>'; - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Portrait)') .'</a></td> </tr> </table>'; } - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="'. $rootpath .'/SelectOrderItems.php?identifier='.$identifier . '&NewOrder=Yes">'. _('Add Another Sales Order') .'</a></td> @@ -620,7 +617,7 @@ include('includes/footer.inc'); exit; -} elseif (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder']!=0){ +} elseif (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]!=0){ /* update the order header then update the old order line details and insert the new lines */ @@ -634,7 +631,7 @@ if ($_SESSION['Items'.$identifier]->Quotation==0) { //now its being changed? to an order $ContractResult = DB_query("SELECT contractref, requireddate - FROM contracts WHERE orderno='" . $_SESSION['ExistingOrder'] ."' + FROM contracts WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] ."' AND status=1",$db); if (DB_num_rows($ContractResult)==1){ //then it is a contract quotation being changed to an order $ContractRow = DB_fetch_array($ContractResult); @@ -643,20 +640,26 @@ $DbgMsg = _('The SQL that failed to update the contract status was'); $UpdContractResult=DB_query("UPDATE contracts SET status=2, wo='" . $WONo . "' - WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); + WHERE orderno='" .$_SESSION['ExistingOrder'.$identifier] . "'", $db,$ErrMsg,$DbgMsg,true); $ErrMsg = _('Could not insert the contract bill of materials'); $InsContractBOM = DB_query("INSERT INTO bom (parent, component, workcentreadded, loccode, effectiveafter, - effectiveto) + effectiveto, + quantity) SELECT contractref, stockid, workcentreadded, '" . $_SESSION['Items'.$identifier]->Location ."', '" . Date('Y-m-d') . "', +<<<<<<< .mine + '2037-12-31', + quantity +======= '2099-12-31' +>>>>>>> .r4665 FROM contractbom WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); @@ -712,21 +715,20 @@ $HeaderSQL = "UPDATE salesorders SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', - customerref = '". $_SESSION['Items'.$identifier]->CustRef ."', - comments = '". $_SESSION['Items'.$identifier]->Comments ."', + customerref = '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + comments = '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', ordertype = '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', shipvia = '" . $_POST['ShipVia'] . "', - deliverydate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->DeliveryDate) . "', - quotedate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->QuoteDate) . "', - confirmeddate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->ConfirmedDate) . "', - deliverto = '" . $_SESSION['Items'.$identifier]->DeliverTo . "', - buyername = '" . $_SESSION['Items'.$identifier]->BuyerName . "', - deladd1 = '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', - deladd2 = '" . $_SESSION['Items'.$identifier]->DelAdd2 . "', - deladd3 = '" . $_SESSION['Items'.$identifier]->DelAdd3 . "', - deladd4 = '" . $_SESSION['Items'.$identifier]->DelAdd4 . "', - deladd5 = '" . $_SESSION['Items'.$identifier]->DelAdd5 . "', - deladd6 = '" . $_SESSION['Items'.$identifier]->DelAdd6 . "', + deliverydate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "', + quotedate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "', + confirmeddate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "', + deliverto = '" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + deladd1 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + deladd2 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + deladd3 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + deladd4 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + deladd5 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + deladd6 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', contactphone = '" . $_SESSION['Items'.$identifier]->PhoneNo . "', contactemail = '" . $_SESSION['Items'.$identifier]->Email . "', freightcost = '" . $_SESSION['Items'.$identifier]->FreightCost ."', @@ -734,7 +736,7 @@ printedpackingslip = '" . $_POST['ReprintPackingSlip'] . "', quotation = '" . $_SESSION['Items'.$identifier]->Quotation . "', deliverblind = '" . $_SESSION['Items'.$identifier]->DeliverBlind . "' - WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] ."'"; + WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] ."'"; $DbgMsg = _('The SQL that was used to update the order and failed was'); $ErrMsg = _('The order cannot be updated because'); @@ -757,7 +759,7 @@ completed='" . $Completed . "', poline='" . $StockItem->POLine . "', itemdue='" . FormatDateForSQL($StockItem->ItemDue) . "' - WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' AND salesorderdetails.orderlineno='" . $StockItem->LineNumber . "'"; $DbgMsg = _('The SQL that was used to modify the order line and failed was'); @@ -771,20 +773,20 @@ unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); - prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'] . ' ' . _('has been updated'),'success'); + prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'.$identifier] . ' ' . _('has been updated'),'success'); echo '<br /> <table class="selection"> <tr> - <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td> - <td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td> + <td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Invoice') . '" alt=""></td> - <td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td> + <td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td> @@ -805,7 +807,7 @@ echo '</b> ' . _('Customer Name') . ' :<b> ' . $_SESSION['Items'.$identifier]->CustomerName . '</b></p>'; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -837,10 +839,10 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayPrice = locale_number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); - $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); + $DisplayDiscount = number_format(($StockItem->DiscountPercent * 100),2); if ($k==1){ @@ -853,11 +855,11 @@ echo '<td>'.$StockItem->StockID.'</td> <td>'.$StockItem->ItemDescription.'</td> - <td class="number">'.$DisplayQuantity.'</td> + <td class=number>'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class="number">'.$DisplayPrice.'</td> - <td class="number">'.$DisplayDiscount.'</td> - <td class="number">'.$DisplayLineTotal.'</td> + <td class=number>'.$DisplayPrice.'</td> + <td class=number>'.$DisplayDiscount.'</td> + <td class=number>'.$DisplayLineTotal.'</td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -865,14 +867,14 @@ $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + ($StockItem->Quantity * $StockItem->Weight); } - $DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); echo '<tr class="EvenTableRows"> - <td colspan=6 class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class="number">'.$DisplayTotal.'</td> + <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class=number>'.$DisplayTotal.'</td> </tr></table>'; - $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); - $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); + $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); + $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); echo '<br /><table><tr class="EvenTableRows"> <td>'. _('Total Weight') .':</td> <td class="number">'.$DisplayWeight.'</td> @@ -885,14 +887,13 @@ /*Display the order without discount */ echo '<div class="centre"><b>' . _('Order Summary') . '</b></div> - <table cellpadding="2" colspan="7" border="1"> - <tr> - <th>'. _('Item Description') .'</th> - <th>'. _('Quantity') .'</th> - <th>'. _('Unit') .'</th> - <th>'. _('Price') .'</th> - <th>'. _('Total') .'</th> - </tr>'; + <table cellpadding=2 colspan=7 border=1><tr> + <th>'. _('Item Description') .'</th> + <th>'. _('Quantity') .'</th> + <th>'. _('Unit') .'</th> + <th>'. _('Price') .'</th> + <th>'. _('Total') .'</th> + </tr>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -901,9 +902,9 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayPrice = locale_number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); if ($k==1){ echo '<tr class="OddTableRows">'; @@ -913,10 +914,10 @@ $k=1; } echo '<td>'.$StockItem->ItemDescription.'</td> - <td class="number">'. $DisplayQuantity.'</td> + <td class=number>'. $DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class="number">'. $DisplayPrice.'</td> - <td class="number">'. $DisplayLineTotal .'</font></td> + <td class=number>'. $DisplayPrice.'</td> + <td class=number>'. $DisplayLineTotal .'</font></td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -925,41 +926,35 @@ } - $DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - echo '<table class="selection"> - <tr> - <td>'. _('Total Weight') .':</td> - <td>'.$DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'.$DisplayVolume .'</td> - </tr> - </table>'; + $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + echo '<table class=selection><tr> + <td>'. _('Total Weight') .':</td> + <td>'.$DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'.$DisplayVolume .'</td> + </tr></table>'; - $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); - $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<table class="selection"> - <tr> - <td>'. _('Total Weight') .':</td> - <td>'. $DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'. $DisplayVolume .'</td> - </tr> - </table>'; + $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); + $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); + echo '<table class=selection><tr> + <td>'. _('Total Weight') .':</td> + <td>'. $DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'. $DisplayVolume .'</td> + </tr></table>'; } -echo '<br /><table class="selection"> - <tr> - <td>'. _('Deliver To') .':</td> - <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> - </tr>'; +echo '<br /><table class=selection><tr> + <td>'. _('Deliver To') .':</td> + <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> +</tr>'; echo '<tr> <td>'. _('Deliver from the warehouse at') .':</td> <td><select name="Location">'; -if ($_SESSION['Items'.$identifier]->Location=='' - OR !isset($_SESSION['Items'.$identifier]->Location)) { +if ($_SESSION['Items'.$identifier]->Location=='' OR !isset($_SESSION['Items'.$identifier]->Location)) { $_SESSION['Items'.$identifier]->Location = $DefaultStockLocation; } @@ -1006,11 +1001,6 @@ </tr>'; echo '<tr> - <td>'. _('Buyer Name') . ':</td> - <td><input type="text" size=30 maxlength=30 name="BuyerName" value="' . $_SESSION['Items'.$identifier]->BuyerName . '"></td> -</tr>'; - -echo '<tr> <td>'. _('Delivery Address 1') . ':</td> <td><input type="text" size=42 maxlength=40 name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '"></td> </tr>'; @@ -1084,7 +1074,7 @@ } echo '<tr><td>'. _('Charge Freight Cost inc tax') .':</td>'; -echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '"></td>'; +echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '"></td>'; if ($_SESSION['DoFreightCalc']==true){ echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '"></td></tr>'; @@ -1112,6 +1102,7 @@ echo '</select></td></tr>'; + echo '<tr><td>'. _('Quotation Only') .':</td> <td><select name="Quotation">'; if ($_SESSION['Items'.$identifier]->Quotation==1){ @@ -1126,15 +1117,15 @@ echo '</table>'; -echo '<br /><div class="centre"><input type=submit name="BackToLineDetails" value="' . _('Modify Order Lines') . '" /><br />'; +echo '<br /><div class="centre"><input type=submit name="BackToLineDetails" value="' . _('Modify Order Lines') . '"><br />'; -if ($_SESSION['ExistingOrder']==0){ - echo '<br /><br /><input type="submit" name="ProcessOrder" value="' . _('Place Order') . '" />'; - echo '<br /><br /><input type="submit" name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '"/>'; +if ($_SESSION['ExistingOrder'.$identifier]==0){ + echo '<br /><br /><input type=submit name="ProcessOrder" value="' . _('Place Order') . '">'; + echo '<br /><br /><input type=submit name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '">'; } else { - echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '" />'; + echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; } echo '</div></form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ex...@us...> - 2011-12-13 01:32:39
|
Revision: 4767 http://web-erp.svn.sourceforge.net/web-erp/?rev=4767&view=rev Author: exsonqu Date: 2011-12-13 01:32:32 +0000 (Tue, 13 Dec 2011) Log Message: ----------- bug fix for $_SESSION['ExistingOrder'] to $_SESSION['ExistingOrder'.$identifier] by Tim Modified Paths: -------------- trunk/DeliveryDetails.php Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-12-11 09:52:20 UTC (rev 4766) +++ trunk/DeliveryDetails.php 2011-12-13 01:32:32 UTC (rev 4767) @@ -44,13 +44,13 @@ /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ - $OldFreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $OldFreightCost = round($_POST['FreightCost'],2); } if (isset($_POST['Update']) - OR isset($_POST['BackToLineDetails']) - OR isset($_POST['MakeRecurringOrder'])) { + or isset($_POST['BackToLineDetails']) + or isset($_POST['MakeRecurringOrder'])) { $InputErrors =0; if (mb_strlen($_POST['DeliverTo'])<=1){ @@ -64,7 +64,7 @@ // if (mb_strpos($_POST['BrAdd1'],_('Box'))>0){ // prnMsg(_('You have entered the word') . ' "' . _('Box') . '" ' . _('in the street address') . '. ' . _('Items cannot be delivered to') . ' ' ._('box') . ' ' . _('addresses'),'warn'); // } - if (!is_numeric(filter_number_format($_POST['FreightCost']))){ + if (!is_numeric($_POST['FreightCost'])){ $InputErrors =1; prnMsg( _('The freight cost entered is expected to be numeric'),'error'); } @@ -119,7 +119,7 @@ if ($_SESSION['DoFreightCalc']==True){ list ($_POST['FreightCost'], $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_POST['BrAdd2'], $_POST['BrAdd3'], $_SESSION['Items'.$identifier]->totalVolume, $_SESSION['Items'.$identifier]->totalWeight, $_SESSION['Items'.$identifier]->Location, $db); if ( !empty($BestShipper) ){ - $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_POST['FreightCost'] = round($_POST['FreightCost'],2); $_POST['ShipVia'] = $BestShipper; } else { prnMsg(_($_POST['FreightCost']),'warn'); @@ -148,7 +148,7 @@ $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)==0){ - prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); + prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_POST['Select'] . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); if ($debug==1){ echo '<br />' . _('The SQL that failed to get the branch details was') . ':<br />' . $sql; @@ -183,11 +183,10 @@ $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_SESSION['Items'.$identifier]->FreightCost = round($_POST['FreightCost'],2); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } else { $_SESSION['Items'.$identifier]->DeliverTo = $_POST['DeliverTo']; - $_SESSION['Items'.$identifier]->BuyerName = $_POST['BuyerName']; $_SESSION['Items'.$identifier]->DelAdd1 = $_POST['BrAdd1']; $_SESSION['Items'.$identifier]->DelAdd2 = $_POST['BrAdd2']; $_SESSION['Items'.$identifier]->DelAdd3 = $_POST['BrAdd3']; @@ -200,13 +199,13 @@ $_SESSION['Items'.$identifier]->ShipVia = $_POST['ShipVia']; $_SESSION['Items'.$identifier]->DeliverBlind = $_POST['DeliverBlind']; $_SESSION['Items'.$identifier]->SpecialInstructions = $_POST['SpecialInstructions']; - $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format($_POST['DeliveryDays']); + $_SESSION['Items'.$identifier]->DeliveryDays = $_POST['DeliveryDays']; $_SESSION['Items'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['Items'.$identifier]->QuoteDate = $_POST['QuoteDate']; $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $_SESSION['Items'.$identifier]->FreightCost = round($_POST['FreightCost'],2); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } /*$_SESSION['DoFreightCalc'] is a setting in the config.php file that the user can set to false to turn off freight calculations if necessary */ @@ -219,7 +218,7 @@ and show a link to set them up - if shippers defined but the default shipper is bogus then use the first shipper defined */ - if ((isset($BestShipper) and $BestShipper=='') AND ($_POST['ShipVia']=='' OR !isset($_POST['ShipVia']))){ + if ((isset($BestShipper) and $BestShipper=='') AND ($_POST['ShipVia']=='' || !isset($_POST['ShipVia']))){ $sql = "SELECT shipper_id FROM shippers WHERE shipper_id='" . $_SESSION['Default_Shipper']."'"; @@ -277,9 +276,9 @@ if ($InputErrors ==0) { $OK_to_PROCESS = 1; } - If (filter_number_format($_POST['FreightCost']) != $OldFreightCost AND $_SESSION['DoFreightCalc']==true){ + If ($_POST['FreightCost'] != $OldFreightCost && $_SESSION['DoFreightCalc']==True){ $OK_to_PROCESS = 0; - prnMsg(_('The freight charge has been updated') . '. ' . _('Please reconfirm that the order and the freight charges are acceptable and then confirm the order again if OK') .' <br /> '. _('The new freight cost is') .' ' .filter_number_format($_POST['FreightCost']) . ' ' . _('and the previously calculated freight cost was') .' '. $OldFreightCost,'warn'); + prnMsg(_('The freight charge has been updated') . '. ' . _('Please reconfirm that the order and the freight charges are acceptable and then confirm the order again if OK') .' <br /> '. _('The new freight cost is') .' ' . $_POST['FreightCost'] . ' ' . _('and the previously calculated freight cost was') .' '. $OldFreightCost,'warn'); } else { /*check the customer's payment terms */ @@ -312,7 +311,7 @@ } #end if else freight charge not altered } #end if process order -if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder']==0){ +if (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]==0){ /* finally write the order header to the database and then the order line details */ @@ -334,7 +333,6 @@ ordertype, shipvia, deliverto, - buyername, deladd1, deladd2, deladd3, @@ -354,19 +352,18 @@ '". $OrderNo . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', - '". $_SESSION['Items'.$identifier]->CustRef ."', - '". $_SESSION['Items'.$identifier]->Comments ."', - '" . Date('Y-m-d H:i') . "', + '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', + '" . Date("Y-m-d H:i") . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_POST['ShipVia'] ."', - '". $_SESSION['Items'.$identifier]->DeliverTo . "', - '" . $_SESSION['Items'.$identifier]->BuyerName . "', - '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd2 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd3 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd4 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd5 . "', - '" . $_SESSION['Items'.$identifier]->DelAdd6 . "', + '". DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', '" . $_SESSION['Items'.$identifier]->PhoneNo . "', '" . $_SESSION['Items'.$identifier]->Email . "', '" . $_SESSION['Items'.$identifier]->FreightCost ."', @@ -403,7 +400,7 @@ '" . $StockItem->Price . "', '" . $StockItem->Quantity . "', '" . floatval($StockItem->DiscountPercent) . "', - '" . $StockItem->Narrative . "', + '" . DB_escape_string($StockItem->Narrative) . "', '" . $StockItem->POLine . "', '" . FormatDateForSQL($StockItem->ItemDue) . "' )"; @@ -591,20 +588,20 @@ } else { /*link to print the quotation */ - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Landscape)') .'</a></td> </tr> </table>'; - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Portrait)') .'</a></td> </tr> </table>'; } - echo '<br /><table class="selection"> + echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td> <td>' . ' ' . '<a href="'. $rootpath .'/SelectOrderItems.php?identifier='.$identifier . '&NewOrder=Yes">'. _('Add Another Sales Order') .'</a></td> @@ -620,7 +617,7 @@ include('includes/footer.inc'); exit; -} elseif (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder']!=0){ +} elseif (isset($OK_to_PROCESS) and $OK_to_PROCESS == 1 && $_SESSION['ExistingOrder'.$identifier]!=0){ /* update the order header then update the old order line details and insert the new lines */ @@ -634,7 +631,7 @@ if ($_SESSION['Items'.$identifier]->Quotation==0) { //now its being changed? to an order $ContractResult = DB_query("SELECT contractref, requireddate - FROM contracts WHERE orderno='" . $_SESSION['ExistingOrder'] ."' + FROM contracts WHERE orderno='" . $_SESSION['ExistingOrder'.$identifier] ."' AND status=1",$db); if (DB_num_rows($ContractResult)==1){ //then it is a contract quotation being changed to an order $ContractRow = DB_fetch_array($ContractResult); @@ -643,20 +640,26 @@ $DbgMsg = _('The SQL that failed to update the contract status was'); $UpdContractResult=DB_query("UPDATE contracts SET status=2, wo='" . $WONo . "' - WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); + WHERE orderno='" .$_SESSION['ExistingOrder'.$identifier] . "'", $db,$ErrMsg,$DbgMsg,true); $ErrMsg = _('Could not insert the contract bill of materials'); $InsContractBOM = DB_query("INSERT INTO bom (parent, component, workcentreadded, loccode, effectiveafter, - effectiveto) + effectiveto, + quantity) SELECT contractref, stockid, workcentreadded, '" . $_SESSION['Items'.$identifier]->Location ."', '" . Date('Y-m-d') . "', +<<<<<<< .mine + '2037-12-31', + quantity +======= '2099-12-31' +>>>>>>> .r4665 FROM contractbom WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); @@ -712,21 +715,20 @@ $HeaderSQL = "UPDATE salesorders SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', - customerref = '". $_SESSION['Items'.$identifier]->CustRef ."', - comments = '". $_SESSION['Items'.$identifier]->Comments ."', + customerref = '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + comments = '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', ordertype = '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', shipvia = '" . $_POST['ShipVia'] . "', - deliverydate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->DeliveryDate) . "', - quotedate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->QuoteDate) . "', - confirmeddate = '" . FormatDateForSQL($_SESSION['Items'.$identifier]->ConfirmedDate) . "', - deliverto = '" . $_SESSION['Items'.$identifier]->DeliverTo . "', - buyername = '" . $_SESSION['Items'.$identifier]->BuyerName . "', - deladd1 = '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', - deladd2 = '" . $_SESSION['Items'.$identifier]->DelAdd2 . "', - deladd3 = '" . $_SESSION['Items'.$identifier]->DelAdd3 . "', - deladd4 = '" . $_SESSION['Items'.$identifier]->DelAdd4 . "', - deladd5 = '" . $_SESSION['Items'.$identifier]->DelAdd5 . "', - deladd6 = '" . $_SESSION['Items'.$identifier]->DelAdd6 . "', + deliverydate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "', + quotedate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "', + confirmeddate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "', + deliverto = '" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + deladd1 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + deladd2 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + deladd3 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + deladd4 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + deladd5 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + deladd6 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', contactphone = '" . $_SESSION['Items'.$identifier]->PhoneNo . "', contactemail = '" . $_SESSION['Items'.$identifier]->Email . "', freightcost = '" . $_SESSION['Items'.$identifier]->FreightCost ."', @@ -734,7 +736,7 @@ printedpackingslip = '" . $_POST['ReprintPackingSlip'] . "', quotation = '" . $_SESSION['Items'.$identifier]->Quotation . "', deliverblind = '" . $_SESSION['Items'.$identifier]->DeliverBlind . "' - WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] ."'"; + WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'.$identifier] ."'"; $DbgMsg = _('The SQL that was used to update the order and failed was'); $ErrMsg = _('The order cannot be updated because'); @@ -757,7 +759,7 @@ completed='" . $Completed . "', poline='" . $StockItem->POLine . "', itemdue='" . FormatDateForSQL($StockItem->ItemDue) . "' - WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'] . "' + WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'.$identifier] . "' AND salesorderdetails.orderlineno='" . $StockItem->LineNumber . "'"; $DbgMsg = _('The SQL that was used to modify the order line and failed was'); @@ -771,20 +773,20 @@ unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); - prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'] . ' ' . _('has been updated'),'success'); + prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'.$identifier] . ' ' . _('has been updated'),'success'); echo '<br /> <table class="selection"> <tr> - <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td> - <td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td> + <td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Invoice') . '" alt=""></td> - <td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td> + <td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td> </tr>'; echo '<tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td> @@ -805,7 +807,7 @@ echo '</b> ' . _('Customer Name') . ' :<b> ' . $_SESSION['Items'.$identifier]->CustomerName . '</b></p>'; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?identifier='.$identifier . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -837,10 +839,10 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayPrice = locale_number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); - $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); + $DisplayDiscount = number_format(($StockItem->DiscountPercent * 100),2); if ($k==1){ @@ -853,11 +855,11 @@ echo '<td>'.$StockItem->StockID.'</td> <td>'.$StockItem->ItemDescription.'</td> - <td class="number">'.$DisplayQuantity.'</td> + <td class=number>'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class="number">'.$DisplayPrice.'</td> - <td class="number">'.$DisplayDiscount.'</td> - <td class="number">'.$DisplayLineTotal.'</td> + <td class=number>'.$DisplayPrice.'</td> + <td class=number>'.$DisplayDiscount.'</td> + <td class=number>'.$DisplayLineTotal.'</td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -865,14 +867,14 @@ $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + ($StockItem->Quantity * $StockItem->Weight); } - $DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); echo '<tr class="EvenTableRows"> - <td colspan=6 class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class="number">'.$DisplayTotal.'</td> + <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class=number>'.$DisplayTotal.'</td> </tr></table>'; - $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); - $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); + $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); + $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); echo '<br /><table><tr class="EvenTableRows"> <td>'. _('Total Weight') .':</td> <td class="number">'.$DisplayWeight.'</td> @@ -885,14 +887,13 @@ /*Display the order without discount */ echo '<div class="centre"><b>' . _('Order Summary') . '</b></div> - <table cellpadding="2" colspan="7" border="1"> - <tr> - <th>'. _('Item Description') .'</th> - <th>'. _('Quantity') .'</th> - <th>'. _('Unit') .'</th> - <th>'. _('Price') .'</th> - <th>'. _('Total') .'</th> - </tr>'; + <table cellpadding=2 colspan=7 border=1><tr> + <th>'. _('Item Description') .'</th> + <th>'. _('Quantity') .'</th> + <th>'. _('Unit') .'</th> + <th>'. _('Price') .'</th> + <th>'. _('Total') .'</th> + </tr>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -901,9 +902,9 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayPrice = locale_number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); if ($k==1){ echo '<tr class="OddTableRows">'; @@ -913,10 +914,10 @@ $k=1; } echo '<td>'.$StockItem->ItemDescription.'</td> - <td class="number">'. $DisplayQuantity.'</td> + <td class=number>'. $DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> - <td class="number">'. $DisplayPrice.'</td> - <td class="number">'. $DisplayLineTotal .'</font></td> + <td class=number>'. $DisplayPrice.'</td> + <td class=number>'. $DisplayLineTotal .'</font></td> </tr>'; $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; @@ -925,41 +926,35 @@ } - $DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); - echo '<table class="selection"> - <tr> - <td>'. _('Total Weight') .':</td> - <td>'.$DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'.$DisplayVolume .'</td> - </tr> - </table>'; + $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + echo '<table class=selection><tr> + <td>'. _('Total Weight') .':</td> + <td>'.$DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'.$DisplayVolume .'</td> + </tr></table>'; - $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); - $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<table class="selection"> - <tr> - <td>'. _('Total Weight') .':</td> - <td>'. $DisplayWeight .'</td> - <td>'. _('Total Volume') .':</td> - <td>'. $DisplayVolume .'</td> - </tr> - </table>'; + $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); + $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); + echo '<table class=selection><tr> + <td>'. _('Total Weight') .':</td> + <td>'. $DisplayWeight .'</td> + <td>'. _('Total Volume') .':</td> + <td>'. $DisplayVolume .'</td> + </tr></table>'; } -echo '<br /><table class="selection"> - <tr> - <td>'. _('Deliver To') .':</td> - <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> - </tr>'; +echo '<br /><table class=selection><tr> + <td>'. _('Deliver To') .':</td> + <td><input type="text" size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> +</tr>'; echo '<tr> <td>'. _('Deliver from the warehouse at') .':</td> <td><select name="Location">'; -if ($_SESSION['Items'.$identifier]->Location=='' - OR !isset($_SESSION['Items'.$identifier]->Location)) { +if ($_SESSION['Items'.$identifier]->Location=='' OR !isset($_SESSION['Items'.$identifier]->Location)) { $_SESSION['Items'.$identifier]->Location = $DefaultStockLocation; } @@ -1006,11 +1001,6 @@ </tr>'; echo '<tr> - <td>'. _('Buyer Name') . ':</td> - <td><input type="text" size=30 maxlength=30 name="BuyerName" value="' . $_SESSION['Items'.$identifier]->BuyerName . '"></td> -</tr>'; - -echo '<tr> <td>'. _('Delivery Address 1') . ':</td> <td><input type="text" size=42 maxlength=40 name="BrAdd1" value="' . $_SESSION['Items'.$identifier]->DelAdd1 . '"></td> </tr>'; @@ -1084,7 +1074,7 @@ } echo '<tr><td>'. _('Charge Freight Cost inc tax') .':</td>'; -echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '"></td>'; +echo '<td><input type="text" class="number" size=10 maxlength=12 name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '"></td>'; if ($_SESSION['DoFreightCalc']==true){ echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '"></td></tr>'; @@ -1112,6 +1102,7 @@ echo '</select></td></tr>'; + echo '<tr><td>'. _('Quotation Only') .':</td> <td><select name="Quotation">'; if ($_SESSION['Items'.$identifier]->Quotation==1){ @@ -1126,15 +1117,15 @@ echo '</table>'; -echo '<br /><div class="centre"><input type=submit name="BackToLineDetails" value="' . _('Modify Order Lines') . '" /><br />'; +echo '<br /><div class="centre"><input type=submit name="BackToLineDetails" value="' . _('Modify Order Lines') . '"><br />'; -if ($_SESSION['ExistingOrder']==0){ - echo '<br /><br /><input type="submit" name="ProcessOrder" value="' . _('Place Order') . '" />'; - echo '<br /><br /><input type="submit" name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '"/>'; +if ($_SESSION['ExistingOrder'.$identifier]==0){ + echo '<br /><br /><input type=submit name="ProcessOrder" value="' . _('Place Order') . '">'; + echo '<br /><br /><input type=submit name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '">'; } else { - echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '" />'; + echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; } echo '</div></form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-11 09:52:27
|
Revision: 4766 http://web-erp.svn.sourceforge.net/web-erp/?rev=4766&view=rev Author: daintree Date: 2011-12-11 09:52:20 +0000 (Sun, 11 Dec 2011) Log Message: ----------- 1/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? Modified Paths: -------------- trunk/DailySalesInquiry.php trunk/SupplierInvoice.php trunk/doc/Change.log trunk/includes/DateFunctions.inc Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/DailySalesInquiry.php 2011-12-11 09:52:20 UTC (rev 4766) @@ -15,26 +15,27 @@ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection"> - <tr> - <td>' . _('Month to Show') . ':</td> - <td><select tabindex="1" name="MonthToShow">'; - if (!isset($_POST['MonthToShow'])){ $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); - $Result = DB_query("SELECT lastdate_in_period FROM periods WHERE period='" . $_POST['MonthToShow'] . "'",$db); + echo 'Got Month to show of: ' .$_POST['MonthToShow']; + $Result = DB_query("SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['MonthToShow'] . "'",$db); $myrow = DB_fetch_array($Result); $EndDateSQL = $myrow['lastdate_in_period']; } +echo '<table class="selection"> + <tr> + <td>' . _('Month to Show') . ':</td> + <td><select tabindex="1" name="MonthToShow">'; + $PeriodsResult = DB_query("SELECT periodno, lastdate_in_period FROM periods",$db); while ($PeriodRow = DB_fetch_array($PeriodsResult)){ if ($_POST['MonthToShow']==$PeriodRow['periodno']) { - echo '<option selected value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; - $EndDateSQL = $PeriodRow['lastdate_in_period']; + echo '<option selected value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + $EndDateSQL = $PeriodRow['lastdate_in_period']; } else { - echo '<option value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; } } echo '</select></td> @@ -51,9 +52,9 @@ while ($SalespersonRow = DB_fetch_array($SalespeopleResult)){ if ($_POST['Salesperson']==$SalespersonRow['salesmancode']) { - echo '<option selected value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + echo '<option selected value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; } else { - echo '<option Value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + echo '<option Value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; } } echo '</select></td>'; @@ -116,7 +117,7 @@ $BilledDays = 0; $DaySalesArray = array(); while ($DaySalesRow=DB_fetch_array($SalesResult)) { - $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])] = new Cart; + if ($DaySalesRow['salesvalue'] > 0) { $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->Sales = $DaySalesRow['salesvalue']; } else { Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/SupplierInvoice.php 2011-12-11 09:52:20 UTC (rev 4766) @@ -228,17 +228,20 @@ /* everything below here only do if a Supplier is selected fisrt add a header to show who we are making an invoice for */ - echo '<br /><table class=selection colspan=4> - <tr><th>' . _('Supplier') . '</th> + echo '<br /><table class="selection" colspan="4"> + <tr> + <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Terms') . '</th> - <th>' . _('Tax Authority') . '</th></tr>'; + <th>' . _('Tax Authority') . '</th> + </tr>'; - echo '<tr><td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . + echo '<tr> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></font></td> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> </tr> </table>'; @@ -247,7 +250,8 @@ echo '<br /><table class="selection">'; - echo '<tr><td>' . _('Supplier Invoice Reference') . ':</td> + echo '<tr> + <td>' . _('Supplier Invoice Reference') . ':</td> <td><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '"></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ @@ -467,9 +471,11 @@ } - echo '<tr><td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> - <td class=number><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> - </tr></table>'; + echo '<tr> + <td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> + <td class="number"><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + </tr> + </table>'; } $_SESSION['SuppTrans']->OvAmount = ($TotalGRNValue + $TotalGLValue + $TotalAssetValue + $TotalShiptValue + $TotalContractsValue); @@ -788,9 +794,9 @@ foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ - /*contract postings need to get the WIP from the contract items stock category record - * debit postings to this WIP account - * the WIP account is tidied up when the contract is closed*/ + /*contract postings need to get the WIP from the contract items stock category record + * debit postings to this WIP account + * the WIP account is tidied up when the contract is closed*/ $result = DB_query("SELECT wipact FROM stockcategory INNER JOIN stockmaster ON stockcategory.categoryid=stockmaster.categoryid @@ -860,7 +866,7 @@ /*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */ $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db); - + /*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */ if ($_SESSION['WeightedAverageCosting']==1){ /*Weighted Average costing */ @@ -915,61 +921,6 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - - /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. - - The assumption here is that the goods have been sold prior to the purchase invocie being entered so it is necessary to back track on the sales analysis cost. - * - Note that this will mean that posting to GL COGS will not agree to the cost of sales from the sales analysis*/ - - $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; - $CostVarPerUnit = (($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) - $EnteredGRN->StdCostUnit); - $PeriodAllocated = $PeriodNo; - - while ($QuantityVarianceAllocated >0) { - $SalesAnalResult=DB_query("SELECT cust, - custbranch, - typeabbrev, - periodno, - stkcategory, - area, - salesperson, - cost, - qty - FROM salesanalysis - WHERE salesanalysis.stockid = '" . $EnteredGRN->ItemCode . "' - AND salesanalysis.budgetoractual=1 - AND periodno='" . $PeriodAllocated . "'", - $db); - if (DB_num_rows($SalesAnalResult)>0){ - while ($SalesAnalRow = DB_fetch_array($SalesAnalResult) AND $QuantityVarianceAllocated >0){ - if ($SalesAnalRow['qty']<=$QuantityVarianceAllocated){ - $QuantityVarianceAllocated -= $SalesAnalRow['qty']; - $QuantityAllocated = $SalesAnalRow['qty']; - } else { - $QuantityAllocated = $QuantityVarianceAllocated; - $QuantityVarianceAllocated=0; - } - $UpdSalAnalResult = DB_query("UPDATE salesanalysis - SET cost = cost + " . ($CostVarPerUnit * $QuantityAllocated) . " - WHERE cust ='" . $SalesAnalRow['cust'] . "' - AND stockid='" . $EnteredGRN->ItemCode . "' - AND custbranch='" . $SalesAnalRow['custbranch'] . "' - AND typeabbrev='" . $SalesAnalRow['typeabbrev'] . "' - AND periodno='" . $PeriodAllocated . "' - AND area='" . $SalesAnalRow['area'] . "' - AND salesperson='" . $SalesAnalRow['salesperson'] . "' - AND stkcategory='" . $SalesAnalRow['stkcategory'] . "' - AND budgetoractual=1", - $db); - } - } //end if there were sales in that period - $PeriodAllocated--; //decrement the period - if ($PeriodNo - $PeriodAllocated >6) { - /*if more than 6 months ago when sales were made then forget it */ - break; - } - } //end loop around different periods to see which sales analysis records to update } // end if the quantity being invoiced here is greater than the current stock on hand /*Now post any remaining price variance to stock rather than price variances */ @@ -996,33 +947,6 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - /*Now to update the stock cost with the new weighted average */ - - /*Need to consider what to do if the cost has been changed manually between receiving the stock and entering the invoice - this code assumes there has been no cost updates made manually and all the price variance is posted to stock. - - A nicety or important?? */ - - - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost could not be updated because'); - $DbgMsg = _('The following SQL to update the cost was used'); - - if ($TotalQuantityOnHand>0) { - - $CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand; - - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost=materialcost+" . $CostIncrement . " - WHERE stockid='" . $EnteredGRN->ItemCode . "'"; - $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); - } else { - /* if stock is negative then update the cost to this cost */ - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost='" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . "' - WHERE stockid='" . $EnteredGRN->ItemCode . "'"; - $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); - } - /* End of Weighted Average Costing Code */ - } else { //It must be Standard Costing $SQL = "INSERT INTO gltrans (type, @@ -1219,11 +1143,15 @@ /* Now update the GRN and PurchOrderDetails records for amounts invoiced - can't use the other loop through the GRNs as this was only where the GL link to credtors is active */ foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ - - $SQL = "UPDATE purchorderdetails SET qtyinvoiced = qtyinvoiced + " . $EnteredGRN->This_QuantityInv .", - actprice = '" . $EnteredGRN->ChgPrice . "' - WHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'"; + //in local currency + $ActualCost = $EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate; + $PurchPriceVar = $EnteredGRN->This_QuantityInv * ($ActualCost - $EnteredGRN->StdCostUnit); + + $SQL = "UPDATE purchorderdetails + SET qtyinvoiced = qtyinvoiced + " . $EnteredGRN->This_QuantityInv .", + actprice = '" . $EnteredGRN->ChgPrice . "' + WHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity invoiced of the purchase order line could not be updated because'); @@ -1231,8 +1159,9 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - $SQL = "UPDATE grns SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . - " WHERE grnno = '" . $EnteredGRN->GRNNo . "'"; + $SQL = "UPDATE grns + SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . " + WHERE grnno = '" . $EnteredGRN->GRNNo . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity invoiced off the goods received record could not be updated because'); $DbgMsg = _('The following SQL to update the GRN quantity invoiced was used'); @@ -1258,10 +1187,180 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); } //end of adding GRN shipment charges + else { + /*so its not a GRN shipment item its a plain old stock item */ + + if ($PurchPriceVar !=0){ /* don't bother with any of this lot if there is no difference ! */ + + if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */ + /*We need to: + * + * a) update the stockmove for the delivery to reflect the actual cost of the delivery + * + * b) If a WeightedAverageCosting system and the stock quantity on hand now is negative then the cost that has gone to sales analysis and the cost of sales stock movement records will have been incorrect ... attempt to fix it retrospectively + */ + /*Get the location that the stock was booked into */ + $result = DB_query("SELECT intostocklocation + FROM purchorders + WHERE orderno='" . $EnteredGRN->PONo . "'", + $db); + $LocRow = DB_fetch_array($result); + $LocCode = $LocRow['intostocklocation']; + + /* First update the stockmoves delivery cost */ + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the delivery could not have the cost updated to the actual cost'); + $result = DB_query("UPDATE stockmoves SET price = '" . $ActualCost . "' + WHERE stockid='" .$EnteredGRN->ItemCode . "' + AND type=25 + AND loccode='" . $LocCode . "' + AND transno='" . $EnteredGRN->GRNNo . "'", + $db,$ErrMsg,$DbgMsg,True); + + if ($_SESSION['WeightedAverageCosting']==1){ + /* + * How many in stock now? + * The quantity being invoiced here - $EnteredGRN->This_QuantityInv + * If the quantity in stock now is less than the quantity being invoiced + * here then some items sold will not have had this cost factored in + * The cost of these items = $ActualCost + */ + + $sql ="SELECT quantity + FROM locstock + WHERE loccode='" . $LocCode . "' + AND stockid='" . $EnteredGRN->ItemCode . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity on hand could not be retrieved from the database'); + $DbgMsg = _('The following SQL to retrieve the total stock quantity was used'); + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + $QtyRow = DB_fetch_row($Result); + $TotalQuantityOnHand = $QtyRow[0]; + + /* If the quantity on hand is less the quantity charged on this invoice then some must have been sold and the price variance should be reflected in the cost of sales*/ + + if ($EnteredGRN->This_QuantityInv > $TotalQuantityOnHand){ + + /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. + + The assumption here is that the goods have been sold prior to the purchase invoice being entered so it is necessary to back track on the sales analysis cost. + * Note that this will mean that posting to GL COGS will not agree to the cost of sales from the sales analysis + * Of course the price variances will need to be included in COGS as well + * */ + + $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; + $CostVarPerUnit = $ActualCost - $EnteredGRN->StdCostUnit; + $PeriodAllocated = $PeriodNo; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales analysis records could not be updated for the cost variances on this purchase invoice'); + + while ($QuantityVarianceAllocated >0) { + $SalesAnalResult=DB_query("SELECT cust, + custbranch, + typeabbrev, + periodno, + stkcategory, + area, + salesperson, + cost, + qty + FROM salesanalysis + WHERE salesanalysis.stockid = '" . $EnteredGRN->ItemCode . "' + AND salesanalysis.budgetoractual=1 + AND periodno='" . $PeriodAllocated . "'", + $db); + if (DB_num_rows($SalesAnalResult)>0){ + while ($SalesAnalRow = DB_fetch_array($SalesAnalResult) AND $QuantityVarianceAllocated >0){ + if ($SalesAnalRow['qty']<=$QuantityVarianceAllocated){ + $QuantityVarianceAllocated -= $SalesAnalRow['qty']; + $QuantityAllocated = $SalesAnalRow['qty']; + } else { + $QuantityAllocated = $QuantityVarianceAllocated; + $QuantityVarianceAllocated=0; + } + $UpdSalAnalResult = DB_query("UPDATE salesanalysis + SET cost = cost + " . ($CostVarPerUnit * $QuantityAllocated) . " + WHERE cust ='" . $SalesAnalRow['cust'] . "' + AND stockid='" . $EnteredGRN->ItemCode . "' + AND custbranch='" . $SalesAnalRow['custbranch'] . "' + AND typeabbrev='" . $SalesAnalRow['typeabbrev'] . "' + AND periodno='" . $PeriodAllocated . "' + AND area='" . $SalesAnalRow['area'] . "' + AND salesperson='" . $SalesAnalRow['salesperson'] . "' + AND stkcategory='" . $SalesAnalRow['stkcategory'] . "' + AND budgetoractual=1", + $db,$ErrMsg,$DbgMsg,True); + } + } //end if there were sales in that period + $PeriodAllocated--; //decrement the period + if ($PeriodNo - $PeriodAllocated >6) { + /*if more than 6 months ago when sales were made then forget it */ + break; + } + } /*end loop around different periods to see which sales analysis records to update */ + + /*now we need to work back through the sales stockmoves up to the quantity on this purchase invoice to update costs + * Only go back up to 6 months looking for stockmoves and + * Only in the stock location where the purchase order was received + * into - if the stock was transferred to another location then + * we cannot adjust for this */ + $result = DB_query("SELECT stkmoveno, + type, + qty, + standardcost + FROM stockmoves + WHERE loccode='" . $LocCode . "' + AND qty < 0 + AND stockid='" . $EnteredGRN->ItemCode . "' + AND trandate>='" . FormatDateForSQL(DateAdd($_SESSION['SuppTrans']->TranDate,'m',-6)) . "' + ORDER BY stkmoveno DESC", + $db); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movements for invoices cannot be updated for the cost variances on this purchase invoice'); + $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; + while ($StkMoveRow = DB_fetch_array($result) AND $QuantityVarianceAllocated >0){ + if ($StkMoveRow['qty']+$QuantityVarianceAllocated>0){ + if ($StkMoveRow['type']==10) { //its a sales invoice + $result = DB_query("UPDATE stockmoves + SET standardcost = '" . $ActualCost . "' + WHERE stkmoveno = '" . $StkMoveRow['stkmoveno'] . "'", + $db,$ErrMsg,$DbgMsg,True); + } + } //end if the invoice qty is more than is left to allocate + $QuantityVarianceAllocated+=$StkMoveRow['qty']; + } + } // end if the quantity being invoiced here is greater than the current stock on hand + + /*Now to update the stock cost with the new weighted average */ + + /*Need to consider what to do if the cost has been changed manually between receiving the stock and entering the invoice - this code assumes there has been no cost updates made manually and all the price variance is posted to stock. + + A nicety or important?? */ + + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost could not be updated because'); + $DbgMsg = _('The following SQL to update the cost was used'); + + if ($TotalQuantityOnHand>0) { + + $CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand; + + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost=materialcost+" . $CostIncrement . " + WHERE stockid='" . $EnteredGRN->ItemCode . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); + } else { + /* if stock is negative then update the cost to this cost */ + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost='" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . "' + WHERE stockid='" . $EnteredGRN->ItemCode . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); + } + } /* End if it is weighted average costing we are working with */ + } /*Its a stock item */ + } /* There was a price variance */ + } if ($EnteredGRN->AssetID!=0) { //then it is an asset - $PurchPriceVar = $EnteredGRN->This_QuantityInv * (($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) - $EnteredGRN->StdCostUnit); if ($PurchPriceVar !=0) { /*Add the fixed asset trans for the difference in the cost */ $SQL = "INSERT INTO fixedassettrans (assetid, Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/doc/Change.log 2011-12-11 09:52:20 UTC (rev 4766) @@ -1,5 +1,9 @@ webERP Change Log +11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables +11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? +10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. + 3/12/11 Release 4.06.2 2/12/11 Phil: Added indian_number_format for specific unusal number formatting 00,00,000.00 for India and apparently South Asian countries. Kicks in for en_IN.utf8 and hi_IN.utf8 Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/includes/DateFunctions.inc 2011-12-11 09:52:20 UTC (rev 4766) @@ -646,7 +646,14 @@ } function DateAdd ($DateToAddTo,$PeriodString,$NumberPeriods){ - + /*Takes + * DateToAddTo in $_SESSION['DefaultDateFormat'] format + * $PeriodString is one of: + * d - days + * w - weeks + * m - months + * y - years + * $NumberPeriods is an integer positve or negative */ $DateToAddTo = trim($DateToAddTo); if (mb_strpos($DateToAddTo,'/')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-11 09:52:27
|
Revision: 4766 http://web-erp.svn.sourceforge.net/web-erp/?rev=4766&view=rev Author: daintree Date: 2011-12-11 09:52:20 +0000 (Sun, 11 Dec 2011) Log Message: ----------- 1/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables 11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? Modified Paths: -------------- trunk/DailySalesInquiry.php trunk/SupplierInvoice.php trunk/doc/Change.log trunk/includes/DateFunctions.inc Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/DailySalesInquiry.php 2011-12-11 09:52:20 UTC (rev 4766) @@ -15,26 +15,27 @@ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection"> - <tr> - <td>' . _('Month to Show') . ':</td> - <td><select tabindex="1" name="MonthToShow">'; - if (!isset($_POST['MonthToShow'])){ $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); - $Result = DB_query("SELECT lastdate_in_period FROM periods WHERE period='" . $_POST['MonthToShow'] . "'",$db); + echo 'Got Month to show of: ' .$_POST['MonthToShow']; + $Result = DB_query("SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['MonthToShow'] . "'",$db); $myrow = DB_fetch_array($Result); $EndDateSQL = $myrow['lastdate_in_period']; } +echo '<table class="selection"> + <tr> + <td>' . _('Month to Show') . ':</td> + <td><select tabindex="1" name="MonthToShow">'; + $PeriodsResult = DB_query("SELECT periodno, lastdate_in_period FROM periods",$db); while ($PeriodRow = DB_fetch_array($PeriodsResult)){ if ($_POST['MonthToShow']==$PeriodRow['periodno']) { - echo '<option selected value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; - $EndDateSQL = $PeriodRow['lastdate_in_period']; + echo '<option selected value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + $EndDateSQL = $PeriodRow['lastdate_in_period']; } else { - echo '<option value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; } } echo '</select></td> @@ -51,9 +52,9 @@ while ($SalespersonRow = DB_fetch_array($SalespeopleResult)){ if ($_POST['Salesperson']==$SalespersonRow['salesmancode']) { - echo '<option selected value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + echo '<option selected value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; } else { - echo '<option Value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + echo '<option Value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; } } echo '</select></td>'; @@ -116,7 +117,7 @@ $BilledDays = 0; $DaySalesArray = array(); while ($DaySalesRow=DB_fetch_array($SalesResult)) { - $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])] = new Cart; + if ($DaySalesRow['salesvalue'] > 0) { $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->Sales = $DaySalesRow['salesvalue']; } else { Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/SupplierInvoice.php 2011-12-11 09:52:20 UTC (rev 4766) @@ -228,17 +228,20 @@ /* everything below here only do if a Supplier is selected fisrt add a header to show who we are making an invoice for */ - echo '<br /><table class=selection colspan=4> - <tr><th>' . _('Supplier') . '</th> + echo '<br /><table class="selection" colspan="4"> + <tr> + <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Terms') . '</th> - <th>' . _('Tax Authority') . '</th></tr>'; + <th>' . _('Tax Authority') . '</th> + </tr>'; - echo '<tr><td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . + echo '<tr> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></font></td> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> + <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> </tr> </table>'; @@ -247,7 +250,8 @@ echo '<br /><table class="selection">'; - echo '<tr><td>' . _('Supplier Invoice Reference') . ':</td> + echo '<tr> + <td>' . _('Supplier Invoice Reference') . ':</td> <td><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '"></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ @@ -467,9 +471,11 @@ } - echo '<tr><td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> - <td class=number><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> - </tr></table>'; + echo '<tr> + <td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> + <td class="number"><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + </tr> + </table>'; } $_SESSION['SuppTrans']->OvAmount = ($TotalGRNValue + $TotalGLValue + $TotalAssetValue + $TotalShiptValue + $TotalContractsValue); @@ -788,9 +794,9 @@ foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ - /*contract postings need to get the WIP from the contract items stock category record - * debit postings to this WIP account - * the WIP account is tidied up when the contract is closed*/ + /*contract postings need to get the WIP from the contract items stock category record + * debit postings to this WIP account + * the WIP account is tidied up when the contract is closed*/ $result = DB_query("SELECT wipact FROM stockcategory INNER JOIN stockmaster ON stockcategory.categoryid=stockmaster.categoryid @@ -860,7 +866,7 @@ /*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */ $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db); - + /*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */ if ($_SESSION['WeightedAverageCosting']==1){ /*Weighted Average costing */ @@ -915,61 +921,6 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - - /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. - - The assumption here is that the goods have been sold prior to the purchase invocie being entered so it is necessary to back track on the sales analysis cost. - * - Note that this will mean that posting to GL COGS will not agree to the cost of sales from the sales analysis*/ - - $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; - $CostVarPerUnit = (($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) - $EnteredGRN->StdCostUnit); - $PeriodAllocated = $PeriodNo; - - while ($QuantityVarianceAllocated >0) { - $SalesAnalResult=DB_query("SELECT cust, - custbranch, - typeabbrev, - periodno, - stkcategory, - area, - salesperson, - cost, - qty - FROM salesanalysis - WHERE salesanalysis.stockid = '" . $EnteredGRN->ItemCode . "' - AND salesanalysis.budgetoractual=1 - AND periodno='" . $PeriodAllocated . "'", - $db); - if (DB_num_rows($SalesAnalResult)>0){ - while ($SalesAnalRow = DB_fetch_array($SalesAnalResult) AND $QuantityVarianceAllocated >0){ - if ($SalesAnalRow['qty']<=$QuantityVarianceAllocated){ - $QuantityVarianceAllocated -= $SalesAnalRow['qty']; - $QuantityAllocated = $SalesAnalRow['qty']; - } else { - $QuantityAllocated = $QuantityVarianceAllocated; - $QuantityVarianceAllocated=0; - } - $UpdSalAnalResult = DB_query("UPDATE salesanalysis - SET cost = cost + " . ($CostVarPerUnit * $QuantityAllocated) . " - WHERE cust ='" . $SalesAnalRow['cust'] . "' - AND stockid='" . $EnteredGRN->ItemCode . "' - AND custbranch='" . $SalesAnalRow['custbranch'] . "' - AND typeabbrev='" . $SalesAnalRow['typeabbrev'] . "' - AND periodno='" . $PeriodAllocated . "' - AND area='" . $SalesAnalRow['area'] . "' - AND salesperson='" . $SalesAnalRow['salesperson'] . "' - AND stkcategory='" . $SalesAnalRow['stkcategory'] . "' - AND budgetoractual=1", - $db); - } - } //end if there were sales in that period - $PeriodAllocated--; //decrement the period - if ($PeriodNo - $PeriodAllocated >6) { - /*if more than 6 months ago when sales were made then forget it */ - break; - } - } //end loop around different periods to see which sales analysis records to update } // end if the quantity being invoiced here is greater than the current stock on hand /*Now post any remaining price variance to stock rather than price variances */ @@ -996,33 +947,6 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - /*Now to update the stock cost with the new weighted average */ - - /*Need to consider what to do if the cost has been changed manually between receiving the stock and entering the invoice - this code assumes there has been no cost updates made manually and all the price variance is posted to stock. - - A nicety or important?? */ - - - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost could not be updated because'); - $DbgMsg = _('The following SQL to update the cost was used'); - - if ($TotalQuantityOnHand>0) { - - $CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand; - - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost=materialcost+" . $CostIncrement . " - WHERE stockid='" . $EnteredGRN->ItemCode . "'"; - $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); - } else { - /* if stock is negative then update the cost to this cost */ - $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost='" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . "' - WHERE stockid='" . $EnteredGRN->ItemCode . "'"; - $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); - } - /* End of Weighted Average Costing Code */ - } else { //It must be Standard Costing $SQL = "INSERT INTO gltrans (type, @@ -1219,11 +1143,15 @@ /* Now update the GRN and PurchOrderDetails records for amounts invoiced - can't use the other loop through the GRNs as this was only where the GL link to credtors is active */ foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ - - $SQL = "UPDATE purchorderdetails SET qtyinvoiced = qtyinvoiced + " . $EnteredGRN->This_QuantityInv .", - actprice = '" . $EnteredGRN->ChgPrice . "' - WHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'"; + //in local currency + $ActualCost = $EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate; + $PurchPriceVar = $EnteredGRN->This_QuantityInv * ($ActualCost - $EnteredGRN->StdCostUnit); + + $SQL = "UPDATE purchorderdetails + SET qtyinvoiced = qtyinvoiced + " . $EnteredGRN->This_QuantityInv .", + actprice = '" . $EnteredGRN->ChgPrice . "' + WHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity invoiced of the purchase order line could not be updated because'); @@ -1231,8 +1159,9 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - $SQL = "UPDATE grns SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . - " WHERE grnno = '" . $EnteredGRN->GRNNo . "'"; + $SQL = "UPDATE grns + SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . " + WHERE grnno = '" . $EnteredGRN->GRNNo . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity invoiced off the goods received record could not be updated because'); $DbgMsg = _('The following SQL to update the GRN quantity invoiced was used'); @@ -1258,10 +1187,180 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); } //end of adding GRN shipment charges + else { + /*so its not a GRN shipment item its a plain old stock item */ + + if ($PurchPriceVar !=0){ /* don't bother with any of this lot if there is no difference ! */ + + if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */ + /*We need to: + * + * a) update the stockmove for the delivery to reflect the actual cost of the delivery + * + * b) If a WeightedAverageCosting system and the stock quantity on hand now is negative then the cost that has gone to sales analysis and the cost of sales stock movement records will have been incorrect ... attempt to fix it retrospectively + */ + /*Get the location that the stock was booked into */ + $result = DB_query("SELECT intostocklocation + FROM purchorders + WHERE orderno='" . $EnteredGRN->PONo . "'", + $db); + $LocRow = DB_fetch_array($result); + $LocCode = $LocRow['intostocklocation']; + + /* First update the stockmoves delivery cost */ + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the delivery could not have the cost updated to the actual cost'); + $result = DB_query("UPDATE stockmoves SET price = '" . $ActualCost . "' + WHERE stockid='" .$EnteredGRN->ItemCode . "' + AND type=25 + AND loccode='" . $LocCode . "' + AND transno='" . $EnteredGRN->GRNNo . "'", + $db,$ErrMsg,$DbgMsg,True); + + if ($_SESSION['WeightedAverageCosting']==1){ + /* + * How many in stock now? + * The quantity being invoiced here - $EnteredGRN->This_QuantityInv + * If the quantity in stock now is less than the quantity being invoiced + * here then some items sold will not have had this cost factored in + * The cost of these items = $ActualCost + */ + + $sql ="SELECT quantity + FROM locstock + WHERE loccode='" . $LocCode . "' + AND stockid='" . $EnteredGRN->ItemCode . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity on hand could not be retrieved from the database'); + $DbgMsg = _('The following SQL to retrieve the total stock quantity was used'); + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + $QtyRow = DB_fetch_row($Result); + $TotalQuantityOnHand = $QtyRow[0]; + + /* If the quantity on hand is less the quantity charged on this invoice then some must have been sold and the price variance should be reflected in the cost of sales*/ + + if ($EnteredGRN->This_QuantityInv > $TotalQuantityOnHand){ + + /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. + + The assumption here is that the goods have been sold prior to the purchase invoice being entered so it is necessary to back track on the sales analysis cost. + * Note that this will mean that posting to GL COGS will not agree to the cost of sales from the sales analysis + * Of course the price variances will need to be included in COGS as well + * */ + + $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; + $CostVarPerUnit = $ActualCost - $EnteredGRN->StdCostUnit; + $PeriodAllocated = $PeriodNo; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales analysis records could not be updated for the cost variances on this purchase invoice'); + + while ($QuantityVarianceAllocated >0) { + $SalesAnalResult=DB_query("SELECT cust, + custbranch, + typeabbrev, + periodno, + stkcategory, + area, + salesperson, + cost, + qty + FROM salesanalysis + WHERE salesanalysis.stockid = '" . $EnteredGRN->ItemCode . "' + AND salesanalysis.budgetoractual=1 + AND periodno='" . $PeriodAllocated . "'", + $db); + if (DB_num_rows($SalesAnalResult)>0){ + while ($SalesAnalRow = DB_fetch_array($SalesAnalResult) AND $QuantityVarianceAllocated >0){ + if ($SalesAnalRow['qty']<=$QuantityVarianceAllocated){ + $QuantityVarianceAllocated -= $SalesAnalRow['qty']; + $QuantityAllocated = $SalesAnalRow['qty']; + } else { + $QuantityAllocated = $QuantityVarianceAllocated; + $QuantityVarianceAllocated=0; + } + $UpdSalAnalResult = DB_query("UPDATE salesanalysis + SET cost = cost + " . ($CostVarPerUnit * $QuantityAllocated) . " + WHERE cust ='" . $SalesAnalRow['cust'] . "' + AND stockid='" . $EnteredGRN->ItemCode . "' + AND custbranch='" . $SalesAnalRow['custbranch'] . "' + AND typeabbrev='" . $SalesAnalRow['typeabbrev'] . "' + AND periodno='" . $PeriodAllocated . "' + AND area='" . $SalesAnalRow['area'] . "' + AND salesperson='" . $SalesAnalRow['salesperson'] . "' + AND stkcategory='" . $SalesAnalRow['stkcategory'] . "' + AND budgetoractual=1", + $db,$ErrMsg,$DbgMsg,True); + } + } //end if there were sales in that period + $PeriodAllocated--; //decrement the period + if ($PeriodNo - $PeriodAllocated >6) { + /*if more than 6 months ago when sales were made then forget it */ + break; + } + } /*end loop around different periods to see which sales analysis records to update */ + + /*now we need to work back through the sales stockmoves up to the quantity on this purchase invoice to update costs + * Only go back up to 6 months looking for stockmoves and + * Only in the stock location where the purchase order was received + * into - if the stock was transferred to another location then + * we cannot adjust for this */ + $result = DB_query("SELECT stkmoveno, + type, + qty, + standardcost + FROM stockmoves + WHERE loccode='" . $LocCode . "' + AND qty < 0 + AND stockid='" . $EnteredGRN->ItemCode . "' + AND trandate>='" . FormatDateForSQL(DateAdd($_SESSION['SuppTrans']->TranDate,'m',-6)) . "' + ORDER BY stkmoveno DESC", + $db); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movements for invoices cannot be updated for the cost variances on this purchase invoice'); + $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; + while ($StkMoveRow = DB_fetch_array($result) AND $QuantityVarianceAllocated >0){ + if ($StkMoveRow['qty']+$QuantityVarianceAllocated>0){ + if ($StkMoveRow['type']==10) { //its a sales invoice + $result = DB_query("UPDATE stockmoves + SET standardcost = '" . $ActualCost . "' + WHERE stkmoveno = '" . $StkMoveRow['stkmoveno'] . "'", + $db,$ErrMsg,$DbgMsg,True); + } + } //end if the invoice qty is more than is left to allocate + $QuantityVarianceAllocated+=$StkMoveRow['qty']; + } + } // end if the quantity being invoiced here is greater than the current stock on hand + + /*Now to update the stock cost with the new weighted average */ + + /*Need to consider what to do if the cost has been changed manually between receiving the stock and entering the invoice - this code assumes there has been no cost updates made manually and all the price variance is posted to stock. + + A nicety or important?? */ + + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost could not be updated because'); + $DbgMsg = _('The following SQL to update the cost was used'); + + if ($TotalQuantityOnHand>0) { + + $CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand; + + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost=materialcost+" . $CostIncrement . " + WHERE stockid='" . $EnteredGRN->ItemCode . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); + } else { + /* if stock is negative then update the cost to this cost */ + $sql = "UPDATE stockmaster + SET lastcost=materialcost+overheadcost+labourcost, + materialcost='" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . "' + WHERE stockid='" . $EnteredGRN->ItemCode . "'"; + $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); + } + } /* End if it is weighted average costing we are working with */ + } /*Its a stock item */ + } /* There was a price variance */ + } if ($EnteredGRN->AssetID!=0) { //then it is an asset - $PurchPriceVar = $EnteredGRN->This_QuantityInv * (($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) - $EnteredGRN->StdCostUnit); if ($PurchPriceVar !=0) { /*Add the fixed asset trans for the difference in the cost */ $SQL = "INSERT INTO fixedassettrans (assetid, Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/doc/Change.log 2011-12-11 09:52:20 UTC (rev 4766) @@ -1,5 +1,9 @@ webERP Change Log +11/12/11 Phil: SupplierInvoice.php attempts to post back any cost variances where there is no stock left to apportion the variances to - posting back to stockmoves (so the DailySales.php and other sales inquiry scripts reflect the appropriate GP) and the salesanalysis tables +11/12/11 Phil: DailySalesInquiry.php removed incorrect call to establish new cart object?? +10/12/11 Brian May: ConfirmDispatch_Invoice.php corrected SQL that was not calculating the difference to go to the orderdeliverydifferences log in parenthesis first before casting/concatenating to string for the SQL. + 3/12/11 Release 4.06.2 2/12/11 Phil: Added indian_number_format for specific unusal number formatting 00,00,000.00 for India and apparently South Asian countries. Kicks in for en_IN.utf8 and hi_IN.utf8 Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-12-10 18:23:41 UTC (rev 4765) +++ trunk/includes/DateFunctions.inc 2011-12-11 09:52:20 UTC (rev 4766) @@ -646,7 +646,14 @@ } function DateAdd ($DateToAddTo,$PeriodString,$NumberPeriods){ - + /*Takes + * DateToAddTo in $_SESSION['DefaultDateFormat'] format + * $PeriodString is one of: + * d - days + * w - weeks + * m - months + * y - years + * $NumberPeriods is an integer positve or negative */ $DateToAddTo = trim($DateToAddTo); if (mb_strpos($DateToAddTo,'/')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2011-12-10 18:23:47
|
Revision: 4765 http://web-erp.svn.sourceforge.net/web-erp/?rev=4765&view=rev Author: tim_schofield Date: 2011-12-10 18:23:41 +0000 (Sat, 10 Dec 2011) Log Message: ----------- Brian May correction to sql Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-12-08 18:48:01 UTC (rev 4764) +++ trunk/ConfirmDispatch_Invoice.php 2011-12-10 18:23:41 UTC (rev 4765) @@ -70,14 +70,14 @@ currencies.decimalplaces, custbranch.defaultshipvia, custbranch.specialinstructions - FROM salesorders INNER JOIN debtorsmaster + FROM salesorders INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON salesorders.branchcode = custbranch.branchcode AND salesorders.debtorno = custbranch.debtorno - INNER JOIN currencies - ON debtorsmaster.currcode = currencies.currabrev - INNER JOIN locations + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + INNER JOIN locations ON locations.loccode=salesorders.fromstkloc WHERE salesorders.orderno = '" . $_GET['OrderNumber']."'"; @@ -233,9 +233,9 @@ $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; } } else if (isset($_POST[$Itm->LineNumber . '_QtyDispatched' ])){ - if (is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) + if (is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)){ - + $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched = round(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']),$Itm->DecimalPlaces); } } @@ -471,10 +471,10 @@ if (!isset($_POST['ChargeFreightCost'])) { $_POST['ChargeFreightCost']=0; } -if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 - AND (!isset($_SESSION['Items'.$identifier]->FreightCost) +if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 + AND (!isset($_SESSION['Items'.$identifier]->FreightCost) OR $_POST['ChargeFreightCost']==0)) { - + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td> <td><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="0"></td>'; $_SESSION['Items'.$identifier]->FreightCost=0; @@ -670,7 +670,7 @@ FROM salesorderdetails WHERE completed=0 AND orderno = '" . $_SESSION['ProcessingOrder']."'"; - + $Result = DB_query($SQL,$db); if (DB_num_rows($Result) != count($_SESSION['Items'.$identifier]->LineItems)){ @@ -696,13 +696,13 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] + if ($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error'); - + echo '<br />'; echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; @@ -859,13 +859,13 @@ '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'CAN')"; - + $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } - } elseif (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 + } elseif (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 AND DateDiff(ConvertSQLDate($DefaultDispatchDate),$_SESSION['Items'.$identifier]->DeliveryDate,'d')>0) { /*The order is being short delivered after the due date - need to insert a delivery differnce log */ @@ -882,7 +882,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'BO' @@ -899,14 +899,14 @@ // Test above to see if the line is completed or not if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ - $SQL = "UPDATE salesorderdetails + $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "', completed=1 WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { - $SQL = "UPDATE salesorderdetails + $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "' WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' @@ -947,11 +947,11 @@ $QtyOnHandPrior = 0; } - $SQL = "UPDATE locstock + $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -969,7 +969,7 @@ WHERE bom.parent='" . $OrderLine->StockID . "' AND bom.effectiveto >= '" . Date('Y-m-d') . "' AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1009,7 +1009,7 @@ qty, standardcost, show_on_inv_crds, - newqoh) + newqoh) VALUES ('" . $AssParts['component'] . "', 10, '" . $InvoiceNo . "', @@ -1477,7 +1477,7 @@ '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', '" . round((-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "')"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal proceeds GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1510,7 +1510,7 @@ $DbgMsg = '<br />' ._('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL = "UPDATE fixedassets + $SQL = "UPDATE fixedassets SET disposalproceeds ='" . round(($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "', disposaldate ='" . $DefaultDispatchDate . "' WHERE assetid ='" . $AssetNumber . "'"; @@ -1590,7 +1590,7 @@ '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . round((-$TaxAmount/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "')"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1652,7 +1652,7 @@ <td>' ._('Invoice Text'). ':</td> <td><textarea tabindex="'.$j.'" name="InvoiceText" cols="31" rows="5">' . reverse_escape($_POST['InvoiceText']) . '</textarea></td> </tr>'; - + $j++; echo '</table> <br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2011-12-10 18:23:47
|
Revision: 4765 http://web-erp.svn.sourceforge.net/web-erp/?rev=4765&view=rev Author: tim_schofield Date: 2011-12-10 18:23:41 +0000 (Sat, 10 Dec 2011) Log Message: ----------- Brian May correction to sql Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-12-08 18:48:01 UTC (rev 4764) +++ trunk/ConfirmDispatch_Invoice.php 2011-12-10 18:23:41 UTC (rev 4765) @@ -70,14 +70,14 @@ currencies.decimalplaces, custbranch.defaultshipvia, custbranch.specialinstructions - FROM salesorders INNER JOIN debtorsmaster + FROM salesorders INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON salesorders.branchcode = custbranch.branchcode AND salesorders.debtorno = custbranch.debtorno - INNER JOIN currencies - ON debtorsmaster.currcode = currencies.currabrev - INNER JOIN locations + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + INNER JOIN locations ON locations.loccode=salesorders.fromstkloc WHERE salesorders.orderno = '" . $_GET['OrderNumber']."'"; @@ -233,9 +233,9 @@ $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; } } else if (isset($_POST[$Itm->LineNumber . '_QtyDispatched' ])){ - if (is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) + if (is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)){ - + $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched = round(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']),$Itm->DecimalPlaces); } } @@ -471,10 +471,10 @@ if (!isset($_POST['ChargeFreightCost'])) { $_POST['ChargeFreightCost']=0; } -if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 - AND (!isset($_SESSION['Items'.$identifier]->FreightCost) +if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 + AND (!isset($_SESSION['Items'.$identifier]->FreightCost) OR $_POST['ChargeFreightCost']==0)) { - + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td> <td><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="0"></td>'; $_SESSION['Items'.$identifier]->FreightCost=0; @@ -670,7 +670,7 @@ FROM salesorderdetails WHERE completed=0 AND orderno = '" . $_SESSION['ProcessingOrder']."'"; - + $Result = DB_query($SQL,$db); if (DB_num_rows($Result) != count($_SESSION['Items'.$identifier]->LineItems)){ @@ -696,13 +696,13 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] + if ($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error'); - + echo '<br />'; echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; @@ -859,13 +859,13 @@ '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'CAN')"; - + $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } - } elseif (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 + } elseif (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 AND DateDiff(ConvertSQLDate($DefaultDispatchDate),$_SESSION['Items'.$identifier]->DeliveryDate,'d')>0) { /*The order is being short delivered after the due date - need to insert a delivery differnce log */ @@ -882,7 +882,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'BO' @@ -899,14 +899,14 @@ // Test above to see if the line is completed or not if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ - $SQL = "UPDATE salesorderdetails + $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "', completed=1 WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { - $SQL = "UPDATE salesorderdetails + $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "' WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' @@ -947,11 +947,11 @@ $QtyOnHandPrior = 0; } - $SQL = "UPDATE locstock + $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -969,7 +969,7 @@ WHERE bom.parent='" . $OrderLine->StockID . "' AND bom.effectiveto >= '" . Date('Y-m-d') . "' AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1009,7 +1009,7 @@ qty, standardcost, show_on_inv_crds, - newqoh) + newqoh) VALUES ('" . $AssParts['component'] . "', 10, '" . $InvoiceNo . "', @@ -1477,7 +1477,7 @@ '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', '" . round((-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "')"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal proceeds GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1510,7 +1510,7 @@ $DbgMsg = '<br />' ._('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL = "UPDATE fixedassets + $SQL = "UPDATE fixedassets SET disposalproceeds ='" . round(($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "', disposaldate ='" . $DefaultDispatchDate . "' WHERE assetid ='" . $AssetNumber . "'"; @@ -1590,7 +1590,7 @@ '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . round((-$TaxAmount/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "')"; - + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1652,7 +1652,7 @@ <td>' ._('Invoice Text'). ':</td> <td><textarea tabindex="'.$j.'" name="InvoiceText" cols="31" rows="5">' . reverse_escape($_POST['InvoiceText']) . '</textarea></td> </tr>'; - + $j++; echo '</table> <br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-08 18:48:08
|
Revision: 4764 http://web-erp.svn.sourceforge.net/web-erp/?rev=4764&view=rev Author: daintree Date: 2011-12-08 18:48:01 +0000 (Thu, 08 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockStatus.php trunk/Z_ImportFixedAssets.php trunk/index.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/StockLocTransfer.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -33,26 +33,23 @@ //loop through file rows while ( ($myrow = fgetcsv($FileHandle, 10000, ',')) !== FALSE ) { - //check for correct number of fields - $FieldCount = count($myrow); - if ($FieldCount != 2)){ - prnMsg (_('File contains') . ' '. $FieldCount . ' ' . _('columns, but only 2 columns are expected. The comma separated file should have just two columns the first for the item code and the second for the quantity to transfer'),'error'); + if (count($myrow) != 2){ + prnMsg (_('File contains') . ' '. count($myrow) . ' ' . _('columns, but only 2 columns are expected. The comma separated file should have just two columns the first for the item code and the second for the quantity to transfer'),'error'); fclose($FileHandle); include('includes/footer.inc'); exit; } // cleanup the data (csv files often import with empty strings and such) + $StockID=''; + $Quantity=0; for ($i=0; $i<count($myrow);$i++) { - $StockID=''; - $Quantity=0; - $myrow[$i] = trim($myrow[$i]); switch ($i) { case 0: $StockID = trim(mb_strtoupper($myrow[$i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $StockID . "'",$db); - $myrow = DB_fetch_row($result); - if ($myrow[0]==0){ + $StockIDCheck = DB_fetch_row($result); + if ($StockIDCheck[0]==0){ $InputError = True; $ErrorMessage .= _('The part code entered of'). ' ' . $StockID . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; } @@ -73,76 +70,77 @@ AND loccode='".$_POST['FromStockLocation']."'", $db); $CheckStockRow = DB_fetch_array($result); - if ($myrow['quantity'] < $Quantity){ + if ($CheckStockRow['quantity'] < $Quantity){ $InputError = True; - $ErrorMessage .= _('The item'). ' ' . $StockID . ' ' . _('does not have enough stock available (') . ' ' . $myrow['quantity'] . ')' . ' ' . _('The quantity required to transfer was') . ' ' . $Quantity . '.<br />'; + $ErrorMessage .= _('The item'). ' ' . $StockID . ' ' . _('does not have enough stock available (') . ' ' . $CheckStockRow['quantity'] . ')' . ' ' . _('The quantity required to transfer was') . ' ' . $Quantity . '.<br />'; } } - - if ($StockID!='' AND $Quantity!=0){ - $_POST['StockID' . $RowCounter] = $StockID; - $_POST['StockQTY' . $RowCounter] = $Quantity; - } } // end for loop through the columns on the row being processed - $TotalItems++; - $_POST['LinesCounter']=$TotalItems; + if ($StockID!='' AND $Quantity!=0){ + $_POST['StockID' . $TotalItems] = $StockID; + $_POST['StockQTY' . $TotalItems] = $Quantity; + $StockID=''; + $Quantity=0; + $TotalItems++; + } } //end while there are lines in the CSV file + $_POST['LinesCounter']=$TotalItems; } //end if there is a CSV file to import else { // process the manually input lines - $ErrorMessage=''; - for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ - $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); - $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); - $myrow = DB_fetch_row($result); - if ($myrow[0]==0){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; - $_POST['LinesCounter'] -= 10; - } - DB_free_result( $result ); - if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ - $InputError = True; - $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; - $_POST['LinesCounter'] -= 10; - } - if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ - $InputError = True; - $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; - $_POST['LinesCounter'] -= 10; - } - if ($_SESSION['ProhibitNegativeStock']==1){ - // Only if stock exists at this location - $result = DB_query("SELECT quantity - FROM locstock - WHERE stockid='" . $_POST['StockID' . $i] . "' - AND loccode='".$_POST['FromStockLocation']."'", - $db); - - $myrow = DB_fetch_row($result); - if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; - $_POST['LinesCounter'] -= 10; - } - } - DB_free_result( $result ); - $TotalItems++; - } - }//for all LinesCounter - } - - if ($TotalItems == 0){ - $InputError = True; - $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; - } - - /*Ship location and Receive location are different */ - if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ - $InputError=True; - $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); - } - } //end if the transfer is not a duplicated + $ErrorMessage=''; + for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ + $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); + $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]==0){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; + $_POST['LinesCounter'] -= 10; + } + DB_free_result( $result ); + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ + $InputError = True; + $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ + $InputError = True; + $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if ($_SESSION['ProhibitNegativeStock']==1){ + // Only if stock exists at this location + $result = DB_query("SELECT quantity + FROM locstock + WHERE stockid='" . $_POST['StockID' . $i] . "' + AND loccode='".$_POST['FromStockLocation']."'", + $db); + + $myrow = DB_fetch_row($result); + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; + $_POST['LinesCounter'] -= 10; + } + } + DB_free_result( $result ); + $TotalItems++; + } + }//for all LinesCounter + } + + if ($TotalItems == 0){ + $InputError = True; + $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; + } + + /*Ship location and Receive location are different */ + if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ + $InputError=True; + $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); + } + } //end if the transfer is not a duplicated } if(isset($_POST['Submit']) AND $InputError==False){ @@ -203,7 +201,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; + echo '<form enctype="multipart/form-data" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; @@ -252,11 +250,11 @@ echo '</select></td></tr>'; echo '<tr> - <td>' . _('Upload CSV file of Transfer Items and Quantites') . ':</td> - <td><input name="SelectedTransferFile" type="file" /></td> - </tr> - </table>'; - + <td>' . _('Upload CSV file of Transfer Items and Quantites') . ':</td> + <td><input name="SelectedTransferFile" type="file" /></td> + </tr> + </table>'; + echo '<table class="selection">'; $tableheader = '<tr><th>'. _('Item Code'). '</th> Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/StockStatus.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock Status'); Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/Z_ImportFixedAssets.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -276,7 +276,7 @@ fclose($FileHandle); -} elseif ( isset($_POST['gettemplate']) || isset($_GET['gettemplate']) ) { //download an import template +} elseif ( isset($_POST['gettemplate']) OR isset($_GET['gettemplate']) ) { //download an import template echo '<br /><br /><br />"'. implode('","',$FieldNames). '"<br /><br /><br />'; @@ -288,7 +288,7 @@ <br /> <br /> '; - echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method=post>'; + echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '">'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">'; Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/index.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -236,7 +236,7 @@ </td> <td class="menu_group_items"> <!-- Orders Maintenance options --> - <table width="100%"> + <table width="100%" class="table_index" > <tr> <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/SelectContract.php">' . _('Select Contract') . '</a></p>'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-08 18:48:08
|
Revision: 4764 http://web-erp.svn.sourceforge.net/web-erp/?rev=4764&view=rev Author: daintree Date: 2011-12-08 18:48:01 +0000 (Thu, 08 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockStatus.php trunk/Z_ImportFixedAssets.php trunk/index.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/StockLocTransfer.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -33,26 +33,23 @@ //loop through file rows while ( ($myrow = fgetcsv($FileHandle, 10000, ',')) !== FALSE ) { - //check for correct number of fields - $FieldCount = count($myrow); - if ($FieldCount != 2)){ - prnMsg (_('File contains') . ' '. $FieldCount . ' ' . _('columns, but only 2 columns are expected. The comma separated file should have just two columns the first for the item code and the second for the quantity to transfer'),'error'); + if (count($myrow) != 2){ + prnMsg (_('File contains') . ' '. count($myrow) . ' ' . _('columns, but only 2 columns are expected. The comma separated file should have just two columns the first for the item code and the second for the quantity to transfer'),'error'); fclose($FileHandle); include('includes/footer.inc'); exit; } // cleanup the data (csv files often import with empty strings and such) + $StockID=''; + $Quantity=0; for ($i=0; $i<count($myrow);$i++) { - $StockID=''; - $Quantity=0; - $myrow[$i] = trim($myrow[$i]); switch ($i) { case 0: $StockID = trim(mb_strtoupper($myrow[$i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $StockID . "'",$db); - $myrow = DB_fetch_row($result); - if ($myrow[0]==0){ + $StockIDCheck = DB_fetch_row($result); + if ($StockIDCheck[0]==0){ $InputError = True; $ErrorMessage .= _('The part code entered of'). ' ' . $StockID . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; } @@ -73,76 +70,77 @@ AND loccode='".$_POST['FromStockLocation']."'", $db); $CheckStockRow = DB_fetch_array($result); - if ($myrow['quantity'] < $Quantity){ + if ($CheckStockRow['quantity'] < $Quantity){ $InputError = True; - $ErrorMessage .= _('The item'). ' ' . $StockID . ' ' . _('does not have enough stock available (') . ' ' . $myrow['quantity'] . ')' . ' ' . _('The quantity required to transfer was') . ' ' . $Quantity . '.<br />'; + $ErrorMessage .= _('The item'). ' ' . $StockID . ' ' . _('does not have enough stock available (') . ' ' . $CheckStockRow['quantity'] . ')' . ' ' . _('The quantity required to transfer was') . ' ' . $Quantity . '.<br />'; } } - - if ($StockID!='' AND $Quantity!=0){ - $_POST['StockID' . $RowCounter] = $StockID; - $_POST['StockQTY' . $RowCounter] = $Quantity; - } } // end for loop through the columns on the row being processed - $TotalItems++; - $_POST['LinesCounter']=$TotalItems; + if ($StockID!='' AND $Quantity!=0){ + $_POST['StockID' . $TotalItems] = $StockID; + $_POST['StockQTY' . $TotalItems] = $Quantity; + $StockID=''; + $Quantity=0; + $TotalItems++; + } } //end while there are lines in the CSV file + $_POST['LinesCounter']=$TotalItems; } //end if there is a CSV file to import else { // process the manually input lines - $ErrorMessage=''; - for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ - $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); - $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); - $myrow = DB_fetch_row($result); - if ($myrow[0]==0){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; - $_POST['LinesCounter'] -= 10; - } - DB_free_result( $result ); - if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ - $InputError = True; - $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; - $_POST['LinesCounter'] -= 10; - } - if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ - $InputError = True; - $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; - $_POST['LinesCounter'] -= 10; - } - if ($_SESSION['ProhibitNegativeStock']==1){ - // Only if stock exists at this location - $result = DB_query("SELECT quantity - FROM locstock - WHERE stockid='" . $_POST['StockID' . $i] . "' - AND loccode='".$_POST['FromStockLocation']."'", - $db); - - $myrow = DB_fetch_row($result); - if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; - $_POST['LinesCounter'] -= 10; - } - } - DB_free_result( $result ); - $TotalItems++; - } - }//for all LinesCounter - } - - if ($TotalItems == 0){ - $InputError = True; - $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; - } - - /*Ship location and Receive location are different */ - if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ - $InputError=True; - $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); - } - } //end if the transfer is not a duplicated + $ErrorMessage=''; + for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ + $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); + $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]==0){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; + $_POST['LinesCounter'] -= 10; + } + DB_free_result( $result ); + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ + $InputError = True; + $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ + $InputError = True; + $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if ($_SESSION['ProhibitNegativeStock']==1){ + // Only if stock exists at this location + $result = DB_query("SELECT quantity + FROM locstock + WHERE stockid='" . $_POST['StockID' . $i] . "' + AND loccode='".$_POST['FromStockLocation']."'", + $db); + + $myrow = DB_fetch_row($result); + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; + $_POST['LinesCounter'] -= 10; + } + } + DB_free_result( $result ); + $TotalItems++; + } + }//for all LinesCounter + } + + if ($TotalItems == 0){ + $InputError = True; + $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; + } + + /*Ship location and Receive location are different */ + if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ + $InputError=True; + $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); + } + } //end if the transfer is not a duplicated } if(isset($_POST['Submit']) AND $InputError==False){ @@ -203,7 +201,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; + echo '<form enctype="multipart/form-data" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; @@ -252,11 +250,11 @@ echo '</select></td></tr>'; echo '<tr> - <td>' . _('Upload CSV file of Transfer Items and Quantites') . ':</td> - <td><input name="SelectedTransferFile" type="file" /></td> - </tr> - </table>'; - + <td>' . _('Upload CSV file of Transfer Items and Quantites') . ':</td> + <td><input name="SelectedTransferFile" type="file" /></td> + </tr> + </table>'; + echo '<table class="selection">'; $tableheader = '<tr><th>'. _('Item Code'). '</th> Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/StockStatus.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock Status'); Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/Z_ImportFixedAssets.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -276,7 +276,7 @@ fclose($FileHandle); -} elseif ( isset($_POST['gettemplate']) || isset($_GET['gettemplate']) ) { //download an import template +} elseif ( isset($_POST['gettemplate']) OR isset($_GET['gettemplate']) ) { //download an import template echo '<br /><br /><br />"'. implode('","',$FieldNames). '"<br /><br /><br />'; @@ -288,7 +288,7 @@ <br /> <br /> '; - echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method=post>'; + echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '">'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">'; Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-12-07 07:03:38 UTC (rev 4763) +++ trunk/index.php 2011-12-08 18:48:01 UTC (rev 4764) @@ -236,7 +236,7 @@ </td> <td class="menu_group_items"> <!-- Orders Maintenance options --> - <table width="100%"> + <table width="100%" class="table_index" > <tr> <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/SelectContract.php">' . _('Select Contract') . '</a></p>'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-12-07 07:03:44
|
Revision: 4763 http://web-erp.svn.sourceforge.net/web-erp/?rev=4763&view=rev Author: daintree Date: 2011-12-07 07:03:38 +0000 (Wed, 07 Dec 2011) Log Message: ----------- Modified Paths: -------------- trunk/StockLocTransfer.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-12-03 04:18:47 UTC (rev 4762) +++ trunk/StockLocTransfer.php 2011-12-07 07:03:38 UTC (rev 4763) @@ -22,56 +22,127 @@ unset($_POST['StockID' . $i]); unset($_POST['StockQTY' . $i]); } - } - $ErrorMessage=''; - for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ - $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); - $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); - $myrow = DB_fetch_row($result); - if ($myrow[0]==0){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; - $_POST['LinesCounter'] -= 10; - } - DB_free_result( $result ); - if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ - $InputError = True; - $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; - $_POST['LinesCounter'] -= 10; - } - if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ - $InputError = True; - $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; - $_POST['LinesCounter'] -= 10; - } - // Only if stock exists at this location - $result = DB_query("SELECT quantity - FROM locstock - WHERE stockid='" . $_POST['StockID' . $i] . "' - AND loccode='".$_POST['FromStockLocation']."'", - $db); - - $myrow = DB_fetch_row($result); - if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ - $InputError = True; - $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; - $_POST['LinesCounter'] -= 10; - } - DB_free_result( $result ); - $TotalItems++; - } - }//for all LinesCounter - if ($TotalItems == 0){ - $InputError = True; - $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; - } + } else { + if ($_FILES['SelectedTransferFile']['name']) { //start file processing + //initialize + $InputError = false; + $ErrorMessage=''; + //get file handle + $FileHandle = fopen($_FILES['SelectedTransferFile']['tmp_name'], 'r'); + $TotalItems=0; + //loop through file rows + while ( ($myrow = fgetcsv($FileHandle, 10000, ',')) !== FALSE ) { -/*Ship location and Receive location are different */ - if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ - $InputError=True; - $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); - } + //check for correct number of fields + $FieldCount = count($myrow); + if ($FieldCount != 2)){ + prnMsg (_('File contains') . ' '. $FieldCount . ' ' . _('columns, but only 2 columns are expected. The comma separated file should have just two columns the first for the item code and the second for the quantity to transfer'),'error'); + fclose($FileHandle); + include('includes/footer.inc'); + exit; + } + + // cleanup the data (csv files often import with empty strings and such) + for ($i=0; $i<count($myrow);$i++) { + $StockID=''; + $Quantity=0; + $myrow[$i] = trim($myrow[$i]); + switch ($i) { + case 0: + $StockID = trim(mb_strtoupper($myrow[$i])); + $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $StockID . "'",$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]==0){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $StockID . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; + } + break; + case 1: + $Quantity = filter_number_format($myrow[$i]); + if (!is_numeric($Quantity)){ + $InputError = True; + $ErrorMessage .= _('The quantity entered for'). ' ' . $StockID . ' ' . _('of') . $Quantity . ' '. _('is not numeric.') . _('The quantity entered for transfers is expected to be numeric'); + } + break; + } // end switch statement + if ($_SESSION['ProhibitNegativeStock']==1){ + // Only if stock exists at this location + $result = DB_query("SELECT quantity + FROM locstock + WHERE stockid='" . $StockID . "' + AND loccode='".$_POST['FromStockLocation']."'", + $db); + $CheckStockRow = DB_fetch_array($result); + if ($myrow['quantity'] < $Quantity){ + $InputError = True; + $ErrorMessage .= _('The item'). ' ' . $StockID . ' ' . _('does not have enough stock available (') . ' ' . $myrow['quantity'] . ')' . ' ' . _('The quantity required to transfer was') . ' ' . $Quantity . '.<br />'; + } + } + + if ($StockID!='' AND $Quantity!=0){ + $_POST['StockID' . $RowCounter] = $StockID; + $_POST['StockQTY' . $RowCounter] = $Quantity; + } + } // end for loop through the columns on the row being processed + $TotalItems++; + $_POST['LinesCounter']=$TotalItems; + } //end while there are lines in the CSV file + } //end if there is a CSV file to import + else { // process the manually input lines + $ErrorMessage=''; + for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ + $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); + $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]==0){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('is not set up in the database') . '. ' . _('Only valid parts can be entered for transfers'). '<br />'; + $_POST['LinesCounter'] -= 10; + } + DB_free_result( $result ); + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ + $InputError = True; + $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ + $InputError = True; + $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; + $_POST['LinesCounter'] -= 10; + } + if ($_SESSION['ProhibitNegativeStock']==1){ + // Only if stock exists at this location + $result = DB_query("SELECT quantity + FROM locstock + WHERE stockid='" . $_POST['StockID' . $i] . "' + AND loccode='".$_POST['FromStockLocation']."'", + $db); + + $myrow = DB_fetch_row($result); + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ + $InputError = True; + $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; + $_POST['LinesCounter'] -= 10; + } + } + DB_free_result( $result ); + $TotalItems++; + } + }//for all LinesCounter + } + + if ($TotalItems == 0){ + $InputError = True; + $ErrorMessage .= _('You must enter at least 1 Stock Item to transfer').'<br />'; + } + + /*Ship location and Receive location are different */ + if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ + $InputError=True; + $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); + } + } //end if the transfer is not a duplicated } if(isset($_POST['Submit']) AND $InputError==False){ @@ -178,8 +249,14 @@ echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr></table>'; + echo '</select></td></tr>'; + echo '<tr> + <td>' . _('Upload CSV file of Transfer Items and Quantites') . ':</td> + <td><input name="SelectedTransferFile" type="file" /></td> + </tr> + </table>'; + echo '<table class="selection">'; $tableheader = '<tr><th>'. _('Item Code'). '</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |