hi sindorela use following code CustLedgEntry.RESET; CustLedgEntry.SETCURRENTKEY("Customer No.","Posting Date"); CustLedgEntry.SETRANGE("Customer No.","No."); CustLedgEntry.SETFILTER(CustLedgEntry."posting date",'..%1',startdate); if CustLedgEntry.find('-') then begin Repeat CustLedgEntry.CALCFIELDS(Amount); StartBalance:= StartBalance + CustLedgEntry.Amount; UNTIL CustLedgEntry.NEXT = 0; END; or find my below customization where i have given option on page customer ledger entry to show opening and closing balance of customer TotAmt:=0; OpeningBal:=0; StartDate:=010101D; EndDate:=CALCDATE('-1D',010110D); "Cust.Ledg.Entry".RESET; "Cust.Ledg.Entry".SETCURRENTKEY("Cust.Ledg.Entry"."Customer No.","Cust.Ledg.Entry"."Posting Date"); "Cust.Ledg.Entry".SETRANGE("Cust.Ledg.Entry"."Customer No.","Customer No."); "Cust.Ledg.Entry".SETFILTER("Cust.Ledg.Entry"."Posting Date",'%1..%2',StartDate,EndDate); IF "Cust.Ledg.Entry".FINDFIRST THEN BEGIN REPEAT "Cust.Ledg.Entry".CALCFIELDS("Cust.Ledg.Entry"."Amount (LCY)"); TotAmt :=TotAmt+"Cust.Ledg.Entry"."Amount (LCY)"; OpeningBal:=TotAmt; UNTIL "Cust.Ledg.Entry".NEXT=0; END; EndDate1:=CALCDATE('-1D',010121D); "Cust.Ledg.Entry1".RESET; "Cust.Ledg.Entry1".SETCURRENTKEY("Cust.Ledg.Entry1"."Customer No.","Cust.Ledg.Entry1"."Posting Date"); "Cust.Ledg.Entry1".SETRANGE("Cust.Ledg.Entry1"."Customer No.","Customer No."); "Cust.Ledg.Entry1".SETFILTER("Cust.Ledg.Entry1"."Posting Date",'%1..%2',010110D,EndDate1); IF "Cust.Ledg.Entry1".FINDFIRST THEN BEGIN REPEAT "Cust.Ledg.Entry1".CALCFIELDS("Cust.Ledg.Entry1"."Amount (LCY)"); "Cust.Ledg.Entry1"."Opening Balance":=OpeningBal; "Cust.Ledg.Entry1"."Closing Balance":="Cust.Ledg.Entry1"."Opening Balance"+"Cust.Ledg.Entry1"."Amount (LCY)"; "Cust.Ledg.Entry1".MODIFY; OpeningBal:="Cust.Ledg.Entry1"."Closing Balance"; UNTIL "Cust.Ledg.Entry1".NEXT=0; END;
↧