Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MRP shortages includes "Service/Labour" items
06-28-2019, 11:21 PM
Post: #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
Find all posts by this user
Quote this message in a reply
06-29-2019, 01:08 AM (This post was last modified: 06-29-2019 01:13 AM by falkoner.)
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
06-29-2019, 02:26 AM
Post: #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
Find all posts by this user
Quote this message in a reply
06-29-2019, 02:36 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
06-29-2019, 03:50 AM
Post: #5
RE: MRP shortages includes "Service/Labour" items
Thanks Tim,
Yes just missed that one line.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)