The Code is working fine if simple sales class but does not work if it is Voucher class View attachment 4839 [#Line : EI Column One] Add : Right Field: After: VCH RateUnitsTitle: OTSCustomerDalaliAmountTitle [Field:OTSCustomerDalaliAmountTitle] Use: Name Field Set as: "Dalali" Align: Centre Skip: Yes Border: Thick Left Right Width:10 Invisible: If @@IsSales then No else Yes [#Line : EI Inv Info] ;; Inventory Repeat Line - - With out Class Add : Right Fields: After : VCH RateUnit: OTSCustomerDalaliAmount [#Line : CI Inv Info] ;; Inventory Repeat Line - - With Class Add : Right Fields: After : VCH RateUnit: OTSCustomerDalaliAmount [Field:OTSCustomerDalaliAmount] Use: Amount Field Width:10 Storage:OTSDalaliAmount Invisible: If @@IsSales then No else Yes [System:UDF] OTSDalaliAmount:Amount:1234 [#Field: EI Value] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change the code as per your requirement in my code the ledger name should contain the word Dalali to get the total SetbyCondition : $LedgerName Contains "Dalali" : $$AsAmount:$$CollAmtTotal:Inventoryentries:$OTSDalaliAmount Set Always: Yes