Current Month "Purch.Order quantity" to next Month

Hi All

I would like to show from this month “Purch.Order quantity” to next month in my Report. Does anyone have any ideas how i can do this?

First have 2 variables Startdate and Enddate both datatype Dates.
Startdate := calcdate(’+CM’,today);
enddate := calcdate(‘1M’,today);
purchaseline.reset;
purhaseline.setcurrentkey(“posting date”);
purchaseline.setrange(“posting date”,startdate,enddate);
purchaseline.calcsums(quantity);
Make sure you have a key and sumindex set for quantity.

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