RE: how to create a bucket in nav 2009
Hi Bharat,
Please check if the data (Posted Sales Invoices) exists for the other buckets. Hope the following details helps you to understand the code -
Following code prepare the PeriodStartDate array variable
Report-OnPreReport -
(
EVALUATE(PeriodLength,'<-1M>');
FOR i := 3 TO 5 DO
PeriodStartDate[i] := CALCDATE(PeriodLength,PeriodStartDate[i-1]);
PeriodStartDate[6] := 31129999D;
)
Following Code filters the SalesInvoice and populate the bucket accordingly -
Customer - OnAfterGetRecord()
(
FOR i := 2 TO 5 DO BEGIN
SalesInvHead.SETRANGE("Sell-to Customer No.",Customer."No.");
SalesInvHead.SETRANGE("Posting Date",PeriodStartDate[i],PeriodStartDate[i + 1] - 1);
IF SalesInvHead.FINDFIRST THEN
NoofPstdInvoices[i] := SalesInvHead.COUNT;
END;
)
The following code is to skip the customer who doesn't have any invoice in any bucket -
Customer - OnAfterGetRecord()
(
IF (NoofPstdInvoices[2]=0) AND
(NoofPstdInvoices[3]=0) AND
(NoofPstdInvoices[4]=0) AND
(NoofPstdInvoices[5]=0) THEN
PrintCust:=FALSE;
)