auto journal entry

Discussion in 'Requests' started by ag_1234, Jul 13, 2020.

         
  1. ag_1234

    ag_1234 New Member


    Hello everyone...

    Taking inspiration from many people on forum tried creating auto journal voucher from sales voucher (complied from various sources available on forum itself.)
    have 3 fields in the form namely
    1) cash
    2) bank
    3) for sundry debtors (i needed this as i am in the field where in payment against voucher can come from 4-5 different sources like part payment received from company who has financed the product. )

    code is saving the journal entry very well. the only issue that i am facing is that i am not able to make selection from list of accounts for sundry debtors. Can anyone help on same.


    Regards
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Your collection for Debtors is wrong..... you are collecting Vouchers.....

    Type should be Ledger and Child of --- GroupSundryDebtors
     


  3. ag_1234

    ag_1234 New Member


    Dear Sir,
    Thank you for your quick reply. I already tried the same under collection list but was unable to put the same at right place.
    request you to kindly provide help on this part of coding.

    Regards
    Abhinav
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Local : Field : Name Field : Table : SundryDebtors Class Ledgers ExtractSundryDebtors ;: $$IsEmpty:VchGroupSundryDebtors --- (delete this red marked)

    [Collection : SundryDebtors Class Ledgers ExtractSundryDebtors]
    Use : List of Ledgers
    Fetch : Name, Parent
    Delete : Format
    Add : Format : $Name, 40
    Add : Format : $Parent, 30
    Filter : IsLedgerDrs

    [System : Formula]
    IsLedgerDrs : $$IsGrpofGrp:$Parent:$$GroupSundryDebtors
     
    ag_1234 likes this.


  5. ag_1234

    ag_1234 New Member


    Dear Amit Ji

    Thank you very much for your help. I have updated the same and its working.
    Thank you for your kind gesture as i was scratching my head for the same for last 3-4 days.
    I am uploading the same again so that if anyone wants to use the same can use it.
    Learned a lot on how the structure of tdl is like from the forum itself. Thanks once again.

    Regards
    Abhinav
     

    Attached Files:



  6. ag_1234

    ag_1234 New Member


    Dear Amit Sir
    One more doubt i want to clarify.
    the entry passed with this small code gives 3 debits and 1 credit account on passing the journal entry.
    eg.
    dr cash
    dr bank
    dr o/s account name
    Cr on the sales voucher ledger name.

    now suppose out of 3 payment modes i used only 2 modes say cash ledger and o/s account name ledger. when i check the journal voucher passed it shows as

    dr cash-100 rs
    dr bank --0 rs
    dr o/s account---500 rs
    Cr - xyz (person on whose name the ledger account is created for sales)---600 rs.

    should i use $$SysName:NotApplicable command for not showing dr bank---0 rs
    if not $$SysName:NotApplicable then what should be for same and where the same needs to be placed i.e in line command after collection table or somewhere else.

    awaiting for your positive reply.

    Regards
    Abhinav
     


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    In your function....use conditional formula along with If-EndIf.......... $$Isempty then do not run that code of debit entries........

    ALWAYS .... make a copy of old working TDL and start fresh one......if myTDL13-07-2020 is working, then make a copy and rename it myTDL15-07-2020 and so on.........

    Lookup various functions in TDL developer and learn to implement from that..... e.g. check out GetDSPName
     


  8. ag_1234

    ag_1234 New Member


    Dear Amit ji
    Please have a look. made 2 changes
    1) added not applicable in table
    2) if $$IsEmpty in function

    The voucher is not created. neither it shows any error

    Please help on same.

    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 : RecieptVchCreate
    
    [Part : VchReceiptInfo]
    Top Lines : VCH Receiptdr, VchReceiptInfo, VCH Receiptdr1, Vch ReceiptInfo1, VCH Receiptdr2, Vch ReceiptInfo2,  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 : @@IsSale
    
    [Line : VchReceiptdr]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "CASH ACCOUNT :"
    Local : Field : Name Field : Table : Cash Class Ledgers ExtractCash, NOT Applicable
    Local : Field : Name Field : Storage : VchReceiptdr
    Local : Field : Name Field : Show Table : Always
    
    [Line : VchReceiptInfo]
    Left Fields : Medium Prompt, VchReceiptInfo
    Local : Field : Medium Prompt : Set as : "CASH PAYMENT :"
    
    [Line : VchReceiptdr1]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "BANK ACCOUNT:"
    Local : Field : Name Field : Table : Bank Class Ledgers ExtractBank, NOT Applicable
    Local : Field : Name Field : Storage : VchReceiptdr1
    Local : Field : Name Field : Show Table : Always
    
    [Line : VchReceiptInfo1]
    Left Fields : Medium Prompt, VchReceiptInfo1
    Local : Field : Medium Prompt : Set as : "BANK PAYMENT :"
    
    [Line : VchReceiptdr2]
    Left Fields : Medium Prompt, Name Field
    Local : Field : Medium Prompt : Set as : "SELECT O/S ACCOUNT :"
    Local : Field : Name Field : Table : SundryDebtors Class Ledgers ExtractSundryDebtors, NOT Applicable
    Local : Field : Name Field : Storage : VchReceiptdr2
    Local : Field : Name Field : Show Table : Always
    
    [Line : VchReceiptInfo2]
    Left Fields : Medium Prompt, VchReceiptInfo2
    Local : Field : Medium Prompt : Set as : "O/S ACCOUNT 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
    
    [Field : VchReceiptInfo1]
    Use : Amount Field
    Storage : VchReceiptInfo1
    
    [Field : VchReceiptInfo2]
    Use : Amount Field
    Storage : VchReceiptInfo2
    
    [Collection : Cash Class Ledgers ExtractCash]
    Use : List of Ledgers
    Fetch : Name, Parent
    Delete : Format
    Add : Format : $Name, 20
    Add : Format : $Parent, 10
    Filter : IsLedgerCash
    
    [Collection : Bank Class Ledgers ExtractBank]
    Use : List of Ledgers
    Fetch : Name, Parent
    Delete : Format
    Add : Format : $Name, 20
    Add : Format : $Parent, 10
    Filter : IsLedgerBank
    
    [Collection : SundryDebtors Class Ledgers ExtractSundryDebtors]
    Use : List of Ledgers
    Fetch : Name, Parent
    Delete : Format
    Add : Format : $Name, 20
    Add : Format : $Parent, 10
    Filter : IsLedgerDrs
    
    [Function : JournalVchCreate]
    
    Action : 01 : QUERYBOX : "Create Reciept Voucher ?":Yes:No
    Action : 02 : IF : $$LastResult
    Action : 03 : NEW OBJECT : VOUCHER
    Action : 04 : SET VALUE : Date : $Date
    Action : 05 : SET VALUE : VoucherTypeName : $$VchTypeReciept
    Action : 06 : SET VALUE : Narration : $VCHNarrNew
    
    IF NOT $$IsEmpty: $VchReceiptDr OR $$IsEmpty: $VchReceiptInfo Then $$IsSysName: Not Applicable Else $VchReceiptDr
    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 : $$Negative:($VchReceiptInfo)
    Endif
    
    IF NOT $$IsEmpty: $VchReceiptDr1 OR $$IsEmpty: $VchReceiptInfo1 Then $$IsSysName: Not Applicable Else $VchReceiptDr1
    Action : 12 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 13 : SET VALUE : LedgerName : $VchReceiptDr1
    Action : 14 : SET VALUE : Is Deemed Positive : "Yes"
    Action : 15 : SET VALUE : Amount : $$Negative:($VchReceiptInfo1)
    Endif
    
    IF NOT $$IsEmpty: $VchReceiptDr2 OR $$IsEmpty: $VchReceiptInfo2 Then $$IsSysName: Not Applicable Else $VchReceiptDr2
    Action : 16 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 17 : SET VALUE : LedgerName : $VchReceiptDr2
    Action : 18 : SET VALUE : Is Deemed Positive : "Yes"
    Action : 19 : SET VALUE : Amount : $$Negative:($VchReceiptInfo2)
    Endif
    
    Action : 20 : INSERT COLLECTION OBJECT : AllLedgerEntries
    Action : 21 : SET VALUE : LedgerName : $PartyLedgerName
    Action : 22 : SET VALUE : Is Deemed Positive : "No"
    Action : 23 : SET VALUE : Amount : ($VchReceiptInfo+$VchReceiptInfo1+$VchReceiptInfo2)  ;; ($VchReceiptInfo+$VchReceiptInfo1+$VchReceiptInfo2)  ;;$amount
    
    
    Action : 24 : INSERT COLLECTION OBJECT : BillAllocations
    Action : 25 : SET VALUE : BillType : $$SysName:Advance
    Action : 26 : SET VALUE : Name : $VCHBillNameNew
    Action : 27 : SET VALUE : Amount : ($VchReceiptInfo+$VchReceiptInfo1+$VchReceiptInfo2)  ; ($VchReceiptInfo+$VchReceiptInfo1+$VchReceiptInfo2)  ;;$amount
    Action : 28 : SET TARGET : ...
    Action : 29 : SET TARGET : ..
    Action : 30 : SET VALUE : PersistedView : ##SVViewName
    Action : 31 : CREATE TARGET
    Action : 32 : ENDIF
    
    
    [#System: Formulae]
    
    IsLedgerCash : $$IsGrpofGrp:$Parent:$$GroupCash
    IsLedgerBank : $$IsGrpofGrp:$Parent:$$GroupBank OR $$IsGrpofGrp:$Parent:$$GroupBankOD
    IsLedgerDrs : $$IsGrpofGrp:$Parent:$$GroupSundryDebtors
    
    [System : UDF]
    VchReceiptdr : String : 901 : Yes
    VchReceiptdr1 : String : 902 : Yes
    VchReceiptdr2 : String : 903 : Yes
    VCH ReceiptPass : Logical : 904 : Yes
    VchReceiptInfo : Amount : 905 : Yes
    VchReceiptInfo1 : Amount : 906 : Yes
    VchReceiptInfo2 : Amount : 907 : Yes
    VchNarrNew : String : 908 : Yes
    VchBillNameNew : String : 909 : Yes 
     


  9. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    The "IF" conditions you have specified in FUNCTION is wrong.......

    In Function, there is a different way of doing the IF....it is followed by End If.....

    Refer to any in-built Tally functions in TDE and learn....... (e.g. try GetDSPName function and see how If-Endif is made.)
    I am making you learn and do it yourself, that way you will learn a good lesson......
     


  10. ag_1234

    ag_1234 New Member


    Dear Amit ji

    I checked the GETDSPName Function seems to be related to tax collection i checked the logic of most of 54 fielsd where the same can be used but unable to figure out the correct code that gives me idea of what to use. can you help on same.

    Regards
    Abhinav
     


  11. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    I have already guided you....

    You are supposed to STUDY that function....irregardless of its use and purpose.... to understand how IF conditions are used.....

    The purpose of that function is immaterial...... please read my previous messages in this forum once again. carefully.
    ;):)
     


  12. ag_1234

    ag_1234 New Member


    Dear Sir,
    Can you help on the solution. still unable to do it. every time i use combination for If Commands tally gives unknown command error. if you can help on same then plz help.
    regards
     


  13. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Wish I could help, but am myself weak in Function.....
    other experts and knowledgeable members might help. Keep patience.
     


  14. ag_1234

    ag_1234 New Member


    Sir,
    I found one file on auto receipt based on Pos transaction which i tried to customized as required.
    It passes the entry when the payment is shown as only cash. but when 2 ledgers used i.e. the bank and cash gives me error at line no 570 in function stating voucher total do not match
    difference dr 6200 dr, cr 18200cr, difference 12000cr.

    i read your comment to use $Negative in function but still not working. can you help on same. attaching the same for your reference
     

    Attached Files:

    • new.txt
      File size:
      11.3 KB
      Views:
      23
    Last edited: Jul 28, 2020


  15. Johar

    Johar Member


    Taking above TDL I have modified as per my needs, In this total amount of sales voucher is automatically posted in respective cash/bank as per user choice.

    Thanks a lot still learning from experts and taking idea and developing.
     

    Attached Files:

    uttam100 likes this.


  16. ag_1234

    ag_1234 New Member


    Dear Johar ji
    Thank you for posting the screen. issue is not with 2 collection accounts. i.e cash and bank a/c.
    we have financers that pay us on behalf of our customers like bajaj finance etc. so posting the amount for single bill might require posting of journal entry effecting 3 account
    1) cash
    2) bank
    3) sundry debtors (say debtor account on behalf of finance facility provided to customer)

    the entry mentioned in post no 5 (see attachment journalentry.txt) works well but is not a clean code for posting to respective ledgers e.g
    person paid in 1) cash, 2) swiped the balance on swipe machine (i.e.) bank account.
    Journal entry posting shows
    cash DR-5 rs
    bank DR-5 Rs
    sundry debtor Dr-0 Rs
    XYZ account CR--10 Rs.

    i just wanted to remove that ZERO Transaction value entry from the journal entry passed. attaching the screenshot for your reference. in this i tried with 2 accounts
    1- cash as 14000
    2- bank for 2000
    3-- this field is the code posting issue as the same picks the topmost account of the available debtors a/c
    4 CR field on whose name the sales invoice is created..
    can you help me with this.

    upload_2020-7-29_14-55-45.png





    De
     

    Attached Files:



  17. Johar

    Johar Member


    E-mail ID Please
     


  18. ag_1234

    ag_1234 New Member


    abhinav2911(@)gmail(.)com
     


  19. Mohan.S

    Mohan.S Member


    Dear sir we are crate auto receipt voucher posting from rejection inward voucher. here auto receipt voucher is created successfully but the rejection inward voucher is not created.
    and the same we are try with delivery note that is working fine both vouchers are created success fully.
    pls help us for rejection inward.

    Thanking you.

    see the code below:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;[#Form : Deliverynote Color]
    ;;Add : On : At End : Form Accept : Yes : CALL : Create Receipt Voucher

    [#Form : Rejection Inward Color]
    Add : On : At End : Form Accept : Yes : CALL : Create Receipt Voucher

    [Function : Create Receipt Voucher]
    001 : Query Box : " Do you want to post \n Receipt voucher for Work from Return " : Yes : No
    002 : If : $$LastResult=Yes
    003 : CALL : Create Rec Voucher Create
    004 : END if

    [Function : Create Rec Voucher Create]
    VARIABLE : CurrentBillName : String
    VARIABLE : CurrentBillAmt : Amount
    VARIABLE : BankLedgerName : String
    VARIABLE : PartyLedgerName : String
    VARIABLE : Cheqno : String
    VARIABLE : Cheqdate : Date

    12 :SET : CurrentBillAmt : $$Abs:$BillAmt1
    13 :SET : BankLedgerName : $CashBankLedger
    14 :SET : PartyLedgerName : $Costcentrename
    15:NEW OBJECT:Voucher
    20:SET VALUE:VoucherTypeName: $$VchTypeReceipt
    25:SET VALUE:Date : $Date
    35:SET:SVViewName: $$SysName:AcctgVchView
    45:SET VALUE:Narration:"For Work Form Return: " + $VoucherNumber + " Auto Receipt "

    50:INSERT COLLECTION OBJECT : LedgerEntries
    55:SET VALUE :Ledger Name: ##PartyLedgerName
    60:SET VALUE :IsDeemedPositive :No
    65:SET VALUE :Amount: ##CurrentBillAmt
    91:SET TARGET: ..

    95:INSERT COLLECTION OBJECT : LedgerEntries
    100:SET VALUE :Ledger Name : ##BankLedgerName
    105:SET VALUE :IsDeemedPositive :Yes
    110:SET VALUE :Amount : (##CurrentBillAmt*-1 )
    146:SET TARGET: ..

    150: SET VALUE : PersistedView : ##SVViewName
    155:CREATE TARGET
    156:LOG : ">>>Voucher Created on "+$$String:$$Machinedate + " @ " + $$String:$$MachineTime + ">>>>>"
    160:RETURN


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;EOF



    [#Object: Voucher]
    BillAmt1 : $Dccash ;;; $$CollectionField:$BillAmt:1:LedgerEntries
    BillName1:$$CollectionField:$BillName:1:LedgerEntries
    [#Object: LedgerEntry]
    BillAmt : $Dccash ;;;$$CollectionField:$Amount:1:BillAllocations
    BillName: $$CollectionField:$Name:1:BillAllocations
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    [#Part: DBLLINE Narration]
    Delete: Lines
    Add: Lines: VCH ICFGBoMCompDetails, VCH ShowStatutoryDetails,Vch Payment Detail,VCH NarrPrompt, VCH Narration

    [Line: Vch Payment Detail]
    Fields : Medium Prompt, IsVchRecPay
    Local : Field : Medium Prompt : Set As : if $Vouchertypename = "Work Form" then "Enter Payment Details : " else if $Vouchertypename = "Material Return" then "Enter Receipt Details:" else " "
    ;;;Invisible : Not @@IsDelnote And Not $$IsRejIn:##SVVoucherType

    [Field : IsVchRecPay]
    Use : Logical Field
    Set As : "No"
    Storage : IsRecPayment
    Sub Form: Payment Receipt form : $$Value = "Yes"


    [System : UDF]
    IsRecPayment : Logical : 1010
    CashBankLedger: String : 147

    [Report: Payment Receipt form]
    Form: Payment Receipt form

    [Form: Payment Receipt form]

    Part : FormSubTitle , Payment Rec details
    VerticalAlign : Bottom
    HorizontalAlign : Left
    Background : @@SV_UNYELLOW
    Full Height : No
    Full Width : No
    Space Bottom : 0.25
    Option : Small Size Form
    Local : Field : Form SubTitle : Info : $$LocaleString:"Payment/Receipt Details"


    [Part : Payment Rec details]
    Line : CashorBank

    [Line: CashorBank]
    Fields : Medium Prompt, Receiptbank
    Local : Field : Medium Prompt : Set as : "Bank/Cash : "

    [Field : Receiptbank]
    Use : Name Field
    Keys : Create Ledger, Alter Ledger
    Storage : CashBankLedger
    Table : CashBank Ledgers Extract
    Show Table : Always
     


Share This Page