Maintain in batches?

Discussion in 'Tally Integration' started by Partha Mondal, Apr 11, 2021.

    
  1. Partha Mondal

    Partha Mondal Member


    Dear all Member,

    I am new in TDL. I have created Stock Item master import from Excel. Import successfully done. But face some problem when I import. If any Item Category exist in Tally then show category already exist and not import.
    Also I want to Maintain in batches? field is automatically Yes if Excel file have data in Bachname row when I import.
    can anyone help me regarding this issue. is this possible? Attach my code below.

    Thank you in advance.



    ;;; Shri Ganesh

    [#Menu : GateWay of Tally]

    Key Item : Item (Master) Import : K : Execute : Rpt_Ledgermaster_Import

    [Report : Rpt_Ledgermaster_Import] ;; Auto Report

    Form : Frm_Ledgermaster_Import
    Title : $$LocaleString:"Item Master Import"
    Auto : Yes

    [Form: Frm_Ledgermaster_Import]

    No Confirm : Yes
    Space Top : 1
    Space Left : 1
    Space Right : 1
    Space Bottom : 1
    Option : Small Size Form
    Full Width : No
    Full Height : No
    Vertical Align : Centre
    Parts : Part_Ledgermaster_Import_Title, Part_Ledgermaster_Import_Details
    On : Form Accept : Yes : CALL : Func_ImportLedgerMaster


    Local : Field : Fld_Import_FileName : Modifies : Var_SVExcelPath : Yes
    Local : Field : Fld_Import_FileName : Variable : Var_SVExcelPath

    [Part: Part_Ledgermaster_Import_Title]

    Lines : Line_Ledgermaster_Imports, Line_Ledgermaster_Imports_Info

    [Line: Line_Ledgermaster_Imports]

    Fields : Form Sub Title
    Space Bottom : 0.25
    Local : Field : Form Sub Title : Info : $$LocaleString:"Item Master Import"

    [Line: Line_Ledgermaster_Imports_Info]

    Field : Simple Field
    Space Bottom : 0.75
    Local : Field : Simple Field : Info : $$LocaleString:"(Only Tally (XLS) Format is Supported)"
    Local : Field : Simple Field : Full Width : Yes
    Local : Field : Simple Field : Align : Centre

    [Part: Part_Ledgermaster_Import_Details]

    Lines : Line_Import_FileName

    [Line: Line_Import_FileName]

    Field : Medium Prompt, Fld_Import_FileName
    Local : Field : Medium Prompt : Info : $$LocaleString:"Import File Name (XLS / XLSX) :"

    [Field: Fld_Import_FileName]

    Use : Name Field
    Width : @@NarrWidth
    Set as : "F:\Salesdemo.xlsx"
    Full Width : Yes


    [Variable: Var_SVExcelPath]

    Type : String
    Default : ""
    Persist : Yes

    [System: Variable]

    Var_SVExcelPath : ""

    [System: Formula]

    ExcelFilePath : ##Var_SVExcelPath

    [Collection : Coll_ItemMaster_Excel]
    ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ= " + @@ExcelFilePath
    SQL : "Select * from [Sheet1$]"
    SQLObject : ItemMaster Object
    Client Only : Yes

    [Object : ItemMaster Object]

    PMItemName : $_21
    PMItemGroup : $_24
    PMItemCategory : $_25
    PMItemDesc : $_26
    PMItemHSN : $_29
    PMBatchName : $_32
    PMItemUOM : $_40

    [Collection : Coll_Ledgermaster_Source]
    Source Collection : Coll_ItemMaster_Excel
    Fetch : *.*

    Compute : PMItemName : $_21
    Compute : PMItemGroup : $_24
    Compute : PMItemCategory : $_25
    Compute : PMItemDesc : $_26
    Compute : PMItemHSN : $_29
    Compute : PMBatchName : $_32
    compute : PMItemUOM : $_40

    Format : $PMItemName

    [Function: Func_ImportLedgerMaster]
    ;; Procedural Block
    Variable : Counter : Number

    ;; Definition Block
    01 : SET FILE LOG ON
    02 : SET : Counter : 0
    03 : START PROGRESS : ($$NumItems:Coll_Ledgermaster_Source) : "Item Master Import" : @@CmpMailName : "Importing Masters..."

    04 : WALK COLLECTION : Coll_Ledgermaster_Source

    10 : If : NOT $$IsEmpty:$PMItemName

    20 : New Object : Stock Item
    30 : SET VALUE : Name : $PMItemName
    40 : SET VALUE : Parent : $PMItemGroup
    50 : SET VALUE : Description : $PMItemDesc
    60 : Set Value : Base Units : $PMItemUOM

    100 : SET VALUE : Category : $PMItemCategory

    110 : Set Target:..
    120 : Create Target
    130 : End If

    140 : SHOW PROGRESS : ##Counter
    150 : INCREMENT : Counter
    160 : END WALK
    170 : END PROGRESS
    180 : MSGBOX: "Status" :"Item Master Imported \n successfully!!! "
    190 : SET FILE LOG OFF
    200 : RETURN

    [#Field: STKI Batchable]

    Use : Logical Field
    Type : Logical : Forced
    Storage : Is BatchWise On
    Set as : if $$InCreateMode then @SetVal else if $ItemBatchesExist then Yes else $$Value
    SetVal : If $$IsEmpty:$IsBatchWiseOn:StockGroup:$Parent OR NOT $IsBatchWiseOn:StockGroup:$Parent Then No else Yes
    Set always : Yes

    Inactive : $$IsSysName:$BaseUnits
    Skip on : if $$InCreateMode then No Else $ItemBatchesExist
    Option : MSTKI BatchableOption : ##MVInMultiMode
     


  2. Vijay Shetye

    Vijay Shetye Member


    In the function add this line after 100 : Set Value : Category : $PMItemCategory

    101 : Set Value : IsBatchwiseon : Yes

    by doing item created using the import function will have batch wise Yes
     


Share This Page