From: <dai...@us...> - 2015-12-19 21:40:31
|
Revision: 7417 http://sourceforge.net/p/web-erp/reponame/7417 Author: daintree Date: 2015-12-19 21:40:28 +0000 (Sat, 19 Dec 2015) Log Message: ----------- Seach product by supplier item code Modified Paths: -------------- trunk/SelectProduct.php trunk/doc/Change.log trunk/locale/en_US.utf8/LC_MESSAGES/messages.po Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2015-12-14 09:59:18 UTC (rev 7416) +++ trunk/SelectProduct.php 2015-12-19 21:40:28 UTC (rev 7417) @@ -167,26 +167,24 @@ echo '<tr> <th class="number">' . _('Price') . ':</th>'; if (DB_num_rows($PriceResult) == 0) { - echo '<td class="select" colspan="6">' . _('No Default Price Set in Home Currency') . '</td> - </tr>'; + echo '<td class="select" colspan="2">' . _('No Default Price Set') . '</td>'; $Price = 0; } else { $PriceRow = DB_fetch_row($PriceResult); $Price = $PriceRow[1]; - echo '<td class="select">' . $PriceRow[0] . '</td> - <td class="select">' . locale_number_format($Price, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <th class="number">' . _('Cost') . ':</th> - <td class="select">' . locale_number_format($Cost, $_SESSION['StandardCostDecimalPlaces']) . '</td> - <th class="number">' . _('Gross Profit') . ':</th> - <td class="select">'; - if ($Price > 0) { - echo locale_number_format(($Price - $Cost) * 100 / $Price, 1) . '%'; - } else { - echo _('N/A'); - } - echo '</td> - </tr>'; + echo '<td class="select" colspan="2" style="text-align:right">' . locale_number_format($Price, $_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; } + echo '<th class="number">' . _('Cost') . ':</th> + <td class="select" style="text-align:right">' . locale_number_format($Cost, $_SESSION['StandardCostDecimalPlaces']) . '</td> + <th class="number">' . _('Gross Profit') . ':</th> + <td class="select" style="text-align:right">'; + if ($Price > 0) { + echo locale_number_format(($Price - $Cost) * 100 / $Price, 1) . '%'; + } else { + echo _('N/A'); + } + echo '</td> + </tr>'; } //end of if PricesSecuirty allows viewing of prices echo '</table>'; //end of first nested table // Item Category Property mod: display the item properties @@ -302,15 +300,15 @@ } echo '<tr> <th class="number" style="width:15%">' . _('Quantity On Hand') . ':</th> - <td style="width:17%" class="select">' . $QOH . '</td> - </tr>'; -echo '<tr> + <td style="width:17%; text-align:right" class="select">' . $QOH . '</td> + </tr> + <tr> <th class="number" style="width:15%">' . _('Quantity Demand') . ':</th> - <td style="width:17%" class="select">' . locale_number_format($Demand, $myrow['decimalplaces']) . '</td> - </tr>'; -echo '<tr> + <td style="width:17%; text-align:right" class="select">' . locale_number_format($Demand, $myrow['decimalplaces']) . '</td> + </tr> + <tr> <th class="number" style="width:15%">' . _('Quantity On Order') . ':</th> - <td style="width:17%" class="select">' . $QOO . '</td> + <td style="width:17%; text-align:right" class="select">' . $QOO . '</td> </tr> </table>'; //end of nested table echo '</td>'; //end cell of master table @@ -319,10 +317,10 @@ AND (in_array($SuppliersSecurity, $_SESSION['AllowedPageSecurityTokens']))){ echo '<td style="width:50%" valign="top"><table> - <tr><th style="width:50%">' . _('Supplier') . '</th> + <tr><th style="width:20%">' . _('Supplier') . '</th> + <th stlye="width:15%">' . _('Code') . '</th> <th style="width:15%">' . _('Cost') . '</th> <th style="width:5%">' . _('Curr') . '</th> - <th style="width:15%">' . _('Eff Date') . '</th> <th style="width:10%">' . _('Lead Time') . '</th> <th style="width:10%">' . _('Min Order Qty') . '</th> <th style="width:5%">' . _('Prefer') . '</th></tr>'; @@ -330,25 +328,38 @@ suppliers.currcode, suppliers.supplierid, purchdata.price, - purchdata.effectivefrom, + purchdata.suppliers_partno, purchdata.leadtime, purchdata.conversionfactor, purchdata.minorderqty, purchdata.preferred, - currencies.decimalplaces + currencies.decimalplaces, + MAX(purchdata.effectivefrom) FROM purchdata INNER JOIN suppliers ON purchdata.supplierno=suppliers.supplierid INNER JOIN currencies ON suppliers.currcode=currencies.currabrev WHERE purchdata.stockid = '" . $StockID . "' - ORDER BY purchdata.preferred DESC, purchdata.effectivefrom DESC"); + GROUP BY suppliers.suppname, + suppliers.currcode, + suppliers.supplierid, + purchdata.price, + purchdata.suppliers_partno, + purchdata.leadtime, + purchdata.conversionfactor, + purchdata.minorderqty, + purchdata.preferred, + currencies.decimalplaces + ORDER BY purchdata.preferred DESC"); + while ($SuppRow = DB_fetch_array($SuppResult)) { - echo '<tr><td class="select">' . $SuppRow['suppname'] . '</td> - <td class="select">' . locale_number_format($SuppRow['price'] / $SuppRow['conversionfactor'], $SuppRow['decimalplaces']) . '</td> - <td class="select">' . $SuppRow['currcode'] . '</td> - <td class="select">' . ConvertSQLDate($SuppRow['effectivefrom']) . '</td> - <td class="select">' . $SuppRow['leadtime'] . '</td> - <td class="select">' . $SuppRow['minorderqty'] . '</td>'; + echo '<tr> + <td class="select">' . $SuppRow['suppname'] . '</td> + <td class="select">' . $SuppRow['suppliers_partno'] . '</td> + <td class="select" style="text-align:right">' . locale_number_format($SuppRow['price'] / $SuppRow['conversionfactor'], $SuppRow['decimalplaces']) . '</td> + <td class="select">' . $SuppRow['currcode'] . '</td> + <td class="select" style="text-align:right">' . $SuppRow['leadtime'] . '</td> + <td class="select" style="text-align:right">' . $SuppRow['minorderqty'] . '</td>'; if ($SuppRow['preferred']==1) { //then this is the preferred supplier echo '<td class="select">' . _('Yes') . '</td>'; @@ -362,13 +373,18 @@ echo '</table>'; DB_data_seek($result, 0); } -echo '</td></tr></table><br />'; // end first item details table -echo '<table width="90%"><tr> - <th style="width:33%">' . _('Item Inquiries') . '</th> - <th style="width:33%">' . _('Item Transactions') . '</th> - <th style="width:33%">' . _('Item Maintenance') . '</th> - </tr>'; -echo '<tr><td valign="top" class="select">'; +echo '</td> + </tr> + </table> + <br />'; // end first item details table +echo '<table width="90%"> + <tr> + <th style="width:33%">' . _('Item Inquiries') . '</th> + <th style="width:33%">' . _('Item Transactions') . '</th> + <th style="width:33%">' . _('Item Maintenance') . '</th> + </tr> + <tr> + <td valign="top" class="select">'; /*Stock Inquiry Options */ echo '<a href="' . $RootPath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a><br />'; if ($Its_A_Kitset_Assembly_Or_Dummy == False) { @@ -525,14 +541,26 @@ } else { echo '<input type="text" autofocus="autofocus" name="Keywords" title="' . _('Enter text that you wish to search for in the item description') . '" size="20" maxlength="25" />'; } -echo '</td></tr><tr><td></td>'; -echo '<td><b>' . _('OR') . ' ' . '</b>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; -echo '<td>'; +echo '</td> + </tr> + <tr> + <td></td> + <td><b>' . _('OR') . ' ' . '</b>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td> + <td>'; if (isset($_POST['StockCode'])) { echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" title="' . _('Enter text that you wish to search for in the item code') . '" size="15" maxlength="18" />'; } else { echo '<input type="text" name="StockCode" title="' . _('Enter text that you wish to search for in the item code') . '" size="15" maxlength="18" />'; } +echo '<tr> + <td></td> + <td><b>' . _('OR') . ' ' . '</b>' . _('Enter partial') . ' <b>' . _('Supplier Code') . '</b>:</td> + <td>'; +if (isset($_POST['SupplierStockCode'])) { + echo '<input type="text" name="SupplierStockCode" value="' . $_POST['SupplierStockCode'] . '" title="' . _('Enter text that you wish to search for in the supplier\'s item code') . '" size="15" maxlength="18" />'; +} else { + echo '<input type="text" name="SupplierStockCode" title="' . _('Enter text that you wish to search for in the supplier\'s item code') . '" size="15" maxlength="18" />'; +} echo '</td></tr></table><br />'; echo '<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /></div><br />'; echo '</div> @@ -549,7 +577,7 @@ if ($_POST['Keywords'] AND $_POST['StockCode']) { prnMsg (_('Stock description keywords have been used in preference to the Stock code extract entered'), 'info'); } - if ($_POST['Keywords']) { + if (isset($_POST['Keywords']) AND mb_strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; @@ -597,7 +625,7 @@ stockmaster.decimalplaces ORDER BY stockmaster.discontinued, stockmaster.stockid"; } - } elseif (isset($_POST['StockCode'])) { + } elseif (isset($_POST['StockCode']) AND mb_strlen($_POST['StockCode'])>0) { $_POST['StockCode'] = mb_strtoupper($_POST['StockCode']); if ($_POST['StockCat'] == 'All') { $SQL = "SELECT stockmaster.stockid, @@ -643,7 +671,7 @@ stockmaster.decimalplaces ORDER BY stockmaster.discontinued, stockmaster.stockid"; } - } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { + } elseif (isset($_POST['SupplierStockCode']) AND mb_strlen($_POST['SupplierStockCode'])>0) { if ($_POST['StockCat'] == 'All') { $SQL = "SELECT stockmaster.stockid, stockmaster.description, @@ -654,7 +682,57 @@ stockmaster.units, stockmaster.decimalplaces FROM stockmaster + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid LEFT JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE purchdata.suppliers_partno " . LIKE . " '%" . $_POST['SupplierStockCode'] . "%' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.units, + stockmaster.mbflag, + stockmaster.discontinued, + stockmaster.decimalplaces + ORDER BY stockmaster.discontinued, stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.mbflag, + stockmaster.discontinued, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE categoryid='" . $_POST['StockCat'] . "' + AND purchdata.suppliers_partno " . LIKE . " '%" . $_POST['SupplierStockCode'] . "%' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.units, + stockmaster.mbflag, + stockmaster.discontinued, + stockmaster.decimalplaces + ORDER BY stockmaster.discontinued, stockmaster.stockid"; + } + } else { + if ($_POST['StockCat'] == 'All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.mbflag, + stockmaster.discontinued, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster + LEFT JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid, locstock WHERE stockmaster.stockid=locstock.stockid Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2015-12-14 09:59:18 UTC (rev 7416) +++ trunk/doc/Change.log 2015-12-19 21:40:28 UTC (rev 7417) @@ -1,6 +1,7 @@ webERP Change Log -14/12/15 Exson: Remove retrieving allocated data in Z_AutoCustomerAllocations.php. +20/12/15 Phil: SelectProduct.php now allows items to be searched based on the supplier's item code +14/12/15 Exson: Remove retrieving allocated data in Z_AutoCustomerAllocations.php. 11/12/15 Exson: Fixed the default Transaction Disable bug to enable for CustomerBranches.php. 10/12/15 Exson: Add invoice no while reprint GRN in ReprintGRN.php. 10/12/15 Exson: Add multiple work orders total cost inquiry script. Modified: trunk/locale/en_US.utf8/LC_MESSAGES/messages.po =================================================================== --- trunk/locale/en_US.utf8/LC_MESSAGES/messages.po 2015-12-14 09:59:18 UTC (rev 7416) +++ trunk/locale/en_US.utf8/LC_MESSAGES/messages.po 2015-12-19 21:40:28 UTC (rev 7417) @@ -5537,7 +5537,7 @@ #: includes/PDFSuppTransListingPageHeader.inc:48 #: includes/PDFSupplierBalsPageHeader.inc:33 msgid "Supplier" -msgstr "" +msgstr "Vendor" #: ContractCosting.php:180 SuppContractChgs.php:81 msgid "Anticipated" @@ -11620,7 +11620,7 @@ #: EDIProcessOrders.php:437 msgid "This implies that the EDI message is for some other supplier" -msgstr "" +msgstr "This implies that the EDI message is for some other vendor" #: EDIProcessOrders.php:437 msgid "No further processing will be done" @@ -15560,7 +15560,7 @@ #: InventoryPlanningPrefSupplier.php:126 InventoryPlanningPrefSupplier.php:128 msgid "Inventory Planning Based On Lead Time Of Preferred Supplier" -msgstr "" +msgstr "Inventory Planning Based On Lead Time Of Preferred Vendor" #: InventoryPlanningPrefSupplier.php:350 msgid "Nil" @@ -19832,7 +19832,7 @@ #: PO_Header.php:534 msgid "Purchase Order: Select Supplier" -msgstr "" +msgstr "Purchase Order: Select Vendor" #: PO_Header.php:545 msgid "Enter text in the supplier name" |