Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MRP shortages includes "Service/Labour" items
06-28-2019, 11:21 PM,
#1
MRP shortages includes "Service/Labour" items
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
Reply
06-29-2019, 01:08 AM, (This post was last modified: 06-29-2019, 01:13 AM by TimSchofield.)
#2
RE: MRP shortages includes "Service/Labour" items
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
Reply
06-29-2019, 02:26 AM,
#3
RE: MRP shortages includes "Service/Labour" items
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
Reply
06-29-2019, 02:36 AM,
#4
RE: MRP shortages includes "Service/Labour" items
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
Reply
06-29-2019, 03:50 AM,
#5
RE: MRP shortages includes "Service/Labour" items
Thanks Tim,
Yes just missed that one line.

Reply
09-02-2019, 01:37 AM,
#6
RE: MRP shortages includes "Service/Labour" items
I suddenly discovered while working through some old stuff that I had never committed this fix, so I have done so now, and added a pull request

Tim
Reply
09-02-2019, 09:19 AM,
#7
RE: MRP shortages includes "Service/Labour" items
I pulled that Tim, thanks!
Reply
09-02-2019, 04:48 PM,
#8
RE: MRP shortages includes "Service/Labour" items
Thanks Paul
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)