Sustain parent report from filtered report

Discussion in 'Tally Developer' started by Lynch, Feb 6, 2023.

    
  1. Lynch

    Lynch Member


    Dear Members,
    I have written a code for a report generating from collection populated by a json file... I have added a button to it to filter the report... but once the filter is executed... I cant find a way get out of the filter alone... when I press escape at the filter report, entire report closes...
    I could see there are some gaps in the filter report.... but I couldnt get any idea to fulfill the gaps.. so that, I can sustain the parent report..
    d'yu have any logical explanation about how to sustain the parent report?

    a small extract of the code is being attached below.... (its just extract, may throw errors, please let me know if in that case)
    I've attached a zip file containing json file.. please mention the full path in the Collection:GSTRcollecs definition of the below code

    Code:
    [#Menu: GST Reports]
        Add:Item:Online Reports:Menu:GSTR1
        [Menu:GSTR1]
                    Item:B2B:Display:R1B2B
    [Report:R1B2B]
            Use:GST standard Report
            Set:gstrCollecvar:"GSTR1"
            Set:GstrSecCollecvar:"b2b"
            Set:explodevar:No
    [Report: MyFilters]   ;; Auto Report
         Auto    : Yes
        Title    : $$LocaleString:"Filtration Report"
        Help    : @@HlpChangePeriod
       
    [Form:MyFilters]
         No Confirm  : Yes
        Space Left  : 1
        Space Right : 1
        Part        : MyFilters
        FullWidth   : No
        Local       : Field : Default : Case : Normal
       
    [Part: MyFilters]
    
        Line        : Form SubTitle, Plain SubTitle, MyFilters
        Height      : 14
        Scroll      : Vertical
    
        Local       : Field : Form SubTitle     : Info : $$LocaleString:"Range of Information in Report"
        Local       : Field : Plain SubTitle    : Info : $$LocaleString:"(Filter to view only those lines that satisfy the below conditions)"
        Local       : Field : Plain SubTitle    : Style: Small Italic
        Local       : Line  : Form SubTitle     : Space Bottom : 0
        Local       : Line  : Plain SubTitle    : Space Bottom : 0.5
    
       
    [Line: MyFilters]
    
        Fields      : My IFLT Prompt, My IFLT Method, My IFLT Value
        Option      : Small Size Line
        Space Top   : if $$Line = 1 then 0 else 0.5
    [Field:My IFLT Prompt]
        Use:Name Field
        Table:Table Type
        Width:20
        Show Table:Always
        Variable:ifltprom   
        Modifies:ifltprom
       
    [Field: My IFLT Method]
        Info:"equals"
        Width       : 20
        Align       : Right
        Style:Normal Italic
        Skip:Yes
    
    [Field: My IFLT Value]
    
        Use         : Short Name Field
        Width       : 40
        Table        : b2b inum Table
        Variable    : filtermethod
        Modifies    : filtermethod
        Show Table: Always
    
    [!Table:b2b inum Table]
        Title:Type of Information
        Sub Title:"Invoice Number", "GSTIN", "Name", "Taxable value", "Total tax"
        Use:b2bCollection
        Delete:Filter
        Format        : $INVOICE_NUMBER, 20
        Format      : $GSTIN, 20
        Format        : $SUPPLIER_NAME, 40
        Format        : $TOTAL_TAXABLE_VALUE, 10
        Format        : $IGST + $CGST + $SGST + $CESS, 10
        Align       : Centre
        Column Align   : Left, Left, Left, Right, Right
         Keep Source:..
       
    [Table:Table Type]
        Title:"Type of Filter Method"
        List:"GSTIN","Supplier Name", "Invoice number"
    
    [Variable:filter method]
        Type:String
    
    [Report:GST standard Report]
        Form:GST standard form
       
        Variable:SVFromDate, SVTodate, filter method
        Variable    : DBFilterVar
        Filtered    : No
        Set:SVFromDate:$$MonthStart:($$PrevMonth:##SVCurrentDate)
        Set:SVToDate:$$MonthEnd:($$PrevMonth:##SVCurrentDate)
        Local       : Field : Default : Case : Normal
        ;Local : Collection : Default : Add : Filter : myFilter
        [Form:GST standard form]
            Parts:form subtitle, GSTR normal b2b
            Local:Field:form subtitle:Info:##gstrCollecvar + " Reconciliation (" + $$String:##SVFromDate + " -to- " + $$String:##SVTodate + ")"
            Local:Field:form subtitle:Cells:23
           
            Button:F2ChangePeriod, f6Filter
            Key:SetFilterVariable
            Bottom Button:removeline, Restore Line, Restore AllLines, Select AllLines
           
            [Button:f6Filter]
                Key : F6
                Action        : Execute :My Filters
                Title : "Filter"
                Modifier Keys:filter off button
               
            [Key: filter off button]
                Key : Alt + F6
                Title : "Remove Filter"
                Action: Set: filtermethod :""
    
            [Part: GSTR normal b2b]
                Line: GSTR title line, GSTR detail line
                Bottom Line: Gross total line
                Repeat:GSTR detail line:b2b collection
                Scroll:Both
                Total: GSTR TAXABLE VALUE, GSTR IGST, GSTR CGST, GSTR SGST,GSTR CESS, TOTAL TAX, INVOICE TOT VALUE
                Common Border: Yes
    [Line:GSTR detail line]
                    LEFT FIELD: GSTR SNO,  SUPPLIER GSTIN, SUPPLIER GSTR1 FILED, SUPPLIER GSTR1 FILED DATE, SUPPLIER NAME, INVOICE NUMBER, INVOICE DATE, ORIGINAL INVOICE NUMBER, ORIGINAL INVOICE DATE
                    RIGHT FIELD: GSTR TAXABLE VALUE, GSTR IGST, GSTR CGST, GSTR SGST, GSTR CESS, GSTR RATE, TOTAL TAX, INVOICE TOT VALUE, REVERSE CHARGE, PLACE OF SUPPLY,    DOCUMENT TYPE, TAXPAYER TYPE, CUSTID,    SUPPLY  PRD
                    Repeat:SUPPLIER GSTR1 FILED
                   
                [Line:GSTR title line]
                    Use:GSTR detail line
                    Repeat:SUPPLIER GSTR1 FILED
                    Delete:Remove       
                    Local    :    Field    :    Default                        :    Type    :    String
                    Local    :    Field    :    Default                        :    Align    :    Center
                    Local    :    Field    :    Default                        :    Skip    :    Yes
                    Local    :    Field    :    GSTR SNO                    :    Set as    :    "S.No"
                    ;Local    :    Field    :    GSTR SNO                    :    Fixed    :    Yes
                    Local    :    Field    :    SupplierGSTIN                :    Set as    :    "PARTY GSTIN"
                    Local    :    Field    :    SUPPLIER GSTR1 FILED        :    Set as    :    "GSTR1 FILED"
                    Local    :    Field    :    SUPPLIER GSTR1 FILED DATE    :    Set as    :    "GSTR1 FILED DATE"
                    Local    :    Field    :    SUPPLIER NAME                :    Set as    :    "PARTY NAME"
                    Local    :    Field    :    TAXPAYER TYPE                :    Set as    :    "SUPPLY TYPE"
                    Local    :    Field    :    INVOICE NUMBER                :    Set as    :    "INVOICE NUMBER"
                    Local    :    Field    :    INVOICE DATE                :    Set as    :    "INVOICE DATE"
                    Local    :    Field    :    ORIGINAL INVOICE NUMBER        :    Set as    :    "ORIGINAL INVOICE NUMBER"
                    Local    :    Field    :    ORIGINAL INVOICE DATE        :    Set as    :    "ORIGINAL INVOICE DATE"
                    Local    :    Field    :    GSTR TAXABLE VALUE            :    Set as    :    "TAXABLE  VALUE"
                    Local    :    Field    :    GSTRIGST                    :    Set as    :    "IGST"
                    Local    :    Field    :    GSTRCGST                    :    Set as    :    "CGST"
                    Local    :    Field    :    GSTRSGST                    :    Set as    :    "SGST"
                    Local    :    Field    :    GSTR CESS                    :    Set as    :    "CESS"
                    Local    :    Field    :    GSTR RATE                    :    Set as    :    "RATE"
                    Local    :    Field    :    TOTAL TAX                    :    Set as    :    "TOTAL TAX"
                    Local    :    Field    :    INVOICE TOT VALUE            :    Set as    :    "INVOICE TOTAL VALUE"
                    Local    :    Field    :    REVERSE CHARGE                :    Set as    :    "REVERSE CHARGE?"
                    Local    :    Field    :    PLACE OF SUPPLY                :    Set as    :    "PLACE OF SUPPLY"
                    Local    :    Field    :    DOCUMENT TYPE                :    Set as    :    "DOCUMENT TYPE"
                    Local    :    Field    :    CUSTID                        :    Set as    :    "CUSTOMER ID"
                    Local    :    Field    :    SUPPLY  PRD                    :    Set as    :    "SUPPLY  PRD"
                    Border    :   Flush Column Titles
    
               
            [Part:GSTR Bottom part]
                Bottom Line: Gross total line
    
                [Line:Gross total line]
                    Fixed:Yes
                   
                    Use:GSTR detail line
                    Repeat:SUPPLIER GSTR1 FILED
                    Delete:Remove
                    Local    :    Field    :    Default                        :    Full Width: Yes
                    Local    :    Field    :    Default                        :    Type    :    String
                    Local    :    Field    :    GSTR SNO                    :    Set as    :    ""
                    ;Local    :    Field    :    GSTR SNO                    :    Fixed    :    Yes
                    Local    :    Field    :    SupplierGSTIN                :    Set as    :    ""
                    Local    :    Field    :    SUPPLIER GSTR1 FILED        :    Set as    :    ""
                    Local    :    Field    :    SUPPLIER GSTR1 FILED DATE    :    Set as    :    ""
                    Local    :    Field    :    SUPPLIER NAME                :    Set as    :    ""
                    Local    :    Field    :    TAXPAYER TYPE                :    Set as    :    ""
                    Local    :    Field    :    INVOICE NUMBER                :    Set as    :    ""
                    Local    :    Field    :    INVOICE DATE                :    Set as    :    ""
                    Local    :    Field    :    ORIGINAL INVOICE NUMBER        :    Set as    :    ""
                    Local    :    Field    :    ORIGINAL INVOICE DATE        :    Set as    :    ""
                    Local    :    Field    :    GSTR TAXABLE VALUE            :    Set as    :    $$Total:GSTRTAXABLEVALUE;"TAXABLE  VALUE"
                    Local    :    Field    :    GSTRIGST                    :    Set as    :    $$Total:GSTRIGST;"IGST"
                    Local    :    Field    :    GSTRCGST                    :    Set as    :    $$Total:GSTRCGST;"CGST"
                    Local    :    Field    :    GSTRSGST                    :    Set as    :    $$Total:GSTRSGST;"SGST"
                    Local    :    Field    :    GSTR CESS                    :    Set as    :    $$Total:GSTRCESS;"CESS"
                    Local    :    Field    :    GSTR RATE                    :    Set as    :    ""
                    Local    :    Field    :    TOTAL TAX                    :    Set as    :    $$Total:TOTALTAX;""
                    Local    :    Field    :    INVOICE TOT VALUE            :    Set as    :    $$Total:INVOICETOTVALUE;""
                    Local    :    Field    :    REVERSE CHARGE                :    Set as    :    ""
                    Local    :    Field    :    PLACE OF SUPPLY                :    Set as    :    ""
                    Local    :    Field    :    DOCUMENT TYPE                :    Set as    :    ""
                    Local    :    Field    :    CUSTID                        :    Set as    :    ""
                    Local    :    Field    :    SUPPLY  PRD                    :    Set as    :    ""
                   
                   
                    Border:  Flush totals
    
    [Field:GSTR SNO]
        Use:Number Field
        ;Width:5
        Set as:$$Line
        ;Border:thin left
        Full Width    : Yes
       
    [Field:SUPPLIER GSTIN]
        Use:name field
        Width:18
        Set as:$GSTIN
        Border:thin left right
        ;Full Width    : Yes
        ;Invisible:(##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl") or ##GstrSecCollecvar="exp"  or ##GstrSecCollecvar="b2cs" 
        Fixed:Yes
        Quick Search:Yes
    [Field:SUPPLIER GSTR1 FILED]
        Use: Logical Field
        Set as:$GSTR1_FILED
        Border:thin left right
        Width:10
        ;Full Width    : Yes
        ;;Invisible:##gstrCollecvar="e-Invoice" or ##gstrCollecvar="GSTR1"
        ;Invisible:(##gstrCollecvar="e-Invoice" or ##gstrCollecvar="GSTR1" or (##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl")) or ##GstrSecCollecvar="exp"  or ##GstrSecCollecvar="b2cs"
       
    [Field:SUPPLIER GSTR1 FILED DATE]
        Use:Name Field
        Width:15
        Set as:$GSTR1_FILED_Dt
        Border:thin left right
    ;    Full Width    : Yes
        ;Invisible:(##gstrCollecvar="e-Invoice" or ##gstrCollecvar="GSTR1" or (##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl")) or ##GstrSecCollecvar="exp"  or ##GstrSecCollecvar="b2cs"
        ;;Invisible:
    [Field:SUPPLIER NAME]
        Use:name field
        ;Width:@@LongWidth + @@ratewidth + 10
        Width:45
        Border:thin left right
        Set as:if $$IsEmpty:$SUPPLIER_NAME or $SUPPLIER_NAME ="NYTBF" then $SUPPLIER_NAME else $SUPPLIER_NAME
        Full Width:Yes
        Border:thin left right
        ;Full Width    : Yes
        ;Invisible:(##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl") or ##GstrSecCollecvar="exp"  or ##GstrSecCollecvar="b2cs"
       
    [Field:TAXPAYER TYPE]
        Use:Name Field
        Width:18
        Set as:$TYPE
        Border:thin left right
        Full Width    : Yes
        ;Invisible:(##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl") or ##GstrSecCollecvar="exp"  or ##GstrSecCollecvar="b2cs"
       
    [Field:INVOICE NUMBER]
        Use:name Field
        Set as:$INVOICE_NUMBER
        Width:18
        Border:thin left right
        Full Width    : Yes
        ;Invisible:  ##GstrSecCollecvar="b2cs"
    [Field:INVOICE DATE]
        Use:uni date field
        Width:18
        ;Width:@@ShortDateWidth * 2
        Set as:$$Date:$INVOICE_DATE
        Border:thin left right
        Full Width    : Yes
        ;Invisible:  ##GstrSecCollecvar="b2cs"
    [Field:ORIGINAL INVOICE NUMBER]
        Use:name Field
        Set as:$ORIGINAL_INVOICE_NUMBER
        ;Width:35
        Border:thin left right
        Full Width    : Yes
        ;Invisible:##GstrSecCollecvar<>"b2ba";="e-Invoice" or ##gstrCollecvar="GSTR1" or (##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl")
    [Field:ORIGINAL INVOICE DATE]
        Use:uni date field
        Width:18
        Set as:$$Date:$ORIGINAL_INVOICE_NUMBER_DATE
        Border:thin left right
        Full Width    : Yes
        ;Invisible:##GstrSecCollecvar<>"b2ba"
    [Field:GSTR TAXABLE VALUE]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:$$AsAmount:$TOTAL_TAXABLE_VALUE
        Border:thin left right
        Full Width    : Yes   
    
    [Field:GSTR IGST]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:if $$IsEmpty:$IGST then $$AsAmount:0 else $$AsAmount:$IGST
        Border:thin left right
        Full Width    : Yes   
    
    [Field:GSTR CGST]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:if $$IsEmpty:$CGST then $$AsAmount:0 else $$AsAmount:$CGST
        Border:thin left right
        Full Width    : Yes   
        ;Invisible: ##GstrSecCollecvar="exp"
    [Field:GSTR SGST]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:if $$IsEmpty:$SGST then $$AsAmount:0 else $$AsAmount:$SGST
        Border:thin left right
        Full Width    : Yes
        ;Invisible: ##GstrSecCollecvar="exp"
    ;
    [Field:GSTR CESS]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:if $$IsEmpty:$CESS then $$AsAmount:0 else $$AsAmount:$CESS
        Border:thin left right
        Full Width    : Yes
    
    [Field:TOTAL TAX]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth
        Format:"Decimals:2"
        Set as:$IGST + $CGST + $SGST + $CESS
        Border:thin left right
        Full Width    : Yes   
        ;Invisible: ##GstrSecCollecvar="exp"
       
    [Field:GSTR RATE]
        Use:number field
        Align:Right
        Width:5
        Format:"Decimals:0"
        Set as:$GSTR_RATE
        Border:thin left right
        Full Width    : Yes   
        ;Invisible: ##GstrSecCollecvar="exp"
       
    [Field:INVOICE TOT VALUE]
        Use:Amount field
        Align:Right
        Width:@@AmountWidth+5
        Format:"Decimals:2"
        Set as:$TOTAL_TAXABLE_VALUE + $IGST + $CGST + $SGST + $CESS
        Border:thin left right
        Full Width    : Yes
        ;Invisible: ##GstrSecCollecvar="exp"
       
    [Field:REVERSE CHARGE]
        Use: Logical Field
        Width:18
        Set as:$reverse_Charge
        Border:thin left right
        Full Width    : Yes
        ;Invisible:(##gstrCollecvar="e-Invoice" or ##gstrCollecvar="GSTR1" or (##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl")) or ##GstrSecCollecvar="exp" or ##GstrSecCollecvar="b2cs"
    [Field:PLACE OF SUPPLY]
        Use:name field
        Width:18
        Set as:$PLACE_OF_SUPPLY
        Border:thin left
        Full Width    : Yes
        ;Invisible: ##GstrSecCollecvar="exp"
       
    [Field:DOCUMENT TYPE]
        Use:name field
        Set as: $DOC_TYPE
        Border:thin left
        Width:10
        Full Width    : Yes
        ;Invisible: ##GstrSecCollecvar="exp"
    [Field:CUSTID]
        Use:number field
        Width:10
        Set as:$custSN
        Border:thin left right
        Full Width    : Yes
        ;Invisible:(##gstrCollecvar<>"e-Invoice" AND ##gstrCollecvar<>"GSTR1") or ##GstrSecCollecvar="exp" or ##GstrSecCollecvar="b2cs"
    [Field:SUPPLY  PRD]
        Use:name field
        Width:10
        Set as:$SUPPLY_PRD
        Border:thin left right
        Full Width    : Yes
        ;Invisible:(##gstrCollecvar="e-Invoice" or ##gstrCollecvar="GSTR1" or (##gstrCollecvar="GSTR1" and ##GstrSecCollecvar="b2cl")) or ##GstrSecCollecvar="exp" or ##GstrSecCollecvar="b2cs"
    [Collection:GSTRcollecs]
        ; Switch      : FileSrc   : Jsonflsrc       : No;NOT @@IsGSTR2JsonZipFile
        ;Switch      : FileSrc   : JsonZipflsrc    : Yes
        ;Source Collection:JsonZipflsrc
        Data Source:File JSON:$$filejson ; perhaps this function returns the path of the attached json file
        JSON Object Path:"data:1"
        Fetch:*.*, b2b.*;,b2b.inv.*, b2b.inv.itms.*, b2b.inv.items.itm_det.*
        Fetch:cdn.*,b2ba.*,exp.*,cdnr.*,cdnur.*,impgsez.*,b2cl.*,b2cs.*
         
    [Collection:b2b array]
        Source Collection:GSTRcollecs
        Walk:b2b
        Compute:GSTIN:$ctin
        Compute:GSTR1_FILED:if $$IsEmpty:$supfildt then (if $$IsEmpty:$fldtr1 then  No else  Yes) else Yes
        Compute:GSTR1_FILED_Dt:if $$IsEmpty:$supfildt then (if $$IsEmpty:$fldtr1 then  No else  $fldtr1) else $supfildt
        Compute:SUPPLIER_NAME:if $$IsEmpty:$trdnm then (if $$IsEmpty:$trdname then  "lets forget the name, for now.." else  $trdname) else $trdnm;if $$IsEmpty:$trdnm then $$findtrdname else $trdnm
        ;Compute:DOC_TYPE:"Invoice"
        Compute:SUPPLY_PRD:if $$IsEmpty:$supprd then (if $$IsEmpty:$flprdr1 then  No else  $flprdr1) else $supprd
        Fetch:*.*, inv.*, inv.itms.*, inv.itms.itm_det.*
    [Collection:b2bCollection]
       
        Source Collection:b2b array
        Source Var            : partyGSTIN    : String    : $GSTIN
        Source Var            : PartyName    : String    : $SUPPLIER_NAME
        Source Var            : GSTR1_FILED    : Logical    : $GSTR1_FILED
        Source Var            : rtnfileddt    : String    : $GSTR1_FILED_Dt
        Source Var            : SUPPLY_PRD        : String    : $SUPPLY_PRD
        ;Source Var            : DOC_TYPE        : Number    : 0
            Walk:inv
            Compute:GSTIN:##partyGSTIN
            Compute:GSTR1_FILED:##GSTR1_FILED   
            Compute:GSTR1_FILED_Dt:##rtnfileddt
            Compute:SUPPLIER_NAME:##PartyName
            Compute:DOC_TYPE:"Invoice"
                Walk:itms
                    Compute:TYPE:if $$IsEmpty:$typ then $inv_typ else $typ
                    Compute:INVOICE_NUMBER:$inum
                    Compute:INVOICE_DATE:if $$IsEmpty:$idt then $dt else $idt
                    Compute:REVERSE_CHARGE:if $rchrg="Y" then Yes else No
                    Compute:PLACE_OF_SUPPLY:($$getGSTStateName:$$String:$pos)
                    Compute:SUPPLY_PRD:##SUPPLY_PRD
                    By:INVOICE_NUMBER:$inum
                    By:GSTR_RATE:$rt
                        Walk:itm_det
                            By:INVOICE_NUMBER:$inum
                            By:GSTR_RATE:$rt
                            Aggr Compute:TOTAL_TAXABLE_VALUE:Sum:$$AsAmount:$txval
                            Aggr Compute:IGST:Sum:if $$IsEmpty:$iamt then $$InitValue:Amount else $$AsAmount:$iamt
                            Aggr Compute:CGST:Sum:if $$IsEmpty:$camt then $$InitValue:Amount else $$AsAmount:$camt
                            Aggr Compute:SGST:Sum:if $$IsEmpty:$samt then $$InitValue:Amount else $$AsAmount:$samt
                            Aggr Compute:CESS:Sum:if $$IsEmpty:$csamt then $$InitValue:Amount else $$AsAmount:$csamt
                            Aggr Compute:INVOICE_TOTAL:Sum:($TOTAL_TAXABLE_VALUE + $total_tax)
            Filter:myfilter
    
    [System:Formula]
    myfilter:$GSTIN contains ##filtermethod OR $INVOICE_NUMBER contains ##filtermethod OR $SUPPLIER_NAME contains ##filtermethod
    
    
     

    Attached Files:

    Last edited: Feb 6, 2023


Share This Page