Need Help GSTStateRateSummary Collection - Sorting, Month-Year Grouping, and Tax Values

Discussion in 'Tally Developer' started by kishan agrawal, May 22, 2025.


  1. I’m working on a TDL report (GSTStateRateSummary) to summarize sales data by month, state, and GST rate, but I’m facing the following issues:

    1. Sorting Issue: The collection is not sorting correctly by Month, State, and GstRate despite using Sort: $Month, $State, $GstRate. The output appears unsorted or jumbled.
    2. Month-Year Grouping: I’m using By: Month: $$String:$$MonthOfDate:$..Date + "-" + $$String:$$YearOfDate:$..Date to group by month-year (e.g., "Jan-2025"). However, I’m unsure if this is the correct way to walk and aggregate data for month-wise totals.
    3. IGST, CGST, SGST Values: The values for IGSTAmt, CGSTAmt, and SGSTAmt (calculated using $$FilterAmtTotal:LedgerEntries:<Filter>:$Amount) are either blank or incorrect. I’m not sure where these values are being fetched from or if my filters (IsOutputIGST, IsOutputCGST, IsOutputSGST) are wrong.
    Here’s my collection code for reference:


    ;; Collection: new_502_SalesVouchers
    [Collection: new_502_SalesVouchers]
    Type : Ledger
    Type : Vouchers : VoucherType
    Child Of : "sales"
    Belongs To : Yes
    Fetch : LedgerEntries.*, LedgerEntries.MasterID, LedgerEntries.AllInventoryEntries.*, LedgerEntries.AllInventoryEntries.BatchAllocations.*,CMPGSTSTATE
    Fetch : InventoryEntries.BankDetVCHnarration, InventoryEntries.TRsportS2, InventoryEntries.vchactbundle
    Fetch : LedgerEntries.STOTRNAME, LedgerEntries.vchpack,CMPGSTSTATE
    Fetch : InventoryEntries.RateDetails.* ;; Added to fetch GST rate details
    Fetch : InventoryEntries.vchpack, InventoryEntries.VCHActBund, InventoryEntries.VCHPacking

    Filter : new_502_withoutgstb2c


    [Collection: GSTStateRateSummary]
    Title : "GST State Rate Summary"
    Source Collection : new_502_SalesVouchers
    Walk : InventoryEntries
    By : Month : $$MonthOfDate:$Date
    By : State : $..PLACEOFSUPPLY
    By : GstRate : $$FilterValue:$GSTRate:RateDetails:First:new_502_IsIGSTRate
    Aggr Compute : TaxableAmt : SUM : $Amount
    Aggr Compute : IGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputIGST:$Amount
    Aggr Compute : CGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputCGST:$Amount
    Aggr Compute : SGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputSGST:$Amount
    ;;Format : $GstRate, "Percentage, NoZero, Decimal:2"
    Sort : $State,$Month



    [System: Formula]
    new_502_IsOutputIGST : $LedgerName Contains "OUTPUT IGST"
    new_502_IsOutputCGST : $LedgerName Contains "OUTPUT CGST"
    new_502_IsOutputSGST : $LedgerName Contains "OUTPUT SGST"
    new_502_Isroundoff : $LedgerName Contains "Round"
    new_502_IsIGSTRate : $GSTRateDutyHead = "IGST"
    new_502_withoutgstb2c : $$IsEmpty:$partygstin
    new_502_withoutgstb2camount : $amount < :100000


    ;; Menu Integration
    [#Menu: Gateway of Tally]
    Add : Item : Before : @@locQuit : new_502_Sales Voucher Report : Display : new_502_SalesVoucherReport

    ;; Report Definition
    [Report: new_502_SalesVoucherReport]
    Form : new_502_SalesVoucherForm
    Title : "new_502_Sales Voucher Report"

    ;; Form Definition
    [Form: new_502_SalesVoucherForm]
    Part : new_502_SalesVoucherPart
    Height : 100% Screen
    Width : 100% Screen
    Button: F2ChangePeriod,Change Company


    ;; Part Definition
    [Part: new_502_SalesVoucherPart]
    Line : new_502_SalesVoucherTitle, new_502_SalesVoucherLine,
    Repeat : new_502_SalesVoucherLine : GSTStateRateSummary
    Scroll : Vertical
    CommonBorder: Yes
    Total : Taxable, IGSTAmount, CGSTAmount, SGSTAmount, RoundOff, InvAmount

    ;; Title Line
    [Line: new_502_SalesVoucherTitle]
    Field : new_502_SalesSNO, new_502_b2cmonth, new_502_b2cstate, new_502_b2cgstrate, new_502_b2ctotalsales,new_502_b2ctotalsalesgstin
    Local : Field : Default : Type : String
    Local : Field : Default : Style : Normal Bold
    Local : Field : Default : Align : Center
    Local : Field : new_502_SalesSNO : Info : "S.No."
    Local : Field : new_502_b2cmonth : Info : "Month"
    Local : Field : new_502_b2cstate : Info : "State"
    Local : Field : new_502_b2cgstrate : Info : "Gst Rate"
    Local : Field : new_502_b2ctotalsales : Info : "Total Sales"
    Border : Column Titles

    ;; Data Line
    [Line: new_502_SalesVoucherLine]
    Field : new_502_SalesSNO, new_502_b2cmonth, new_502_b2cstate, new_502_b2cgstrate, new_502_b2ctotalsales
    ;; Total Line
    [Line: new_502_SalesVoucherTotal]
    Field : new_502_SalesTotalLabel, new_502_SalesTaxableTotal, new_502_SalesIGSTTotal, new_502_SalesCGSTTotal, new_502_SalesSGSTTotal, new_502_SalesRoundOffTotal, new_502_SalesInvAmountTotal
    Local : Field : Default : Style : Normal Bold
    Border : Thin Top

    ;; Field Definitions
    [Field: new_502_SalesSNO]
    Use : Number Field
    Set as : $$Line
    Width : 5
    Align : Center
    Border : Thin Left

    [Field: new_502_b2cmonth]
    Use : naME Field
    Set as : $Month
    Width : 10
    Align : Center
    Border : Thin Left

    [Field: new_502_b2cstate]
    Use : Name Field
    Set as : $state
    Width : 10
    Align : Center
    Border : Thin Left

    [Field: new_502_b2cgstrate]
    Use : Name Field
    Set as : $GstRate
    Width : 10
    Align : Center
    Border : Thin Left

    [Field: new_502_b2ctotalsales]
    Use : Name Field
    Set as : $TaxableAmt
    Width : 10
    Align : Left
    Border : Thin Left

    [Field: new_502_b2ctotalsalesgstin]
    Use : Name Field
    Set as : $CGSTAmt
    Width : 12
    Align : Left
    Border : Thin Left

    upload_2025-5-22_19-20-45.png
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Sort : $$Default : $State,$Month
     
    kishan agrawal likes this.



  3. HOW TO DO THIS ?

    Month-Year Grouping
    :
     



  4. Problem 2 Solved (Month-Year Grouping):

    Fixed! Now grouping & sorting works correctly:

    • Display: "2025 Jan" format

    • Sorting: Uses numeric month for proper order
    No further changes needed.




    [Collection: GSTStateRateSummary]
    Title : "GST State Rate Summary"
    Source Collection : new_502_SalesVouchers
    Walk : InventoryEntries

    By : PeriodYear : $$YearOfDate:$Date
    By : PeriodMonth : $$FullMonthName:$Date
    By : MonthDate : $New_502_VoucherYearMonth
    By : Month : $$ZeroFill:mad:@New_502_VoucherMonthNumber:2
    By : State : $..PLACEOFSUPPLY
    By : GstRate : $$FilterValue:$GSTRate:RateDetails:First:new_502_IsIGSTRate
    Aggr Compute : TaxableAmt : SUM : $Amount
    Aggr Compute : IGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputIGST:$Amount
    Aggr Compute : CGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputCGST:$Amount
    Aggr Compute : SGSTAmt : SUM : $$FilterAmtTotal:LedgerEntries:new_502_IsOutputSGST:$Amount
    Sort : @@Default :$PeriodYear,$Month,$State,$GstRate
    Keep Source : ().

    [#Object : Voucher]
    New_502_VoucherYearMonth : $$String:mad:@New_502_VoucherYear + $$ZeroFill:mad:@New_502_VoucherMonthNumber:2

    [System : Formula]
    New_502_VoucherYear : $$YearOfDate:$Date
    New_502_VoucherMonth : $$MonthOfDate:$Date
    New_502_VoucherMonthNumber : $$String:mad:@New_502_VoucherMonth

    new_502_IsOutputIGST : $LedgerName Contains "OUTPUT IGST"
    new_502_IsOutputCGST : $LedgerName Contains "OUTPUT CGST"
    new_502_IsOutputSGST : $LedgerName Contains "OUTPUT SGST"
    new_502_Isroundoff : $LedgerName Contains "Round"
    new_502_IsIGSTRate : $GSTRateDutyHead = "IGST"
    new_502_withoutgstb2c : $$IsEmpty:$partygstin
    new_502_withoutgstb2camount : $amount < :100000


    upload_2025-5-23_11-14-12.png
     


Share This Page