Auto generate related Voucher while creating any Vocuher

Discussion in 'Tally Developer' started by Bipin Damania, Dec 19, 2018.

    
  1. Bipin Damania

    Bipin Damania Active Member


    Dear All

    I want to know how to Generate related voucher automatically while creating any voucher.
    e.g. if i create Purchase entry and with the same if want to generate TDS Journal using Purchase amount.

    Please guide me

    Thanks
     


  2. Jenny

    Jenny Active Member


    in generate tds entry its inbuilt in tally . you can one entry pass in purchase and tds. see this link......
     


  3. Bipin Damania

    Bipin Damania Active Member


    Thank you for your reply.

    But I want to generate different entry. This is just example given.

    Please reply
     


  4. Jenny

    Jenny Active Member


    just clarify ur query what u want....and if u have any code for that then post it....otherwise no one can help u without query....
     


  5. Bipin Damania

    Bipin Damania Active Member


    x
    If I receive short payment from my Customer and I came to know while passing Receipt entry, I have to pass Discount Journal entry.
    and that Journal I want to pass Automatically.

    Please guide me for the same.
    I will try & write TDL.

    Thanks
     


  6. Jenny

    Jenny Active Member


    You can pass an entry in same voucher for "discount paid" its not necessary to pass an another journal entry for discount
     


  7. Bipin Damania

    Bipin Damania Active Member


    No But I want to pass separate entry, not in same receipt entry.
     


  8. Jenny

    Jenny Active Member


    Code:
    [Report: VchReceiptInfo]
    
        Forms                : Vch Receipt Info
    
    [Form: VchReceiptInfo]
    
        Top Parts            : Vch Receipt Info
        On                   : Form Accept         : Yes    : Form Accept
        On                   : Form Accept         : Yes    : CALL : JournalVchCreate
    
    [Part: VchReceiptInfo]
    
        Top Lines            : VCH Receiptdr,Vch Receipt Info
        Local                : Line : Default : Space top : 1
    
    [#Part: DBLLINE Narration]
    
        Add                  : Line : Before : Vch Narrprompt : VCH ReceiptPass
    
    [Line: VCH ReceiptPass]
    
        Left Fields          : Medium Prompt,VCH ReceiptPass
        Local                : Field : Medium Prompt : Set as :"Pass Journal Entry : "
        Invisible            : not @@isreceipt
    
    [Line: VchReceiptdr]
    
        Left Fields          : Medium Prompt,Name Field
        Local                : Field : Medium Prompt : Set as :"Discount Ledger Name :"
        Local                : Field : Name Field :  Table       : Cash Class Ledgers ExtractCash : $$IsEmpty:@VchLed
        Local                : Field : Name Field :  Storage:VchReceiptdr
        Local                : Field : Name Field : Show Table : Always
    
    [Line: VchReceiptInfo]
    
        Left Fields          : Medium Prompt,Vch Receipt Info
        Local                : Field : Medium Prompt : Set as :"Discount Amount :"
    
    
    [Field: VCH ReceiptPass]
    
        Use                  : Logical Field
        Storage              : VCHReceiptPass
        Set Always           : Yes
        Show Table           : always
        Sub Forms            : Vch Receipt Info :$$Value
    
    [Field: VchReceiptInfo]
    
        Use                  : Amount Field
        Storage              : VchReceiptInfo
    
    
    [Collection: Cash Class Ledgers ExtractCash]
    
        Use                  : Extract Alias Collection
        Source Collection    : LedgersVch Src
        Collections          : Notapplicable
        Title                : $$LocaleString:"List of Ledger Accounts"
       Parm Var    : GroupSundryDebtors    : String    : $$GroupSundryDebtors
        Native Method        : Name, Parent, ReserveName
        Keep Source          : ().
        Client Only          : Yes
       
    [Function: JournalVchCreate]
    
        Action               : 01  : QUERYBOX : "Create Journal Voucher ?":Yes:No
        Action               : 02 : IF : $$LastResult
        Action               : 03 : NEW OBJECT : VOUCHER
        Action               : 04 :   SET VALUE : Date      : $date
        Action               : 05 :   SET VALUE : VoucherTypeName   : $$VchTypeJournal
        Action               : 06  :  SET VALUE  : Narration     : $Narration
        Action               : 08 :   INSERT COLLECTION OBJECT    : AllLedgerEntries
        Action               : 09 : SET VALUE  : LedgerName   : $Partyledgername
        Action               : 10 :  SET VALUE  : Is Deemed Positive : "no"
        Action               : 11 :  SET VALUE  : Amount     : ($VchReceiptInfo)   ;;($VchReceiptInfo)   ;;$Amount
        Action               : 12 :    INSERT COLLECTION OBJECT    : BillAllocations
        Action               : 13 :   SET VALUE   : BillType    : $$SysName:Advance
        Action               : 14 :     SET VALUE  : Name     : $vouchernumber
        Action               : 15 :    SET VALUE  : Amount                :($VchReceiptInfo)  ;($VchReceiptInfo)   ;;$amount
        Action               : 16 :    SET TARGET  : ...
        Action               : 17 :   INSERT COLLECTION OBJECT    : AllLedgerEntries
        Action               : 18 :  SET VALUE  : LedgerName   : $VchReceiptdr
        Action               : 19 :   SET VALUE  : Amount    : $VchReceiptInfo
        Action               : 20 :   SET VALUE  : Is Deemed Positive : "yes"
        Action               : 21 :   SET TARGET  : ..
     
        Action               : 22  :   SET VALUE       : PersistedView  : ##SVViewName
        Action               : 23 :  CREATE TARGET
        Action               : 24 :  ENDIF
       
    [System: UDF]
    
       VCH ReceiptPass      : Logical:902:yes
        VchReceiptdr         : String:901:yes
       
        VchReceiptInfo       : Amount:903:yes
       
     
    Sushil Kumar likes this.


  9. Bipin Damania

    Bipin Damania Active Member


    Jenny Madam

    I tried with this code but discount entry is not generate.

    Please guide me
    Thanks for your prompt reply.
     


  10. Salman

    Salman Member


    Mr. Dipin Damania,

    This is working fine for me i checked the code. but u can do the more modification in that code so the date u can put as u want to post the voucher..Just add some fields like date, narration or any other fields so the Journal voucher you can post as u want..
     
    Jenny likes this.


  11. Jenny

    Jenny Active Member


    Its not a full code for ur requirement .Just i post for this u have some idea... you modified the code as per ur requirement .. just see @Salman says...
     


  12. Bipin Damania

    Bipin Damania Active Member


    Thanks Salmanji

    I think my Receipt Voucher no was empty so it is not generate. Now I will modify as suggested by you.

    Jenny Madam

    Journal entry is generated but with Cr first & Dr second. Now I will modify.

    Ok. I will do.

    Thank you very much both of you.
     
    Jenny likes this.


  13. Bipin Damania

    Bipin Damania Active Member


    Jenny Madam

    I made changes in code
    Now in Auto Generate Journal Voucher Dr is First & Cr is Second
    and also
    Add 2 Field Narration and Bill no.

    Thank you very much

    Will try more

    Once again Thanks
     
    Jenny likes this.


  14. Jenny

    Jenny Active Member


    You most welcome....and in freecode section post your code because some of others to benefits.
     


  15. Bipin Damania

    Bipin Damania Active Member


    Sorry for delay

    Uploading Now.

    Thanks

    [Report : VchReceiptInfo]
    Forms : Vch Receipt Info

    [Form : VchReceiptInfo]
    Top Parts : Vch Receipt Info
    On : Form Accept : Yes : Form Accept
    On : Form Accept : Yes : CALL : JournalVchCreate

    [Part : VchReceiptInfo]
    Top Lines : VCH Receiptdr, Vch Receipt Info, VCH Narr New, VCH BillName New
    Local : Line : Default : Space Top : 1

    [#Part : DBLLINE Narration]
    Add : Line : Before : Vch Narrprompt : VCH ReceiptPass

    [Line : VCH ReceiptPass]
    Left Fields : Medium Prompt, VCH ReceiptPass
    Local : Field : Medium Prompt : Set as :"Pass Journal Entry : "
    Invisible : Not @@IsReceipt

    [Line : VchReceiptdr]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "Discount Ledger Name :"
    Local : Field : Name Field : Table : Cash Class Ledgers ExtractCash : $$IsEmpty:mad:VchLed
    Local : Field : Name Field : Storage : VchReceiptdr
    Local : Field : Name Field : Show Table : Always

    [Line : VchReceiptInfo]
    Left Fields : Medium Prompt, Vch Receipt Info
    Local : Field : Medium Prompt : Set as : "Discount Amount :"

    [Line : VchNarrNew]
    Left Fields : Medium Prompt, Vch Narr New
    Local : Field : Medium Prompt : Set as : "Narration :"

    [Line : VchBillNameNew]
    Left Fields : Medium Prompt, Vch BillName New
    Local : Field : Medium Prompt : Set as : "Bill No :"

    [Field : VCH Narr New]
    Use : Name Field
    Storage : VCHNarrNew
    Set Always : Yes

    [Field : VCH BillName New]
    Use : Name Field
    Storage : VCHBillNameNew
    Set Always : Yes

    [Field : VCH ReceiptPass]
    Use : Logical Field
    Storage : VCHReceiptPass
    Set Always : Yes
    Show Table : Always
    Sub Forms : Vch Receipt Info : $$Value

    [Field : VchReceiptInfo]
    Use : Amount Field
    Storage : VchReceiptInfo

    [Collection : Cash Class Ledgers ExtractCash]
    Use : Extract Alias Collection
    Source Collection : LedgersVch Src
    Collections : Notapplicable
    Title : $$LocaleString:"List of Ledger Accounts"
    Parm Var : GroupSundryDebtors : String : $$GroupSundryDebtors
    Native Method : Name, Parent, ReserveName
    Keep Source : ().
    Client Only : Yes

    [Function : JournalVchCreate]

    Action : 01 : QUERYBOX : "Create Journal Voucher ?":Yes:No
    Action : 02 : IF : $$LastResult
    Action : 03 : NEW OBJECT : VOUCHER
    Action : 04 : SET VALUE : Date : $Date
    Action : 05 : SET VALUE : VoucherTypeName : $$VchTypeJournal
    Action : 06 : SET VALUE : Narration : $VCHNarrNew
    Action : 08 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 09 : SET VALUE : LedgerName : $VchReceiptDr
    Action : 10 : SET VALUE : Is Deemed Positive : "Yes"
    Action : 11 : SET VALUE : Amount : ($VchReceiptInfo)
    Action : 17 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 18 : SET VALUE : LedgerName : $PartyLedgerName
    Action : 19 : SET VALUE : Amount : $VchReceiptInfo
    Action : 20 : SET VALUE : Is Deemed Positive : "No"
    Action : 21 : INSERT COLLECTION OBJECT : BillAllocations
    Action : 22 : SET VALUE : BillType : $$SysName:Advance
    Action : 23 : SET VALUE : Name : $VCHBillNameNew
    Action : 24 : SET VALUE : Amount : ($VchReceiptInfo)
    Action : 25 : SET TARGET : ...
    Action : 26 : SET TARGET : ..
    Action : 27 : SET VALUE : PersistedView : ##SVViewName
    Action : 28 : CREATE TARGET
    Action : 29 : ENDIF

    [System : UDF]
    VchReceiptdr : String : 901 : Yes
    VCH ReceiptPass : Logical : 902 : Yes
    VchReceiptInfo : Amount : 903 : Yes
    VchNarrNew : String : 904 : Yes
    VchBillNameNew : String : 905 : Yes
     
    Jenny likes this.


  16. Bipin Damania

    Bipin Damania Active Member


    Jenny Madam

    I am getting error
    at Lable = Create Target
    "Voucher totals do not match!"
    Dr: 2.00 Dr Cr: Diff: 2.00 Dr

    Please reply
     


  17. Sanjjaypal

    Sanjjaypal New Member


    Your problem was solved or not?
     


  18. Bipin Damania

    Bipin Damania Active Member


    No
    Not yet
     


  19. Bipin Damania

    Bipin Damania Active Member


    Any guidance
     


  20. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Action : 11 : SET VALUE : Amount : $$Negative:$VchReceiptInfo
     


  21. Bipin Damania

    Bipin Damania Active Member


    At the time of create Receipt entry with Auto Pass Journal as "YES" it gives error

    FUNCTION:'JournalVchCreate' LABEL:28: Vocuher totals do not match! Dr: 0.50 Dr Cr:Diff:0.50Dr

    But when we edit same Receipt entry with Auto Pass Journal as "YES" entry is generated without any error

    Don't understand.

    Please guide.

    Thanks
     


  22. Sanjjaypal

    Sanjjaypal New Member


    Modify your code
    Try this

    [Report : VchReceiptInfo]
    Forms : Vch Receipt Info

    [Form : VchReceiptInfo]
    Top Parts : Vch Receipt Info
    On : Form Accept : Yes : Form Accept
    On : Form Accept : Yes : CALL : JournalVchCreate

    [Part : VchReceiptInfo]
    Top Lines : VCH Receiptdr, Vch Receipt Info, VCH Narr New, VCH BillName New
    Local : Line : Default : Space Top : 1

    [#Part : DBLLINE Narration]
    Add : Line : Before : Vch Narrprompt : VCH ReceiptPass

    [Line : VCH ReceiptPass]
    Left Fields : Medium Prompt, VCH ReceiptPass
    Local : Field : Medium Prompt : Set as :"Pass Journal Entry : "
    Invisible : Not @@IsReceipt

    [Line : VchReceiptdr]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "Discount Ledger Name :"
    Local : Field : Name Field : Table : Cash Class Ledgers ExtractCash : $$IsEmpty:mad:VchLed
    Local : Field : Name Field : Storage : VchReceiptdr
    Local : Field : Name Field : Show Table : Always

    [Line : VchReceiptInfo]
    Left Fields : Medium Prompt, Vch Receipt Info
    Local : Field : Medium Prompt : Set as : "Discount Amount :"

    [Line : VchNarrNew]
    Left Fields : Medium Prompt, Vch Narr New
    Local : Field : Medium Prompt : Set as : "Narration :"

    [Line : VchBillNameNew]
    Left Fields : Medium Prompt, Vch BillName New
    Local : Field : Medium Prompt : Set as : "Bill No :"

    [Field : VCH Narr New]
    Use : Name Field
    Storage : VCHNarrNew
    Set Always : Yes

    [Field : VCH BillName New]
    Use : Name Field
    Storage : VCHBillNameNew
    Set Always : Yes

    [Field : VCH ReceiptPass]
    Use : Logical Field
    Storage : VCHReceiptPass
    Set Always : Yes
    Show Table : Always
    Sub Forms : Vch Receipt Info : $$Value

    [Field : VchReceiptInfo]
    Use : Amount Field
    Storage : VchReceiptInfo

    [Collection : Cash Class Ledgers ExtractCash]
    Use : Extract Alias Collection
    Source Collection : LedgersVch Src
    Collections : Notapplicable
    Title : $$LocaleString:"List of Ledger Accounts"
    Parm Var : GroupSundryDebtors : String : $$GroupSundryDebtors
    Native Method : Name, Parent, ReserveName
    Keep Source : ().
    Client Only : Yes

    [Function : JournalVchCreate]

    Action : 01 : QUERYBOX : "Create Journal Voucher ?":Yes:No
    Action : 02 : IF : $$LastResult
    Action : 03 : NEW OBJECT : VOUCHER
    Action : 04 : SET VALUE : Date : $Date
    Action : 05 : SET VALUE : VoucherTypeName : $$VchTypeJournal
    Action : 06 : SET VALUE : Narration : $VCHNarrNew
    Action : 08 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 09 : SET VALUE : LedgerName : $VchReceiptDr
    Action : 10 : SET VALUE : Is Deemed Positive : "Yes"
    ;Action : 10 : SET VALUE : Is Deemed Positive : "No"
    Action : 11 : SET VALUE : Amount : $VchReceiptInfo
    Action : 17 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 18 : SET VALUE : LedgerName : $PartyLedgerName
    Action : 19 : SET VALUE : Amount : ($VchReceiptInfo)
    Action : 20 : SET VALUE : Is Deemed Positive : "No"
    ;Action : 20 : SET VALUE : Is Deemed Positive : "Yes"
    Action : 21 : INSERT COLLECTION OBJECT : BillAllocations
    Action : 22 : SET VALUE : BillType : $$SysName:Advance
    Action : 23 : SET VALUE : Name : $VCHBillNameNew
    Action : 24 : SET VALUE : Amount : $VchReceiptInfo
    Action : 25 : SET TARGET : ...
    Action : 26 : SET TARGET : ..
    Action : 27 : SET VALUE : PersistedView : ##SVViewName
    Action : 28 : CREATE TARGET
    Action : 29 : ENDIF

    [System : UDF]
    VchReceiptdr : String : 901 : Yes
    VCH ReceiptPass : Logical : 902 : Yes
    VchReceiptInfo : Amount : 903 : Yes
    VchNarrNew : String : 904 : Yes
    VchBillNameNew : String : 905 : Yes
     
    naren1234 likes this.


  23. Bipin Damania

    Bipin Damania Active Member



    Sanjay Palji

    Thanks for your reply
    But
    getting same error
     


  24. Bipin Damania

    Bipin Damania Active Member


    Jenny Madam

    Can I have your email ID please.

    Please reply.
     


  25. Bipin Damania

    Bipin Damania Active Member


    Jenny Madam

    My problem resolved.
    Can I have your email ID please.
    Thank you.
     


Share This Page