Want to add Cess Amount in Balance Field of Ledger Report

Stivan_dsouza21Stivan_dsouza21 Member Posts: 218
Want to add Cess Amount in Balance Field of Ledger Report.
I Have added the Following Code:

G/L Entry - OnAfterGetRecord()

IF LocationCode <> '' THEN BEGIN
CLEAR(Cess);
PostedStrOrdrDetails.RESET;
PostedStrOrdrDetails.SETRANGE(PostedStrOrdrDetails.Type,PostedStrOrdrDetails.Type::Sale);
PostedStrOrdrDetails.SETRANGE(PostedStrOrdrDetails."Document Type",PostedStrOrdrDetails."Document Type"::Invoice);
PostedStrOrdrDetails.SETRANGE(PostedStrOrdrDetails."Invoice No.",GLEntry."Document No.");
PostedStrOrdrDetails.SETRANGE(PostedStrOrdrDetails."Tax/Charge Type",PostedStrOrdrDetails."Tax/Charge Type"::Charges);
PostedStrOrdrDetails.SETRANGE(PostedStrOrdrDetails."Tax/Charge Group",'Cess');
IF PostedStrOrdrDetails.FINDFIRST THEN
REPEAT
Cess := Cess + PostedStrOrdrDetails.Amount;
UNTIL PostedStrOrdrDetails.NEXT = 0;
END;

IF Amount>0 THEN
TransDebits := TransDebits + Amount;
IF Amount<0 THEN
TransCredits := TransCredits - Amount + Cess;

Cess Amount gets calculated in balance Field.
But if in G/l Entry they are multiple lines against the one Document then it calculates the Cess Amount Multiple times.

Can somebody help me out...... :-k
Thanks & Regards,
Stivan D'souza

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    If you want it to calculate once, why do you need REPEAT?
    try with
    IF PostedStrOrdrDetails.FINDFIRST THEN
      Cess := Cess + PostedStrOrdrDetails.Amount;
    

    PS: Dont use REPEAT with FINDFIRST..use FINDSET
  • Stivan_dsouza21Stivan_dsouza21 Member Posts: 218
    Mohana as u said i have done but then too Cess amount is not getting Calculated.
    Thanks & Regards,
    Stivan D'souza
  • Stivan_dsouza21Stivan_dsouza21 Member Posts: 218
    Below are the Details of Report been Generated:
    Posting Date Document No. Debit Amount Credit Amount Balance
    Opening Balance 2,08,23,965.37 2,08,23,965.37 Cr
    31-05-2011 INV/34/AL/11-12/0074 0 28,519.88 20852485.25
    31-05-2011 INV/34/AL/11-12/0075 0 8,641.56 20861126.81 AFter this Document No. it adding multiple times the Ces Amount
    31-05-2011 INV/34/AL/11-12/0076 0 32,610.64 20894060.34
    31-05-2011 INV/34/AL/11-12/0077 0 14,353.37 20908413.71
    31-05-2011 INV/34/AL/11-12/0078 0 14,223.97 20922778.52

    2,09,21,481.84 2,09,21,481.84 Cr

    Below are details of G/L Entry Table:
    Entry No. G/L Account No. Posting Date Document No. Amount Transaction No.
    2811461 32170100 31-05-2011 INV/34/AL/11-12/0074 -28,237.50 488151
    2811557 32170100 31-05-2011 INV/34/AL/11-12/0075 -8,556.00 488164
    2812005 32170100 31-05-2011 INV/34/AL/11-12/0076 -5,225.00 488230
    2812007 32170100 31-05-2011 INV/34/AL/11-12/0076 -27,062.75 488230

    2812120 32170100 31-05-2011 INV/34/AL/11-12/0077 -14,211.25 488245
    2814196 32170100 31-05-2011 INV/34/AL/11-12/0078 -7,638.75 488444
    2814198 32170100 31-05-2011 INV/34/AL/11-12/0078 -6,444.38 488444
    Thanks & Regards,
    Stivan D'souza
  • Stivan_dsouza21Stivan_dsouza21 Member Posts: 218
    Actual Value of Balance Field in report Should be these:
    2,08,52,485.25
    2,08,61,126.81
    2,08,93,737.45
    2,09,08,090.82
    2,09,22,314.79
    Thanks & Regards,
    Stivan D'souza
Sign In or Register to comment.