2 --- concept is to find the slow moving stock.
5 -- a find the average product sales for the last 3 months.
16 item_descrip1 AS rkey,
20 -- COALESCE(SUM(loccurbal_ending),0)
26 -- location_id = loccurbal_location_id
28 -- loccurbal_itemsite_id = itemsite_id
30 -- location_name NOT LIKE 'Import Goods%'
33 COALESCE(SUM(itemloc_qty),0)
39 location_id = itemloc_location_id
42 itemloc_itemsite_id = itemsite_id
44 location_name NOT LIKE 'Import Goods%'
46 '' = charass_getvalue('C', location_cust_id,'INTERNALCOMPANY')
52 CASE WHEN ( sum(invcitem_billed) / 3 ) > 0 THEN
53 ( sum(invcitem_billed) / 3 )
60 COALESCE(SUM(itemloc_qty),0)
66 location_id = itemloc_location_id
68 itemloc_itemsite_id = itemsite_id
70 location_name NOT LIKE 'Import Goods%'
72 '' = charass_getvalue('C', location_cust_id,'INTERNALCOMPANY')
76 CASE WHEN ( sum(invcitem_billed) / 3 ) > 0 THEN
77 ( sum(invcitem_billed) / 3 )
91 invchead_id = invcitem_invchead_id
96 item_id = invcitem_item_id
101 itemsite_item_id = invcitem_item_id
108 invchead_invcdate >= NOW() - INTERVAL '3 MONTHS'
110 invchead_invcdate <= NOW()
112 invchead_void = false
115 rkey, rkid ,itemsite_id