sales voucher import with Party address

Discussion in 'Tally Developer' started by Lynch, Apr 3, 2021.

    
Tags:
  1. Lynch

    Lynch Member


    I've posted the code to import vouchers from excel in the following link
    http://tdlexpert.com/index.php?thre...from-excel-not-for-inventory.8994/#post-37422
    This is post is an update to the existing code.

    Why this update required?. What drawback in the existing code?
    While importing the voucher, the code lacked in importing address of the party in the supplementary details. So to print the voucher with address, I was in need to add more code to print the voucher with party address by adding the party address in the printing report.

    So, the absolute necessary arrives now, if I didnt have the code to print the voucher, the voucher is not printing with Party address. Therefore, it is utmost necessary to import the address once and for all while importing the voucher itself.

    But How?.. earlier I couldnt formulate, but now I made it so here's the code..

    first we need two variable to be declared in the function start
    Code:
     Variable            : LedAddressCount       : Number    : 0
        Variable            : AddressCount            : Number    : 0
    Then while selecting the party ledger in the import function, add some more information relating to the supplementary details, such as
    Party mailing name, Address, Pincode, Place of supply, Party GSTIN, Country etc..

    out of the supplementary details mentioned above... leave the address alone because its a stand alone collection variable which we need to update as a last information. In other words, if you're maintaining bill wise information to the party ledger, then update the bills allocation collection object first then come to address collection as a final object.

    in the below code, just imagine my customer's name is mentioned in the third column of the excel sheet,
    Code:
    60 : INSERT COLLECTION OBJECT : LedgerEntries
    61 : SET TARGET : LedgerEntries
    
    62 : SET VALUE : LedgerName : $_3
    63 : SET VALUE : Amount : ##Currvalue
    65 : SET VALUE        : PartyGSTIN            : $PartyGSTIN:Ledger:$_3
    65a: Set Value        : PartyMailingName        : $_3
    65b: Set Value        : PartyPinCode            : $Pincode:Ledger:$_3
    65c: Set Value        : PartyPinCode            : $Pincode:Ledger:$_3
    
    
    65cb    : Set            : AddressCount            : $$NumItems:Address
    65cc : Set           : LedAddressCount   : $$NumFilledItems:Address:Ledger:$_3;$$CollectionFieldByKey:$TotalAddressLines:($$SysName:Primary):BasicBuyerAddress;($LedgerMailingDetails:Ledger:$_3)
        
    65e    : Set Value:ConsigneeMailingName:$_3
    65f : Set Value:Consigneepincode:$Pincode:Ledger:$_3
    65g : Set Value:ConsigneeStateName:$LedgerStateName:Ledger:$_3
    65h : Set Value:ConsigneeCountryName:$CountryName:Ledger:$_3
    65i    : Set Value:BillToPlace:$LedgerStateName:Ledger:$_3
    65j : Set Value:ShipToPlace:$LedgerStateName: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         : $StateName:Ledger:$_3
    68a: SET VALUE        : GSTRegistrationType   : $GSTRegistrationType:Ledger:$_3
    68b: SET VALUE    : CurrBuyerAddressType        : ($$SysName:Primary)
    68c:Log:$PartyGSTIN:Ledger:$_3
    hereafter I go to update the sub collection of bills allocation
    Code:
    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
    
    and finally I've given as much enogh information about the party ledger, finally the address need to updated. The following code would do that
    Code:
    69e    : If                : (##LedAddressCount > 0)
        69f    :    For Range        : Index    : Number    : 1    : ##LedAddressCount : 1
        
        69g    :        Do If        : ($$IsEmpty:@@myLedgerAddress)    : Continue
        69h    :        If          : ##Index > ##AddressCount
     
        69i :           Insert Collection Object    : Address
        69j :       Else
        69k :           Set Target  : Address[##Index].
        69l :       End If
        69m    :        Set Value    : Address        : @@LedgerAddressyaa
        69n :        Set Target    : ..
        69o    :    End For
        69p    : End If
        
       
    
    Since I use a formula ( @@LedgerAddressyaa ) in the function, I need to describe it inside the[ system : Formula ] block just like this

    Code:
    [System:Formulae]
        LedgerAddressyaa:$(Ledger, $_3).Address[##Index].Address
    
    My thanks to Jenny for giving various ideas to come up to this update
     
    Jenny likes this.


  2. ASHTAMOORTHY

    ASHTAMOORTHY New Member


     


Share This Page