Needed sum of all Credit Entries in a ledger

Discussion in 'Free Source Codes' started by SRIKANTH SARE, Sep 30, 2023.

    
  1. SRIKANTH SARE

    SRIKANTH SARE New Member


    Dear Sir,

    I'm a Beginner in coding,
    The Below will fetch the data of Last Receipt date and closing balance of ledger.
    My requirement is to get sum of all Credit Entries (either Receipt or journal entries) in a ledger.

    Help me in coding to get desired results.
    Code:
    [#Menu: Gateway of Tally]
        Add     : Button : MyVoucherTypeBook
     
    [Button: MyVoucherTypeBook]
     
        Title    : "Collection from Customer Summary"
        Key      : F5
        Action   : Display Collection : LedgerColl             ;;;; groupnameLedgerColl ;;;;
    
    [Collection:LedgerColl]
    
        Title        : "List of Groups"                 ;;;; groupname Groups ;;;;
        Type         : Group
        Align        : Center
        Format       : $Name , 25
        Format       : $Parent, 15
        Format       : $OpeningBalance, 10
        Format       : $ClosingBalance, 12
        Sub Title    : "Group Name", " Parent", "Open. Balance","Closing Balance"
        Trigger      : TrigerGrpItemColl
        Variable     : VarGrpItem ;; to bridge between collection and display report
        Report       : DisplayGrpItem
        Filter       : GrpFilter
     
        [Report:TrigerGrpItemColl]
         
        Form:TrigerGrpItemColl
        Title: "Select Stock Item Name"
    
        [Form:TrigerGrpItemColl]
             
        Part:TrigerGrpItemColl
        Vertical Align        : Top
        Horizontal Align      : Center
             
        [Part:TrigerGrpItemColl]
                 
        Line:TrigerGrpItemColl
                 
        [Line:TrigerGrpItemColl]
                 
        Field:TrigerGrpItemColl
                     
        [Field:TrigerGrpItemColl]
                         
        Table        : LedgerColl                     ;;;; groupnameLedgerColl ;;;;
        Modifies     : VarGrpItem
        Show Table   : Always ;;show the table always
        Width        : 45
        Max          : 256 ;;Allows to type 50 charactor, by defualt it is only 1 charactor
                 
    ;;End of TrigerReport
    
    ;;Start Final Display Report
    [Report:DisplayGrpItem]
         
            Form        : DisplayGrpItem
            ;Object     : Ledger               : ##VarGrpItem ;; to bridge between collection and display report
            Title       : "Ledger Under          : " + ##VarGrpItem
            Variable    : SVFromDate, SVToDate,
            Set         : SVfromDate             : $$YearOfDate:##SvCurrentdate ;$$Monthstart:##SvCurrentdate
            ;Set        : LedgerName             : ##LedgerName
            Variable    : IsMultiPage, InNewPages,
            Set         : IsMultiPage           : yes
            Set         : InNewPages             : yes
            Set         : SVToDate               : ##SVCurrentdate
     
            [Form:DisplayGrpItem]
                Use     : DSP Template
                Part    : HeadingPart, DisplayGrpItem, DevBottPart
                Width   : 100% screen
                Height  : 100% screen
             
            [Part: HeadingPart]
                Line    : HeadingPart,
             
                [Line:HeadingPart]
                    Field:HeadingPart
                 
                    [Field:HeadingPart]
                     
                    Use          : Name field
                    Set as       : $$LocaleString:"Statement for the period: From " + $$String:##SVFromDate + " To " + $$String:##SVToDate
                    Align        : Center
                    Full Width   : Yes
                    Local        : Style        : Defualt    : Height    : 20
                    Color        : Black
                    Style        : large bold
                    Background   : Light Surf Green
                     
    [Part:DevBottPart]
        Line:DevBottPart
        Background: Dark Green
     
    [Line:DevBottPart]
        Field:DevBottPart
     
    [Field:DevBottPart]
        Info        : "(This is a customised report, developed by Mr. sri CA nth sare)"
        Align       : Center
        Full Width  : Yes
        Local       : Style    :Defualt    :Height    :27
        Color       : Black
        Style       : Tiny Small ;Small Prompt;large bold
        Background  : Light Surf Green;Light Sea Green;CalcBGClr
        ;Border     : Thin Top
        Invisible   : NOT ($$InPrintMode OR $$InExportMode OR $$InMailAction) OR ($$InCreateMode OR $$InAlterMode)
        Invisible   : ($$InPrintMode OR $$InExportMode OR $$InMailAction) OR ($$InCreateMode OR $$InAlterMode)
    
                [Part:DisplayGrpItem]
                    Line           : DisplayGrpItemTitle,DisplayGrpItem
                    Bottom Line    : DisplayGrpItemTotal
                    Repeat         : DisplayGrpItem : MyLedgerColl
                    Scroll         : Vertical
                    Common Border  : Yes
                    Total          : DisplayGrpItem, DisplayGrpItemClBalDr, DisplayGrpItemClBalCr
                 
                    [Line:DisplayGrpItemTitle]
                        Use      : DisplayGrpItem 
                        Local    : Field    : DisplayGrpItem                 : Info: "Ledger Name"
                        Local    : Field    : DisplayGrpItemOpBal            : Info: "Opening Balance"
                        Local    : Field    : DisplayGrpItemLastBillVchType  : Info: "Last Receipt Voucher Type"
                        Local    : Field    : DisplayGrpItemLastBillVchAmt   : Info: "Last Receipt Amount"
                Local    : Field    : DisplayGrpItemLastBillDate     : Info: "Last Receipt Date"                 
                        Local    : Field    : DisplayGrpItemClBalCr          : Info: "Closing Balance (Cr.)"
                Local    : Field    : DisplayGrpItemClBalDr          : Info: "Closing Balance (Dr.)"
                        Local    : Field    : Default                        : Style    : Normal Bold
                        Local    : Field    : Default                        : Line     : 0
                        Local    : Field    : Default                        : Align    : Center
                        Border   : Thick Top Bottom
                     
                        [Line:DisplayGrpItemTotal]
    
                            use       : DisplayGrpItem
                            Border    : Totals
                            Local     : Field : Default                         : Style      : Normal Bold
                            Local     : Field : Default                         : Type       : String
                            Local     : Field : DisplayGrpItem                  : Set As     : "Total"
                            Local     : Field : DisplayGrpItemLastVchAmt        : Set As     : ""
                            Local     : Field : DisplayGrpItemLastBillDate      : Set As     : ""
                Local     : Field : DisplayGrpItemClBalDr           : Set As     : $$Total:DisplayGrpItemClBalDr
                            Local     : Field : DisplayGrpItemClBalCr           : Set As     : $$Total:DisplayGrpItemClBalCr
    
                        [Line:DisplayGrpItem]
                            Field      : DisplayGrpItem, DisplayGrpItemOpBal, +
                                         DisplayGrpItemLastBillVchType, DisplayGrpItemLastBillVchAmt, DisplayGrpItemLastBillDate
                            Right Field: DisplayGrpItemClBalCr, DisplayGrpItemClBalDr
                        ;Key        : LineObjectEnterAlter, LineClickObjectEnterAlter
                         Key       : MyLedger
    
                        [Field:DisplayGrpItem]
                            Use       : Name Field 
                            Set as    : $Name
                            Width     : 45
                            Border    : Thin Left
                Option    : Alter on Enter
                Alter     : Ledger
                Variable  : Ledger Name
                Display   : Ledger Vouchers
     
    ;;;;;;;BILL/RECEIPT SECTION;;;;;;;
              
                [Field:DisplayGrpItemOpBal]
                            Use        : Amount Field 
                            Set as     : $OpeningBalance
                            Width      : 15
                            Border     : Thin Left
                            Format     : "DrCr"
    
                        [Field:DisplayGrpItemLastBillVchType]
                            Use        : Name Field 
                            Set as     : $$CollectionField:$VoucherTypeName:1:AllRcptVchrs
                            Border     : Thin Left Right
                            Width      : 15
                Align      : Center
                         
                        [Field:DisplayGrpItemLastBillVchAmt]
                            Use        : Amount Field 
                            Set as     : $$CollectionField:$Amount:1:AllRcptVchrs
                            Border     : Thin Left Right
                            Width      : 15
                            ;Format    : "DrCr"
              
                [Field:DisplayGrpItemLastBillDate]
                            Use        : Uni Date Field 
                            Set as     : $$CollectionField:$Date:1:AllRcptVchrs;$LastVoucherDate ;
                            Border     : Thin Left Right
                            Width      : 15
                Align      : Center
     
    ;;;CLOSING BALANCE;;;;;;;;;;;
    
                        [Field:DisplayGrpItemClBalCr]
                            Use        : Amount Field 
                            Set as     : If NOT $$IsDr:$ClosingBalance Then $ClosingBalance Else $$AsAmount:0
                            Border     : Thin Left Right
                            Width      : 15
                ;Format    : "DrCr"
              
                [Field:DisplayGrpItemClBalDr]
                            Use        : Amount Field 
                            Set as     : If $$IsDr:$ClosingBalance Then $ClosingBalance Else $$AsAmount:0
                            Border     : Thin Left
                            Width      : 15 
                            ;Format    : "DrCr"
    
    ;;;;;;;;;;;;;;;;LEDGER COLL;;;;;;;;;
    [Collection:MyLedgerColl]
        Type        : Ledger
        Filter        : MyLedFilter
        Fetch        : VoucherTypeName, *.*
    
    ;;;;All Vouchers COLL;;;;;;;;;; 
    [Collection:AllVchrsSrc]
        Type               : Vouchers : Ledger
        Child Of           : #DisplayGrpItem
        Belongs To         : Yes
        Fetch              : Amount, Date, VoucherTypeName
      
    ;;;;RECEIPT COLL;;;;;;;;;; 
    [Collection:AllRcptVchrs]
        Source Collection  : AllVchrsSrc
        Walk               : LedgerEntries
        Compute            : Date                         : $$Owner:$Date
        Compute            : VoucherTypeName            : $$Owner:$VoucherTypeName
        Compute            : LedgerName                : $LedgerName
        Compute            : Amount                    : $Amount
        ;Fetch             : Amount, Date, VoucherTypeName
        Sort               : Default             : -$Date
        Filter             : MyRcptEntries
     
    [Variable:VarGrpItem]
        Type:String
    
    [System: Variables]
        VarGrpItem       : ""
             
    [System: Formulae]
        MyLedFilter      :  $ClosingBalance >= 0 AND $Parent = ##VarGrpItem
     
        MyRcptEntries    :  ($$IsReceipt:$VoucherTypeName) AND $LedgerName =  #DisplayGrpItem ;)
     
        GrpFilter        :  $Name Contains "" ;;;; " group name ";;;;
     

    Attached Files:

    • 1.png
      1.png
      File size:
      257.5 KB
      Views:
      39
    • 2.png
      2.png
      File size:
      165.8 KB
      Views:
      38


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    In your collection -- compute the value --- If RcptVchType or jrnlVchtype then $Amount else 0

    Then use Function CollAmtTotal in your Field.
     
    psr likes this.


  3. SRIKANTH SARE

    SRIKANTH SARE New Member


    Hi Sir,

    As per your suggestion the results are blank
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    As per my suggestions - the results are coming. **note:- I have only included Receipt Vchrs only.

    Capture.PNG
     


  5. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You already have computed the AMOUNT in the collection -- AllRcptVchrs --- so use CollAmtTotal in your Field.

    As a learner -- check collAmtTotal in Developer and use it - it is not that hard.
     


  6. SRIKANTH SARE

    SRIKANTH SARE New Member


    I have tried but failed
    i'll learn
    i dont know the exact reason i'm unable to activate my existing license in tally developer.

    kindly tell me exactly where the changes need to be made.

    need to change the code to get the last entry date (whether it is receipt or journal) and total of all credit entries (whether it is receipt or journal)

    i'm learning tally Tdl https://www.youtube.com/playlist?list=PLxJfBA3tV7X5rhgj5hYxRe4RQy35rTFx4. through this youtube channel.

    kindly help me and sugget any other ways to learn
     


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Add a column to your Report for "Total Receipts" -- add in Title as well as Body.

    In that Field --- Set As : $$CollAmtTotal:AllRcptVchrs:$Amount

    make similar Collection for Journal Vouchers as you have done for AllRcptVchrs but of Journal VchType.
    In this Collection compute the amount --- compute : JVAmt : If NOT $$IsDr:$Amount then $amount else 0

    Then modify the above field to Set As : $$CollAmtTotal:AllRcptVchrs:$Amount + $$CollAmtTotal:AllJrnlVchrs:$JVAmt
     


Share This Page