Read All JSON File

Discussion in 'Free Source Codes' started by Jenny, Feb 15, 2020.

         
Tags:
  1. Jenny

    Jenny Active Member


    All of developers please correct my code ....

    1. Ledger name not showing (i want to if json gstin no = default tally data (ledger gstin no) then showing that ledger name

    2. bottom total not working

    3. if one sales bill and different taxes then its showing twice or more as per json file ( i want to combine it as per voucher no)

    4. if any other modification as per uses please do it...

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    This code is working all json (.zip) format only.

    Code:
    [Collection    : JsonUsersColl]
        Data Source:File JSONZip: ##Jenny_jsn_PathFile
        JSON Object Path:b2b:1
        fetch: ctin,cfs,itms.*,num.*,itm_det.*,inv.*,b2b.*
        Fetch : *.*
        Client Only:Yes
       
       
    [Collection: JennyJsonUsersColl]
    
    Source Collection: JsonUsersColl
    fetch: ctin,cfs,itms.*,num.*,itm_det.*,inv.*,b2b.*
    Fetch : *.*
    Walk :inv;,itms;b2b;
    Compute: cfsstat:$cfs
    
    Walk :itms
    
    Walk :itm_det
    
    Compute:idt:$idt
    Compute:inum:$inum
    Compute:val:$val
    Compute :txval:$txval
    Compute :iamt:$iamt
    Compute :camt:$camt
    Compute :samt:$samt
    
    Filter    : jennyAllfilter
    
    [Collection: JennyJsonUsersColl1]
    Source Collection: JennyJsonUsersColl
    fetch: ctin,cfs,itms.*,num.*,itm_det.*,inv.*,b2b.*
    Fetch : *.*
    Client Only:Yes
    Walk :inv
    Compute:val:$$AsAmount:$val
    Compute:idt:$idt
    Compute:inum:$inum
    Walk :itms
    
    Walk :itm_det
    Compute: txval :$$AsAmount:$txval
    Compute: iamt :$$AsAmount:$iamt
    Compute: camt :$$AsAmount:$camt
    Compute: samt :$$AsAmount:$samt
    
    Compute    : ctin :$$String:$ctin
    
    [#Object    : inv]
        Storage            :  val       : Number
        Storage            :  inv_typ   : String
        Storage            :  pos       : Number
        Storage            :  idt       : String
        Storage            :  rchrg     : String
        Storage            :  inum      : String
        Storage            :  chksum    : String
       
    [Object    : itms]
        Storage            :  num         : Number
     
    [Object: itm_det]
       Storage        :  samt  : Amount
       Storage        :  rt    : Number
       Storage        :  txval : Amount
       Storage        :  camt  : Amount
      
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
    [System: Variable]
        Jenny_jsn_Path     : ""
        Jenny_jsn_File     : ""
        Jenny_jsn_PathFile : ""
    
    [Variable: Jenny_jsn_Path]
        Type: String
        Default: "" 
        Persist: Yes
     
    
    [Variable: Jenny_jsn_File]
        Type: String
        Default: "" 
        Persist: Yes
    
    [Variable: Jenny_jsn_PathFile]
        Type: String
        Default: "" 
        Persist: Yes
       
    [Button: Jsonfilepath]
        Title: Upload JSON
        Key: Alt+J
        Action : Alter: Jenny_jsn_Options
         
    [Report: Jenny_jsn_Options]
        Form        : Jenny_jsn_Options
        Full Screen    : Yes
       
    [Form: Jenny_jsn_Options]
        No Confirm      : No
        Space Top       : 1
        Space Left      : 1
        Space Right     : 1
        Space Bottom    : 1
        Height        : 40% Page
        Width        : 60% Page
        Vertical Align  : Centre
     
        Local    : Field    : Jenny_jsn_Import Directory    : Modifies    : Jenny_jsn_Path    : Yes
        Local    : Field    : Jenny_jsn_Import FileName    : Modifies    : Jenny_jsn_File    : Yes
        Local: Field: Form SubTitle    : Info    : "Select Zip file from the List"
       
        Part: Jenny_jsn_ImportSet
        On    : Form Accept: Yes: Form Accept
     
    [Part: Jenny_jsn_ImportSet]
        Parts    : Jenny_jsn_Import Title, Form SubTitle
        Parts    : Jenny_jsn_Import Details
        Vertical     : Yes
    
    [Part: Jenny_jsn_Import Title]
        Lines    : Jenny_jsn_Import, Jenny_jsn_Import Info
        Space Bottom    : 0.20
    
        [Line: Jenny_jsn_Import]
            Fields          : Form Sub Title
            Local   : Field : Form Sub Title : Info    : $$LocaleString:"JSon file Importing"
                 
        [Line: Jenny_jsn_Import Info]
            Field    : Simple Field
       
            Local   : Field : Simple Field : Info       : $$LocaleString:"(Only Zip (.zip) Format is Supported)"
            Local   : Field : Simple Field : Full Width : Yes
            Local   : Field : Simple Field : Align      : Centre
    
         
    [Part: Jenny_jsn_Import Details]
            Lines    :   Jenny_jsn_Import Directory, Jenny_jsn_Import FileName
            Space Bottom    : 0.10
            Space Bottom    : 0.20
     
        [Line: Jenny_jsn_Import Directory]
            Field   : Long Prompt, Jenny_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: Jenny_jsn_Import FileName]
            Field   : Long Prompt, Jenny_jsn_Import FileName
            Local   : Field : Long Prompt    : Info     : $$LocaleString:"Import File Name (.zip) :"
            Local   : Field : Long Prompt : Alignment: Left
            Local   : Field : Long Prompt : Width : 40
            Space Bottom    : 0.20
          
         
        [Field: Jenny_jsn_Import Directory]
            Use        : Name Field
            Width   : @@MaxNameWidth
            Set as    : ##Jenny_jsn_Path
            Full Width   : Yes
            Style        : Normal
            Set Always    : Yes
            Storage        : u_RMP_Directory
            Modifies    : Jenny_jsn_Path 
            Validate    : NOT $$IsEmpty:$$Value
     
         
        [Field: RBC Medium Prompt]
            Use            : Name Field
            Set as        : ""
            Width         : @@NarrWidth
            Full Width    : Yes
            Style        : Normal
             
       [Field: Jenny_jsn_Import FileName]
            Use        : Name Field
            Width   : @@MaxNameWidth
            Full Width   : Yes
            Modifies    : Jenny_jsn_File 
            Storage        : u_RMP_FileName 
            Style        : Normal
            Set Always    : Yes
            Table        : JennyJSonList of Files
            Show Table : On Blank
            Validate    : NOT $$IsEmpty:$$Value
            On    : Accept:  Yes  : Set:Jenny_jsn_PathFile:##Jenny_jsn_Path+"\"+$$Value
            On     : Accept:  Yes: Field Accept
         
    
         
     
    [Collection: JennyJSonList of Files]
                Title                : "List of Files : " + ##Jenny_jsn_Path
                Source Collection    : JennyJSon 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:JennyJSon Files Src]
    
        Data Source    : Directory    : ##Jenny_jsn_Path
        Filter        :  RBC_JSonOnlyFilesFilter
        Filter        :  RBC_JSonSelectedFormats 
         
        Client Only    : Yes
        Keep Source: Yes
    
    [Function: JennyJSonSupportedFiles]
    
        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
    
    
    [#Menu:gatewayoftally]
    Add:Item:Display JSON Data:Display:User Report
    
    [Report:User Report]
        Use : DSP Template
        Form:User Report
        Title : "GSTR - DETAILS"
        Set : vjennyAllfilter : ""
       
    [Form:User Report]
        Use : DSP Template
        Part:FormSubTitle,User Report
        Height : 100% screen
        Width : 100% screen
        Local : Field : FormSubTitle : Info : $$LocaleString:"GSTR - DETAILS"
        Local    : Field : Form SubTitle        : Color          : Dark Red
        Local: Field:Form SubTitle    : Style    : Large SerIf Bold   
        Add: Button: Jsonfilepath,jennyAllfilter
       
    [Part:User Report]
        Common Border:Yes
        Line:User Report Titles,User Report Data
        Repeat:User Report Data:JennyJsonUsersColl
        BottomLines : JSONTotal
        Scroll : Vertical
        Total  :PartySNo,PartyInvoiceTotal,PartyInvoiceNetAmt,PartySGSTAmt,PartyCGSTAmt,PartyIGSTAmt,PartyCESSAmt
       
    [Line:User Report Titles]
        Use:User Report Data
        Left Fields:PartySNo,PartyInvDate,PartyGSTINNo,PartyInvoiceNo,PartyInvoiceName
        Right Fields:PartyInvoiceTotal,PartyInvoiceNetAmt,PartySGSTAmt,PartyCGSTAmt,PartyIGSTAmt,PartyCESSAmt
        Local:Field:PartySNo:Set as:"S.No."
        Local:Field:PartyInvDate:Set as:"DATE"
        Local:Field:PartyGSTINNo:Set as:"GSTIN NO"
        Local:Field:PartyInvoiceNo:Set as:"INVOICE NO"
        Local:Field:PartyInvoiceName:Set as:"PARTY NAME"
        Local:Field:PartyInvoiceTotal:Set as:"TOTAL"
        Local:Field:PartyInvoiceNetAmt:Set as:"NET AMT"
        Local:Field:PartySGSTAmt:Set as:"SGST"
        Local:Field:PartyCGSTAmt:Set as:"CGST"
        Local:Field:PartyIGSTAmt:Set as:"IGST"
        Local:Field:PartyCESSAmt:Set as:"CESS"
        Local:Field:default:Style:Normal Bold
        Local:Field:default:Align:Center
        Local:Field:default:Border:thinright
        Border:Thin Column Titles
       
    
    
    [Line:User Report Data]
        Space Top:0.5
        Left Fields:PartySNo,PartyInvDate,PartyGSTINNo,PartyInvoiceNo,PartyInvoiceName
        Right Fields:PartyInvoiceTotal,PartyInvoiceNetAmt,PartySGSTAmt,PartyCGSTAmt,PartyIGSTAmt,PartyCESSAmt
        Border:Thin Column Titles
       
    
    [Field:PartySNo]
        Set as:$$Line
        Width:5
        Align: Center
       
    [Field:PartyInvDate]
        Set as:$idt
        Width:10
       
       
    [Field:PartyGSTINNo]
        Set as:$ctin
        Width:15
       
    [Field:PartyInvoiceNo]
        Set as:$inum
        Width:10
       
    [Field:PartyInvoiceName]
        Set as:$PartyLedgerName:Ledger:$Parent
        Full Width:Yes
       
    [Field:PartyInvoiceTotal]
        Set as:$val
        Width:10
       
       
    [Field:PartyInvoiceNetAmt]
        Set as:$txval
        Width:10
       
       
    [Field:PartySGSTAmt]
        Set as:$samt
        Width:10
       
       
    [Field:PartyCGSTAmt]
        Set as:$camt
        Width:10
       
       
    [Field:PartyIGSTAmt]
        Set as:$iamt
        Width:10
       
       
    [Field:PartyCESSAmt]
        Set as:$csamt
        Width:5
       
       
    [Line: JSONTotal]
    Use:User Report Data
    Local : Field : Default : Type    : String
    Local : Field : Default : Style : Tiny Bold
    Local : Field : Default : Align : Centre
    Local : Field : PartySNo        : Set as: $$Total:PartySNo
    Local : Field : PartyInvDate     : Set as: ""
    Local : Field : PartyGSTINNo    : Set as: ""
    Local : Field : PartyInvoiceNo    : Set as: ""
    Local : Field : PartyInvoiceName: Set as: ""
    Local : Field : PartyInvoiceTotal: Set as: $$Total:PartyInvoiceTotal
    Local : Field : PartyInvoiceNetAmt: Set as: $$Total:PartyInvoiceNetAmt
    Local : Field : PartySGSTAmt : Set as: $$Total:PartySGSTAmt
    Local : Field : PartyCGSTAmt : Set as: $$Total:PartyCGSTAmt
    Local : Field : PartyIGSTAmt : Set as: $$Total:PartyIGSTAmt
    Local : Field : PartyCESSAmt : Set as: $$Total:PartyCESSAmt
    Border : Flush Totals
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;FILTER START;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    [Button:jennyAllfilter]
    Key : Alt+F
    Action : Alter: jennyAllfilter
    Title : Filter
    
    [Report:jennyAllfilter]
    Form : jennyAllfilter
    
    [Form:jennyAllfilter]
    Part : jennyAllfilter
    No Confirmation : Yes
    
    [Part:jennyAllfilter]
    Line : jennyAllfilter
    
    [Line:jennyAllfilter]
    Field : Medium Prompt,jennyAllfilter
    Option : alter on enter
    Local : Field : Medium Prompt : Set as : "Filter : "
    Local : Field : Medium Prompt : Color :Blue
    Local : Field : Medium Prompt : Style :Normal Bold
    
    [Field:jennyAllfilter]
    Use : Name Field
    Width : 30
    Border : Thin Box
    Variable : vjennyAllfilter
    Modifies : vjennyAllfilter
    
    [System: Formulae]
    jennyAllfilter : $ctin = ##vjennyAllfilter Or $inum = ##vjennyAllfilter Or $$IsSysName:##vjennyAllfilter
    
    [Variable:vjennyAllfilter]
    Type : String
    
    [System:Variable]
    vjennyAllfilter : ""
     


  2. sattam

    sattam Active Member


    [Collection: JennyJsonUsersColl1]
    Source Collection: JsonUsersColl
    fetch: ctin,cfs,itms.*,num.*,itm_det.*,inv.*,b2b.*
    Fetch : *.*
    ;Sort : @@Default: $ctin
    Walk :inv;,itms;b2b;

    By: ctin:$ctin

    Compute: cfsstat:$cfs


    Walk :itms

    Walk :itm_det

    Aggr Compute :totinvval : Sum : $$AsAmount:$val
    Aggr Compute :tottxval : Sum : $$AsAmount:$txval
    Aggr Compute :totiamt : Sum : $$AsAmount:$iamt
    Aggr Compute :totcamt : Sum : $$AsAmount:$camt
    Aggr Compute :totsamt : Sum : $$AsAmount:$samt
    Aggr Compute :totcsamt : Sum : $$AsAmount:$csamt


    [Line: JSONTotal]
    Use:User Report Data
    Local : Field : Default : Type : String
    Local : Field : Default : Style : Tiny Bold
    Local : Field : Default : Align : Centre
    Local : Field : PartySNo : Set as: $$Total:partySNo
    Local : Field : PartyInvDate : Set as: ""
    Local : Field : PartyGSTINNo : Set as: ""
    Local : Field : PartyInvoiceNo : Set as: ""
    Local : Field : PartyInvoiceName: Set as: ""
    Local : Field : PartyInvoiceTotal: Set as: $$CollAmtTotal:JennyJsonUsersColl1:$totinvval;$$Total:partyInvoiceTotal
    Local : Field : PartyInvoiceNetAmt: Set as: $$CollAmtTotal:JennyJsonUsersColl1:$tottxval;$$Total:partyInvoiceNetAmt
    Local : Field : PartySGSTAmt : Set as: $$CollAmtTotal:JennyJsonUsersColl1:$totsamt;$$Total:partySGSTAmt
    Local : Field : PartyCGSTAmt : Set as: $$CollAmtTotal:JennyJsonUsersColl1:$totcamt;$$Total:partyCGSTAmt
    Local : Field : PartyIGSTAmt : Set as: $$CollAmtTotal:JennyJsonUsersColl1:$totiamt;$$Total:partyIGSTAmt
    Local : Field : PartyCESSAmt : Set as: $$CollAmtTotal:JennyJsonUsersColl1:$totcsamt;$$Total:partyCESSAmt
    Border : Flush Totals
     


  3. Jenny

    Jenny Active Member


    Its worked Only gstr-2 if i upload gstr-1 then showing error (memory acess violation)
     


  4. garima

    garima Active Member


    Dear Jenny,

    the collection that has been created is specific to GSTR2A json file only

    I suggest you to use Note Pad ++ and In plugin manager download and install json tool.

    then open json files like GSTR2A and GSTR1 and GSTR9 etc.. and view them in notepad ++ and json tool in it.

    you will get json file structure for that particular file.. create collections accordingly ..

    See the left side Tree in attached JPG .. you will understand GSTR2A structure.
    First is the root. then b2b , then inv and then itms and last one is itm_det

    So walk would be like

    Walk : b22
    Compute :
    Walk : Inv
    Compute
    Walk : itms
    Compute
    Walk : Item_det


    for GSTR2A

    Same way you can create for GSTR1 also
     

    Attached Files:



  5. Jenny

    Jenny Active Member


    But if i remove total line then how its showing "gstr1 & gstr2"...all data are fetch correctly...
     


  6. garima

    garima Active Member



Share This Page