Function to import sales and Purchase transactions from Excel (not for inventory)

Discussion in 'Tally Developer' started by Lynch, Nov 12, 2020.

    
  1. Lynch

    Lynch Member


    You can now import sales and Purchase transactions from Excel (not for inventory) to Tally by calling the following function either by button or menu option

    Please let me know if it throws error:-
    most common error:
    excel driver error, which can be solved by installing MS Access Database engine provided in the Microsoft website
    in the Excel file, Please keep all the Date field, invoice number filed as text format or just use the excel sheet attached as here.

    Since I've designed it exclusively for my transactions, you may alter it the way in which it suits you.

    I usually enter transactions in Google Spreadsheets, and I'll copy paste those entries to this excel(while pasting use paste special -> values) and import it to tally.

    Code:
    [Function : Import From Excel che]
    ;Parameter:fyf:String
    Variable : Counter : Number
    Variable : ParName1 : String : 0
    Variable : MyGSTIN : String:0
    Variable: partyaddrlinecount:Number
    Variable: Narrate:String
    Variable:Addrcount:Number:1
    Variable:CurrSrno:String:""
    Variable:PrevSrNo:String:""
    Variable:TDScurrvalue:Amount:0
    Variable:CCTDScurrvalue:Amount:0
    Variable:CITDScurrvalue:Amount:0
    Variable:JTDScurrvalue:Amount:0
    Variable:ITDScurrvalue:Amount:0
    Variable:NilTDScurrvalue:Amount:0
    Variable:currvalue:Amount:0
    Variable:Prevvalue:Amount:0
    Variable:i2,j2:Number:0
    Variable:GSTRecon:String:"No"
    00 : SET : Counter : 0
    ;00a:Log:##fyf
    00b:START PROGRESS : ($$NumItems:SalesInfo) : "Importing Vouchers" : @@CmpMailName : "Importing Sales Vouchers ..."
    00c:Walk Collection:Sales info
    01a:Do If:$_20 ="Debit Note Pch":Set:CurrSrno:$_2
    01b:Do If:$_20 <>"Debit Note Pch":Set:CurrSrno:$_2
    ;=======================Save voucher Serial number changes (except for last entry)================
    01x:if:##Counter > 0 and (##CurrSrno <> ##PrevSrno)
    01y : SET : SVViewName : $$SysName:InvVchView
    01z : Set Value :IsInvoice :"YES"
    02:Log:$_3
    02a:Create Target
    03:End If
    ;=========================Creates voucher single time for the same voucher number===================
    39:if:##Counter >= 0 and (##CurrSrno <> ##PrevSrno)
    40: Set : ParName1 : $_3
    Fetch Object:Ledger:##parName1:Name, InterStateSTNumber, VATTINNumber, SalesTaxNumber, Address, +
                                              LedMultiAddressList.*, LedgerStateName, IsOthTerritoryAssessee, Pincode, CountryName
    40a:Log:$_3
    41 : IF :$$IsEmpty:$Name:Ledger:##parName1
    
    42 : NEW OBJECT : Ledger
    43 : Set Value : Name : ##ParName1
    43a:Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" :Set Value : Parent : "Active Clients"
    43b:Do If:$_20="Purchase" or $_20 ="Debit Note Pch":Set Value : Parent : "Amazon Vendors"
    45 :Set Value : GSTRegistrationType:$_32
    45a:Set Value : Address:$_28
    5b:Set Value :LedStateName:$_29
    45c: Set Value : PartyGSTIN : $_31
    45za: Log:##ParName1
    46 : CREATE TARGET
    47 : END IF
    
    
    48a:Set:ParName1:$_14
    48b: IF :$$IsEmpty:$Name:CostCentre:##ParName1
    48c:NEW OBJECT : Cost Centre
    48d:Set Value : Name : ##ParName1
    48e:Set Value : Category : "Platform"
    48f:Create Target
    48g:End If
    
    49a:Set:J2:0
    49aa:Set:Narrate:""
    ;49ab:if:$_20<>"Debit Note Pch"
    49b:Walk Collection:sales info
    49c:Do If:##Currsrno=$_2:Set:currvalue:($$AmountAdd:##Currvalue:$_10)
    ;49ca:Do If:##Currsrno=$_25 and ($_20 ="Debit Note Pch"):Set:currvalue:($$AmountAdd:##Currvalue:$_10)
    49cb:Do If:##Currsrno=$_2 and ($_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch") and ($_21="94CC" or $_21="94CI"):Set:TDScurrvalue:($$AmountAdd:##TDSCurrvalue:$_22)
    49cc:Do If:##Currsrno=$_2 and ($_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch") and  $_21="94I":Set:TDScurrvalue:($$AmountAdd:##TDSCurrvalue:$_23)
    49cd:Do If:##Currsrno=$_2 and ($_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch") and  $_21="94J":Set:TDScurrvalue:($$AmountAdd:##TDSCurrvalue:$_24)
    49ce:Do If:##Currsrno=$_2 and ($_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch") and  $_21="95_NRI":Set:TDScurrvalue:($$AmountAdd:##TDSCurrvalue:$_30)
    49d:Do If:##Currsrno=$_2:Set:j2:##J2 + 1
    49e:Do If:##Currsrno=$_2:Set:Narrate:$$NewLine + ##Narrate + $_11
    ;49f:End If
    49g:End Walk
    49h:Log:$$Number:##Currvalue
    
    
    50 : NEW OBJECT : Voucher
    51 : Do If:$_20="Credit Note" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE: Date : $$Date:@@EVchDateStrPost
    51a: Do If:$_20="Tax invoice" or $_20="Purchase" :SET VALUE: Date : $$Date:@@EVchDateStrPost
    52 : SET VALUE : VoucherTypeName : $_20
    53 : Do If:$_20="Tax invoice" or $_20="GST Sales" :Set Value : Voucher Number:$$String:$_2
    53a:Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value : Voucher Number:$$String:$_2
    53b:Do If:$_20 ="Credit Note" :Set Value : Voucher Number:$$String:$_27
    54 : Do If:$_20="Purchase":SET VALUE : Narration : $$String:$$Machinedate + " Being Service Procured from " + $_3 + " in relating to : " + ##Narrate + $$NewLine ++
                                                    "Through Invoice number : " + $_2 + "Dated :" + @@EVchDateStrPost +  + " Entered by : " + $$CmpUserName
    54a : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch":SET VALUE : Narration : $$String:$$Machinedate + $_11 + "Being Digital Marketing Services in the Context of : " + ##Narrate + $$NewLine ++
                                                    " Provided to :" + $_3 + " Through Invoice number : " + $_2 + "Dated :" + @@EVchDateStrPost +  + " Entered by : " + $$CmpUserName
    54b : Do If:$_20="Credit Note" :SET VALUE : Narration : $$String:$$Machinedate + $_11 + "Being Reversal of Digital Marketing Services in the Context of : " + ##Narrate + $$NewLine ++
                                                    " Provided to :" + $_3 + " Through Invoice number : " + $_2 + "Dated :" + @@ERefDateStrPost +  + " Entered by : " + $$CmpUserName  
    54c : Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch":SET VALUE : Narration : $$String:$$Machinedate + $_11 + "Being Reversal of Goods / Service Procured from " + $_3 + " in relating to : " + ##Narrate + $$NewLine ++
                                                    "Through Credit note number : " + $_2 + " Dated :" + @@EVchDateStrPost +  + " Entered by : " + $$CmpUserName
    54d:  Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" or $_20="Credit Note":Set Value:GSTNatureofReturn:"01-Sales Return"
    54e:  Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" or $_20="Credit Note": Set Value:VATPartyTransReturnNumber:$_2
    54f:  Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" or $_20="Credit Note": Set Value:VATPartyTransReturnDate:@@EVchDNCNDateStrPost
    
    55 : SET VALUE : BasicBuyerName:$_3
    56 : Do If:$_20="Purchase":SET VALUE : Reference :$$String:$_2
    56a : Do If:$_20="Credit Note":SET VALUE : Reference :$$String:$_2
    57 : Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Reference :$$String:$_25
    57a: Log:@@ErefDateStrPost
    58 : Do If:$_20="Purchase" or $_20="Credit Note" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value : Reference Date: $$Date:@@ErefDateStrPost
    58a: Log:$Date
    58b: Log:$Referencedate
    59 : Do If:$_20="Credit Note" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value : Reference Date: $$Date:@@EVchDNCNDateStrPost
    60 : INSERT COLLECTION OBJECT : LedgerEntries
    61 : SET TARGET : LedgerEntries
    61q  : Do If:$_20="Purchase" or $_20="Credit Note":SET VALUE : Is Deemed Positive : "No"
    61r  : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "Yes"
    62 : SET VALUE : LedgerName : $_3
    63 : SET VALUE : Amount : ##Currvalue
    65 : SET VALUE        : PartyGSTIN            : $PartyGSTIN:Ledger:$_3
    66 : SET VALUE        : CountryofResidence    : $CountryName:Ledger:$_3
    67 : SET VALUE        : StateName                : $LedgerStateName:Ledger:$_3
    67a: Set Value        : BasicDueDateOfPymt    : $BillCreditPeriod:Ledger:$_3
    68 : SET VALUE        : PlaceOfSupply         : $LedgerStateName:Ledger:$_3
    68a: SET VALUE        : GSTRegistrationType   : $GSTRegistrationType:Ledger:$_3
    68b: SET VALUE    : CurrBuyerAddressType        : ($$SysName:Primary)
    68c:Log:$PartyGSTIN:Ledger:$_3
    
    ;68b:Walk Collection:sales info
    ;68c : If:##Currsrno=$_2
    68e : INSERTCOLLECTION OBJECT : BillAllocations
    68g : SET VALUE :BillType : $$SysName:Newref
    68h : Do If:$_20="Purchase" :SET VALUE :  Name : $$String:$_2
    68ha: Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE :  Name : $$String:$_25
    68hb: Do If:$_20="Tax invoice" :SET VALUE :  Name : $$String:$_2
    68hc: Do If:$_20="Credit Note" :SET VALUE :  Name : $$String:$_2
    68i : Do If:$_20="Purchase" or $_20="Credit Note" : Set Value : Amount :($$AmountSubtract:##Currvalue:##TDSCurrvalue)
    ;68ia : Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" : Set Value : Amount :($$AmountSubtract:##TDSCurrvalue:##Currvalue)
    68ia : Do If:$_20 ="Debit Note" : Set Value : Amount :($$AmountSubtract:##TDSCurrvalue:##Currvalue)
    68ib  : Do If:$_20 ="Debit Note Pch" : Set Value : Amount :($$AmountSubtract:$_22:$_10)
    68j : Do If:$_20="Tax invoice" or $_20="GST Sales" : Set Value : Amount :($$AmountSubtract:0:##Currvalue)
    68ja : Do If:$_20="Credit Note" : Set Value : Amount :##Currvalue
    
    68k : If:$_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch"
    ;68ka:Log:"error"
        68l : INSERTCOLLECTION OBJECT : BillAllocations
        68m : SET VALUE :BillType : $$SysName:Newref
        68n : Do If:$_20="Purchase" :SET VALUE :  Name : $$String:$_2
        68na: Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE :  Name : $$String:$_25
        ;68o : Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch": Set Value : Amount :$$AmountSubtract:0:##TDSCurrvalue
         68o : Do If:$_20 ="Debit Note" or $_20: Set Value : Amount :$$AmountSubtract:0:##TDSCurrvalue
         68p : Do If:$_20 ="Debit Note Pch": Set Value : Amount :$$AmountSubtract:0:$_22
        68q: Do If:$_20="Purchase": Set Value : Amount :##TDSCurrvalue
    
    68r : End If
    ;68s : End If
    ;68t : End Walk
    /*
    68k : If:$_20="Purchase" or $_20="Debit Note"
    68ka:Log:"bill alloc ok"
        68l : INSERTCOLLECTION OBJECT : BillAllocations
        68m : SET VALUE :BillType : $$SysName:AgstRef
        68n : Do If:$_20="Purchase" :SET VALUE :  Name : $_2
        68na: Do If:$_20="Debit Note" :SET VALUE :  Name : $_25
        68o : Do If:$_20="Debit Note": Set Value : Amount :($$AmountSubtract:0:##TDSCurrvalue)
        68oa : Do If:$_20="Purchase": Set Value : Amount :##TDSCurrvalue
    68p : End If
    */
    
    
    69k : For Range:i:Number:1:($$NumFilledItems:Address:Ledger:$_3):1
    69l : Insert Collection Object:Address
    69m : Set Value    : BasicBuyerAddress    :$(Ledger, $_3).Address[##i].Address; .[].Address
    69n : Set Target    : ..
    69o :End For
    
    69q:Set:Currvalue:0
    69r:Set:i2:0
    69s:End If
    ;69t:End If
    ;;---------------------------------------------------------
    ;;BY SALES Entry
    
    70 : INSERT COLLECTION OBJECT : Ledger Entries
    
    71 : SET TARGET : LedgerEntries
    72 : SET VALUE : LedgerName : $_4
    73 : SET VALUE : BasicUserDescription : $_11
    
    74 : SET VALUE : Amount : $_5
    74a : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    74b  : Do If:$_20="Purchase" or $_20="Credit Note":SET VALUE : Is Deemed Positive : "Yes"
    74ba:Increment:i2
    74bb:If:not $$IsEmpty:$_13
    75c:Insert Collection Object:CategoryAllocations
    75d:Set Value:Category:$_13
    75e:Insert Collection Object:Cost Centre Allocations
    75f:Set Value:Name:$_14
    76e:Do If:$_20="Purchase" or $_20="Credit Note" :Set Value:Amount:($$AmountSubtract:0:$_5)
    76f:Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value:Amount:$_5
    76ga:End If
    76gb:If:not $$IsEmpty:$_13
    77a:Insert Collection Object:CategoryAllocations
    77b:Set Value:Category:$_15
    77c:Insert Collection Object:Cost Centre Allocations
    77e:Set Value:Name:$_16
    77f:Do If:$_20="Purchase" or $_20="Credit Note" :Set Value:Amount:($$AmountSubtract:0:$_5)
    77fa:Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value:Amount:$_5
    76fb:End If
    76fc:If:not $$IsEmpty:$_13
    77g:Insert Collection Object:CategoryAllocations
    77h:Set Value:Category:$_17
    77i:Insert Collection Object:Cost Centre Allocations
    77k:Set Value:Name:$_18
    77l:Do If:$_20="Purchase" or $_20="Credit Note":Set Value:Amount:($$AmountSubtract:0:$_5)
    77la:Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :Set Value:Amount:$_5
    77lb:End If
    
    
    
    77o :Log:##i2
    77p :Log:##j2
    78a : SET TARGET : ..
    
                        ;==================add Tax and rounding off at the end of the line=================================
                        78aa:if:(##i2 = ##j2)
                        78ab:Walk Collection:sales info
                        78ac:Do If:##Currsrno=$_2:Set:currvalue:($$AmountAdd:##Currvalue:$_8)
                        ;78aca:Do If:##Currsrno=$_25 and ($_20 ="Debit Note Pch"):Set:currvalue:($$AmountAdd:##Currvalue:$_8)
                        78ad:End Walk
    
                        78b: INSERT COLLECTION OBJECT : LedgerEntries
                        78c : SET TARGET : LedgerEntries
                        79 : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Credit Note" :SET VALUE : LedgerName : "Output IGST"
                        79a: Do If:$_20="Purchase" or $_20 ="Debit Note Pch" :SET VALUE : LedgerName : "Input IGST"
                        79b:  Do If:$_19="P" :SET VALUE : LedgerName : "IGST"
                        79c:Do If:$_19="C" :SET VALUE : BasicUserDescription : "IGST"
                        80 : SET VALUE : Amount : ##Currvalue
                        80a: Log:$$Number:##Currvalue
                        81 : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
                        81a : Do If:$_20="Purchase" or $_20="Credit Note" :SET VALUE : Is Deemed Positive : "Yes"
                        82 : SET TARGET : ..
                        82a:Set:Currvalue:0
    
                        82ab:Walk Collection:sales info
                        82ac:Do If:##Currsrno=$_2:Set:currvalue:($$AmountAdd:##Currvalue:$_6)
                        ;82aca:Do If:##Currsrno=$_25 and ($_20 ="Debit Note Pch"):Set:currvalue:($$AmountAdd:##Currvalue:$_6)
                        82ad:End Walk
    
                        83: INSERT COLLECTION OBJECT : LedgerEntries
                        84 : SET TARGET : LedgerEntries
                        85 : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Credit Note" :SET VALUE : LedgerName : "Output CGST"
                        85a: Do If:$_20="Purchase" or $_20 ="Debit Note Pch" :SET VALUE : LedgerName : "Input CGST"
                        85b:Do If:$_19="P" :SET VALUE : LedgerName : "CGST"
                        85c:Do If:$_19="C" :SET VALUE : BasicUserDescription : "CGST"
                        86 : SET VALUE : Amount : ##Currvalue
                        86a: Log:$$Number:##Currvalue
                        87 : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
                        87a : Do If:$_20="Purchase" or $_20="Credit Note":SET VALUE : Is Deemed Positive : "Yes"
                        88 : SET TARGET : ..
                        88a:Set:Currvalue:0
    
                        88ab:Walk Collection:sales info
                        88ac:Do If:##Currsrno=$_2:Set:currvalue:($$AmountAdd:##Currvalue:$_7)
                        ;88aca:Do If:##Currsrno=$_25 and ($_20 ="Debit Note Pch"):Set:currvalue:($$AmountAdd:##Currvalue:$_7)
                        88ad:End Walk
    
                        89: INSERT COLLECTION OBJECT : LedgerEntries
                        90 : SET TARGET : LedgerEntries
                        91 :  Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Credit Note" :SET VALUE : LedgerName : "Output SGST"
                        91a:  Do If:$_20="Purchase" or $_20 ="Debit Note Pch" :SET VALUE : LedgerName : "Input SGST"
                        91b:Do If:$_19="P" :SET VALUE : LedgerName : "SGST"
                        91c:Do If:$_19="C" :SET VALUE : BasicUserDescription : "SGST"
                        92 : SET VALUE : Amount : ##Currvalue
                        92a: Log:$$Number:##Currvalue
                        93 : Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
                        93a : Do If:$_20="Purchase" or $_20="Credit Note" :SET VALUE : Is Deemed Positive : "Yes"
                        94 : SET TARGET : ..
                        94a:Set:Currvalue:0
    
    ;                    94b:End If
    
    94c:If:($_20="Purchase" or $_20 ="Debit Note" or $_20 ="Debit Note Pch")
    
    94e:Walk Collection:sales info
    94f:Log:$$Number:##CurrValue
    94g:Do If:(##Currsrno=$_2 and $_21="94CC"):Set:CCTDScurrvalue:($$AmountAdd:##CCTDSCurrvalue:$_22)
    94h:Do If:(##Currsrno=$_2 and $_21="94CI"):Set:CITDScurrvalue:($$AmountAdd:##CITDSCurrvalue:$_22)
    94i:Do If:(##Currsrno=$_2 and $_21="94J"):Set:JTDScurrvalue:($$AmountAdd:##JTDSCurrvalue:$_24)
    94j:Do If:(##Currsrno=$_2 and $_21="94I"):Set:ITDScurrvalue:($$AmountAdd:##ITDSCurrvalue:$_23)
    94ja:Do If:(##Currsrno=$_2 and $_21="95_NRI"):Set:ITDScurrvalue:($$AmountAdd:##ITDSCurrvalue:$_30)
    94k:Do If:(##Currsrno=$_2 and $_21=""):Set:NilTDScurrvalue:($$AmountAdd:##NilTDSCurrvalue:0)
    94l:End Walk
    
    95b: INSERT COLLECTION OBJECT : LedgerEntries
    95c : SET TARGET : LedgerEntries
    95d: SET VALUE : LedgerName : "Tds on Contracts"
    95da:Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    95e: Do If:$_20="Purchase" :SET VALUE : Amount : ##CCTDSCurrValue
    95ea: Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Amount :##CCTDSCurrValue
    95f :Do If:$_20="Purchase":SET VALUE : Is Deemed Positive :"Yes"
    95h: SET TARGET : ..
    95ha:Set:Currvalue:0
    95hb:Set:TDSCurrValue:0
    95hc:Set:CCTDSCurrValue:0
    
    
    95k: INSERT COLLECTION OBJECT : LedgerEntries
    95l : SET TARGET : LedgerEntries
    95m: SET VALUE : LedgerName : "Tds on Consultancy Fees"
    95ma:Do If:$_20="Debit Note" :SET VALUE : Is Deemed Positive : "No"
    95n: SET VALUE : Amount :##JTDSCurrValue
    95o :SET VALUE : Is Deemed Positive : "Yes"
    ;95oa:Do If:$_20="Debit Note" :SET VALUE : Is Deemed Positive : "No"
    95p: SET TARGET : ..
    95pa:Set:Currvalue:0
    95pb:Set:TDSCurrValue:0
    95pc:Set:JTDSCurrValue:0
    
    95s: INSERT COLLECTION OBJECT : LedgerEntries
    95t : SET TARGET : LedgerEntries
    95u: SET VALUE : LedgerName : "Tds on Rent"
    95v :Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    95w: SET VALUE : Amount : ##ITDSCurrValue
    95wa :Do If:$_20="Purchase" :SET VALUE : Is Deemed Positive : "Yes"
    95x: SET TARGET : ..
    95xa:Set:Currvalue:0
    95xb:Set:TDSCurrValue:0
    95xc:Set:ITDSCurrValue:0
    
    95yas: INSERT COLLECTION OBJECT : LedgerEntries
    95yat : SET TARGET : LedgerEntries
    95yau: SET VALUE : LedgerName : "Tds on Contracts Individual"
    95yav: SET VALUE : Amount :##CITDSCurrValue
    95yaw :Do If:$_20="Purchase" :SET VALUE : Is Deemed Positive : "Yes"
    121 :Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    122: SET TARGET : ..
    123:Set:Currvalue:0
    124:Set:TDSCurrValue:0
    125:Set:CITDSCurrValue:0
    
    125a: INSERT COLLECTION OBJECT : LedgerEntries
    125b: SET TARGET : LedgerEntries
    125c: SET VALUE : LedgerName : "Tds on Non Resident Payments"
    125d:Do If:$_20="Purchase" :SET VALUE : Is Deemed Positive : "Yes"
    125e:Do If:$_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    125f: SET VALUE : Amount :##CITDSCurrValue
    125g: SET TARGET : ..
    125h:Set:Currvalue:0
    125i:Set:TDSCurrValue:0
    125j:Set:CITDSCurrValue:0
    
    
    
    
    126:End If
    
    
    
    127:Walk Collection:sales info
    128:Do If:##Currsrno=$_2:Set:currvalue:($$AmountAdd:##Currvalue:$_9)
    129:End Walk
    
    
    130 : INSERT COLLECTION OBJECT : Ledger Entries
    131 : SET TARGET : Ledger Entries
    132 : SET VALUE : LedgerName : "ROUND OFF"
    
    132a : If: ##currvalue > 0
            132b: Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    132c : Else
            132d: Do If:$_20="Tax invoice" or $_20="GST Sales" or $_20 ="Debit Note" or $_20 ="Debit Note Pch" :SET VALUE : Is Deemed Positive : "No"
    132e : End If
    
    
    
    133 : SET VALUE : Amount : ##currvalue
    134 : If: ##currvalue > 0
      
            135a : Do If:$_20="Purchase" or $_20="Credit Note" :SET VALUE : Is Deemed Positive : "Yes"
    136 : Else
          
            137a : Do If:$_20="Purchase" or $_20="Credit Note" :SET VALUE : Is Deemed Positive : "Yes"
    138 : End If
    
    140 :  SET TARGET : ..
    141 :Set:currvalue:0
    141a:Set:TDSCurrValue:0
    142:End If
    
    ;;---------------------------------------------------------
    
    ;159 : SET VALUE : PersistedView : ##SVViewname
    160 : INCREMENT : Counter
    170 : SHOW PROGRESS : ##Counter
    
    ;====================Serial number swap================
    180 : Set:prevSrno:##currSrNo
    
    ;==========================saves last voucher=================
    180b: if:##Counter = ($$NumItems:Salesinfo)
    180c : SET : SVViewName : $$SysName:InvVchView
    180d: Set Value :IsInvoice :"YES"
    180da:Log:"vocher created"
    180e :Create Target
    180f:End If
    181 : END WALK
    190 : END PROGRESS
    200 : RETURN
    
    [Collection: Sales Info]
    ODBC            : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + $$Localestring:##ExcelFilePath
    SQL                : "Select * From ["+$$Localestring:##sheetname+"$]"
    Fetch            : *.*
    SQLObject: sales info
    ;SQL: Yes
    /*Object:DSDDate : $_1
    Object:DSDVchNo : $_2
    Object:DSDCName : $_3
    Object:DSDSALed : $_4
    Object:DSDSAAmt : $_5
    Object:DSDTDSAmt : $_6
    Object:DSDIGSTAmt :$_7
    Object:DSDRAAmt :$_8
    Object:DSDTotal : $$AsAmount:$_9
    Object:DSDNarration : $_10
    Object:DSDCGSTIN : $_11
    Object:DSDVCHDate : $_12
    */
    [Object:Sales Info]
    DSDDate : $_1
    DSDVchNo : $_2
    DSDCName : $_3
    DSDSALed : $_4
    DSDSAAmt : $_5
    DSDTDSAmt : $_6
    DSDIGSTAmt :$_7
    DSDRAAmt :$_8
    DSDTotal : $$AsAmount:$_9
    DSDNarration : $_10
    DSDCGSTIN : $_11
    DSDVCHDate : $_12
    
    
     

    Attached Files:

    Last edited: Nov 14, 2020


  2. Rupesh H

    Rupesh H New Member


    Sir
    Thanks for uploading the code
    I have doesn't know how to use this one
    please guide me
    Thanks
     


  3. Lynch

    Lynch Member


    you should have a configuration screen to get the path and sheet name of an Excel File. once you get the inputs, call the function by passing the path and sheet name [you may need to add parameters to the function]

    then the function will do its work.
     


  4. Rupesh H

    Rupesh H New Member


    Ok sir
    will try
     


  5. Rupesh H

    Rupesh H New Member


    Sir
    I copy the code in txt file and loaded into tally but their is no menu or buttons for importing the data from excel file to tally
    Kindly suggest proper way for this
    Thanks
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Please read his statement again........you will have to make a Configuration screen........

    He has made the function and the EXCEL file only -- hence there is no Menu or Buttons.

    -------- the rest of the things you will have to make it to pass the parameters into the Function.
     


Share This Page