Re: How could you calculate tax in your transaction?
* Yuri Khan [2020-12-30 02:26]: > Then maybe round first, negate second? > > = /^Pizza:/ > Pizza:Taxes (roundto(amount * 0.0775, 2)) > CreditCard (-roundto(amount * 0.0775, 2)) Good idea! -- Martin Michlmayr https://www.cyrius.com/ -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/20201230033225.GA20423%40jirafa.cyrius.com.
Re: How could you calculate tax in your transaction?
On Wed, 30 Dec 2020 at 02:22, the.so...@gmail.com wrote: >> * Martin Michlmayr [2020-12-24 13:43]: >> > = /^Pizza:/ >> > Pizza:Taxes (roundto(amount * 0.0775, 2)) >> > CreditCard (roundto(-amount * 0.0775, 2)) > The problem is the ceil() function that roundto() in turn uses. That is a > positive biased rounding function, which rounds up towards +∞, instead of > rounding away from/toward zero. Then maybe round first, negate second? = /^Pizza:/ Pizza:Taxes (roundto(amount * 0.0775, 2)) CreditCard (-roundto(amount * 0.0775, 2)) -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAP_d_8WtqKb5zyQmgnV%3DEKADEtF8LB47PJ-yuYUZqMJ5wT-Nxw%40mail.gmail.com.
Re: How could you calculate tax in your transaction?
The problem is the ceil() function that roundto() in turn uses. That is a positive biased rounding function, which rounds up towards +∞, instead of rounding away from/toward zero. On Tuesday, 29 December, 2020 at 6:48:50 pm UTC+5:30 Martin Michlmayr wrote: > * Martin Michlmayr [2020-12-24 13:43]: > > = /^Pizza:/ > > Pizza:Taxes (roundto(amount * 0.0775, 2)) > > CreditCard (roundto(-amount * 0.0775, 2)) > > > > This does what you want. > > > Unfortunately, it leads to an error due to a bug, but if you e.g. > > change the tax rate from 0.0775 to 0.0774 it works. > > I've now reported that issue: > https://github.com/ledger/ledger/issues/1983 > -- > Martin Michlmayr > https://www.cyrius.com/ > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/0f8fb706-fe06-4bb8-bb83-319d88e564ccn%40googlegroups.com.
Re: How could you calculate tax in your transaction?
* Martin Michlmayr [2020-12-24 13:43]: > = /^Pizza:/ > Pizza:Taxes (roundto(amount * 0.0775, 2)) > CreditCard(roundto(-amount * 0.0775, 2)) > > This does what you want. > Unfortunately, it leads to an error due to a bug, but if you e.g. > change the tax rate from 0.0775 to 0.0774 it works. I've now reported that issue: https://github.com/ledger/ledger/issues/1983 -- Martin Michlmayr https://www.cyrius.com/ -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/20201229131843.GC17251%40jirafa.cyrius.com.
Re: How could you calculate tax in your transaction?
Just FYI, top-level accounts like Assets: and Liabilities: in this case would look something like this: 2020-12-28 * Woodstocks Pizza Assets:Receivable:Person:FriendA $21.04 ; Cheese Pizza Assets:Receivable:Person:FriendA $7.54 ; Salad Assets:Receivable:Person:FriendA $10.00 ; Drink Assets:Receivable:Person:FriendA $2.99 ; Taxes @ 7.75% Liabilities:Credit Card:Amex $-41.57 On Thursday, 24 December, 2020 at 11:13:14 am UTC+5:30 Martin Michlmayr wrote: > * Jimi Damon [2020-12-23 08:28]: > > I know about how you can set up a matcher like > > = /Pizza/ > > (taxes ) 0.0775 > > = /^Pizza:/ > Pizza:Taxes (roundto(amount * 0.0775, 2)) > CreditCard (roundto(-amount * 0.0775, 2)) > > This does what you want. > > Unfortunately, it leads to an error due to a bug, but if you e.g. > change the tax rate from 0.0775 to 0.0774 it works. > > P.S. Please use top-level accounts like Assets: and Liabilities: > -- > Martin Michlmayr > https://www.cyrius.com/ > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/2da83325-6906-49d4-9d73-3979996f54adn%40googlegroups.com.
Re: How could you calculate tax in your transaction?
* Jimi Damon [2020-12-23 08:28]: > I know about how you can set up a matcher like > = /Pizza/ >(taxes ) 0.0775 = /^Pizza:/ Pizza:Taxes (roundto(amount * 0.0775, 2)) CreditCard(roundto(-amount * 0.0775, 2)) This does what you want. Unfortunately, it leads to an error due to a bug, but if you e.g. change the tax rate from 0.0775 to 0.0774 it works. P.S. Please use top-level accounts like Assets: and Liabilities: -- Martin Michlmayr https://www.cyrius.com/ -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/20201224054305.GA5493%40jirafa.cyrius.com.
How could you calculate tax in your transaction?
Hi, I was just trying out an example where I bought pizza for friends and then was just going to have them venmo me for the cost of the pizza plus the tax added. I had something like this 2020/12/20 * Woodstocks Pizza ; tag: FriendA Pizza:Cheese$21.04 Pizza:Salad $7.54 Pizza:Drink$10.00 ; Pizza:Taxes(PizzaCurrentTransaction * 0.0775 ) My ideal CreditCard But I'd really like to add in the taxes as well with some line saying 0.0775 * this current transaction without having to calculate it manually and then add it in. I know about how you can set up a matcher like = /Pizza/ (taxes ) 0.0775 to calculate the taxes but in my case I really want to have the taxes stay with the transaction that can be looked up with tag FriendA. Is there a way to calculate the taxes on the current transaction using a math expression ? Thanks, -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CAHkuPsu3wv11uQ%3DGh0pj6QaH6JxY%2Bj%3D9Mu3eKWr%2BqNvJ2TQLeA%40mail.gmail.com.