Auto Bulk Payment

Discussion in 'Free Source Codes' started by sattam, Apr 18, 2019.

    
  1. sattam

    sattam Active Member


    I make this code with the help of tally sample code.This code create auto payment voucher monthly with fixed amount.But I need to create monthly random amount.(Attached screenshot)
    Respected developer please help me.

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

    [#Menu: Gateway of Tally]

    Add : Item : Before : @@Locquit: Auto Bulk Payment : ALTER : Auto Bulk Payment

    [Report: Auto Bulk Payment]

    ;; Interface to accept user Input

    Local : Field : Default : Local : Style : Default : Height : 10
    ;Local : Field : Default : Local : Style : Default : color : maroon

    Use : Simple Auto Bulk Payment

    Local : Form : Interest Calc : On: Form Accept : Yes : Call : CreateProvVouchers:#InterestPrincipal:#InterestRate:#InterestNoOfYrs:#InterestResult:#AmountForexField
    Local : Form : Interest Calc : Local : Field : Form SubTitle : Info : "Auto Bulk Payment Details"
    Local : Form : Interest Calc : Local : Field : Form SubTitle : color : Maroon
    Local : Form : Interest Calc : Height : 50% Page
    Local : Form : Interest Calc : Width : 60% Page
    Local : Form : Interest Calc : Background : "Light Orange"

    Local : Field : Medium Prompt : Width : 25

    Local : Part : Interest Calc : Add : Lines : ProvLedAmt;;,ProvLedNarr

    Local : Line : Interest Principal: Local : Field : Medium Prompt : Info : "Starting Date :"
    Local : Field : Interest Principal: Type : Date
    Local : Field : Interest Principal: Case : Title Case
    Local : Field : Interest Principal: Width : 30
    Local : Field : Interest Principal: Align : Left

    Local : Line : Interest Rate : Local : Field : Medium Prompt : Info : "No. of Instalments :"
    Local : Field : Interest Rate : Type : Number
    Local : Field : Interest Rate : Format : "No Zero, No Percentage, No Comma"
    Local : Field : Interest Rate : Width : 30
    Local : Field : Interest Rate : Align : Left

    Local : Line : Interest NoOfYrs : Local : Field : Medium Prompt : Info : "Cash/ Bank Ledger :"
    Local : Field : Interest NoOfYrs : Type : String
    Local : Field : Interest NoOfYrs : Table : Cash Ledgers Extract
    Local : Field : Interest NoOfYrs : Show Table: Always
    Local : Field : Interest NoOfYrs : Case : Title Case
    Local : Field : Interest NoOfYrs : Width : 30
    Local : Field : Interest NoOfYrs : Align : Left

    Local : Line : Interest Result : Local : Field : Medium Prompt : Info : "Payee Ledger :"
    Local : Line : Interest Result : Local : Field : Default : Inactive : No
    Local : Field : Interest Result : Table : Expense Ledgers Extract
    Local : Field : Interest Result : Show Table: Always
    Local : Field : Interest Result : Set As : "";$$CollectionField:$Name:1:ExpenseLedgersExtract
    Local : Field : Interest Result : Case : Title Case
    Local : Field : Interest Result : Type : String
    Local : Field : Interest Result : Width : 30
    Local : Field : Interest Result : Align : Left
    Fetch Collection: Cash Ledgers Extract, Expense Ledgers Extract

    [Line: ProvLedAmt]

    Field : Medium Prompt, Amount Forex Field

    Local : Field : Medium Prompt : Info : "Enter Ledger Amount :"

    [Line: ProvLedNarr]

    Field : Medium Prompt, Name Field

    Local : Field : Medium Prompt : Info : "Enter Ledger Narration :"
    Local : Field : Name Field : Info : ""
    Local : Field : Name Field : Width : 50

    ;; Report designed to open daybook with newly created entries
    ;; immediately after the execution of current function call

    [Report: Prov Entries in Daybook]

    Use : Daybook
    Set : VoucherTypeName : "Payment"
    Set : SVFromDate : $$FinYearBeg:##StartDate:$StartingFrom:Company:##SVCurrentCompany
    Set : SVToDate : $$FinYearEnd:##StartDate:$StartingFrom:Company:##SVCurrentCompany

    Local : Collection : Default : Add : Filter : Prov Filter

    [System: Formula]

    Prov Filter : $Amount = ##InputAmt

    ;; Function to create Provisional Vouchers automatically
    ;; and display list of vouchers created instantaneously

    [Function: Create Prov Vouchers]

    ;; Definition Block

    Parameter : InputDate : Date
    Parameter : InputNoofEnt : Number
    Parameter : InputCBLed : String
    Parameter : InputOthLed : String
    Parameter : InputAmt : Amount


    Variable : Counter : Number
    Variable : VoucherTypeName : String
    Variable : FamilyVoucherFlag : Logical

    Variable : StartDate : Date
    Variable : PostDatedFlag : Logical

    ;; Procedural Block

    00 : SET : Counter : ##InputNoofEnt
    10 : SET : StartDate : ##InputDate ;; Variable introduced to retain original date reqd for filtering in daybook

    20 : WHILE : ##Counter >= 1
    30 : SET : SVViewName : $$SysName:AcctgVchView
    35 : SET : SV VoucherType : $$VchTypePayment
    40 : NEW OBJECT : Voucher
    50 : SET VALUE : Date : ##InputDate
    60 : SET VALUE : Is Post Dated : if $LastVoucherDate:Company:##SVCurrentCompany < ##InputDate then "Yes" else "No"
    70 : SET VALUE : VoucherTypeName : $$VchTypePayment

    80 : INSERT COLLECTION OBJECT : LedgerEntries
    100 : SET VALUE : LedgerName : ##InputOthLed
    110 : SET VALUE : Is Deemed Positive: "YES"
    120 : SET VALUE : Amount : $$Negative:##InputAmt
    130 : SET TARGET : ..

    140 : INSERT COLLECTION OBJECT : LedgerEntries
    150 : SET TARGET : LedgerEntries
    160 : SET VALUE : LedgerName : ##InputCBLed
    170 : SET VALUE : Is Deemed Positive: "NO"
    180 : SET VALUE : Amount : ##InputAmt
    190 : SET TARGET : ..

    200 : SET VALUE : PersistedView : ##SVViewName
    201 : SET VALUE : NARRATION :"Paid By Cash For " +" "+ ##InputOthLed
    ;202 : SET VALUE : CrDtTm1 :$$CmpUserName
    ;203 : SET VALUE : CrDtTm2 :$$MachineDate
    ;204 : SET VALUE : CrDtTm3 :$$MachineTime
    210 : CREATE TARGET
    220 : SET : InputDate: $$MonthEnd:$$NextMonth:##InputDate
    ;225 : SET : InputAmt : $$Round:##InputAmt+(##InputAmt*2.3%):1


    230 : DECREMENT : Counter
    240 : END WHILE
    250 : DISPLAY : Prov Entries in Daybook
    260 : RETURN

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [Report: Simple Auto Bulk Payment]

    Form : Interest Calc
    Auto : Yes

    [Form: Interest Calc]

    Parts : Form SubTitle, Interest Calc


    [Part: Interest Calc]

    Lines : Interest Principal, Interest Rate, Interest NoOfYrs, Interest Result
    Local : Field : Default : color : Maroon
    [Line: Interest Principal]

    Fields : Medium Prompt, Interest Principal


    [Field: Interest Principal]

    Use : Amount Field

    [Line: Interest Rate]

    Fields : Medium Prompt, Interest Rate


    [Field: Interest Rate]

    Use : Number Field
    Format : "No Zero, Percentage"
    Align : Right
    Width : @@AmountWidth

    [Line: Interest NoOfYrs]

    Fields : Medium Prompt, Interest NoOfYrs


    [Field: Interest NoOfYrs]

    Use : Number Field
    Format : "NoZero"
    Align : Right
    Width : @@AmountWidth

    [Line: Interest Result]

    Fields : Medium Prompt, Interest Result

    Local : Field : Default : Inactive : $$IsEmpty:#InterestPrincipal OR $$IsEmpty:#InterestRate OR $$IsEmpty:#InterestNoOfYrs
    SpaceTop: 1

    [Field: Interest Result]

    Use : Amount Field
    Set Always : Yes



    ;; End-of-File
     

    Attached Files:



  2. sattam

    sattam Active Member


    I want when we enter amount 30000 it should create auto payment vouchers which total amount is rs 30000 (see screenshot).
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Use Function ............. $$RandomNumber
     


  4. sattam

    sattam Active Member


    Amit ji would you please correct my code if you have a little time
     


  5. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    am not good at functions yet...........
     


  6. sattam

    sattam Active Member


    Respected developers please help me
     


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You don't need any help. You can do it...........on your own.......

    Refer $$RandomNumber in Sample folder........release 3.6..........

    you need to implement that in your code, not inside your function............

    Without even trying ......don't give up...............
     


  8. sattam

    sattam Active Member


    I have no idea about this function $$RandomNumber.Try to use but not succeed .cant understand how to use.
    Also go through that sample file
     


  9. sattam

    sattam Active Member


    Please anybody give some idea to get my result.I have no clue.
     


  10. sattam

    sattam Active Member


    Please anybody give some idea to get my result.I have no clue.
     


  11. kamalDas

    kamalDas New Member


    Try This....





    [#Menu: Gateway of Tally]

    Add : Item : Before : @@Locquit: Auto Bulk Payment : ALTER : Auto Bulk Payment

    [Report: Auto Bulk Payment]

    ;; Interface to accept user Input

    Local : Field : Default : Local : Style : Default : Height : 10
    ;;Local : Field : Default : Local : Style : Default : color : maroon

    Use : Simple Auto Bulk Payment

    Local : Form : Interest Calc : On: Form Accept : Yes : Call : CreateProvVouchers:#InterestPrincipal:#InterestRate:#InterestNoOfYrs:#InterestResult:#AmountForexField
    Local : Form : Interest Calc : Local : Field : Form SubTitle : Info : "Auto Bulk Payment Details"
    ;Local : Form : Interest Calc : Local : Field : Form SubTitle : color : Maroon
    Local : Form : Interest Calc : Height : 50% Page
    Local : Form : Interest Calc : Width : 60% Page
    Local : Form : Interest Calc : Background : "Light Orange"

    Local : Field : Medium Prompt : Width : 25

    Local : Part : Interest Calc : Add : Lines : ProvLedAmt;;,ProvLedNarr

    Local : Line : Interest Principal: Local : Field : Medium Prompt : Info : "Starting Date :"
    Local : Field : Interest Principal: Type : Date
    Local : Field : Interest Principal: Case : Title Case
    Local : Field : Interest Principal: Width : 30
    Local : Field : Interest Principal: Align : Left

    Local : Line : Interest Rate : Local : Field : Medium Prompt : Info : "No. of Instalments :"
    Local : Field : Interest Rate : Type : Number
    Local : Field : Interest Rate : Format : "No Zero, No Percentage, No Comma"
    Local : Field : Interest Rate : Width : 30
    Local : Field : Interest Rate : Align : Left

    Local : Line : Interest NoOfYrs : Local : Field : Medium Prompt : Info : "Cash/ Bank Ledger :"
    Local : Field : Interest NoOfYrs : Type : String
    Local : Field : Interest NoOfYrs : Table : Cash Ledgers Extract
    Local : Field : Interest NoOfYrs : Show Table: Always
    Local : Field : Interest NoOfYrs : Case : Title Case
    Local : Field : Interest NoOfYrs : Width : 30
    Local : Field : Interest NoOfYrs : Align : Left

    Local : Line : Interest Result : Local : Field : Medium Prompt : Info : "Payee Ledger :"
    Local : Line : Interest Result : Local : Field : Default : Inactive : No
    Local : Field : Interest Result : Table : Expense Ledgers Extract
    Local : Field : Interest Result : Show Table: Always
    Local : Field : Interest Result : Set As : "";$$CollectionField:$Name:1:ExpenseLedgersExtract
    Local : Field : Interest Result : Case : Title Case
    Local : Field : Interest Result : Type : String
    Local : Field : Interest Result : Width : 30
    Local : Field : Interest Result : Align : Left
    Fetch Collection: Cash Ledgers Extract, Expense Ledgers Extract

    [Line: ProvLedAmt]

    Field : Medium Prompt, Amount Forex Field

    Local : Field : Medium Prompt : Info : "Enter Ledger Amount :"

    [Line: ProvLedNarr]

    Field : Medium Prompt, Name Field

    Local : Field : Medium Prompt : Info : "Enter Ledger Narration :"
    Local : Field : Name Field : Info : ""
    Local : Field : Name Field : Width : 50

    ;; Report designed to open daybook with newly created entries
    ;; immediately after the execution of current function call

    [Report: Prov Entries in Daybook]

    Use : Daybook
    Set : VoucherTypeName : "Payment"
    Set : SVFromDate : $$FinYearBeg:##StartDate:$StartingFrom:Company:##SVCurrentCompany
    Set : SVToDate : $$FinYearEnd:##StartDate:$StartingFrom:Company:##SVCurrentCompany

    Local : Collection : Default : Add : Filter : Prov Filter

    [System: Formula]

    Prov Filter : $Amount = ##InputAmt

    ;; Function to create Provisional Vouchers automatically
    ;; and display list of vouchers created instantaneously

    [Function: Create Prov Vouchers]

    ;; Definition Block

    Parameter : InputDate : Date
    Parameter : InputNoofEnt : Number
    Parameter : InputCBLed : String
    Parameter : InputOthLed : String
    Parameter : InputAmt : Amount


    Variable : Counter : Number
    Variable : VoucherTypeName : String
    Variable : FamilyVoucherFlag : Logical

    Variable : StartDate : Date
    Variable : PostDatedFlag : Logical
    Variable : VLEdAMt : Amount
    Variable : VoucherAmt : Number
    ;; Procedural Block

    Local Formula : LEDAmount : $$RandomNumber:1:($$Number:##InputAmt)
    00 : SET : Counter : ##InputNoofEnt
    10 : SET : StartDate : ##InputDate ;; Variable introduced to retain original date reqd for filtering in daybook
    05 : Set : VLEdAMt : ##InputAmt

    20 : WHILE : ##Counter >= 1
    30 : SET : SVViewName : $$SysName:AcctgVchView
    35 : SET : SV VoucherType : $$VchTypePayment
    40 : NEW OBJECT : Voucher
    50 : SET VALUE : Date : ##InputDate
    60 : SET VALUE : Is Post Dated : if $LastVoucherDate:Company:##SVCurrentCompany < ##InputDate then "Yes" else "No"
    70 : SET VALUE : VoucherTypeName : $$VchTypePayment

    75 : Set : VoucherAmt : if ##Counter = 1 then ##InputAmt else $$RandomNumber:1:($$Number:##InputAmt/2)
    76 : Set : InputAmt : ##InputAmt - ##VoucherAmt
    ;sdddd:Log:##VoucherAmt
    80 : INSERT COLLECTION OBJECT : LedgerEntries
    100 : SET VALUE : LedgerName : ##InputOthLed
    110 : SET VALUE : Is Deemed Positive: "YES"
    120 : SET VALUE : Amount : $$AsAmount:##VoucherAmt *-1;InputAmt
    130 : SET TARGET : ..

    140 : INSERT COLLECTION OBJECT : LedgerEntries
    150 : SET TARGET : LedgerEntries
    160 : SET VALUE : LedgerName : ##InputCBLed
    170 : SET VALUE : Is Deemed Positive: "NO"
    180 : SET VALUE : Amount : $$AsAmount:##VoucherAmt;InputAmt
    190 : SET TARGET : ..

    200 : SET VALUE : PersistedView : ##SVViewName
    201 : SET VALUE : NARRATION :"Paid By Cash For " +" "+ ##InputOthLed
    ;202 : SET VALUE : CrDtTm1 :$$CmpUserName
    ;203 : SET VALUE : CrDtTm2 :$$MachineDate
    ;204 : SET VALUE : CrDtTm3 :$$MachineTime
    210 : CREATE TARGET
    220 : SET : InputDate: $$MonthEnd:$$NextMonth:##InputDate
    ;225 : SET : InputAmt : $$Round:##InputAmt+(##InputAmt*2.3%):1


    230 : DECREMENT : Counter
    240 : END WHILE
    250 : DISPLAY : Prov Entries in Daybook
    260 : RETURN

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [Report: Simple Auto Bulk Payment]

    Form : Interest Calc
    Auto : Yes

    [Form: Interest Calc]

    Parts : Form SubTitle, Interest Calc


    [Part: Interest Calc]

    Lines : Interest Principal, Interest Rate, Interest NoOfYrs, Interest Result
    ;Local : Field : Default : color : Maroon
    [Line: Interest Principal]

    Fields : Medium Prompt, Interest Principal


    [Field: Interest Principal]

    Use : Amount Field

    [Line: Interest Rate]

    Fields : Medium Prompt, Interest Rate


    [Field: Interest Rate]

    Use : Number Field
    Format : "No Zero, Percentage"
    Align : Right
    Width : @@AmountWidth

    [Line: Interest NoOfYrs]

    Fields : Medium Prompt, Interest NoOfYrs


    [Field: Interest NoOfYrs]

    Use : Number Field
    Format : "NoZero"
    Align : Right
    Width : @@AmountWidth

    [Line: Interest Result]

    Fields : Medium Prompt, Interest Result

    Local : Field : Default : Inactive : $$IsEmpty:#InterestPrincipal OR $$IsEmpty:#InterestRate OR $$IsEmpty:#InterestNoOfYrs
    SpaceTop: 1

    [Field: Interest Result]

    Use : Amount Field
    Set Always : Yes
     


  12. sattam

    sattam Active Member


    Thank you very much, I will study your code to understand the logic.
     


  13. tejeet

    tejeet Member


    Dear sir,

    please modify above code for all ledgers instead of only expense ledger in payee name or send me code for required modification
     


Share This Page