In Voucher Creation Mode, is there a way to identify the current voucher's MasterID?

Discussion in 'Tally Developer' started by admin, Jan 24, 2013.

    
  1. admin

    admin Administrator Staff Member


    Query:
    In Voucher Creation Mode, is there a way to identify the current voucher's MasterID?
    Solution:
    Yes, one can determine the current voucher's MasterID from the Company Object's method CmpVchID which retains the Master ID of the subsequent voucher being created.
    For a Single-User Environment, the above solution holds good, but in case of Multi-User Environment where multiple users are entering data simultaneously, it is hard to determine the Master ID of the current voucher since the MasterID from the Company Object will be assigned to the first person saving the voucher.
    Therefore, to determine the MasterID of the current voucher, presently one needs to generate a unique value using $$MakeUniqueID which can be stored within the current Voucher's UDF. Once the voucher is saved, one can find the MasterID of this Voucher from the Collection of Vouchers of this Voucher Type by filtering for the unique ID assigned to it. To narrow down the scope of search, one needs to set the Variable SVFromDate and SVToDate to the current date and find the MasterID from the Collection of Vouchers.
    Summarizing the Steps below:
    1. Using $$MakeUniqueID, generate a Unique value and store it in the UDF within the Voucher object.
    2. Set the value of the UDF within a global variable.
    3. On saving the voucher, invoke a User Defined Function, wherein
    a. Set the SVFromDate and SVToDate to Current Date.
    b. Create a Collection of Vouchers for this Voucher Type.
    c. Using Function FilterValue, from the above Collection, find the MasterID of the Voucher by filtering for the UDF value within the variable.
    d. Do the needful with the Master ID received above.
     


Share This Page