Auto Update Total field in subform at voucher entry

Discussion in 'Tally Developer' started by Rupal Agarwal, May 22, 2022.

    
  1. Rupal Agarwal

    Rupal Agarwal Member


    Hello everyone,

    I have created a subform that will show the total amount(value) of items according to group(parent) at the sales voucher entry by adding a line above the narration.
    But now I am having an issue that when I am changing the price of the item the value in the subform is changed but the total remains the same, the total is not updating as I update anything in the voucher entry.
    Please can anyone help in providing the correct code so the total will also be updated as I update the amount

    My code is given below with image :

    Code:
    ;;========================================= Part : Narration ====================================================================
    [#Part: DBLLINE Narration]
        Add : Line : Before : Vch Narrprompt : GrpColl
    
    [Line:Grp coll]
         Left Fields:long Prompt,grp coll
         Local:Field:long Prompt : Set as :"Open Group-wise amount details : "
        Local:Field:long Prompt : Width: 20
        Invisible : not @@issales
        Space Bottom:0.2
    
    [Field:grp coll]
        Use                  : Logical Field
        Set as            : if #vchstockitem = $$SysName:EndOfList then no else yes
        Set Always           : Yes
        Show Table           : always
        Sub Forms            : CL Details :$$Value
      
    
    ;;;============================================================================================
    
    [Report:CL Details]
        Form:CL Details
      
    [Form:CL Details]
        Part:CL Details
        Height:25 % screen
        Width: 50% screen
          
    [PART:CL Details]
        Top Line:CLD Title
        Line: CL Details
        Repeat:CL Details:CLD Coll
        Bottom Line: CL Total
        Total:IVOther, IVMachis, IVDetergent, IVWp
        Common Border:Yes
      
    [Line:CLD Title]
        Field:IVT, IVOther, IVMachis, IVDetergent, IVWp
        Local:Field:IVT: Info:"Name"
        Local:Field:IVT: Width:10
        Local:Field:IVother:Info:"Other"
        Local:Field:IVMachis:Info:"Match"
        Local:Field:IVDetergent:Info:"Detergent"
        Local:Field:IVWP:Info:"W P"
        Border:Column titles
      
    [Line:CL Details]
        Field:GRPName, IVOther, IVMachis, IVDetergent, IVWp
        Local:Field:IVT: Info:""
      
    [Field:Grp Name]
        Use:name field
        Set as:$parent
        Width:10
        Skip:Yes
      
    [Field:IVOther]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "oth" then $amount else "-"
        Set Always:yes
    
    [Field:IVMachis]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "machis" then $amount else "-"
        Set Always:yes
      
    [Field:IVDetergent]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "det" then $amount else "-"
        Set Always:yes
      
    [Field:IV WP]
        Width:20
        Align:Center
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "wp" then $amount else "-"
        Set Always:yes
    
    [Line:CL Total]
        Field: IVT,IVOthT, IVMatT, IVDetT, IVWpT
        Border:Column Titles
      
    [Field:IVothT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVOther
        Set Always:yes
    ;    Set as:$Grpoth
        Storage:Grpoth
      
    [Field:IVMatT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVmachis
        Set Always:yes  
        Storage:Grpmat
      
    [Field:IVDetT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVDetergent
        Storage:Grpdet
        Set Always:yes
      
    [Field:IVWpT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVwp
        Storage:Grpwp
        Set Always:yes
      
    [Field:IVT]
        Use:name field
        Set as:"Total"
        Width:10
      
    [System:UDF]
        GrpOth:Number:110
        Grpmat:Number:111
        Grpdet:Number:112
        Grpwp:Number:113
      
    [Collection:CLD Coll]
        Source Collection:default
        Walk:inventory entries
        By:Parent:$parent:STOCKITEM:$stockitemname
        Aggr Compute:amount:Sum:$Amount
        Fetch:billedqty, rate, discount, amount,
        Fetch:*
    Screenshot 2022-05-22 140209.png
     


  2. love

    love Member


    try removing storage from the fields
     


  3. gangstar

    gangstar Member


    Code attached
     

    Attached Files:



  4. Rupal Agarwal

    Rupal Agarwal Member


    thank you for replying buddy but I need to use the total in another report that's why I used the storage.
    Please suggest if any other option is available.
     


  5. Rupal Agarwal

    Rupal Agarwal Member


    if storage is removed then I will not be able to fetch the total value in another report.o_O
     


  6. gangstar

    gangstar Member


    $$Collnumtotal:CollectionName:$Fieldvalue thats all
     


  7. Rupal Agarwal

    Rupal Agarwal Member


    Thanks for replying bro.
    I used this code and this code is showing the total of all the vouchers in my report. but I want the total amount of item group from a particular voucher entry.

    Screenshot 2022-05-23 182150.png Screenshot 2022-05-23 182150.png
     


  8. gangstar

    gangstar Member


    Post your code we will help you Mam
     


  9. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Where and Who ----- is the "Ma'am" here................??? ;);):p:p
     
    gangstar likes this.


  10. Rupal Agarwal

    Rupal Agarwal Member


    it's SIR by the way :)
     


  11. Rupal Agarwal

    Rupal Agarwal Member


    Code:
    [#Menu:gateway of tally]
        Add:key Item:Category Ledger:Y:Alter: CL List
    
    [#Part: DBLLINE Narration]
        Add : Line : Before : Vch Narrprompt : GrpColl
    
    [Line:Grp coll]
         Left Fields:long Prompt,grp coll
         Local:Field:long Prompt : Set as :"Open Group-wise amount details : "
        Local:Field:long Prompt : Width: 20
        Invisible : not @@issales
        Space Bottom:0.2
    
    [Field:grp coll]
        Use                  : Logical Field
        Set as            : if #vchstockitem = $$SysName:EndOfList then no else yes
        Set Always           : Yes
        Show Table           : always
        Sub Forms            : CL Details :$$Value
    
    
    
    
    
    ;;====================================== Group Sum at voucher Report =========================================================================================================================
    
    [Report:CL Details]
        Form:CL Details
      
    [Form:CL Details]
        Part:CL Details
        Height:25 % screen
        Width: 50% screen
          
    [PART:CL Details]
        Top Line:CLD Title
        Line: CL Details
        Repeat:CL Details:CLD Coll
        Bottom Line: CL Total
        Total:IVOther, IVMachis, IVDetergent, IVWp
        Common Border:Yes
      
    [Line:CLD Title]
        Field:IVT, IVOther, IVMachis, IVDetergent, IVWp
        Local:Field:IVT: Info:"Name"
        Local:Field:IVT: Width:10
        Local:Field:IVother:Info:"Other"
        Local:Field:IVMachis:Info:"Match"
        Local:Field:IVDetergent:Info:"Soap"
        Local:Field:IVWP:Info:"W P"
        Border:Column titles
      
    [Line:CL Details]
        Field:GRPName, IVOther, IVMachis, IVDetergent, IVWp
        Local:Field:IVT: Info:""
      
    [Field:Grp Name]
        Use:name field
        Set as:$parent
        Width:10
        Skip:Yes
      
    [Field:IVOther]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "oth" then $amount else "-"
      
    
    [Field:IVMachis]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "machis" then $amount else "-"
      
      
    [Field:IVDetergent]
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "det" then $amount else "-"
      
    
    [Field:IV WP]
        Width:20
        Align:Center
        Use:number field
        Skip:Yes
        Width:20
        Align:Center
        Set as:if $parent:STOCKITEM:$stockitemname contains "wp" then $amount else "-"
      
    
    [Line:CL Total]
        Field: IVT,IVOthT, IVMatT, IVDetT, IVWpT
        Border:Column Titles
      
    [Field:IVothT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$LocaleString:$$Total:IVOther
        Set Always:yes
        Storage:Grpoth
          
    [Field:IVMatT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVmachis
        Set Always:yes  
        Storage:Grpmat
      
    [Field:IVDetT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVDetergent
        Storage:Grpdet
        Set Always:yes
      
    [Field:IVWpT]
        Use:number field
        ;Skip:Yes
        Width:20
        Align:Center
        Set as:$$Total:IVwp
        Storage:Grpwp
        Set Always:yes
      
    [Field:IVT]
        Use:name field
        Set as:"Total"
        Width:10
      
    [System:UDF]
        collgrp:Aggregate:114
        GrpOth:Number:110
        Grpmat:Number:111
        Grpdet:Number:112
        Grpwp:Number:113
      
    [Collection:CLD Coll]
        Source Collection:default
        Walk:inventory entries
        By:Parent:$parent:STOCKITEM:$stockitemname
        Aggr Compute:amount:Sum:$Amount
        Fetch:billedqty, rate, discount, amount,
        Fetch:*
    
    ;;==================================== Category Ledger Party wise ================================================
    
    [Report:CL List]
        Form:CL List
    
    [Form:CL List]
        Part:CL List
        Vertical Align: Top
        On:Form Accept:Yes:Display: Catled
        On:Form Accept:Yes:Form Accept
        No Confirm:Yes
          
    [Part:CL List]
        Line:CL ListT, CL List
      
    [Line:CL ListT]
        Field: Name Field
        Local:Field:Name Field:Info:"Select party name :"
        Local:Field:Name Field:Align:Center
        Local:Field:Name Field:Width:20
        Local:Field:Name Field:Border:Thin Bottom
        Space Bottom:1
       
    [Line:CL List]
        Field:CL List
      
    [Field:CL List]
        Use:Name Field
        Table: partylist
        Show Table:Always
        Modifies:party:Yes
        Width:40
    
    [Collection:partylist]
        Title:"Party List"
        Type:ledger
        Full Height:Yes
        Align:Center
        Format:$name, 20
        Format:$parent, 20
        Child Of:"Sundry debtors"
        Belongs To:Yes
        Sort: $parent
      
    [System: Variable]
        Party:""
      
    [Variable:Party]
        Type: String
    
    ;;======================================  Category ledger Report =================================================================================
    
    [Report:catled]
        Form:catled
        Title:"Category Ledger"
        Set:party:##party
    ;    Set:svfromdate:$$CurrentDate - 11
    ;    set: svtodate: $$CurrentDate
      
    [Form:cat led]
        Top Part:led title
        Part:cat led
        ;Bottom Part:devby
        Height:100% screen
        Width: 100% screen
        Button: Change Period, Print Button,Remove Line, Restore Line, explode flag
          
    ;;========================================== Cat ledger Title ===================================================================
      
    [Part:Led title]
        Line:Led title
      
    [Line:Led title]
        Field:Led title
        Space Bottom:1
    
    [Field:Led title]
        Field:Name field
        Local:Field:Name Field: Info:" CATEGORY LEDGER "
        Local:Field:Name Field: Align:Center
        Local:Field:Name field: Border:thin Bottom
        Local:Field:Name field: Wide Space: Yes
        Local:Field:Name field: Full Width:Yes
        Local:Field:name field: Local:Style:default:Height:15
    
    ;;===================================== Cat led Coll + Filter ========================================================================
    
    [Collection:catcoll]
        Type:vouchers
        Belongs To:yes
        Fetch:amount, date, GrpOth, Grpmat,Grpdet,Grpwp, OpeningBalance, partyledgername, vouchertypename
        Sort: $date
        Filter:party
      
    [System:Formulae]
        party : $partyledgername = ##party
    
    ;;======================================== Cat led Detailed Part ====================================================================================
    
    [Part:cat led]
        Top Line: cattitle, opbal
        Line:cat led
        Repeat:cat led : cat coll
        Scroll:Vertical
    
    [Line:opbal]
        Left Field: short name field, Name field
        Right Field:OpbalAmt,DRCR,date1
        Local:Field:name field:Set as:##Party
        Local:Field:name field:Space Left:5
        Local:Field:name field:Style:NORMAL BOLD
        Local:Field:short name field:Set as:$parent:ledger:#namefield
        Local:Field:Date1:Info:""
        Space Bottom:.05
        Space Top: 0.5
        Border:thin bottom
      
    [Field:OpBalAmt]
        Use:number field  
        Set as:$OpeningBalance:Ledger:#Namefield
        Width:15% screen
        Align:Right
    
    [Line:Catled]
        Field: VchTyp, Crbal,Grpoth, GrpMat, GrpDet, GrpWp
        Right Field:drbal,DRCR,DATE1, ;vchmdate
        Border:thin bottom
        Space Top:0.1
        Space Bottom:0.1
    
    [Field:vchtyp]
        Use:name field
        Set as:$vouchertypename
        Width:10% screen
        Space Left:5
        Invisible: $$InPrintMode
    
    [Field:crbal]
        Use:number field
        Set as: if $$IsReceipt:$vouchertypename then $amount else "-"
        Format:"no zero"
        Width:15% screen
        indent:2
        Style:normal
    
    [Field:grpoth]
        Use:number field ;;; ================================== Extra Payment Field ====================
        Set as:if $$IsPayment:$vouchertypename then $amount else $grpoth
        Align:Center
        Width:15% screen
        Format:"no zero"
        Style:normal
              
    [Field:grpmat]
        Use:number field
        Set as:$grpmat
        Align:Center
        Width:15% screen
        Format:"no zero"
        Style:normal
    
    [Field:grpdet]
        Use:number field
        Set as:$grpdet
        Align:Center
        Width:15% screen
        Format:"no zero"
        Style:normal
    
    [Field:grpwp]
        Use:number field
        Set as:$Grpwp
        Align:Center
        Width:15% screen
        Format:"no zero"
        Style:normal
      
    [Field:dr bal]
        Use:number field
        Set as: if ($$Line = 1) then #OpBalAmt - #crbal + (#grpoth + #grpdet + #grpmat + #grpwp) else $$PrevLine:#drbal - #crbal + (#grpoth + #grpdet + #grpmat + #grpwp)
        Width:15% screen
        Align:Right
        Style:normal
      
    [Field:DRCR]
        Use:Name field
        Width: 3% screen
        Set as: If #drbal < 0 then " C " else ""
        Align:Left
        Style:normal
      
    [Field:Date1]
        Use:short name field
        Set as:if $$DayOfDate:$date < 10 then if $$MonthOfDate:$date < 10 then "0"+ $$String:@date + "/" + "0" + $$String:@month else  "0"+$$String:@date + "/" + $$String:@month else $$String:@date + "/" +$$String:@month
        date:$$DayOfDate:$date
        month:$$MonthOfDate:$date
        Width:10% screen
        Align:Center
        Style:normal
        Space Right:10
    
    ;; ===================================== Cat title line ============================================
    [Line:cat title]
        Field: VchTyp,Crbal, Grpoth, GrpMat, GrpDet, GrpWp
        Right Field:drbal,DRCR,date1
        Local:Field:Vchtyp:Info:"VchTyp"
        Local:Field:crbal:Info:"Cr"
        Local:Field:grpoth:Info:"Other"
        Local:Field:grpmat:Info:"Match"
        Local:Field:grpDet:Info:"Soap"
        Local:Field:grpWp:Info:"W P"
        Local:Field:drbal: Info: "Balance"
        Local:Field:drcr: Info: " "
        Local:Field:date1: Info:"Date"
        ;Local:Field:default:Style:normal bold
        Border:column titles
      
    
    Screenshot 2022-05-24 153747.png Screenshot 2022-05-24 154119.png
     


  12. gangstar

    gangstar Member


    Last Name Aggarwal so that i mentioned Mam Sorry Sir

    all total field mentioned the

    Type:Number:forced
     


  13. gangstar

    gangstar Member


    changed kindly check it Sir
     

    Attached Files:



  14. Rupal Agarwal

    Rupal Agarwal Member


    Thank you so much, buddy. :D
    This is working perfectly.
    Can you please tell the changes made in this?
     


  15. gangstar

    gangstar Member


    Guide me how to compute the date, ledgername & amount in single line Sir/Mam..
     


  16. Rupal Agarwal

    Rupal Agarwal Member


    it's sir by the way :p. Single line as in ??

    I have given the code u can understand by that and still you want to ask u can ask me in direct message we can discuss over there if that will be cool with u.
     


  17. gangstar

    gangstar Member



  18. gangstar

    gangstar Member


    How to get Single Date Report???
     

    Attached Files:



  19. Rupal Agarwal

    Rupal Agarwal Member


    U CAN DO THIS BY :

    Set as:if $name:ledger:$LedgerName contains "(YOUR BANK NAME)" then $amount else "-"

    or

    Set as:if $name:ledger:$PartyLedgerName contains "(YOUR BANK NAME)" then $amount else "-"
     


Share This Page