But the program works as intented the first time [#Menu:Gateway of tally] Add:Key ItemendL:L:Execute:mjpend [Report:mjpend] Auto:Yes Form:mjpend Full Screen:Yes [Form:mjpend] Part:mjpend Width:50 % page On:Form Accept:True:Callensav On:Form Accept:True:Form Accept [Part:mjpend] Linesenl1,penl2,penl6,penl5,penl3,penl4 Local:StyleEFAULT:Height:36 [Lineenl1] Fieldsendinfo,penddate Space Top:5 mms [Fieldendinfo] Style : Normal Bold ;;FullWidth : Yes ;;Border : Thin Bottom Align : Right Skip : Yes Fixed : Yes Set as:"Date:" Width: 50 mms [Fieldenddate] Use:short date field Fixed:Yes Skip:Yes Align:Right Set as:$$SysInfo:Systemdate Full Width:Yes [Lineenl2] Fields:cuin,cuna Space Top:5 mms [Field:cuin] Style : Normal Bold ;;FullWidth : Yes ;;Border : Thin Bottom Align : Right Skip : Yes Fixed : Yes Set as:"Name:" Width: 50 mms [Field:cuna] Use:name field Set Always : Yes Table : Party Ledgers Extract Show Table : Always Dynamic : "" Full Width:Yes [Lineenl3] Fields:adft,adf Space Top:5 mms [Field:adft] Style : Normal Bold ;;FullWidth : Yes ;;Border : Thin Bottom Align : Right Skip : Yes Fixed : Yes Set as:"Debit:" Width: 50 mms [Field:adf] Use:amount field Full Width:Yes Align:Left [Lineenl4] Fields:acft,acf Space Top:5 mms [Field:acft] Style : Normal Bold ;;FullWidth : Yes ;;Border : Thin Bottom Align : Right Skip : Yes Fixed : Yes Set as:"Credit:" Width: 50 mms [Field:acf] Use:amount field Full Width:Yes Align:Left Skip:if $$IsEmpty:#adf then no else yes [Lineenl5] Fieldsennt,penn Space Top:5 mms [Fieldennt] Style : Normal Bold Align : Right Skip : Yes Fixed : Yes Set as:"Narration:" Width: 50 mms [Fieldenn] Use:Narration Field Full Width:Yes [Lineenl6] Fieldsencurt,pencur Space Top:5 mms [Fieldencurt] Style : Normal Bold Align : Right Skip : Yes Fixed : Yes Set as:"Balance:" Width: 50 mms [Fieldencur] Use:amount field Style : Normal Bold Align : Right Skip : Yes Fixed : Yes Set as:$closingbalance:Ledger:#cuna Format : "Symbol,DrCr" Set Always:Yes Width: 50 mms [Functionensav] Variableetate Variableledname:String Variable:lclob:Amount Variableennar:String Variableendeb:Amount Variableencred:Amount Variable:temamt:Amount 00:Setet:#penddate 10:Setledname:#cuna 20:Set:lclob:#pencur 30:Setennar:#penn 40:Setendeb:#adf 50:Setencred:#acf 60:Set:temamt:if $$IsEmpty:##pencred then ##pendeb else ##pencred 110:Start Batch Post:50 120:New Object:Voucher 130:Set Valueate:##pet 140:Set Value:VoucherTypeName:"Journal" 141:Set Value:Narration:##pennar ;;142:Msg Box:"1":"1" 150: INSERT COLLECTION OBJECT : AllLedgerEntries 160:Set Target:AllLedgerEntries[1] 170:SET VALUE : Ledger Name If($$IsEmpty:##pencred) then $$String:##pledname else "##") 180:SET VALUE : IsDeemedPositive : "Yes" 190:SET VALUE : Amount : $$Negative:##temamt 200 : SET TARGET : .. 210 : SET VALUE : PersistedView : ##SVViewName ;;212:Msg Box:"2":"2" 215:INSERT COLLECTION OBJECT : AllLedgerEntries 220:Set Target:AllLedgerEntries[2] 230:SET VALUE : Ledger Name If($$IsEmpty:##pencred) then "##" else $$String:##pledname ) 240:SET VALUE : IsDeemedPositive : "No" 250:SET VALUE : Amount : ##temamt 260 : SET TARGET : .. 270 : SET VALUE : PersistedView : ##SVViewName ;;272:Msg Box:"3":"3" 280 :CREATE TARGET 290:End Batch Post