date of previous bill of current ledgerpartyname

Discussion in 'Tally Developer' started by rajendra mithari, Apr 5, 2015.

    

  1. Dear sir,
    how ca i get previous sales voucher date of current sales vouchers party and closing balance of same date ?for eg party of current bill MR ABCand ABC ledger have four bills as 20.02.15 25.02.15 26.02.15 15.03.15now on printing of 15.03.15 the previous bill date is 26.02.15, on print of 26.02.15 previous bill date is 20.02.15 .....i need help to get this date and closing balance on same date.can you help me?
     


  2. Maulik Patel

    Maulik Patel Active Member


    Dear Sir,

    Kindly follow steps
    1. Create A Collection to get all Bill Date for that particular ledger ABC with the use of Filter
    2. Use $$CollectionField function to get Last Date of Invoice
    3. Use $$ToValue function to get closing balance for the Last Bill Date
     
    khushbu likes this.



  3. first and last step done , i dont know how to get previous date of last transaction ?
    ( Use $$CollectionField function to get Last Date of Invoice )
    for eg if four bills are in collection as 10.04.15 12.04.15 16.04.15 and 20.04.15
    then as per my formula i got only 16.04.2015 due to $date - 2
    and this date is always same for any bills
    whereas if i select bill of 12.04.15 then last date of bill should be 10.04.15 not 16.04.15
    same problem for closing balance fetching

    pl guide
     


  4. Maulik Patel

    Maulik Patel Active Member


    $$CollectionField:$Date:1:CollectionName
    Where CollectionName = Collection set per Step 1 where you will need to write Sort : Default : -$Date.
     
    khushbu likes this.


  5. khushbu

    khushbu New Member


    Genius boss
     



  6. Dear Maulik sir,
    i know your solution never fails
    but pl check this code it not work, is any mistake there ? also see this some text from the original code- also find excel sheet as example



    [Field: prevbald]
    Field : Simple Prompt, Amount Field
    Local : Field : Simple Prompt : set as :"Last balance" ; $$LocaleString:mad:@lastsalesdate
    Local : Field : Simple Prompt : Width : 22
    Local : Field : Amount Field : Set as :$$ToValue:($date-2):$ClosingBalance:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries
    @mydt: $$CollectionField:$Date:1:LedVchrs

    Local : Field : Amount Field : Format : "Symbol,DrCr"
    Invisible: if ($$CollectionField:$LedgerName:1:LedgerEntries) contains "cash" then yes else no
    [Field:recptamt]
    Field : Simple Prompt, Amount Field
    Local : Field : Simple Prompt : Info : "total receipts "
    Local : Field : Simple Prompt : Width : 22
    ;Local : Field : Amount Field : Set as : $$FromValue:($date-2):$credittotals:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries - $$ToValue:($date-1):$credittotals:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries
    Local : Field : Amount Field : Set as : ""
    Local : Field : Amount Field : Format : "Symbol,DrCr"
    Invisible: if ($$CollectionField:$LedgerName:1:LedgerEntries) contains "cash" then yes else no

    [Field: Billamtd]
    Field : Simple Prompt, Amount Field
    Local : Field : Simple Prompt : Info : "Current Bill "
    Local : Field : Simple Prompt : Width : 22
    Local : Field : Amount Field : Set as : ($$ToValue:$date:$debittotals:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries)-($$ToValue:($date-1):$debittotals:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries)
    Local : Field : Amount Field : Format : "Symbol,DrCr"
    Invisible: if ($$CollectionField:$LedgerName:1:LedgerEntries) contains "cash" then yes else no

    [Field: Clobal]
    Field : Simple Prompt, Amount Field
    Local : Field : Simple Prompt : Info : "Closing Balance"
    Local : Field : Simple Prompt : Width : 22
    Local : Field : Amount Field : Set as : $$ToValue:$date:$ClosingBalance:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries
    Local : Field : Amount Field : Format : "Symbol,DrCr"
    Invisible: if ($$CollectionField:$LedgerName:1:LedgerEntries) contains "cash" then yes else no




    [#Object: Ledger]

    ;LastSalesDate : $$FilterValue:$Date:(-2):ledvchrs:(-2):LedVchrs
    LastSalesDate : $$CollectionField:$Date:1:LedVchrs
    ;lastsalesdate:$$FilterValue:$date:ledvchrs:(-1):isblowcudt

    ;;Voucher Collection of Ledgers

    [Collection: LedVchrs]
    Type : Vouchers : Ledger
    Child of : $PartyLedgerName
    Filter : IsSalesVch
    Fetch : VoucherTypeName,Date,*.?
    Sort:default:-$date
    Compute:date: #vchdate



    ;Filtering for sales Vouchers

    [System: Formula]

    IsSalesVch : $$IsSales:$VoucherTypeName
    ;Now you can use $$FromValue , $$ToValue to get the Credit Totals of the party .
    LastSalesDate : $$CollectionField:$Date:2:LedVchrs
     

    Attached Files:




  7. Dear admin
    please help me in the query
    regards
    mithari
     


Share This Page