Exporting Eway Bill from Voucher

Discussion in 'Tally Developer' started by Taufeeq Shaikh, Dec 19, 2020.

    
  1. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Please help me to export eway bill in excel from voucher...


    [#Form: Export Invoice]

    Add : Button : EinvExportButton

    [Key: EinvExportButton]

    Key : Alt + T
    Title : $$LocaleString:"Export E-WayBill"
    Action : Export : TRSEwayExport
    Width : 7.3% Screen
    Key Vertical Align : Centre


    [Report: TRSEwayExport]

    Use : GSTeWayBill OutputConfig
    Use : GSTTriangulationVars
    Variable : SVCurrentDate,SVFromDate,SVToDate, SVExportFormat, SVExpExportFormat
    Title : $$LocaleString:"Exporting details for e-Way Bill"

    List Var : GSTeWayVchDtlsVar : String
    Variable : IsVATReport
    Variable : vGSTReportNm : String

    Set : IsGSTeWayVchLevelExp : No

    Set : vGSTReportNm : "e-Way Bill Report Export"

    Print Set : Report Title : $$LocaleString:"Exporting details for e-Way Bill"

    Print : GSTeWayBillDtlsExportConfig
    Form : TRSEwayExport

    On : After Export : Yes : Call : GenerateGSTeWayMBillExportSmry:($$SysName:GSTeWayBill):mad:@DSPFromDate:mad:@DSPToDate:##SVCurrentDate

    Inherit Collection: GSTeWayBill VchBase
    Export Empty Fields : Yes



    [Form: TRSEwayExport]

    Resource : GSTVch eWayBill_Excel

    Map : suptype : @@GSTeWayMVchSupplyType : GSTeWayBillInvoiceReadyColl
    Map : subtype : @@GSTeWayMVchSubType
    Map : transactiontype: @@GSTeWayMVchTransactionType

    Map : doctype : @@GSTeWayMVchDocType
    Map : docno : @@GSTeWayMVchDocNo
    Map : docdate : @@GSTeWayMVchDocDate

    Map : frmparty : @@GSTeWayMVchFrom_OtherPartyName
    Map : frmgstin : @@GSTeWayMVchFrom_GSTIN
    Map : frmadd1 : @@GSTeWayMVchFrom_Address1
    Map : frmadd2 : @@GSTeWayMVchFrom_Address2
    Map : frmplace : @@GSTeWayMVchFrom_Place
    Map : frmdispic : @@GSTeWayMVchFrom_PinCode
    Map : billfrmstate : @@GSTeWayMVchFrom_StateExp
    Map : disfrmstate : @@GSTeWayMVchactualFrom_StateExp

    Map : toparty : @@GSTeWayMVchTo_OtherPartyName
    Map : togstin : @@GSTeWayMVchTo_GSTIN
    Map : toadd1 : @@GSTeWayMVchTo_Address1
    Map : toadd2 : @@GSTeWayMVchTo_Address2
    Map : toplace : @@GSTeWayMVchTo_Place
    Map : shiptopin : @@GSTeWayMVchTo_PinCode
    Map : billtostate : @@GSTeWayMVchTo_StateExp
    Map : shiptostate : @@GSTeWayActualMVchTo_StateExp

    Map : product : @@GSTeWayBillProduct
    Map : desc : @@GSTeWayBillDescription
    Map : hsn : @@GSTeWayBillHSN
    Map : unit : @@GSTeWayBillUnit
    Map : qty : @@GSTeWayBillQty
    Map : assval : @@GSTeWayBillAssessable
    Map : gstrate : @@GSTeWayBillTaxRate
    Map : cgst : @@GSTeWayBillCGSTAmt
    Map : sgst : @@GSTeWayBillSGSTAmt
    Map : igst : @@GSTeWayBillIGSTAmt
    Map : cess : @@GSTeWayBillCessValAmt
    Map : cessnonadvol : @@GSTeWayBillCessQtyAmt
    Map : Others : @@GSTeWayBillOthersAmtVal
    Map : totinvval : @@GSTeWayMVchDocValue

    Map : tranmode : @@GSTeWayMVchTransMode
    Map : dis : @@GSTeWayMVchDistance
    Map : tranname : @@GSTeWayMVchTransName
    Map : tranid : @@GSTeWayMVchTransID
    Map : trandocno : @@GSTeWayMVchTransDocNo
    Map : transdate : @@GSTeWayMVchTransDate
    Map : vehno : @@GSTeWayMVchVehicleNo
    Map : vehtype : @@GSTeWayExcelMVchVehicleType






    [#Form: GSTeWayBill Output Action Info]

    Local : Field : DSP ExpFileName : Set as : @@TRSEwayVchExpFileName



    [System : Formulae]

    TRSEwayVchExpFileName : If #DSPExportFileFormat = $$SysName:Excel Then @@TRSeWayBillTemplateName Else +
    If #DSPExportFileFormat = $$SysName:JSON Then $$Sprintf:"Ewaybill_%s_%s_%s.json":mad:@GSTTrglCMPGSTNumber:($$DDMMYYDateFormat:mad:@DSPToDate:""):($$ExtractNumbers:$$SysInfo:SystemTimeHMS):"" Else +
    $$MakeExportName:##PrintFileName:#DSPExportFileFormat

    TRSeWayBillTemplateName : "GSTVch_e-WayBill.xls"
     


  2. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    You code is not complete..

    There is already good example in Default TDL
     


  3. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Eway Bill from Voucher is now available in Tally.

    Case Solved... But in advancement i would try to create a button and will give direct function to export Excel or Json...
     


  4. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    I tried by rearranging the default functions and reports but not working... Please check...


    [#Form: Export Invoice]

    Add : Button : EinvJsonexport


    [Key: EinvJsonexport]

    Key : Alt + J
    Title : $$LocaleString:"Export Json E-WayBill"
    ;; Action : Export : GSTeWayBillVch_JSONExport
    Action : Call : TRSGSTeWayBillJsonExport
    Width : 7.3% Screen
    Key Vertical Align : Centre





    [Function: TRSGSTeWayBillJsonExport]

    Parameter : pVchrMSTId : Number : $MasterID

    Variable : vGSTeWayBillValidationErr : String : ""
    Variable : ORIGVchNum : String
    Variable : VARVchDate : Date
    Variable : VoucherID : String
    Variable : vIsGSTeWayDtlsExported : Logical : No
    Variable : vIsPurchaseFromURD : Logical : No
    Variable : vEwayBillDate : Date
    Variable : vEwayPartyName : String
    Variable : vVchAmt : Amount
    Variable : vFirstGSTTransNature : String : ""

    List Var : lvGSTAnalysisDetails

    Object : Voucher : $$Sprintf:"ID:%s":##pVchrMSTId

    00 : Do If : NOT ##ICFGEditeWayBill OR $GSTVchTransTypeCode NOT IN (2,3) OR ($$IsEmptyCollection:EWayBillDetails) : Return

    02 : Set : VoucherID : $$Sprintf:"ID:%s":##pVchrMSTId

    05 : Call : LoadGSTInvDtlsLV

    ;; Check whether voucher is qualified for generating e-way bill
    10 : Do If : NOT ##IsGSTVchHasGoods OR ##IsGSTVchWGoodsLedWOItem OR NOT @@IsVchQualifiedForGSTEWayBill : Return

    ;; Check the validation for proper details of e-Way bill
    40 : Do If : NOT ##IsVchWGSTeWayItmExcep : Set : vGSTeWayBillValidationErr : $$GSTVchEWayBillValidationErr

    50 : Do If : (##IsVchWGSTeWayItmExcep OR NOT $$IsEmpty:##vGSTeWayBillValidationErr) : Return

    82 : Set : ORIGVchNum : $VoucherNumber
    83 : Set : VARVchDate : $Date
    84 : Set : vEwayBillDate : If $$IsEmpty:$GSTeWayBillDate Then $Date Else $GSTeWayBillDate
    85 : Set : vEwayPartyName: @@GSTPartyLedgerNameRecon
    86 : Set : vVchAmt : $Amount

    87 : Set : IsGSTeWayVchLevelExp : Yes
    ;; Export to json/excel for the proper data
    90 : Export : GSTeWayBillJsonExport

    100 : Do If : ##vIsGSTeWayDtlsExported : Alter : GSTeWayBillUpdateNoDt



    [Report: GSTeWayBillJsonExport]

    Use : SV Output Config
    Object : Voucher : ##VoucherID
    Family : $$Translate:##SVVoucherType

    Variable : IsVATReport, SVExportFormat, SVExpExportFormat
    List Var : GSTeWayVchDtlsVar : String

    Set : IsVATReport : $$UpdGSTeWayVchDtlsVar
    Print Set : Report Title : $$LocaleString:"Exporting details for e-Way Bill"

    Print : GSTeWayBillJsonExportConfig
    Form : GSTeWayBillVch_JSONExport
    Export Empty Fields : Yes



    [Report: GSTeWayBillJsonPrintConfig]

    Use : SV Output Medium

    Set : SVExportFormatVar : $$SysName:GSTeWayBillJson
    Set : SVExpFileName : $$Sprintf:"Ewaybill_%s_%s_%s.json":mad:@GSTewayBillAutoVchNumber:($$DDMMYYDateFormat:##VARVchDate:""):($$ExtractNumbers:$$SysInfo:SystemTimeHMS):""
    Set : SVExportFormat : $$SysName:Utf8JSON
    Set : SVSendToVar : @@LocalDrives

    Local : Field : DSP ExportFileFormat : Set as : ##SVExportFormatVar
    Local : Line : DSP SendTo : Invisible : Yes

    Local : Part : SV Output Title Info : Local : Field: Left Subtitle : Set as : $$LocaleString:"Exporting Details for e-Way Bill"

    Local : Part : SV Output Actions : Local : Button: PrintExp Configure : Action : Modify Variables : GST eWayBill Output Configuration
    Local : Form : SV Output Medium : Local : Button: Output Config : Action : Modify Variables : GST eWayBill Output Configuration


    [Report: GSTeWayBillJsonExportConfig]

    Use : GSTeWayBillJsonPrintConfig

    Local : Form : SV Output Medium : On : Form Accept : Yes : Call : GSTeWayBillVchExportOnSave
     


  5. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    I don't have time to see, why its not working...
    share your email id , I will send you a sample code, in which I have been able to export json file using two different method...
    a. Export report and..
    b. Write Line

    Though example is of E-Invoice.. as per GST portal specification.. you can use the same concept for E-way bill aloso
     


  6. Taufeeq Shaikh

    Taufeeq Shaikh Active Member



Share This Page