Quantcast
Channel: Dynamics 365 Business Central/NAV User Group
Viewing all articles
Browse latest Browse all 11285

Forum Post: RE: Current Month "Purch.Order quantity" to next Month

$
0
0
Hi Vijaykumar, SBHaTBNg's suggestion might work, it depends on what you need. His code will show you the order quantity for unposted purchase lines (which is a both requisitions, orders, unposted invoices and credit memo) with a posting date this month. But I think that's not really what you are looking for? But the few time I had a customer asking me for a "Monthly Purchase Order Report", then they needed to see the purchase order quantities for that both, both posted and unposted. In your case, as for what I can read out of your question, then what you need is a report, which shows the purchase order quantities for open orders with an order date in this month, but with an expected receipt date next month? If that is the case, then it get's a bit more complex, as you cannot use the calcsums function. You could do something like this: PROCEDURE GetPurchaseOrderQuantityNextPeriod(CurrentMonthStart,CurrentMonthEnd,NextMonthStart,NextMonthEnd) : Decimal; // Local Vars: OrderQty : Decimal; BEGIN OrderQty = 0; WITH PurchaesLine DO BEGIN SETRANGE("Document Type","Document Type"::Order); SETRANGE("Order Date",CurrentMonthStart,CurrentMonthEnd); IF ISEMPTY THEN EXIT(0); FINDSET; REPEAT IF ("Expected Receipt Date" >= NextMonthStart) AND ("Expected Receipt Date" <= NextMonthEnd) THEN OrderQty += "Outstanding Quantity"; UNTIL NEXT = 0; END; EXIT(OrderQty); END; I expect that you know how to calculate the dates before calling the function. And it's quite easy to change to filter on specific items etc. Save

Viewing all articles
Browse latest Browse all 11285

Trending Articles