Saturday 28 May 2022

Import 2A into Tally

 

[#Menu: Gateway of Tally]
  
    Add        : Key Item : Before: @@locQuit : GSTR2A RECO  : F : Menu : GSTR2A
    Key Item: BLANK

   
   
[Menu: GSTR2A]
    Title       : $$LocaleString:"GSTR 2A RECO"
   
    ;Indent        : "Master Imports"
    ;Key Item    : "Item Master"             : i : Execute    : GST Item Import
    ;Key Item    : "Ledger Master"         : l : Execute    : GST Ledger Import
    Item        : BLANK
   
    Indent        : "Imports"
    Item        : BLANK
    Key Item    : "IMPORT GSTR2A"         : 2:alter    : Rbc_Jsn_Options :  NOT $$IsEmpty:$$SelectedCmps
    Item        : BLANK
   




[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

    Height        : 30% Page
    Width        : 60% Page
    Vertical Align  : Centre
    Local    : Field    : Rbc_jsn_Import Directory    : Modifies    : Rbc_jsn_Path    : Yes
    Local    : Field    : Rbc_jsn_Import FileName    : Modifies    : Rbc_jsn_File    : Yes
    
    Local: Field: Form SubTitle    : Info    : "Select JSon or Zip file from the List"

    Part: Rbc_jsn_ImportSet
   On    : Form Accept :  Yes:  Call : GSTR2AIMPO
    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
    Border            : thin Bottom
[Part: Rbc_jsn_Import Title]
    Lines    : Rbc_jsn_Import, Rbc_jsn_Import Info
    Space Bottom    : 0.20
    Border            : thin Bottom

    [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:  Yes  : Set:Rbc_jsn_PathFile:##Rbc_jsn_Path+"\"+$$Value
        On     : Accept:  Yes: Field Accept
    

    
[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    : INVGSTR2A]
    Data Source    : File JSONZip: ##Rbc_jsn_PathFile
    ;JSON Object Path:b2b:1
    ;JSON Object : GSTR2ATable
    Fetch : *.*
    Client Only:Yes
   


[Object    :GSTR2ATable]
    Collection    :     b2b        : b2bObject

[Object        :    b2bObject]

    Storage    :    ctin    : String ;;;;;;; SUPPLIER GSTN NO
    Storage    :    cfs     : String ;;;;;;;
    Storage    :    cname   : String
    Collection :     inv     : invObject
            
[Object    : invObject]
    
    Storage        :  val        : Amount ;;;;;; INVOICE TOTAL
    Storage        :  inv_typ    : String ;;;;;;; INNOCIE TYPE
    Storage        :  pos        : Number ;;;;;;; STATECODE
    Storage        :  idt        : String ;;;;;;; INVOICE DATE
    Storage        :  rchrg      : String ;;;;;;; IS REVERSE CHARGE
    Storage        :  inum       : String ;;;;;;; INVOICE NUMBER
    Storage        :  chksum     : String ;;;;;;; UNIQUE CODE
    
    Collection     : itms         : itmsObject
            
[Object    : itmsObject]
    Storage    :     num    : Number
    Collection    : itm_det     : itm_detObject
[Object: itm_detObject]
   Storage        :  samt    : Amount ;;;;;; SGST AMOUNT
   Storage        :  rt     : String  ;;;;;; GST RATE
   Storage        :  txval  : Amount    ;;;;;; TAXABLE VALUE
   Storage        :  camt  : Amount    ;;;;;;; CGST AMOUNT
   Storage        :  iamt  : Amount     ;;;;;;; IGST AMOUN
   Storage          :    csamt :Amount        ;;;;;; CESS AMOUNT


[Collection    : GSTR2A_BILLSummary]
    Source Collection: INVGSTR2A
    Title        : "GSTIN-NO LIST"
    Walk         :    b2b
    Compute     : SupplierGSTn          :$ctin
    Compute     : cfs                :$cfs
    Compute     : cname             :$cName
    Compute Var : cvinvcnt             : Number     : $$NumItems
    Compute        :NumberofBills        : $$Number:##cvinvcnt
    Walk        : Inv
    Compute        : VoucherNumber      : $inum
    Compute        : VoucherDate        : $idt
    Compute        :IsReversecharge    :$rchrg
   
    Walk        : itms, itm_det
   
    Compute        : GSTRate            :$$String:$rt
    Compute     : InvoiceTotal         :$$AsAmount:$val
    Compute     :TaxableAmount         :$txval
    Compute     :IGST                :IF $$IsEmpty:$iamt THEN $$AsAmount:"0" ELSE $iamt
    Compute     :CGST                :IF $$IsEmpty:$camt THEN $$AsAmount:"0" ELSE $camt
    Compute     :SGST                :IF $$IsEmpty:$samt THEN $$AsAmount:"0" ELSE $samt
    Compute     :CESS                :IF $$IsEmpty:$csamt THEN $$AsAmount:"0" ELSE $csamt
    Compute        :INVOICETYPE        :"BILL"
   

    Format:$INVOICETYPE
    Format:$CFS
    Format:$PartyName,35
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount,10
    Format:$IGST,10
    Format:$CGST,10
    Format:$SGST,10
    Format:$CESS,10
   

[Collection:GSTR2APartywiseSummery]
    Source Collection:GSTR2A_BILLSummary
   
    Fetch        : *.*
   

    By:SupplierGSTn:$SupplierGSTn
    ;By:GSTRATE:$GSTRATE
    By:VoucherNumber:$VoucherNumber
    Sort:@@Default: $SupplierGSTn
   
    Compute:PartyName:$$CollectionFieldByKey:$Name:$SupplierGSTn:RBC_PartyGstnWise
    Aggr Compute:TaxableAmount1:Sum:IF $$IsEmpty:$TaxableAmount THEN $$AsAmount:"0" ELSE  $$AsAmount:$TaxableAmount
    Aggr Compute:IGST1:Sum:IF $$IsEmpty:$IGST THEN $$AsAmount:"0" ELSE $$AsAmount:$IGST
    Aggr Compute:CGST1:Sum:IF $$IsEmpty:$CGST THEN $$AsAmount:"0" ELSE $$AsAmount:$CGST
    Aggr Compute:SGST1:Sum:IF $$IsEmpty:$SGST THEN $$AsAmount:"0" ELSE $$AsAmount:$SGST
    Aggr Compute:CESS1:Sum:IF $$IsEmpty:$CESS THEN $$AsAmount:"0" ELSE $$AsAmount:$CESS
    Compute:TotalVoucherAmt:$TaxableAmount1+$IGST1+$CGST1+$SGST1+$CESS1
    Compute:InvoiceTotal:$InvoiceTotal

    Format:$INVOICETYPE
    Format:$CFS
    Format:$PartyName,35
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$$Number:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount1,10
    Format:$IGST1,10
    Format:$CGST1,10
    Format:$SGST1,10
    Format:$CESS1,10
   
   

[Collection:GSTR2APartywiserateSummery]
    Source Collection:GSTR2A_BILLSummary
   
    Fetch        : *.*
   

    By:SupplierGSTn:$SupplierGSTn
    By:GSTRATE:$GSTRATE
    ;By:VoucherNumber:$VoucherNumber
    Sort:@@Default: $SupplierGSTn
   
    Compute:PartyName:$$CollectionFieldByKey:$Name:$SupplierGSTn:RBC_PartyGstnWise
    Aggr Compute:TaxableAmount1:Sum:$$AsAmount:$TaxableAmount
    Aggr Compute:IGST1:Sum:$$AsAmount:$IGST
    Aggr Compute:CGST1:Sum:$$AsAmount:$CGST
    Aggr Compute:SGST1:Sum:$$AsAmount:$SGST
    Aggr Compute:CESS1:Sum:$$AsAmount:$CESS
    Compute:TotalVoucherAmt:$TaxableAmount1+$IGST1+$CGST1+$SGST+$CESS
   

    Format:$INVOICETYPE
    Format:$CFS
    Format:$PartyName,35
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$$Number:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount1,10
    Format:$IGST1,10
    Format:$CGST1,10
    Format:$SGST1,10
    Format:$CESS1,10
    Filter:IspartyGSTnSame
   



[Collection:GSTR2APartywisebILLWISESummery]
    Source Collection:GSTR2A_BILLSummary
   
    Fetch        : *.*
   

    By:SupplierGSTn:$SupplierGSTn
    ;By:GSTRATE:$GSTRATE
    By:VoucherNumber:$VoucherNumber
    Sort:@@Default: $SupplierGSTn
   
    Compute:PartyName:$$CollectionFieldByKey:$Name:$SupplierGSTn:RBC_PartyGstnWise
    Aggr Compute:TaxableAmount1:Sum:$$AsAmount:$TaxableAmount
    Aggr Compute:IGST1:Sum:$$AsAmount:$IGST
    Aggr Compute:CGST1:Sum:$$AsAmount:$CGST
    Aggr Compute:SGST1:Sum:$$AsAmount:$SGST
    Aggr Compute:CESS1:Sum:$$AsAmount:$CESS
    Compute:TotalVoucherAmt:$TaxableAmount1+$IGST1+$CGST1+$SGST+$CESS
   

    Format:$INVOICETYPE
    Format:$CFS
    Format:$PartyName,35
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$$Number:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount1,10
    Format:$IGST1,10
    Format:$CGST1,10
    Format:$SGST1,10
    Format:$CESS1,10
    Filter:IspartyGSTnSame
   

[Collection:GSTR2ABILLWISERATESummery]
    Source Collection:GSTR2A_BILLSummary
   
    Fetch        : *.*
   

    By:SupplierGSTn:$SupplierGSTn
    By:GSTRATE:$GSTRATE
    By:VoucherNumber:$VoucherNumber
    Sort:@@Default: $SupplierGSTn
   
    Compute:PartyName:$$CollectionFieldByKey:$Name:$SupplierGSTn:RBC_PartyGstnWise
    Aggr Compute:TaxableAmount1:Sum:$$AsAmount:$TaxableAmount
    Aggr Compute:IGST1:Sum:$$AsAmount:$IGST
    Aggr Compute:CGST1:Sum:$$AsAmount:$CGST
    Aggr Compute:SGST1:Sum:$$AsAmount:$SGST
    Aggr Compute:CESS1:Sum:$$AsAmount:$CESS
    Compute:TotalVoucherAmt:$TaxableAmount1+$IGST1+$CGST1+$SGST+$CESS
   

    Format:$INVOICETYPE
    Format:$CFS
    Format:$PartyName,35
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$$Number:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount1,10
    Format:$IGST1,10
    Format:$CGST1,10
    Format:$SGST1,10
    Format:$CESS1,10
    Filter:IsvOUCERNOSame

[Collection    : RBC_PartyGstnWise]
    Type        : Ledger
    ;Child Of    : $$GroupSundryCreditors; Group would be Sundry Debtors for GSTR1
    Fetch        : PartyGSTIN, Name
 
    Format        : $PartyGSTIN, 20
    Format        : $Name, 25

    Search Key    : $PartyGSTIN
    Sort        : @@Default : $PartyGSTIN
    Filter        : RBCnonEmptyGstin
   



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CREDIT NOTE

[System            : Formulae]
    RBCnonEmptyGstin    : Not $$Isempty:$PartyGSTIN
    IspartyGSTnSame: $SupplierGSTn= ##MPIGSTIN
    IsvOUCERNOSame: $VoucherNumber= ##BillNo



[Collection    : CDNGSTR2A]
    Data Source    : File JSONZip: ##Rbc_jsn_PathFile
    ;JSON Object Path:b2b:1
    ;JSON Object : GSTR2ATable
    Fetch : *.*
    Client Only:Yes
   


[Object    :CDNGSTR2ATable]
    Collection    :     cdn        : CDNb2bObject

[Object        :    CDNb2bObject]

    Storage    :    ctin    : String ;;;;;;; SUPPLIER GSTN NO
    Storage    :    cfs     : String ;;;;;;;
    Storage    :    cname   : String
    Collection :     nt     : CDNObject
            
[Object    : CDNObject]
    
    Storage        :  val        : Number ;;;;;; CREDIT NOTE TOTAL
    Storage        :  ntty    : String ;;;;;;; NOTE TYPE
    ;Storage        :  pos        : Number ;;;;;;; STATECODE
    Storage        :  idt        : String ;;;;;;; INVOICE DATE
    Storage            : nt_dt        : String ;;;;;Note Date
    Storage        :  p_gst      : String ;;;;;;; ISPOSTGST
    Storage        :  inum       : String ;;;;;;; INVOICE NUMBER
    Storage           : nt_num:String    ;;;;;Note number
    Storage        :  chksum     : String ;;;;;;; UNIQUE CODE
    
    Collection     : itms         : CDNitmsObject
            
[Object    : CNDitmsObject]
    Storage    :     num    : Number
    Collection    : itms     : CDNitm_detObject
[Object: CNDitm_detObject]
   Storage        :  samt    : Amount ;;;;;; SGST AMOUNT
   Storage        :  rt     : Number  ;;;;;; GST RATE
   Storage        :  txval  : Amount    ;;;;;; TAXABLE VALUE
   Storage        :  camt  : Amount    ;;;;;;; CGST AMOUNT
   Storage        :  iamt  : Amount     ;;;;;;; IGST AMOUN
   Storage          :    csamt :Amount        ;;;;;; CESS AMOUNT


[Collection    : GSTR2A_CDNSummary ]
    Source Collection: CDNGSTR2A
    Title: "GSTIN-NO LIST"
    Walk :    cdn,
    Compute        : SupplierGSTn    :$ctin
    Compute    : cfs    :$cfs
    Compute    : cname :$cName
    Compute Var    : cvinvcnt : Number : $$NumItems
    Compute:NumberofBills: $$Number:##cvinvcnt
    Walk    : nt
    Compute    : VoucherNumber    : $inum
    Compute    : VoucherDate    : $idt
    Compute        :IsReversecharge:$rchrg
    Walk    : itms
    Walk: itm_det
    Compute    : GSTRate    : $rt
 
   Compute : InvoiceTotal     :$val
   Compute :TaxableAmount     :$txval
   Compute :IGST    :$iamt
   Compute :CGST    :$camt
   Compute :SGST    :$samt
   Compute :CESS    :$csamt
    Format:"CREDIT NOTE"
    Format:$SupplierGSTn,10
    Format:$NumberofBills,10
    Format:$VoucherNumber,10
    Format:$VoucherDate,10
    Format:$IsReversecharge,10
    Format:$GSTRate,10
    Format:$InvoiceTotal,10
    Format:$TaxableAmount,10
    Format:$IGST,10
    Format:$CGST,10
    Format:$SGST,10
    Format:$CESS,10
   





   
[Function:PurchaseGVTYP]
    Variable    : ProgressCount        : Number
    Variable      : Counter             : Number
   
    000 : SET : Counter   : 0 
    001 : START PROGRESS  : 1   : "Importing Master" : @@CmpMailName : "Creating Voucher Type ..."
   
   
    042        :            NEW OBJECT            : VOUCHER TYPE
    043      :            Set Value                : Name                     : "GSTR2A"
    044      :           Set Value               : Parent                 : "Purchase"
    050        :            Set Value                : Numbering Method        : "Manual"
    055        :            Set Value                : IsOptional            : "Yes"
    056        :            Set Value                : Prevent Duplicates    : "Yes"
   
    060      :        CREATE TARGET

   
    160      :        CREATE TARGET
   
    180     :                 INCREMENT             : Counter
    190     :                 SHOW PROGRESS             : ##Counter
    200     :     END PROGRESS
    ;210        :    Msg Box: "Ledger Auto Creation !!!":"IGST Ledger Imported Successfully !!!"
    211     :     RETURN






[Function:GSTR2AIMPO]
   
    Variable    : ProgressCount        : Number
    Variable      : Counter             : Number
   
    Variable    : BillNo            : String   
   
    Variable    : MPIGSTIN    : String
    Variable    : MPIDate            : String
    Variable    : MPIRefno            : String
    Variable    : MPIPartyName        : String
    Variable    : MPIPartyState        : String
    variable    : MPI PurhcaseNil    : Amount
    Variable    : MPI Purchase5        : Amount
    Variable    : MPI purchase12    : Amount
    Variable    : MPI purchase18    : Amount
    Variable    : MPI purchase28    : Amount
    Variable    : MPI SGSTINPUT        : Amount
    Variable    : MPI CGSTINPUT        : Amount
    Variable    : MPI iGSTINPUT        : Amount
    Variable    : MPI GrandTotal     : Amount
   

    00 : SET : Counter   : 0 
    10    :IF :$$IsEmpty:$Name:VoucherType:"GSTR2A"
    15    : Call: PurchaseGVTYP
    19    : End If
    ;10: Call:PurchasePartyLedgerCreation
    20 : START PROGRESS  : ($$NumItems:GSTR2APartywiseSummery)   : "Importing GSTR2A" : @@CmpMailName : "Importing GSTR2A ..." ;+ $$NewLine + $$String:($$NumItems:VCHLVExcellVariableBillWise)+$$String:"/"+$$String:##Counter
    30 : WALK COLLECTION : GSTR2APartywiseSummery

    ;;-------------------------------------------------
    ;;Create Party Ledger under Sundry Creditors if party ledger name not found
    39        :    Set: MPIGSTIN:$SupplierGSTn
    40      :       Set             : BillNo         : $VoucherNumber   
    41      :     IF :$$IsEmpty:$PartyName
    42        :            NEW OBJECT            : Ledger
    43      :            Set Value                : Name                     : $SupplierGSTn
    44      :           Set Value               : Parent                 : "Sundry Creditors"
    45        :            Set Value                : GSTRegistrationType    : "Regular"
    46        :            Set Value                : PartyGSTIN            : $SupplierGSTn
    47        :            Set Value                : CountryofResidence    : "India"
    48        :            Set Value                : LedStateName            : If $$IsStatepurchase:$SupplierGSTn then "Maharashtra" else ""
    49        :            Set Value                :IsBillWiseOn            :"No"
    50      :        CREATE TARGET
    51      :       END IF    
    52        : Set  : MPI GrandTotal : @@GrandTotal
    ;53        : Log:"invoice Total- "+$$String:@@GrandTotal;@@GRANDTOTAL
    ;48        : Log: $$String:"Grand Total"+ $$String:##MPIGrandTotal
    ;;-------------------------------------------------
    ;;Basic Info

    81     :     SET                 : SVViewName             : $$SysName:AcctgVchView
   
    83    :     NEW OBJECT        : Voucher
    84    :     SET VALUE        : Date                : $$Date:$VoucherDate
    85    :     SET VALUE        : VoucherTypeName        : "GSTR2A"
    86      :     SET VALUE        : Narration            : "GSTR 2A DETAILS: - PartyName:-"     + $$String:$PartyName + " GSTIN NO.- " + $$String:$SupplierGSTn + " Taxable AMOUNT - " + $$String:$TaxableAmount1 + " CGST AMOUNT - " + $$String:$CGST1 + " SGST AMOUNT - " + $$String:$SGST1 + " IGST AMOUNT - " + $$String:$IGST1 + " CESS AMOUNT - " + $$String:$CESS1 + " INVOICE TOTAL : - " + $$String:@@GRANDTOTAL
    87      :     SET VALUE        : VoucherNumber            : ##BillNo
    88      :     SET VALUE        : Reference            : ##BillNo
    89        :    Set Value        : Isoptional        :"Yes"
    90        :     Set Value        : CFS1                : IF $CFS = "Y" THEN "Yes" else "No"
    91        :     Set Value        : iSREVERSECHARGE1    : if $IsReversecharge = "N" THEN "No" else "Yes"
    ;90        :    Log: $$Date:$SupBillDate
    95      :     SET VALUE        : ReferenceDate :$$Date:$VoucherDate
   
    ;;---------------------------------------------------------
    ;;TO Entry
   
    ;58    : Log: $$String:"InvoiceTotal: "+ $$String:##MPIGrandTotal
    101      :     INSERT COLLECTION OBJECT    : LedgerEntries
    102     :     SET TARGET            : LedgerEntries
    103    :    SET VALUE            : LedgerName        : If $$IsEmpty:$PartyName then $SupplierGSTn else $PartyName
    104    :     SET VALUE            : Amount        : $$AsAmount:@@GrandTotal
    105    :     SET VALUE            : Is Deemed Positive    : "No"
    106    :     SET TARGET            : ..

   

    ;;---------------------------------------------------------
    ;;BY PURCHASE Entry
    107: Walk Collection:GSTR2ABILLWISERATESummery
    P160    :    If: $$IsStatepurchase:$SupplierGSTn
    P170    :     INSERT COLLECTION OBJECT    : LedgerEntries
    P171    :     SET TARGET            : LedgerEntries
    P172    :    SET VALUE            : LedgerName            : @@PURCHASESTATElEDGER;##purchaseimportvar2
    P173    :     SET VALUE            : Amount                : $TaxableAmount
    ;P174    :    Set Value            : GSTOVRDNNATURE        :"Purchase Exempt"
    P176    :     SET VALUE            : Is Deemed Positive    : "Yes"
    P177    :     SET TARGET            : ..
    P178    :    End If
   
    P260    :    If: Not $$IsStatepurchase:$SupplierGSTn
    P270    :     INSERT COLLECTION OBJECT    : LedgerEntries
    P271    :     SET TARGET            : LedgerEntries
    P272    :    SET VALUE            : LedgerName        : @@PURCHASEOMSlEDGER;##purchaseimportvar7
    P273    :     SET VALUE            : Amount        : $TaxableAmount
    ;P274    :    Set Value            : GSTOVRDNNATURE        : if $$IsEmpty:$TIGST and not $$IsEmpty:$TCGST then "Purchase Taxable" Else "Interstate Purchase Taxable"
    P276    :     SET VALUE            : Is Deemed Positive    : "Yes"
    P277    :     SET TARGET            : ..
    p278    :    End If
    108        :    End Walk
    ;;---------------------------------------------------------
    ;;BY Gst Enty
    G160    :    If: $$IsStatepurchase:$SupplierGSTn
    G180    :     INSERT COLLECTION OBJECT    : LedgerEntries
    G181    :     SET TARGET            : LedgerEntries
    G182    :    SET VALUE            : LedgerName        : "CGST INPUT";##purchaseimportvar3
    G183    :     SET VALUE            : Amount        : $CGST1
    G184    :     SET VALUE            : Is Deemed Positive    : "Yes"
    G185    :     SET TARGET            : ..
    G190    : End If
   
   
    G280    :     INSERT COLLECTION OBJECT    : LedgerEntries
    G281    :     SET TARGET            : LedgerEntries
    G282    :    SET VALUE            : LedgerName        : "SGST INPUT";##purchaseimportvar4
    G283    :     SET VALUE            : Amount        : $SGST1
    G284    :     SET VALUE            : Is Deemed Positive    : "Yes"
    G285    :     SET TARGET            : ..
   
    G360    :    If: Not $$IsStatepurchase:$SupplierGSTn
    G380    :     INSERT COLLECTION OBJECT    : LedgerEntries
    G381    :     SET TARGET            : LedgerEntries
    G382    :    SET VALUE            : LedgerName        : "IGST INPUT";##purchaseimportvar5
    G383    :     SET VALUE            : Amount        : $IGST1
    G384    :     SET VALUE            : Is Deemed Positive    : "Yes"
    G385    :     SET TARGET            : ..
    G390    : End If
    ;G480    :     INSERT COLLECTION OBJECT    : LedgerEntries
    ;G481    :     SET TARGET            : LedgerEntries
    ;G482    :    SET VALUE            : LedgerName        : "ROUND";##purchaseimportvar6
    ;G483    :     SET VALUE            : Amount        : if $$IsNegative:(@@RoundValue) then @@RoundValue1 else @@RoundValue
    ;G484    :     SET VALUE            : Is Deemed Positive    :if $$IsNegative:(@@RoundValue) then "Yes" else "No"
    ;G485    :     SET TARGET            : ..
    ;G486    : Log: $$String:"Bill No. "+ $$String:##MPIBillNo + $$String:"Round Value. " +$$String:@@RoundValue
    ;;---------------------------------------------------------   
    109    :     CREATE TARGET   
    ;;---------------------------------------------------------

    110     :       SET VALUE               : PersistedView     : ##SVViewname
    130     :     INCREMENT             : Counter
    140     :     SHOW PROGRESS             : ##Counter
   
    150     :     END WALK
    160     :     END PROGRESS
    155        :    Msg Box: "GSTR2A Imported Successful":"GSTR2A Imported Successful"
    ;170     :     RETURN
   


[Function:IsStatepurchase]
   
    Parameters: P1 :String
    Variable:STATECODE:String
    Return:Logical
   
    ;000:Set:INPUT:$$FileReadCell:##RowIndex:4
    010:Set:STATECODE:$$StringPart:##P1:0:2
    030: Return :@@statesales
   
[System:Formulas]
    statesales: if ##STATECODE = "27" then "Yes" else "No"
    PURCHASESTATElEDGER: IF $GSTRate= "0" THEN "GSTR2A_0" ELSE IF $GSTRate= "5" THEN "GSTR2A_5" ELSE IF $GSTRate= "12" THEN "GSTR2A_12" ELSE IF $GSTRate= "18" THEN "GSTR2A_18" ELSE "GSTR2A_28"
    PURCHASEOMSlEDGER: IF $GSTRate= "0" THEN "GSTR2A_I0" ELSE IF $GSTRate= "5" THEN "GSTR2A_I5" ELSE IF $GSTRate= "12" THEN "GSTR2A_I12" ELSE IF $GSTRate= "18" THEN "GSTR2A_I18" ELSE "GSTR2A_I28"
    GrandTotal :$$AsAmount:($TaxableAmount1+$IGST1+$CGST1+$SGST1+$CESS1)

No comments:

Post a Comment