Problem in Ageing Report
write2sourav
Member Posts: 113
Hi,
I have a report which calculates the ageing balances for customer. The report is outputted in excel format and there are columns for balance values between 1-30 days, 31-60 days,61-90days and >90 days. The problem when i run the report is that most of the balances are coming in one column (1-30 days) and some in 31-60 days, and the remaining columns are taking zero value. Whereas when the report is prepared manually there are values in other columns.
The code for the ageing logic is as follows:
//PSB::START--Creating Aging Structure
PeriodStartDate[1] := "Document Date"-1;
PeriodStartDate[5] := 12319999D;
FOR i := 2 TO 4 DO
PeriodStartDate := CALCDATE('<+30D>',PeriodStartDate[i - 1]);
CustBalanceDueLCY[1]:=0;
CustBalanceDueLCY[2]:=0;
CustBalanceDueLCY[3]:=0;
CustBalanceDueLCY[4]:=0;
FOR i := 1 TO 4 DO BEGIN
DtldCustLedgEntry.RESET;
//DtldCustLedgEntry.SETCURRENTKEY("Customer No.","Cust. Ledger Entry No.","Posting Date");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Customer No.","Customer No.");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Cust. Ledger Entry No.","Entry No.");
//DtldCustLedgEntry.SETRANGE("Posting Date",PeriodStartDate[1],PeriodStartDate[6]);
DtldCustLedgEntry.SETRANGE("Posting Date",PeriodStartDate,PeriodStartDate[i + 1] - 1);
//DtldCustLedgEntry.CALCSUMS(DtldCustLedgEntry."Debit Amount (LCY)");
//CustBalanceDueLCY := DtldCustLedgEntry."Debit Amount (LCY)";
IF DtldCustLedgEntry.FIND('-') THEN
REPEAT
CustBalanceDueLCY:=CustBalanceDueLCY+DtldCustLedgEntry."Debit Amount (LCY)";
UNTIL (DtldCustLedgEntry.NEXT)=0;
END;
CALCFIELDS(Amount);
CALCFIELDS("Amount (LCY)");
CALCFIELDS("Remaining Amount");
intRowNo := intRowNo + 1;
IF Customer.GET("Customer No.") THEN
CustName:=Customer.Name;
IF "Closed at Date"<>0D THEN
NoDaysOverdue:=("Closed at Date"-CALCDATE('+30D',"Document Date"));
IF NoDaysOverdue<0 THEN
NoDaysOverdue:=0;
IF ARAgingReport."Remaining Amount"=0 THEN
FullySettled:=TRUE
ELSE
FullySettled:=FALSE;
can u help me point where i am wrong
I have a report which calculates the ageing balances for customer. The report is outputted in excel format and there are columns for balance values between 1-30 days, 31-60 days,61-90days and >90 days. The problem when i run the report is that most of the balances are coming in one column (1-30 days) and some in 31-60 days, and the remaining columns are taking zero value. Whereas when the report is prepared manually there are values in other columns.
The code for the ageing logic is as follows:
//PSB::START--Creating Aging Structure
PeriodStartDate[1] := "Document Date"-1;
PeriodStartDate[5] := 12319999D;
FOR i := 2 TO 4 DO
PeriodStartDate := CALCDATE('<+30D>',PeriodStartDate[i - 1]);
CustBalanceDueLCY[1]:=0;
CustBalanceDueLCY[2]:=0;
CustBalanceDueLCY[3]:=0;
CustBalanceDueLCY[4]:=0;
FOR i := 1 TO 4 DO BEGIN
DtldCustLedgEntry.RESET;
//DtldCustLedgEntry.SETCURRENTKEY("Customer No.","Cust. Ledger Entry No.","Posting Date");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Customer No.","Customer No.");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Cust. Ledger Entry No.","Entry No.");
//DtldCustLedgEntry.SETRANGE("Posting Date",PeriodStartDate[1],PeriodStartDate[6]);
DtldCustLedgEntry.SETRANGE("Posting Date",PeriodStartDate,PeriodStartDate[i + 1] - 1);
//DtldCustLedgEntry.CALCSUMS(DtldCustLedgEntry."Debit Amount (LCY)");
//CustBalanceDueLCY := DtldCustLedgEntry."Debit Amount (LCY)";
IF DtldCustLedgEntry.FIND('-') THEN
REPEAT
CustBalanceDueLCY:=CustBalanceDueLCY+DtldCustLedgEntry."Debit Amount (LCY)";
UNTIL (DtldCustLedgEntry.NEXT)=0;
END;
CALCFIELDS(Amount);
CALCFIELDS("Amount (LCY)");
CALCFIELDS("Remaining Amount");
intRowNo := intRowNo + 1;
IF Customer.GET("Customer No.") THEN
CustName:=Customer.Name;
IF "Closed at Date"<>0D THEN
NoDaysOverdue:=("Closed at Date"-CALCDATE('+30D',"Document Date"));
IF NoDaysOverdue<0 THEN
NoDaysOverdue:=0;
IF ARAgingReport."Remaining Amount"=0 THEN
FullySettled:=TRUE
ELSE
FullySettled:=FALSE;
can u help me point where i am wrong
0
Comments
-
hi write2sourav,
i think u r deal with statement rpt is it? u can refer to the standard rpt coding...and modify from there..
What i experience b4 is juz modified from the standard one..,
and remember..standard one is juz provide 5 month aging eg: feb, marc, apr, mei, jun. so if u need to display > 5 month then u hv to use variable to store the amount..then display.0 -
Hi,
The above is a newly created report. The existing report in the system(Report 120 IN Version) has not been modified. Can u please say is there any problem with the code.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions