Receipt Import from Excel

Discussion in 'Free Source Codes' started by Partha Mondal, Dec 21, 2021.

    
  1. Partha Mondal

    Partha Mondal Member


    Dear all member,

    This code is generate Receipt voucher from Excel. Can anyone help. Because when I run code from Tally Developper then successful import. But when I run with TCP then getting error Invalid number of steps LEVEL 30. I can understand what is the problem. I attach my code.

    Can anyone help me.

    Thanks
    Partha mondal


    ;;-------------- Om Sai Ram


    ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

    ;; RECEIPT VOUCHER CUSTOMISATION .............
    ;[Include : refresh.txt]

    [Collection : ShrutiVCHRcptColl]
    Type : voucher
    Fetch : TSPLRcptNo
    Format : $TSPLRcptNo, 20
    Title : List of Receipt Nos.

    [#Part : VCH Narration]
    Add : Option : TSPLShrutiRcpt : @@IsReceipt

    [!Part : TSPLShrutiRcpt]

    Add : Line : At Beginning : TSPLShrutiRcptLine1;, TSPLShrutiRcptLine2

    [Line : TSPLShrutiRcptLine1]

    Fields : Medium Prompt, TSPLShrutiRcptRegNo, Short Prompt, TSPLShrutiRcptNo, Simple Prompt, TSPLShrutiRcptRemarks
    Local : Field : Medium Prompt: Info : $$LocaleString:"Reg.No.& Name:"
    Local : Field : Short Prompt: Info : $$LocaleString:"Receipt No."
    Local : Field : Simple Prompt: Info : $$LocaleString:"Remarks"
    Local : Field : Default : Style : Normal Bold
    Space Bottom : 1

    [Field : TSPLShrutiRcptRegNo]

    Use : Name Field
    Width : 50
    Storage : TSPLRegNo
    Set Always : Yes

    [Field : TSPLShrutiRcptNo]

    Use : Name Field
    Width : 30
    Storage : TSPLRcptNo
    Set Always : Yes

    [Field : TSPLShrutiRcptRemarks]

    Use : Name Field
    Width : 50
    Storage : TSPLRcptRemarks
    Set Always : Yes

    [System : UDF]

    TSPLRegNo : String : 29500
    TSPLRcptNo : String : 29501
    TSPLRcptRemarks : String : 29502

    ;;;;;;;;; For Import from Excel ............

    ;[#Menu : Import of Data]
    [#Menu : Gateway of Tally]

    ;Add: Item : Receipt Voucher Import : Call : Receipt Import ;Call : ImportData
    Add: Item : Receipt Voucher Import : Execute : Receipt Import

    [Report : Receipt Import]
    Auto : Yes
    Form : Receipt Import

    [Form : Receipt Import]

    Vertical Alignment : Center
    Horizontal Alignment : Center
    No Confirm : Yes
    Option : Small Size Form
    Full Height : No
    Full Width : No
    Space Bottom : 1
    Space Left : 1
    Space Right : 1
    Space Top : 1
    Background : lightblue
    Local : Field : receiptvoucher : Modifies : receiptvoucher : Yes
    Local : Field : receiptvoucher : Variable : receiptvoucher
    On : Form Accept : Yes : Call : Receipt Import
    Part : receiptvoucher
    [Part: receiptvoucher]
    Line : receiptvoucherpath,receptsheetname
    [Line: receiptvoucherpath]
    Fields : Medium Prompt, receiptvoucher
    Local : Field : Medium Prompt : Set as : $$LocaleString:"Full path name of excel with extensions :"
    Local : Field : Medium Prompt : Style : Normal Bold
    Local : Field : Medium Prompt : Width : 35
    Local : Field : Medium Prompt : Color : Black
    Local : Field : receiptvoucher : Set as : "Insert excel file path here"
    Local : Field : receiptvoucher : Width : 45
    Local : Field : receiptvoucher : Style : Normal Bold

    [Field: receiptvoucher]

    [Line:receptsheetname]
    Fields : Medium Prompt, sheetnam
    Local : Field : Medium Prompt : Set as : $$LocaleString:"Enter Sheet Name"
    Local : Field : Medium Prompt : Style : Normal Bold
    Local : Field : Medium Prompt : Width : 35
    Local : Field : Medium Prompt : Color : Black

    [Field: sheetnam]
    Use:name field
    Set as: "Enter sheet name to be Import"

    [Collection : ExcelSRCColl]

    ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};+
    DBQ=" + @@RcptPathxl + ""
    SQL : "Select * from [" + @@RcptSeetxl + "$]"

    [Collection : ReceiptImportColl]

    Source Collection : ExcelSRCColl

    Compute : RPVchno : $_1
    Compute : RPRcptNo : $_1
    Compute : RPDate : $_2
    Compute : RPRegNo : $_3
    Compute : RPCreditName : $_4
    Compute : RPNarration : $_5
    Compute : RPDebitName : $_6
    Compute : RPBankTranType: $_8
    Compute : RPDebitAmt : $_9
    Compute : RPCreditAmt : $_9
    Compute : RPRemarks : $_12


    [System : Formula]

    RPDate : $$Date:(($$StringPart:$RPDate:8:2) + "-" +($$StringPart:$RPDate:5:2) + "-" +($$StringPart:$RPDate:0:4))

    [Function : Receipt Import]

    Variable : ProgressCount : Number
    Variable : Counter : Number
    Variable : VoucherTypeName : String
    Variable : RPVchno : String

    Variable : RPDate : Date
    Variable : RPDebitName : String
    Variable : RPDebitAmt : Amount
    Variable : RPCreditName : String
    Variable : RPCreditAmt : String
    Variable : RPNarration : String
    Variable : RPRcptNo : String
    Variable : RPRegNo : String
    Variable : RPBankTranType : String
    Variable : RPRemarks : String

    00 : Set : Counter : 0
    01 : Set : ProgressCount : 1
    10 : Query Box : "Are You Import Receipt Voucher ?":Yes:No

    20 : SET : ProgressCount : $$NumItems:ReceiptImportColl ;1

    30 : START PROGRESS : ($$NumItems:ReceiptImportColl) : "Importing of " : " Receipt Vouchers" : "Developped by : Partha Mondal"
    40 : SET : SVViewName : $$SysName:AccVchView

    50 : Walk Collection : ReceiptImportColl

    100 : Set : RPDate : $$Date:$RPDate
    101 : Set : RPDebitName : $$String:$RPDebitName
    102 : Set : RPDebitAmt : $$AsAmount:$RPDebitAmt
    103 : Set : RPCreditName : $$String:$RPCreditName
    104 : Set : RPCreditAmt : $$AsAmount:$RPCreditAmt
    105 : Set : RPNarration : $$String:$RPNarration
    106 : Set : RPRcptNo : $$String:$RPRcptNo
    107 : Set : RPRegNo : $$String:$RPRegNo
    108 : Set : RPRemarks : $$String:$RPRemarks
    109 : Set : RPVchno : $$String:$RPVchno

    ;;;;; UNIQUE VALUE NOT REPEATED

    120 : NEW OBJECT : Voucher

    121 : SET VALUE : Date : ##RPDate
    122 : Set Value : VoucherNumber : ##RPRcptNo ;##RPVchno
    123 : SET VALUE : VoucherTypeName : $$VchTypeReceipt
    124 : Set Value : NARRATION : ##RPNarration
    125 : Set Value : TSPLRegNo : ##RPRegNo
    126 : Set Value : TSPLRcptNo : ##RPRcptNo
    127 : Set Value : TSPLRcptRemarks : ##RPRemarks

    128 : SET VALUE : ISINVOICE : No

    ;; REPEATED VALUE

    150 : Insert Collection Object: Ledger Entries

    151 : SET VALUE : LEDGERNAME : ##RPDebitName
    152 : SET VALUE : Amount : ##RPDebitAmt

    153 : SET VALUE : ISDEEMEDPOSITIVE : "Yes"
    160 : Set Target : ...

    170 : Insert Collection Object: Ledger Entries

    171 : SET TARGET : LedgerEntries
    172 : SET VALUE : LEDGERNAME : ##RPCreditName
    173 : SET VALUE : Amount : ##RPCreditAmt

    174 : SET VALUE : ISDEEMEDPOSITIVE : "No"
    180 : Set Target : ...

    200 : INSERT COLLECTION OBJECT : BankAllocations

    201 : SET VALUE : PaymentFavouring : ##RPCreditName
    202 : SET VALUE : BankPartyName : ##RPCreditName
    203 : SET VALUE : Date : $$Date:$Date
    204 : SET VALUE : INSTRUMENTDATE : $$Date:$Date
    205 : SET VALUE : Name : $VoucherNumber ;$$Date:$Date + $VoucherNumber
    206 : SET VALUE : InstrumentNumber : "00"
    207 : SET VALUE : TransactionType : "Cheque/DD"
    208 : SET VALUE : Amount : ##RPDebitAmt
    209 : SET VALUE : PaymentMode : "Transacted"
    210 : SET VALUE : BankName : ##RPDebitName
    211 : SET VALUE : BankBranchName : "N/A"
    212 : SET TARGET: ...

    300 : SET VALUE : PersistedView : ##SVViewName
    301 : CREATE TARGET
    310 : SHOW PROGRESS : $$LoopIndex:$$Sprintf:"Receipt Voucher Creating":##ProgressCount:"Please wait...."

    320 : Increment : ProgressCount ;Counter
    325 : END WALK
    330 : End Progress
    340 : Msg Box : "Completed" : "Receipt Vouchers Imported \n Successfully!!! "

    400 : Return

    [System: Formulae]
    RcptPathxl : #receiptvoucher
    RcptSeetxl : #sheetnam

    [Collection: MyColl_1]
    Type : Vouchers : VoucherType
    Child Of : $$VchTypeReceipt
    Belongs To : Yes
    Fetch: Date, TSPLRegNo, TSPLRcptNo, Amount, MasterID
    Search Key: $Date + $TSPLRcptNo


    [System: Formula]
    mFor_duplicate : $$ReportObject:$$CollectionFieldByKey:$Date:mad:@mFormula:MyColl_1
    mFormula : ##RPDate + ##RPRcptNo
    ErrMsg : "This Room is already Booked Please select another Room"
     


Share This Page