Function to import Employee Master

Discussion in 'Tally Developer' started by Lynch, Oct 29, 2020.

    
  1. Lynch

    Lynch Member


    To those who are using Tally Payroll for Salary, You can now import Employee master from Excel 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 the DoJ field, Date of Birth Field, Phone number field, aadhar field as text format to solve errors relating to date and number format.


    Code:
    [Variable:MyEmpAddress]
        Variable:myiAddress:String
    [#Field: Employee TransactionType]
        Set as:$$SysName:eFundTransfer
    [Function:Import From Excel Emp Master Upld]
    Variable : Counter : Number
    Variable:i2:Number:0
    Variable:ParName1:String:""
    List Variable:MyEmpAddress
    
    
    000ab : SET : Counter : 0
    000b:START PROGRESS : ($$NumItems:EmpInfo) : "Importing Employee Masters" : @@CmpMailName : "totto doin"
    000c:Walk Collection:EmpInfo
    0010:Set:ParName1:$_1
    0020: IF :$$IsEmpty:$Name:CostCentre:##parName1
    0030:NEW OBJECT : Cost Centre
    0031    :    Set Value    :    Name    :    ##parName1
    0032:Set Value : Category : "Employees"
    0033:Create Target
    0034:NEW Object:Cost Centre:##parName1
    0035    :    Set Value    :    ForPayroll    :    Yes
    0036:Alter Target
    0037:New Object:Cost Centre:##parName1
    0042    :    Set Value    :    EMPDisplayName    :    $_1
    0043    :    Set Value    :    Parent    :    $_3
    0044    :    Set Value    :    DateOfJoin    :    @@EmpDoJPost
    0045    :    Set Value    :    Additional Name    :    $_5
    0046    :    Set Value    :    Designation    :    $_6
    0047    :    Set Value    :    Function    :    $_7
    0048    :    Set Value    :    Location    :    $_8
    0049    :    Set Value    :    Gender    :    $_9
    0050    :    Set Value    :    DateOfBirth    :    @@EmpDoBpost
    0051    :    Set Value    :    BloodGroup    :    $_11
    0052    :    Set Value    :    FatherName    :    $_12
    0053    :    Set Value    :    SpouseName    :    $_13
    
    0053a   :   List Add Ex    :    MyEmpAddress
    0053b    :    Set        :i2:1
    0053c   :   Set    : MyEmpAddress[##i2].myiAddress :    $_14
    0053d    :    List Append Ex    :    MyEmpAddress
    0054    :    Set        :i2:2
    0055    :    Set    : MyEmpAddress[##i2].myiAddress:    $_15
    0055a    :    List Append Ex    :    MyEmpAddress
    0055b    :    Set        :i2:3
    0056    :    Set    : MyEmpAddress[##i2].myiAddress:    $_16
    0056a    :    List Append Ex    :    MyEmpAddress
    0056b    :    Set        :i2:4
    0057    :    Set    : MyEmpAddress[##i2].myiAddress:    $_17
    0057a    :    List Append Ex    :    MyEmpAddress
    0057b    :    Set        :i2:5
    0058    :    Set    : MyEmpAddress[##i2].myiAddress:    $_18
    0058a    :    List Append Ex    :    MyEmpAddress
    0058b    :    Set        :i2:6
    0059    :    Set    : MyEmpAddress[##i2].myiAddress:    $_19
    0059a: FOR RANGE    : myi    : Number    : 1    : 6 : 1
        0059b    :         INSERT COLLECTION OBJECT    : Address
        0059c    :             SET VALUE    : Address    :##MyEmpAddress[##myi].myiAddress
        0059e    :         SET TARGET    : ..
        0059f    : END FOR
    
    0060    :    Set Value    :    ContactNumbers:        $_20
    0061    :    Set Value    :    EMailID        :$_21
    0062    :    Set Value    :    PANNumber    :    $_24
    0063    :    Set Value    :    AadharNumber    :    $_25
    0065    :    Set Value    :    BankAccountNumber    :    $_22
    0066    :    Set Value    :    IFSCode    :    $_23
    0067    :    Set Value    :    BankDetails    :    $_30
    0068    :    Set Value    :    BankBranch    :    $_31
    0068a    :    INSERT COLLECTION OBJECT: Payment Details
    ;0068a: Explode        : Employee InterBank Explosion:yes
    ;0069    :    Set Value  :    $DefaultTransactionType    : $$SysName:eFundTransfer
    0069    :Set Target:Payment Details
    0069a    :    Set Value    :    DefaultTransactionType: $$SysName:InterBankTransfer
    0070    :    Set Value    :    Account Number    :    $_22
    0071    :    Set Value    :    Bank Name    :    $_30
    0071a    :    Set Value    :    IFSCode    :    $_23
    0072    :    If: $$StringPart:$_23:0:4 = "HDFC"
    0073    :    Insert Collection Object    : Beneficiary Code Details
    0074    :    Set Target    :    Beneficiary Code Details 
    0082    :    Set Value    :    Company Bank    :    "HDFC Bank"
    0083    :    Set Value    :    Beneficiary Code    :    $_24
    0084    :    End If
    ;0085    :    Execute Ex    :Employee BankDetails
    
    
    0091:Alter Target
    0092:End If
    0093:Log:$Name:CostCentre:##parName1 + " Created"
    0160 : INCREMENT : Counter
    0170 : SHOW PROGRESS : ##Counter
    0193 : END WALK
    0194 : END PROGRESS
    0195 : RETURN
    
    
    
    [#Field: EmpFilterIsMultiBankAllc]
         
            Set as        : yes
         
         
    
    
    [Collection: EmpInfo]
    
    ODBC            : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + $$Localestring:##ExcelFilePath
    SQL                : "Select * From ["+$$Localestring:##sheetname+"$]"
    Fetch            : *.*
    SQLObject: EmpInfo
    
    [Object:EmpInfo]
    Name    :    $_1
    Name2    :    $_2
    Group    :    $_3
    Join    :    $_4
    EmpNo    :    $_5
    Designation    :    $_6
    Function    :    $_7
    Location    :    $_8
    Gender    :    $_9
    DoB    :    $_10
    Bloodgroup    :    $_11
    FatherName    :    $_12
    SposeName    :    $_13
    Address1    :    $_14
    Address2    :    $_15
    Address3    :    $_16
    Address4    :    $_17
    Address5    :    $_18
    Address6    :    $_19
    PhoneNumber    :    $_20
    Mailid    :    $_21
    Bankacnum    :    $_22
    IFSC    :    $_23
    PAN    :    $_24
    aadhar    :    $_25
     

    Attached Files:

    yacob likes this.


  2. yacob

    yacob New Member


    Sir,

    Can u guide me with import from excel to tally with multi bill allocations.
     


  3. Lynch

    Lynch Member


    Ofcourse, why not...

    For that you need to understand the Bill allocation is a collection object. But you cant see the collection's description anywhere.

    When you enter the bills manually, it is actually repeating the bills details line until the name of the bill becomes empty and stores the data in a aggregate udf which is what the invisible collection object which I mentioned above

    To attain this objective via importing function, the function must insert the collection object in the appropriate place such as after the amount
    Assignment to the party ledger

    Now comes the multi bills allocation, you have to walk the odbc collection (which is nothing but your excel file) and inside the walk you can insert collection object like this...
    (I assume you are asking about the receipt entry)


    ..............
    ...........your code.....

    0786: Walk: receipts info
    <optional if conditions>
    0797:Insert collection object: Bills allocations
    0798: set target: Bills allocations
    0799: set value:name:$_7 ; assuming 7th column(G) in excel where you set the bill name
    0800: Set Value:isdeemedpositive:yes
    0801: set value:amount:$_8
    0802:set target..
    0803:<end if>;if added above
    0804: End walk
    .........
    ......
    ....rest of your code...





     
    yacob likes this.


  4. yacob

    yacob New Member


    Thank You Sir. I Will Check With This....
     


Share This Page