Last Sell Price To Customer

Discussion in 'Tally.ERP 9' started by silpa dravid, Oct 11, 2020.

    
  1. silpa dravid

    silpa dravid Member


    hello Experts
    i want help in sales Voucher where i want to show last sales price to customer as shown in picture. this code
    only shows last price of item.
    Set: $LASTSALEPRICE:STOCKITEM:$STOCKITEM
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Make 2 Collections......
    One collection if for Vouchers and Filtered on Sales Voucher........

    2nd Collection will have source of the first collection....walk the Inventory entries, and fetch the Rate, Date, VoucherTypeName, PartyLedgerName, StockItemName and will be sorted on reverse date....means latest date on top. This should be filtered also based on matching PartyLedgerName and StockITemName

    Then make a formula to fetch the rate ---- $CollectionField:$Rate:1:{2nd collection name} and use this in your Field.
     


  3. silpa dravid

    silpa dravid Member


    Code:
    [Collection : SaleVchColl2]
    Type : Voucher
    Filter : VchSales
    
    [System : Formulae]
    VchSales : $$IsSales:$VoucherTypeName
    [Collection : PartyColl]
    Source Collection : SaleVchColl2
    Walk : InventoryEntries
    By : Pname : $PartyLedgerName
    by:item:$stockitemname
    Aggr Compute : Rate : sum : $Rate
    [#Field: VCH NrmlRate]
    Set as : $$FilterValue:$Rate:partyColl:1:partyItemCheck
    
    [System: Formula]
    PartyItemCheck : $Pname=$$ReqObject:($$Owner:$PartyLedgername) and $item=#VCHStockItem
    this code is working fine in sales voucher to fetch last sale rate to that particular customer but in purchase voucher while entering data Rate Field is showing BLANK
     
    Last edited: Oct 15, 2020


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You made collection filtered on Sales Voucher.... So make similar one for Purchase or maybe combine the two.

    And why are you SUMMING up the rate....rate is Rate...no need to add up.
     
    silpa dravid likes this.


  5. silpa dravid

    silpa dravid Member


    when removing SUM its not working. i do not want anything change in purchase but getting this in RATE FIELD.
    [#Field: VCH NrmlRate] is confliting i think sir
     

    Attached Files:



  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [Collection : PartyColl]
    Source Collection : SaleVchColl2
    Walk : InventoryEntries
    Fetch : Rate, Date, VoucherTypeName, PartyLedgerName, StockItemName
    Filter : LSPRateFltr
    Sort : Default : -$Date

    [System : Formula]
    LSPRateFltr : $PartyLedgerName = #EIConsignee AND $StockItemName = #VCHStockItem
    LSP: $$CollectionField:$Rate:1:LPartyColl

    Now use @@LSP in your field name .......... as per your code it is only for SALES. You need to add Purchase VchType, if you need that too.
     


  7. silpa dravid

    silpa dravid Member


    [#Field: VCH NrmlRate]
    Set as : $$FilterValue:$Rate:partyColl:1:LSPRateFltr
    by doing this also only getting value in sales voucher but in purchase voucher RATE FIELD , it showing blank. not even last purchase rate or defult rate for tally while entering purchase voucher
     


  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    I have said it twice ......... please read carefully what I have suggested in the previous 2 posts above.
     
    silpa dravid likes this.


  9. silpa dravid

    silpa dravid Member


    Amit sir
    i tried to combine for both sales and Purchase but failed. only getting in single voucher. Give me some more help. Please
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    From your code above, it is only for SALES .... there is no Purchase...........

    Show your full code..........
     


  11. silpa dravid

    silpa dravid Member


    amit sir
    is it the [#Field: VCH NrmlRate] i am changing in sales is affecting in purchase voucher as both field are same ?
     


  12. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Yes both fields are common........... for Sales/Purchase/DN/CN etc

    Also unless you understand TDL better, not advisable to change the Tally's default values for important fields ...like .... VCH NrmlRate is one of them.

    For COMMON fields you should use Condition or OPTION or SWITCH......... Condition is simplest of all....... If SalesVchType then "this" else {default tally's}
     


  13. silpa dravid

    silpa dravid Member


    amit sir
    i am able to do in sales and purchase but how to exclude condition for journal voucher
     


  14. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    use NOT JtnlVchType.........
     


  15. Himanshu-2002

    Himanshu-2002 Active Member


    You can do this like too
    [Field: YourFieldName]
    Invisible: Not @@IsSales Or @@IsPurchase
     


  16. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    This will not serve the purpose of his code.

    He is trying to put a value (SET AS) as per voucher type.....
     


  17. Himanshu-2002

    Himanshu-2002 Active Member


    Oo Then He can do like this
    Set as: If @@IsSales Then "value" else If @@IsPurchase ......
     


  18. silpa dravid

    silpa dravid Member


    how to use in this field
    [#Field: VCH NrmlRate]
    Set as : $$FilterValue:$Rate:partyColl:1:partyItemCheck
     


  19. Himanshu-2002

    Himanshu-2002 Active Member


    [#Field: VCH NrmlRate]
    Set as : if not $$VchTypejrnl then $$FilterValue:$Rate:partyColl:1:partyItemCheck else ""
     
    silpa dravid likes this.


  20. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Code:
    Set as : if not $$IsJournal:##SVVoucherType then $$FilterValue:$Rate:partyColl:1:partyItemCheck else ""
    
     
    silpa dravid likes this.


  21. silpa dravid

    silpa dravid Member


    Not working amit sir. in journal while doing sales/ purchase entry auto fill rate field not coming as shown in document. JOURNAL.jpg
     


  22. Himanshu-2002

    Himanshu-2002 Active Member


    In Your Previous Post You told that You want to exclude it in Journal Voucher Type and This code will remove that from Journal Voucher and Now you are telling it is not coming in journal ?

    Please be clear with your requirements and the code which amit sir told is very simple and He used a very simple logic which Everyone generally use in daily life So, Study the code and change it accordingly...Just Put Some Efforts
     
    silpa dravid likes this.


  23. silpa dravid

    silpa dravid Member


     


  24. Himanshu-2002

    Himanshu-2002 Active Member


    Silpa.. Just try to watch few initial videos of Tally solutions on TDL because your problem is very basic But Due to clarity issues I am not able to solve your problem So, It's always better to do some research Because By This only you can learn TDL
     
    silpa dravid likes this.


  25. silpa dravid

    silpa dravid Member


    HIMANSHU Ji
    thanks for response. i tried to go through some tdl on this forum but could not find . where to get video on tdl. i just want the formula to work for sales/ purchase voucher and
    not for journal. if u can give some hints then i can try more. thank you
     


Share This Page