Auto Receipt for sales Invoices

Discussion in 'Tally Developer' started by Arun Prasath, Aug 20, 2012.

  1. Arun Prasath

    Arun Prasath Member

    Dear Experts,

    I want to auto create receipt voucher after the sales Invoices. I add some udf fields to capture cheque relatated information. It should save in the bank allocations. But it doesn't generate auto receipts.

    Pls check the codes.

    ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

    [System : Formula]

    AutoRec for Sales : $$InCreateMode and @@IsReceiptEntry

    [#Form : Sales Color]

    ;;On : Form Accept : @@AutoRecforSales : CALL : Create Receipt Voucher
    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 Sales " : Yes : No
    002 : If : $$LastResult
    003 : CALL : My Voucher Create
    004 : END if

    [Function : My Voucher Create]

    32 : LOG : "Test"
    01:NEW OBJECT :Voucher
    02: SET VALUE: VoucherTypeName: $$VchTypeReceipt
    03: SET VALUE :Date : If $IsPostdated then $RDate else $Date
    02a : SET : SVViewName: $$SysName:AcctgVchView
    04 : SET VALUE : ISPOSTDATED : $IsPostdated
    05:SET VALUE :Narration :$Narration
    06:SET VALUE :Narration :"For Invoice No: " + $VoucherNumber + " Auto Receipt "

    07:INSERT COLLECTION OBJECT : AllLedgerEntries
    08:SET VALUE :Ledger Name:$PartyLedgerName
    09:SET VALUE :IsDeemedPositive :No
    10:SET VALUE :Amount: @@DSDFrightAmt

    13:INSERT COLLECTION OBJECT: BillAllocations
    14:SET VALUE: Name: $BillName1
    15: SET VALUE: BillType: "AgstRef"
    16:SET VALUE: Amount: -$BillAmt1
    17:SET TARGET: ...

    18:INSERT COLLECTION OBJECT : AllLedgerEntries
    19:SET VALUE :Ledger Name : $MyBankLedger
    20:SET VALUE :IsDeemedPositive :Yes
    21:SET VALUE :Amount :mad:@DSDFrightAmt

    22 : INSERT COLLECTION OBJECT : BankAllocations
    22a :SET VALUE: Date: $Date
    23:SET VALUE: InstrumentNumber: $CheNumUDf
    24: SET VALUE: InstrumentDate: $CheDateUdf
    27:SET VALUE: Amount: $CheAmountUDf
    27:SET TARGET: ...

    29a : SET VALUE : PersistedView : ##SVViewName

    ;;32 : LOG : "Test"

    [#Object: Voucher]

    BillAmt1 :$$CollectionField:$BillAmt:1:LedgerEntries

    [#Object: LedgerEntry]

    BillName: $$CollectionField:$Name:1:BillAllocations
    BillAmt : $$CollectionField:$Amount:1:BillAllocations


    DSDFrightAmt: $$FilterAmtTotal:LedgerEntries:DSDFrightAmt2:$Amount
    DSDFrightAmt2: $$IsGroupSundryDebtors:$Parent:Ledger:$Ledgername
    IsReceiptEntry : $IsSalRecipt = "YES"

    [#Part: DBLLINE Narration]

    Add : Line : After : VCH Narration : Vch Recipt Detail

    [Line: Vch Recipt Detail]

    Fields : Medium Prompt, IsVchRecpt
    Local : Field : Medium Prompt : Set As : "Enter Receipt Details : "
    Invisible : Not @@IsSales

    [Field : IsVchRecpt]

    Use : Logical Field
    Set As : "No"
    Storage : IsSalRecipt
    Sub Form: Sales Receipt form : $$Value = "Yes"

    [System : UDF]

    IsSalRecipt : Logical : 1010
    MyBankLedger : String : 147
    IsPostdated : Logical : 1009
    IsRecChq : Logical : 1008
    RDate : Date : 150

    [System : Formula]

    IspostDatedRec : #IsPostdatRec = "No"

    [Report: Sales Receipt form]

    Form: Sales Receipt form

    [Form: Sales Receipt form]

    Part : FormSubTitle , Sales Receipt 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:"Receipt Details"

    [Part : Sales Receipt details]

    Line : IsPostdatRec , PostdatedDate , SalesBank, RecChqDetails

    [Line: IsPostdatRec]

    Fields : Medium Prompt, IsPostdatRec
    Local : Field : Medium Prompt : Set as : "Is Post Dated ? "

    [Field : IsPostdatRec]

    Use : Logical Field
    Storage : IsPostdated
    Set Always : Yes

    [Line: PostdatedDate]

    Fields : Medium Prompt, PostdatedDate
    Local : Field : Medium Prompt : Set as : "Receipt Date : "

    [Field : PostdatedDate]

    Use : Uni Date Field
    Storage : RDate
    Skip : @@IspostDatedRec

    [Line: SalesBank]

    Fields : Medium Prompt, Receiptbank
    Local : Field : Medium Prompt : Set as : "Bank : "

    [Field : Receiptbank]

    Use : Name Field
    Keys : Create Ledger, Alter Ledger
    Storage : MyBankLedger
    Table: CashBank Ledgers Extract
    Show Table : Always

    [Line : RecChqDetails]

    Fields : Medium Prompt, RecChqDetails
    Local : Field : Medium Prompt : Set As :" Enter Cheque Details : "

    [Field : RecChqDetails]

    Use : Logical Field
    Storage : IsRecChq
    Sub Form: Cheque Collection Form : $$Value = "Yes"

    [Report: Cheque Collection Form]

    Form : Cheque Collection Form
    Title: "Cheque Details"

    [Form: Cheque Collection Form]

    Part: ALLOC Title, ALLOC AmtTitle, Cheque Collection Form
    Width: 60% Screen
    Height: 60% Screen
    Background: Very Light Orange

    Local : Field : ALLOC Prompt : Info: $$LocaleString:"Bank Allocations for :"
    Local : Field : ALLOC Name : Set as : $LedgerName
    Local : Field : ALLOC Name : Set Always : Yes
    Local: Line : ALLOC Title: Space Bottom: .5
    Local : Field : ALLOC Amount: Set as: $Amount
    Local : Field : ALLOC Amount: Format : "Forex"
    Local: Line: ALLOC Amount: Local: Field : Simple Prompt : Info : $$LocaleString:"For"

    [Part:Cheque Collection Form]

    Lines: Cheque Collection Title, Cheque Collection Details
    Bottom Line : ABS StuDetails

    Repeat: Cheque Collection Details: Cheque Info
    Scroll: Vertical
    Common Border: Yes
    Break After : $$IsEmpty:$CheNumUDf
    Total :AmountCollected

    [Line: Cheque Collection Title]

    Use: Cheque Collection Details
    Local: Field: Default: Delete: Storage
    Local: Field: Default: Inactive: No
    Local: Field: Default: Type: String
    Local: Field: Course Name: Info: "Cheque No."
    Local: Field: Student Name: Info: "Cheque Date"
    Local: Field: Amount Collected: Info: "Amount"
    Border: Thin Bottom

    [Line: Cheque Collection Details]

    Fields: Course Name, Student Name
    Right Field : AmountCollected

    [Field: Course Name]

    Use: Name Field
    Storage: CheNumUDf
    MAX : 6
    Width : 20 MMS

    [Field: Student Name]

    Use: Uni Date Field
    Storage: CheDateUdf
    Inactive: $$IsEmpty:$CheNumUDf
    Width : 45 MMS

    [Field: Amount Collected]

    Use: Amount Field
    Storage: CheAmountUDf
    Inactive: $$IsEmpty:$CheNumUDf

    [System: UDF]

    Cheque Info: Aggregate: 967
    CheNumUDf: String: 900
    CheDateUdf: Date: 125
    CheAmountUDf: Amount: 900

    [Line: ABS StuDetails]

    Field : Abs Subbank Title
    Right Field : Abs Sub Total

    Border : Totals

    [Field: Abs Subbank Title]

    Info : "Total"
    Width: 70 mms

    [Field: Abs Sub Total]

    Use : Amount Field
    Set as : $Amount
    Read Only : yes
    Jaydeep Shah likes this.

  2. Girdhar

    Girdhar Member

    Cn u plz explain the error u r getting with some screen shots etc.

  3. Arun Prasath

    Arun Prasath Member

    Dear Girdhar,

    I am not getting any error. But receipt doesn't get generated.


  4. Vikram

    Vikram Member

    Dear Arun,
    Please Note : Always attach the File instead of Pasting the full code in the body as you can see the smiley's appearing in between .
    Kindly attach the File to get the Required assistance.

    Thanks & regards

  5. Arun Prasath

    Arun Prasath Member

    Dear Vikram,

    I attached the file.

    Pls check.

    Attached Files:

    mahgs likes this.

  6. Vikram

    Vikram Member

    Dear Prashanth,

    I have given an idea of auto creation in this file . if you found something is missing ,u need to alter it to your requirement.


    Attached Files:

  7. Arun Prasath

    Arun Prasath Member

    Dear Vikram,

    Thanks for your help.

    I have one issue. If we have record more than one Cheque details in the sales invoice entry it doesn't get save properly in the Receipt. first Cheque save perfectly. other cheques doesnt appear in the Bank Allocation (In the Receipt)

    What is the changes I should do?

  8. Arun Prasath

    Arun Prasath Member

    I used below code that is also doesn't give correct output


  9. psjain_jal

    psjain_jal Member

    pl sent me code

  10. Arun Prasath

    Arun Prasath Member

    Pls see attached Codes

    Attached Files:

  11. psjain_jal

    psjain_jal Member

    the above code was not work when we pass sales entry for Rs. 2000 & we recd chq only for 1500 ie rs 500 outstanding but in receipts vourchar its show bank recd chq of rs 2000

  12. Vikram

    Vikram Member

    Dear Prashanth,

    Here the $$Collectionfield function doesnot work as it is repeated atuomatically and doesnot involve manual keystroke,
    Use walk collection bank allocations and end walk to insert the collection object for bankallocations
    Ex :

    BA00 : WALK COLLECTION : bankAllocations
    BA20: .....
    BA80 : SET TARGET : ..
    BA90:END WALk
    Refer the sample code for reference!
    Jaydeep Shah likes this.

  13. Arun Prasath

    Arun Prasath Member

    Hi Vikram,

    I tried that also, It giving an error as
    FUNCTION: 'My Voucher Create' LABEL: 113 : Collection 'BankAllocations' could not be found!
    FUNCTION: 'My Voucher Create' LABEL: 113 : Action execution failed!
    FUNCTION: 'My Voucher Create' LABEL: : Action execution failed!
    FUNCTION: 'Create Receipt Voucher' LABEL: 003 : Action execution failed!
    FUNCTION: 'Create Receipt Voucher' LABEL: : Action execution failed!

  14. Mansur Kalyankar

    Mansur Kalyankar New Member

    Dear all,

    I am also getting same error while using "BankAllocations" with INSERT COLLECTION OBJECT or WALK COLLECTION. I am trying to import payment entries from Excel with Cheque Crossing Comment, Payee Name etc.

    Thanks in advance for any suggestions/help.

    Amol Ashok Bhalgat likes this.

  15. laxman

    laxman Member

    Very good option, but this option will have do for the Company Wise.

  16. laxman

    laxman Member

    Dear Arun this code is not working with voucher class please solution.

  17. N vinoth

    N vinoth Member

    very good but it will take full sales amount kindly to give a against reference i.e partial amount received option

  18. laxman

    laxman Member

    Mr. vinoth please any solution this code is not working with voucher class

  19. laxman

    laxman Member

    dear expert ,
    This code only works when you created the voucher.
    If the same code if we want to use for auto-payment of the Purchase ...... To help

  20. nagaraju

    nagaraju New Member


  21. Arun Prasath

    Arun Prasath Member

    Make the Vouchertype changes. It will work.

  22. Vijaya Kumar

    Vijaya Kumar New Member

    The code is not working with voucher class.

    Thanks in advance for any suggestions/help.

    Attached Files:

  23. This TDL is Not Asked How Many amount Receipt.

    Thanks With Regard
    Pravesh Kushwaha
    Mob. 9770452249

  24. laxman

    laxman Member

    working is good but release 4.91 create receipt after save and need to before create please guide us .......

    thanks again

  25. Amit Mahajan

    Amit Mahajan New Member

    not work on only cash receipt

Share This Page