UDF value not getting carried over during company data split

Discussion in 'Tally Developer' started by K Vinod Kumar, Jun 8, 2012.

    
  1. K Vinod Kumar

    K Vinod Kumar New Member


    A UDF stored in Batch Allocations Collection (which has the opening stock details) which is a sub collection in Stock Item Object, is not getting carried over to the new split company during the splitting of company data. But at the same time the UDFs stored in Primary Object Stock Item is getting carried over to the new company.

    What shall I do to carry over the UDF in the Batch Allocations, to the new split company?
     



  2. Hi Vinod,

    Please use this Code. You will get the Solution.
    The Fuction is Executed while Spliting the Data.
    For Your Refernce i am Attaching The Test Data Also


    Code:
    ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara
     
    ;; UDF Added in StockItem Master At Batch Allocation Level
     
    [#Line: STKALLOC MainLine]
        Add : Right Fields: Before : STKALLOCQty : STKALLOCNum
     
        [Field : STKALLOCNum]
            Use          : Number Field
            Set As        : $STKALLOCNum
            Storage    : STKALLOCNum
            Set Always    : Yes
            Format        : "NoZero"
     
           
    [System : UDF]
        STKALLOCNum : Number : 1947
     
     
    ;; Function Which Will Execute At Splitting Of Company Data
       
    [#Report: Split Company]
        Local        : Form : Split Company: On        : Form Accept : Yes : Form Accept
        Local        : Form : Split Company: On        : Form Accept : Yes : Call  : DSDSplitMainCMPFunc:#CMPAction:@@DSDSplitCMP   
     
    [System : Formula]
        DSDSplitCMP : ($$Sprintf:@@CmpSplitYearFormat:#CMPAction:@@CmpSplitDate)
     
     
    [Function : DSDSplitMainCMPFunc]
        Parameter    : Old Company    : String
        Parameter    : New Company    : String
       
        001    : CALL    : DSDSplitCMPFunc:##OldCompany:##NewCompany
           
     
    [Function:DSDSplitCMPFunc]
        Parameter    : NewCompany C1    : String
        Parameter    : NewCompany C2    : String
       
        Variable    : vsItemName    : String
        Variable    : Counter    : Number    : 1
       
        01    : SET            : SVCurrent Company    : ##NewCompanyC1
        02    : WALK COLLECTION    : DSD StockItems
        03    :    SET        : vsItemName    :$Name   
        04    :        SET        : SVCurrent Company    : ##NewCompanyC2       
        05    :        NEW OBJECT    : StockItem        : $Name    : Yes
        06    : SET            : SVCurrent Company    : ##NewCompanyC1   
        07    : IF : Not $$IsEmpty:$ClosingBalance
        08    : WHILE : ##Counter<=$$NumItems:DSDSTKIBatchAllocattions
        09    :    WALK COLLECTION : BATCHALLOCATIONS
        10    :            SET TARGET    : BATCHALLOCATIONS[##Counter]
        11    :            SET VALUE    : STKALLOCNum    : $$CollectionField:$STKALLOCNum:##Counter:DSDSTKIBatchAllocattions   
        12    :    SET TARGET    : ..
        13    :    END WALK   
        14    : INC    : Counter
        15    : END WHILE
        16    : End If
        17    : SET            : SVCurrent Company    : ##NewCompanyC2
        18    : Accept Alter   
        19    : SET    : SVCurrent Company    : ##NewCompanyC1
        20    : END WALK
       
     
     
    [Collection : DSD StockItems]
        Type        : StockItem
        Filter        : NotEmptyClBalance
        BelongsTo    : Yes
        Format        : $Name,20
        Format        : $ClosingBalance,10
        Fetch        : Name,ClosingBalance
     
    [System : Formula]
        NotEmptyClBalance    : Not $$IsEmpty:$ClosingBalance
        STKI Split Filter    : $Name=##vsItemName
       
     
     
    [Collection: DSD STKI Split]
        Type        : Stock Item
        Filter        : STKI Split Filter
     
    [Collection: DSD STKI Batch Allocattions]
        Source Collection    : DSD STKI Split
        Walk                : Batch Allocations
        Fetch                : Batch Name,STKALLOCNum
     
    ;; End-Of File
     

    Attached Files:



  3. K Vinod Kumar

    K Vinod Kumar New Member


    Dear Sir,
    Thank you very much. Here the UDF stored in Batch Allocations is stored correctly into the New company. I have another query related to same scenario which is as follows :

    I have written a code to store a UDF in Batch Allocations Level in Inventory Entries In Collection in Voucher Object for each Manufacturing Journal. The same also has been done for each Purchase Vouchers. Hence during the splitting, if any batch has closing stock then this batch would appear as the opening stock of the new company. The UDF has to be stored these batches also. The company has the Godown feature enabled too. For this problem will the above need a lot of tweaking or a new function has to be written. Kindly advice.
     



  4. Hi,
    You can use the above function for the same. just construct the collection for purchase or Mfg Journal. Compare the batches and then set the value required.
     


  5. K Vinod Kumar

    K Vinod Kumar New Member


    Dear Sir,
    Thank you for the reply. I will try the same and confirm the result.
     


  6. admin

    admin Administrator Staff Member


    Hope the solution given by dinesh solves ur problem :)
     


  7. K Vinod Kumar

    K Vinod Kumar New Member


    Dear Sir,
    With lit bit of tweaking in the above code I was able to solve my second issue very well. The above code worked well with the first issue. Thanks once again.
     


  8. dhanapal

    dhanapal New Member


    Mr. Dinesh This is not getting closing value of that UDF. it is giving only given in old company.we need
    closing balance of udf to carry as opening balance like billed qty act. pls reply
    Likewise

    Opening Udf value : 10 pcs

    Purchse udf value : 20 pcs

    Sales udf value : 15 pcs

    Closing udf value : 15 pcs this should come as opening balance in splitted company.
     
    SINTO PARAVA likes this.


  9. Gopaalran

    Gopaalran New Member


    Dear Mr Vinod
    Can u share that new code which u made.

    Thanks in advance
     


  10. SINTO PARAVA

    SINTO PARAVA Member


    ;;Sir ..my code is not working while splitting
    ;;please help me
    ;;;===============================


    [#Report: Split Company]
    Local : Form : Split Company: On : Form Accept : Yes : Form Accept
    Local : Form : Split Company: On : Form Accept : Yes : Call : DSDSplitMainCMPFunc:#CMPAction:mad:@DSDSplitCMP

    [System : Formula]
    DSDSplitCMP : ($$Sprintf:mad:@CmpSplitYearFormat:#CMPAction:mad:@CmpSplitDate)


    [Function : DSDSplitMainCMPFunc]
    Parameter : Old Company : String
    Parameter : New Company : String

    001 : CALL : DSDSplitCMPFunc:##OldCompany:##NewCompany


    [Function:DSDSplitCMPFunc]
    Parameter : NewCompany C1 : String
    Parameter : NewCompany C2 : String

    Variable : vsItemName : String
    Variable : Counter : Number : 1

    01 : SET : SVCurrent Company : ##NewCompanyC1
    02 : WALK COLLECTION : DSD StockItems
    03 : SET : vsItemName :$Name
    04 : SET : SVCurrent Company : ##NewCompanyC2
    05 : NEW OBJECT : StockItem : $Name : Yes
    06 : SET : SVCurrent Company : ##NewCompanyC1
    07 : IF : Not $$IsEmpty:$ClosingBalance
    08 : WHILE : ##Counter<=$$NumItems:BatchInGodownName;;DSDSTKIBatchAllocattions
    09 : WALK COLLECTION : BATCHALLOCATIONS
    10 : SET TARGET : BATCHALLOCATIONS[##Counter]
    ;; 11 : SET VALUE : STKALLOCNum : $$CollectionField:$STKALLOCNum:##Counter:DSDSTKIBatchAllocattions
    ;;12: enginno
    13: SET VALUE : enginno : $$CollectionField:$enginno:##Counter:BatchInGodownName;;DSDSTKIBatchAllocattions
    14: SET VALUE : chasisno : $$CollectionField:$chasisno:##Counter:BatchInGodownName;;DSDSTKIBatchAllocattions

    15: SET VALUE : itemcolor : $$CollectionField:$itemcolor:##Counter:BatchInGodownName;;DSDSTKIBatchAllocattions
    16: SET VALUE : skucode : $$CollectionField:$skucode:##Counter:BatchInGodownName;;DSDSTKIBatchAllocattions


    17 : SET TARGET : ..
    18 : END WALK
    19 : INC : Counter
    20 : END WHILE
    21 : End If
    22 : SET : SVCurrent Company : ##NewCompanyC2
    23 : Accept Alter
    24 : SET : SVCurrent Company : ##NewCompanyC1
    25 : END WALK



    [Collection : DSD StockItems]
    Type : StockItem
    Filter : NotEmptyClBalance
    BelongsTo : Yes
    Format : $Name,20
    Format : $ClosingBalance,10
    Fetch : Name,ClosingBalance
    Fetch: GodownName, BatchName, ClosingBalance, Rate, ClosingValue,name,enginno,chasisno,itemcolor,skucode
    [System : Formula]
    NotEmptyClBalance : Not $$IsEmpty:$ClosingBalance
    STKI Split Filter : $Name=##vsItemName



    [Collection: DSD STKI Split]
    Type : Stock Item
    Filter : STKI Split Filter

    [Collection: DSD STKI Batch Allocattions]
    Source Collection : DSD STKI Split
    Walk : Batch Allocations
    Fetch : Batch Name,skucode,enginno,chasisno,itemcolor
    ;; End-Of File


    [#Collection:BatchInGodownName]
    add :Fetch: name,enginno,chasisno,itemcolor,skucode

    ;;;===============================
    ;;Sir ..my code is not working while splitting
    ;;pleasae help me
     


  11. SINTO PARAVA

    SINTO PARAVA Member


    ;;Sir ..my code is not working while splitting
    ;;pleasae help me

     

    Attached Files:



  12. dipika

    dipika New Member


    this code is not working but i am not getting the udf value after split
     


  13. dipika

    dipika New Member


    T


    This code works for only 1st Item
     


Share This Page