Problem in Ageing Report

write2sourav
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

Comments

  • teckpoh
    teckpoh Member Posts: 271
    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.
  • write2sourav
    write2sourav Member Posts: 113
    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.