webERP Forum
MRP shortages includes "Service/Labour" items - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: How To ? (/forumdisplay.php?fid=6)
+--- Thread: MRP shortages includes "Service/Labour" items (/showthread.php?tid=8347)



MRP shortages includes "Service/Labour" items - alanmi3833 - 06-28-2019 11:21 PM

How can I prevent the MRPShortages report from showing Service/Labour items that are currently added to a SalesOrder. Have a couple of these Sales Orders, where the client demand that an item code be added to each Labour item, one order have 115 of these items.

Regards


RE: MRP shortages includes "Service/Labour" items - falkoner - 06-29-2019 01:08 AM

Hi Alan, probably the easiest way of achieving this is to change the SQL at approx line 114 of MRPShortages.php to read:

PHP Code:
      $sql "SELECT stockmaster.stockid,
        stockmaster.description,
        stockmaster.mbflag,
        stockmaster.actualcost,
        stockmaster.decimalplaces,
        (stockmaster.materialcost + stockmaster.labourcost +
         stockmaster.overheadcost ) as computedcost,
        demandtotal.demand,
        supplytotal.supply,
       (demandtotal.demand - supplytotal.supply) *
       (stockmaster.materialcost + stockmaster.labourcost +
        stockmaster.overheadcost ) as extcost
           FROM stockmaster
             LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part
             LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part
             LEFT JOIN stockcategory ON stockmaster.categoryid = stockcategory.categoryid "
             
$SQLCategory .
            
"WHERE stockcategory.stocktype<>'L'
             GROUP BY stockmaster.stockid,
               stockmaster.description,
               stockmaster.mbflag,
               stockmaster.actualcost,
               stockmaster.decimalplaces,
               stockmaster.materialcost,
               stockmaster.labourcost,
               stockmaster.overheadcost,
               computedcost,
               supplytotal.supply,
               demandtotal.demand "
               
$SQLHaving .
               
" ORDER BY '" $_POST['Sort'] . "'"

Note the addition of the "WHERE" clause. We should also probably take out any categories from the drop down list where the stocktype is set to "L", (and possibly "D"??) Unless anybody knows of a use case where they should be included?

Tim


RE: MRP shortages includes "Service/Labour" items - alanmi3833 - 06-29-2019 02:26 AM

Hi Tim,
Got an error with
PHP Code:
"WHERE stockcategory.stocktype<>'L' 

Quote:Database Error 1054 :
Unknown column 'stockcategory.stocktype' in 'where clause'

what worked for me were:
PHP Code:
"WHERE stockmaster.mbflag<>'D' 

Regards


RE: MRP shortages includes "Service/Labour" items - falkoner - 06-29-2019 02:36 AM

Hi Alan, I should have mentioned there was also this line added in the SQL:

LEFT JOIN stockcategory ON stockmaster.categoryid = stockcategory.categoryid "

Though your method works just as well!

Tim


RE: MRP shortages includes "Service/Labour" items - alanmi3833 - 06-29-2019 03:50 AM

Thanks Tim,
Yes just missed that one line.