JSon Viewer- GSTR2A

Discussion in 'Free Source Codes' started by garima, Feb 10, 2020.

         
  1. garima

    garima Active Member


    JSon Viewer- GSTR2A

    Code:
    [#Menu        : Import Indirect]
        Add    : Key Item    :  After : @@LocBanking    : "JSon Viewer    "    : J : alter    : Rbc_Jsn_Options :  NOT $$IsEmpty:$$SelectedCmps ;AND @@RBC_TM_IsOn
       
       
    
    [System: Variable]
       
        Rbc_jsn_Path     : ""
        Rbc_jsn_File     : ""
        Rbc_jsn_PathFile: ""
    
    [Variable: Rbc_jsn_Path]
        Type: String
        Default: ""   
        Persist: Yes
       
    
    [Variable: Rbc_jsn_File]
        Type: String
        Default: ""   
        Persist: Yes
    
    [Variable: Rbc_jsn_PathFile]
        Type: String
        Default: ""   
        Persist: Yes
           
    [Report: Rbc_jsn_Options]
       
        Form        : Rbc_jsn_Options
        Full Screen    : Yes
    
    [Form: Rbc_jsn_Options]
        No Confirm      : No
        Space Top       : 1
        Space Left      : 1
        Space Right     : 1
        Space Bottom    : 1
      ;  Option          : Medium Size Form
        Height        : 40% Page
        Width        : 60% Page
        Vertical Align  : Centre
       
        Local    : Field    : Rbc_jsn_Import Directory    : Modifies    : Rbc_jsn_Path    : Yes
        ;Local    : Field    : RbcVTopUp  Import Directory    : Variable    : RbcVTopUpExcelPath
       
        Local    : Field    : Rbc_jsn_Import FileName    : Modifies    : Rbc_jsn_File    : Yes
        ;Local    : Field    : RbcVTopUp  Import FileName    : Variable    : RbcVTopUpExcelFile
       
       
        Local: Field: Form SubTitle    : Info    : "Select JSon or Zip file from the List"
       
    
        Part: Rbc_jsn_ImportSet
        On    : Form Accept :  Yes:  Call : LogjSonfileName
        On    : Form Accept: Yes: Form Accept
       
        10        : Log: ##Rbc_jsn_PathFile
    
    [Part: Rbc_jsn_ImportSet]
        Parts    : Rbc_jsn_Import Title, Form SubTitle
        Parts    : Rbc_jsn_Import Details
        Vertical     : Yes
    
    [Part: Rbc_jsn_Import Title]
        Lines    : Rbc_jsn_Import, Rbc_jsn_Import Info
        Space Bottom    : 0.20
    
        [Line: Rbc_jsn_Import]
            Fields          : Form Sub Title
            Local   : Field : Form Sub Title : Info    : $$LocaleString:"RBC JSon file Importing"
                   
        [Line: Rbc_jsn_Import Info]
            Field    : Simple Field
         
            Local   : Field : Simple Field : Info       : $$LocaleString:"(Only Zip/JSon (.zip and .json) Format is Supported)"
            Local   : Field : Simple Field : Full Width : Yes
            Local   : Field : Simple Field : Align      : Centre
    
           
    [Part: Rbc_jsn_Import Details]
            Lines    :   Rbc_jsn_Import Directory, Rbc_jsn_Import FileName
            Space Bottom    : 0.10
            Space Bottom    : 0.20
       
        [Line: Rbc_jsn_Import Directory]
            Field   : Long Prompt, Rbc_jsn_Import Directory
            Local   : Field : Long Prompt    : Info     : $$LocaleString:"Import Directory :"
            Local   : Field : Long Prompt : Alignment: Left
            Local   : Field : Long Prompt : Width : 40
            Space Bottom    : 0.20
           
         [Line: Rbc_jsn_Import FileName]
            Field   : Long Prompt, Rbc_jsn_Import FileName
            Local   : Field : Long Prompt    : Info     : $$LocaleString:"Import File Name (.zip, .json) :"
            Local   : Field : Long Prompt : Alignment: Left
            Local   : Field : Long Prompt : Width : 40
            Space Bottom    : 0.20
            
           
        [Field: Rbc_jsn_Import Directory]
            Use        : Name Field
            Width   : @@MaxNameWidth
            Set as    : ##Rbc_jsn_Path;##RbcVTopUpExcelPath
            Full Width   : Yes
            Style        : Normal 
            Set Always    : Yes
            Storage        : u_RMP_Directory
            Modifies    : Rbc_jsn_Path   
            ;Variable    : RbcVTopUpExcelPath   
            Validate    : NOT $$IsEmpty:$$Value
       
           
        [Field: RBC Medium Prompt]
            Use            : Name Field
            Set as        : ""
            Width         : @@NarrWidth
            Full Width    : Yes
            Style        : Normal
               
       [Field: Rbc_jsn_Import FileName]
            Use        : Name Field
            Width   : @@MaxNameWidth
       
            Full Width   : Yes
            Modifies    : Rbc_jsn_File   
       
            Storage        : u_RMP_FileName   
            Style        : Normal
            Set Always    : Yes
            Table        : RbcJSonList of Files
            Show Table : On Blank
            Validate    : NOT $$IsEmpty:$$Value
        ;    On    : Accept: $$IsEdited: Set  : RbcVTopUpMapSheetSelected : Yes
            On    : Accept:  Yes  : Set:Rbc_jsn_PathFile:##Rbc_jsn_Path+"\"+$$Value
            On     : Accept:  Yes: Field Accept ;($$IsEmpty:##RbcVTopUpExcelType)
           
    
           
       
    [Collection: RbcJSonList of Files]
                Title                : "List of Files : " + ##Rbc_jsn_Path
                Source Collection    : RbcJSon Files Src
                Compute                : Name            : $Name
                Compute                : FileDate        : $LastModifiedDate
                Compute                : FileSize        : $FileSize
                Compute                : IsDirectory    : $IsDirectory
    
                Format                : $Name, 30
                Format                : $FileDate, 15
                Format              : $FileSize, 8
                Format                : @@FileType
                Sub Title            : "File Name", "System Date", "Size", "Type"
                Full Height            : Yes
                Filter                : RBC_JSonAvailableFormatFilter
                Client Only            : Yes
           
    [Collection:RbcJSon Files Src]
    
        Data Source    : Directory    : ##Rbc_jsn_Path
        Filter        :  RBC_JSonOnlyFilesFilter
        Filter        :  RBC_JSonSelectedFormats   
           
        Client Only    : Yes
        Keep Source: Yes
    
    [Function: RbcJSonSupportedFiles]
    
        Parameter    : InFileName    : String
    
        0010        : Do If    :  ##InFileName ENDING WITH "zip" OR ##InFileName ENDING WITH "json": Return    : Yes
       
    [System: Formula]
    
        RBC_JSonOnlyFilesFilter            : NOT $IsDirectory
        RBC_JSonSelectedFormats            :  ($Name ENDING WITH "zip" OR $Name ENDING WITH "json")
        RBC_JSonAvailableFormatFilter    :  If ($Name Containing "~$") Then No Else If ##AutoBRSSFileType = "JSon" Then (##IsJSonFormatSupported AND ($Name ENDING WITH "zip" OR $Name ENDING WITH "json")) Else +
                                Yes
    
    
    
    [Collection    : GSTR2A]
        Data Source    : File JSON: ##Rbc_jsn_PathFile
        JSON Object    : GSTR2ATable
        Fetch    : *.*
    
    [Collection    : XL_GSTR2A]
        Source Collection    : GSTR2A
       
        Walk    : b2b, inv, itms, itm_det
       
            Compute    : CustGSTN     : $$Owner:$$Owner:$$Owner:$ctin
            Compute    : Custcfs    : $$Owner:$$Owner:$$Owner:$cfs
            Compute    : CustName  : $$Owner:$$Owner:$$Owner:$cName
           
            Compute    : val        : $$Owner:$$Owner:$val       
            Compute    : inv_typ    : $$Owner:$$Owner:$inv_typ   
            Compute    : pos        : $$Owner:$$Owner:$pos       
            Compute    : idt        : $$Owner:$$Owner:$idt       
            Compute    : rchrg     : $$Owner:$$Owner:$rchrg    
            Compute    : inum        : $$Owner:$$Owner:$inum       
            Compute    : chksum    : $$Owner:$$Owner:$chksum   
           
            Compute    : num        : $$Owner:$num       
           
            Compute    : samt        : $samt       
            Compute    : rt         : $rt            
            Compute    : txval        : $txval       
            Compute    : camt         : $camt        
    
           
       
        Is ODBC Table    : Yes
       
       
    [Object    :GSTR2ATable]
        Collection    :     b2b        : b2bObject
       
    
    [Object        :     b2bObject]
    
        Storage    :     ctin    : String
        Storage    :    cfs        : String
        Storage    :    cname     : String
               
        Collection    : inv : invObject
               
    [Object    : invObject]
           
        Storage        :  val        : Number
        Storage        :  inv_typ    : String
        Storage        :  pos        : Number
        Storage        :  idt        : String
        Storage        :  rchrg     : String
        Storage        :  inum        : String
        Storage        :  chksum    : String
           
        Collection    : itms    : itmsObject
                   
    [Object    : itmsObject]
        Storage    :     num    : Number
        Collection    : itm_det     : itm_detObject
                               
    [Object: itm_detObject]
       Storage        :  samt    : Amount
       Storage        :  rt     : Number
       Storage        :  txval: Amount
       Storage        :  camt : Amount
     
    Rohit Khedar likes this.


  2. Jenny

    Jenny Active Member


    jsn Data not showing......
     


  3. garima

    garima Active Member


    Sorry for the trouble:

    1. Function definition was missing.. Pasting error
    2. I did not create Report to show the gstr1 collection name XL_GSTR2A in the code, instead to view the table, you can check it in excel with Data-Other Data connection MS Query-Tally-ODBC DSN
    Sorry for my laziness
    3. It does not unzip the file( this means it has to be extracted first ), only .json can be seen
    4. GSTR2A json file is the file which starts with "returns_" contains MonthYear, returntype and GSTN No in the name

    Image attached

    Code:
    [#Menu        : Import Indirect]
        Add    : Key Item    :  After : @@LocBanking    : "JSon Viewer    "    : J : alter    : Rbc_Jsn_Options :  NOT $$IsEmpty:$$SelectedCmps ;AND @@RBC_TM_IsOn
      
      
    
    [System: Variable]
      
        Rbc_jsn_Path     : ""
        Rbc_jsn_File     : ""
        Rbc_jsn_PathFile: ""
    
    [Variable: Rbc_jsn_Path]
        Type: String
        Default: ""  
        Persist: Yes
      
    
    [Variable: Rbc_jsn_File]
        Type: String
        Default: ""  
        Persist: Yes
    
    [Variable: Rbc_jsn_PathFile]
        Type: String
        Default: ""  
        Persist: Yes
          
    [Report: Rbc_jsn_Options]
      
        Form        : Rbc_jsn_Options
        Full Screen    : Yes
    
    [Form: Rbc_jsn_Options]
        No Confirm      : No
        Space Top       : 1
        Space Left      : 1
        Space Right     : 1
        Space Bottom    : 1
      ;  Option          : Medium Size Form
        Height        : 40% Page
        Width        : 60% Page
        Vertical Align  : Centre
      
        Local    : Field    : Rbc_jsn_Import Directory    : Modifies    : Rbc_jsn_Path    : Yes
        ;Local    : Field    : RbcVTopUp  Import Directory    : Variable    : RbcVTopUpExcelPath
      
        Local    : Field    : Rbc_jsn_Import FileName    : Modifies    : Rbc_jsn_File    : Yes
        ;Local    : Field    : RbcVTopUp  Import FileName    : Variable    : RbcVTopUpExcelFile
      
      
        Local: Field: Form SubTitle    : Info    : "Select JSon or Zip file from the List"
      
    
        Part: Rbc_jsn_ImportSet
        On    : Form Accept :  Yes:  Call : LogjSonfileName
        On    : Form Accept: Yes: Form Accept
      
    [Function    : LogjSonfileName]
       
        10        : Log: ##Rbc_jsn_PathFile
       
    
    [Part: Rbc_jsn_ImportSet]
        Parts    : Rbc_jsn_Import Title, Form SubTitle
        Parts    : Rbc_jsn_Import Details
        Vertical     : Yes
    
    [Part: Rbc_jsn_Import Title]
        Lines    : Rbc_jsn_Import, Rbc_jsn_Import Info
        Space Bottom    : 0.20
    
        [Line: Rbc_jsn_Import]
            Fields          : Form Sub Title
            Local   : Field : Form Sub Title : Info    : $$LocaleString:"RBC JSon file Importing"
                  
        [Line: Rbc_jsn_Import Info]
            Field    : Simple Field
        
            Local   : Field : Simple Field : Info       : $$LocaleString:"(Only Zip/JSon (.zip and .json) Format is Supported)"
            Local   : Field : Simple Field : Full Width : Yes
            Local   : Field : Simple Field : Align      : Centre
    
          
    [Part: Rbc_jsn_Import Details]
            Lines    :   Rbc_jsn_Import Directory, Rbc_jsn_Import FileName
            Space Bottom    : 0.10
            Space Bottom    : 0.20
      
        [Line: Rbc_jsn_Import Directory]
            Field   : Long Prompt, Rbc_jsn_Import Directory
            Local   : Field : Long Prompt    : Info     : $$LocaleString:"Import Directory :"
            Local   : Field : Long Prompt : Alignment: Left
            Local   : Field : Long Prompt : Width : 40
            Space Bottom    : 0.20
          
         [Line: Rbc_jsn_Import FileName]
            Field   : Long Prompt, Rbc_jsn_Import FileName
            Local   : Field : Long Prompt    : Info     : $$LocaleString:"Import File Name (.zip, .json) :"
            Local   : Field : Long Prompt : Alignment: Left
            Local   : Field : Long Prompt : Width : 40
            Space Bottom    : 0.20
           
          
        [Field: Rbc_jsn_Import Directory]
            Use        : Name Field
            Width   : @@MaxNameWidth
            Set as    : ##Rbc_jsn_Path;##RbcVTopUpExcelPath
            Full Width   : Yes
            Style        : Normal
            Set Always    : Yes
            Storage        : u_RMP_Directory
            Modifies    : Rbc_jsn_Path  
            ;Variable    : RbcVTopUpExcelPath  
            Validate    : NOT $$IsEmpty:$$Value
      
          
        [Field: RBC Medium Prompt]
            Use            : Name Field
            Set as        : ""
            Width         : @@NarrWidth
            Full Width    : Yes
            Style        : Normal
              
       [Field: Rbc_jsn_Import FileName]
            Use        : Name Field
            Width   : @@MaxNameWidth
      
            Full Width   : Yes
            Modifies    : Rbc_jsn_File  
      
            Storage        : u_RMP_FileName  
            Style        : Normal
            Set Always    : Yes
            Table        : RbcJSonList of Files
            Show Table : On Blank
            Validate    : NOT $$IsEmpty:$$Value
        ;    On    : Accept: $$IsEdited: Set  : RbcVTopUpMapSheetSelected : Yes
            On    : Accept:  Yes  : Set:Rbc_jsn_PathFile:##Rbc_jsn_Path+"\"+$$Value
            On     : Accept:  Yes: Field Accept ;($$IsEmpty:##RbcVTopUpExcelType)
          
    
          
      
    [Collection: RbcJSonList of Files]
                Title                : "List of Files : " + ##Rbc_jsn_Path
                Source Collection    : RbcJSon Files Src
                Compute                : Name            : $Name
                Compute                : FileDate        : $LastModifiedDate
                Compute                : FileSize        : $FileSize
                Compute                : IsDirectory    : $IsDirectory
    
                Format                : $Name, 30
                Format                : $FileDate, 15
                Format              : $FileSize, 8
                Format                : @@FileType
                Sub Title            : "File Name", "System Date", "Size", "Type"
                Full Height            : Yes
                Filter                : RBC_JSonAvailableFormatFilter
                Client Only            : Yes
          
    [Collection:RbcJSon Files Src]
    
        Data Source    : Directory    : ##Rbc_jsn_Path
        Filter        :  RBC_JSonOnlyFilesFilter
        Filter        :  RBC_JSonSelectedFormats  
          
        Client Only    : Yes
        Keep Source: Yes
    
    [Function: RbcJSonSupportedFiles]
    
        Parameter    : InFileName    : String
    
        0010        : Do If    :  ##InFileName ENDING WITH "zip" OR ##InFileName ENDING WITH "json": Return    : Yes
      
    [System: Formula]
    
        RBC_JSonOnlyFilesFilter        : NOT $IsDirectory
        RBC_JSonSelectedFormats        :  ($Name ENDING WITH "zip" OR $Name ENDING WITH "json")
        RBC_JSonAvailableFormatFilter  :  If ($Name Containing "~$") Then No Else If ##AutoBRSSFileType = "JSon" Then (##IsJSonFormatSupported AND ($Name ENDING WITH "zip" OR $Name ENDING WITH "json")) Else +
                                Yes
    
    
    
    [Collection    : GSTR2A]
        Data Source    : File JSON: ##Rbc_jsn_PathFile
        JSON Object    : GSTR2ATable
        Fetch    : *.*
    
    [Collection    : XL_GSTR2A]
        Source Collection    : GSTR2A
      
        Walk    : b2b, inv, itms, itm_det
      
            Compute    : CustGSTN   : $$Owner:$$Owner:$$Owner:$ctin
            Compute    : Custcfs    : $$Owner:$$Owner:$$Owner:$cfs
            Compute    : CustName      : $$Owner:$$Owner:$$Owner:$cName
          
            Compute    : val        : $$Owner:$$Owner:$val      
            Compute    : inv_typ    : $$Owner:$$Owner:$inv_typ  
            Compute    : pos        : $$Owner:$$Owner:$pos      
            Compute    : idt        : $$Owner:$$Owner:$idt      
            Compute    : rchrg         : $$Owner:$$Owner:$rchrg   
            Compute    : inum       : $$Owner:$$Owner:$inum      
            Compute    : chksum        : $$Owner:$$Owner:$chksum  
          
            Compute    : num        : $$Owner:$num      
          
            Compute    : samt       : $samt      
            Compute    : rt         : $rt           
            Compute    : txval      : $txval      
            Compute    : camt       : $camt       
    
          
      
        Is ODBC Table    : Yes
      
      
    [Object    :GSTR2ATable]
        Collection    :     b2b        : b2bObject
      
    
    [Object        :     b2bObject]
    
        Storage    :     ctin    : String
        Storage    :    cfs        : String
        Storage    :    cname     : String
              
        Collection    : inv : invObject
              
    [Object    : invObject]
          
        Storage        :  val        : Number
        Storage        :  inv_typ    : String
        Storage        :  pos        : Number
        Storage        :  idt        : String
        Storage        :  rchrg     : String
        Storage        :  inum        : String
        Storage        :  chksum    : String
          
        Collection    : itms    : itmsObject
                  
    [Object    : itmsObject]
        Storage    :     num    : Number
        Collection    : itm_det     : itm_detObject
                              
    [Object: itm_detObject]
       Storage        :  samt  : Amount
       Storage        :  rt   : Number
       Storage        :  txval: Amount
       Storage        :  camt : Amount
     

    Attached Files:



  4. sattam

    sattam Active Member



  5. sattam

    sattam Active Member

    Jenny likes this.


  6. Jenny

    Jenny Active Member



Share This Page