From: <dai...@us...> - 2011-08-04 09:12:51
|
Revision: 4648 http://web-erp.svn.sourceforge.net/web-erp/?rev=4648&view=rev Author: daintree Date: 2011-08-04 09:12:45 +0000 (Thu, 04 Aug 2011) Log Message: ----------- fix for GPPercent reported on discount matrix updates Modified Paths: -------------- trunk/PO_SelectOSPurchOrder.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2011-08-04 08:24:32 UTC (rev 4647) +++ trunk/PO_SelectOSPurchOrder.php 2011-08-04 09:12:45 UTC (rev 4648) @@ -129,7 +129,7 @@ */ if (!isset($OrderNumber) or $OrderNumber=='' ){ - echo '<a href="' . $rootpath . '/PO_Header.php?' .SID . '&NewOrder=Yes">' . _('Add Purchase Order') . '</a>'; + echo '<a href="' . $rootpath . '/PO_Header.php?NewOrder=Yes">' . _('Add Purchase Order') . '</a>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'</p>'; echo '<table class=selection><tr><td>'._('Order Number') . ': <input type="text" name="OrderNumber" maxlength="8" size="9" /> ' . _('Into Stock Location') . ':<select name="StockLocation">'; @@ -183,7 +183,9 @@ echo '<br /><font size=1><div class="page_help_text">' ._('To search for purchase orders for a specific part use the part selection facilities below') .'</div> </font>'; -echo '<br /><table class="selection"><tr>'; +echo '<br /> + <table class="selection"> + <tr>'; echo '<td><font size="1">' . _('Select a stock category') . ':</font><select name="StockCat">'; @@ -196,11 +198,20 @@ } echo '</select>'; echo '<td><font size=1>' . _('Enter text extracts in the') . '<b>' . _('description') . '</b>:</font></td>'; -echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; +echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td> + </tr> + <tr><td></td>'; echo '<td><font size<b>' . _('OR') . '</b></font><font size=1>' . _('Enter extract of the') . '<b>' . _('Stock Code') . '</b>:</font></td>'; -echo '<td><input type="Text" name="StockCode" size=15 maxlength=18></td></tr></table><br />'; -echo '<table><tr><td><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; -echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></td></tr></table>'; +echo '<td><input type="text" name="StockCode" size="15" maxlength="18"></td> + </tr> + </table> + <br />'; +echo '<table> + <tr> + <td><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '"> + <input type=submit name="ResetPart" value="' . _('Show All') . '"></td> + </tr> + </table>'; echo '<br />'; @@ -229,8 +240,8 @@ printf('<td><input type="submit" name="SelectedStockItem" value="%s"</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td></tr>', $myrow['stockid'], $myrow['description'], @@ -267,7 +278,7 @@ $StatusCriteria = " AND purchorders.status='Cancelled' "; } - if (isset($OrderNumber) && $OrderNumber !='') { + if (isset($OrderNumber) AND $OrderNumber !='') { $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, @@ -303,119 +314,119 @@ if (isset($SelectedStockItem)) { $SQL = "SELECT purchorders.realorderno, - purchorders.orderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode, - SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders INNER JOIN purchorderdetails - ON purchorders.orderno = purchorderdetails.orderno - INNER JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorderdetails.completed=0 - AND purchorderdetails.itemcode='". $SelectedStockItem ."' - AND purchorders.supplierno='" . $SelectedSupplier ."' - AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' - " . $StatusCriteria . " - GROUP BY purchorders.orderno ASC, - purchorders.realorderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode"; + purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode, + SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue + FROM purchorders INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorderdetails.completed=0 + AND purchorderdetails.itemcode='". $SelectedStockItem ."' + AND purchorders.supplierno='" . $SelectedSupplier ."' + AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + " . $StatusCriteria . " + GROUP BY purchorders.orderno ASC, + purchorders.realorderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode"; } else { $SQL = "SELECT purchorders.realorderno, - purchorders.orderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode, - SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders INNER JOIN purchorderdetails - ON purchorders.orderno = purchorderdetails.orderno - INNER JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorderdetails.completed=0 - AND purchorders.supplierno='" . $SelectedSupplier ."' - AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' - " . $StatusCriteria . " - GROUP BY purchorders.orderno ASC, - purchorders.realorderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode"; + purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode, + SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue + FROM purchorders INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorderdetails.completed=0 + AND purchorders.supplierno='" . $SelectedSupplier ."' + AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + " . $StatusCriteria . " + GROUP BY purchorders.orderno ASC, + purchorders.realorderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode"; } } else { //no supplier selected if (!isset($_POST['StockLocation'])) {$_POST['StockLocation']='';} if (isset($SelectedStockItem) and isset($_POST['StockLocation'])) { $SQL = "SELECT purchorders.realorderno, - purchorders.orderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode, - SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders INNER JOIN purchorderdetails - ON purchorders.orderno = purchorderdetails.orderno - INNER JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorderdetails.completed=0 - AND purchorderdetails.itemcode='". $SelectedStockItem ."' - AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' - " . $StatusCriteria . " - GROUP BY purchorders.orderno ASC, - purchorders.realorderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode"; + purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode, + SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue + FROM purchorders INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorderdetails.completed=0 + AND purchorderdetails.itemcode='". $SelectedStockItem ."' + AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + " . $StatusCriteria . " + GROUP BY purchorders.orderno ASC, + purchorders.realorderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode"; } else { $SQL = "SELECT purchorders.realorderno, - purchorders.orderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode, - SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders INNER JOIN purchorderdetails - ON purchorders.orderno = purchorderdetails.orderno - INNER JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorderdetails.completed=0 - AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' - " . $StatusCriteria . " - GROUP BY purchorders.orderno ASC, - purchorders.realorderno, - suppliers.suppname, - purchorders.orddate, - purchorders.status, - purchorders.initiator, - purchorders.requisitionno, - purchorders.allowprint, - suppliers.currcode"; + purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode, + SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue + FROM purchorders INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorderdetails.completed=0 + AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + " . $StatusCriteria . " + GROUP BY purchorders.orderno ASC, + purchorders.realorderno, + suppliers.suppname, + purchorders.orddate, + purchorders.status, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + suppliers.currcode"; } } //end selected supplier @@ -430,20 +441,20 @@ // '</td><td class="tableheader">' . _('Receive') . - echo '<tr><th>' . _('Order #') . - '</th><th>' . _('Order Date') . - '</th><th>' . _('Initiated by') . - '</th><th>' . _('Supplier') . - '</th><th>' . _('Currency') . - '</th>'; + echo '<tr> + <th>' . _('Order #') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiated by') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th>'; + if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { echo '<th>' . _('Order Total') .'</th>'; } echo '<th>' . _('Status') . '</th> - <th>' . _('Modify') . '</th> - <th>' . _('Print') . '</th> - <th>' . _('Receive') . '</th> - </tr>'; + <th>' . _('Print') . '</th> + <th>' . _('Receive') . '</th> + </tr>'; $j = 1; $k=0; //row colour counter while ($myrow=DB_fetch_array($PurchOrdersResult)) { @@ -456,20 +467,20 @@ $k++; } - $ModifyPage = $rootpath . '/PO_Header.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; + $ModifyPage = $rootpath . '/PO_Header.php?ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['status'] == 'Printed') { - $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?' . SID . '&PONumber=' . $myrow['orderno'].'">'. + $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?PONumber=' . $myrow['orderno'].'">'. _('Receive').'</a>'; } else { - $ReceiveOrder = _('Receive'); + $ReceiveOrder = ''; } if ($myrow['status'] == 'Authorised' AND $myrow['allowprint'] == 1){ - $PrintPurchOrder = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $myrow['orderno'] . '">' . _('Print Now') . '</a>'; + $PrintPurchOrder = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?OrderNo=' . $myrow['orderno'] . '">' . _('Print') . '</a>'; } elseif ($myrow['status'] == 'Authorisied' AND $myrow['allowprint'] == 0) { $PrintPurchOrder = _('Printed'); } elseif ($myrow['status'] == 'Printed'){ - $PrintPurchOrder = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $myrow['orderno'] . '&realorderno=' . $myrow['realorderno'] . '&ViewingOnly=2"> - ' . _('Print') . '</a>'; + $PrintPurchOrder = '<a target="_blank" href="' . $rootpath . '/PO_PDFPurchOrder.php?OrderNo=' . $myrow['orderno'] . '&realorderno=' . $myrow['realorderno'] . '&ViewingOnly=2"> + ' . _('Print Copy') . '</a>'; } else { $PrintPurchOrder = _('N/A'); } @@ -478,7 +489,7 @@ $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); - echo '<td>' . $myrow['orderno'] . '</td> + echo '<td><a href="'.$ModifyPage.'">' . $myrow['orderno'] . '</a></td> <td>' . $FormatedOrderDate . '</td> <td>' . $myrow['initiator'] . '</td> <td>' . $myrow['suppname'] . '</td> @@ -487,10 +498,9 @@ echo '<td class=number>'.$FormatedOrderValue . '</td>'; } echo '<td>' . _($myrow['status']) . '</td> - <td><a href="'.$ModifyPage.'">' . _('Modify') . '</a></td> - <td>' . $PrintPurchOrder . '</td> - <td>' . $ReceiveOrder . '</td> - </tr>'; + <td>' . $PrintPurchOrder . '</td> + <td>' . $ReceiveOrder . '</td> + </tr>'; //end of page full new headings if } //end of while loop Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-08-04 08:24:32 UTC (rev 4647) +++ trunk/SelectOrderItems.php 2011-08-04 09:12:45 UTC (rev 4648) @@ -1207,6 +1207,7 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-($DiscountMatrixRate/100))) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); } } } @@ -1214,9 +1215,9 @@ } /* end of discount matrix lookup code */ } // the order session is started or there is a new item being added if (isset($_POST['DeliveryDetails'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/DeliveryDetails.php?' . SID .'identifier='.$identifier . '">'; + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/DeliveryDetails.php?identifier='.$identifier . '">'; prnMsg(_('You should automatically be forwarded to the entry of the delivery details page') . '. ' . _('if this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - '<a href="' . $rootpath . '/DeliveryDetails.php?' . SID .'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'), 'info'); + '<a href="' . $rootpath . '/DeliveryDetails.php?identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'), 'info'); exit; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-04 08:24:32 UTC (rev 4647) +++ trunk/doc/Change.log 2011-08-04 09:12:45 UTC (rev 4648) @@ -1,5 +1,6 @@ webERP Change Log +4/8/11 Phil: Fix GP Percent reported when discounts updated by discount matrix 4/8/11 Ricard: SalesInquiry.php now shows net sales after discounts 31/7/11 Phil: PO_Header.php - was not updating when update hit as reported by Klaus(opto) 31/7/11 Phil: BackupDatabase.php script Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-08-04 08:24:32 UTC (rev 4647) +++ trunk/includes/DefineCartClass.php 2011-08-04 09:12:45 UTC (rev 4648) @@ -246,7 +246,7 @@ /* Makes a comma seperated list of the stock items ordered for use in SQL expressions */ - $StockID_List=""; + $StockID_List=''; foreach ($this->LineItems as $StockItem) { $StockID_List .= ",'" . $StockItem->StockID . "'"; } Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-08-04 08:24:32 UTC (rev 4647) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-08-04 09:12:45 UTC (rev 4648) @@ -98,7 +98,7 @@ AND discountcategory ='" . $myrow['discountcategory'] . "' AND quantitybreak <" . $NewItemQty,$db); $DiscCatRow = DB_fetch_row($result); - if ($DiscCatRow[0] != "" && $DiscCatRow[0] > 0) { + if ($DiscCatRow[0] != '' AND $DiscCatRow[0] > 0) { $Discount = $DiscCatRow[0]; } else { $Discount = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |