-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
correct invoice balance with stock orders and deliveries #1075
base: master
Are you sure you want to change the base?
Conversation
exclude stock_orders in orders_sum, consider deliveries_sum
exclude stock-orders from sum(:groups)
show order sums without and with stock order, consider only sums without stock order for total
replaced for loop for summation by .sum()
order sum without markup like in the current implementation
sum_og without markup, like order.sum
added type argument for order and delivery sum and for expected_amount for calculation without and with markup
added additional total with markup added foodcoop profit without/with markup
show invoice labels for profit and markup
added show invoice labels for fc profit and markup (margin)
missing lines added for total_fc calculation
calculate transport sum only from ordegroup transport charges
added order sum over group order transport charges. this can be different form the order's transport amount if groups are not charged with transport costs or if stock orders exist.
show total transport costs and sum of ordergroup charges for transport if they differ. for total, consider only the ordergroup transport charges.
if markup is used, show both differences without and with markup
…rders if an invoice has only deliveries but nor orders, expected amount returned the invoice net-amount but not the deliveries. if an invoice has no orders and deliveries, expected_amount is now 0.
"Überschuss" drückt aus, dass die Einnahmen die Kosten übersteigen, ohne den kommerziellen oder profitorientierten Charakter anzudeuten, der mit "Gewinn" assoziiert wird.
"surplus" expresses that revenues exceed costs without implying the commercial or profit-oriented nature associated with the term "profit."
positive values are displayed green with extra +, negative in red
…d invoice balance to invoice summary, show markup relevant amounts only if markup>0
order.profit was wrong for invoices with other orders and deliveriesThere is still an issue with the Example: if there are two orders
The overall profit is 0. In contrast, So basically, the overall profit should be split amongst all orders and deliveries. In my opinion, there is no perfect way to realize it, because it is generally an unsolvable problem without knowing details of the invoice about the parts of the invoice corresponding to the individual orders and deliveries. Example:
Basically I see the following options (in brackets my estimation/opinion):
I decided to implement nr. 1 as a compromise between a perfect solution and keeping changes small. Example for two orders per invoice, invoice surplus -1,18 € is divided equally on the 2 order surplus (each -0,59 €): |
@yksflip can you please have a look on this pull request and merge it? |
Hey @mjavurek, Thank you so much for your efforts! It's great to see your initiative on this one. As you're probably aware, our development capacities are very limited at the moment. On the one hand, it's really great to have your contribution, but on the other hand, I can't promise to review and merge it very soon. That's why we established a roadmap and a monthly community call to organize the work (see Readme). If you can make it, it would be really cool to have you on the next call so we can discuss how to organize the work. Recently, the Austrian team submitted #1073, which will require some time to review, and we want to try to limit the amount of conflicts. I can try to see if there will be conflicts with your contribution. If so, we might need to rework it to fit with it; if not, we might be able to get it through quickly. Some general remarks: It would be great if you could squash your commits into only a few, more descriptive ones. That would make it easier to review already. Conventional Commits (conventionalcommits.org) might be a good starting point for this. |
Thank you @yksflip for your response. I understand the difficulties, and I hope that despite of the difficulties, it will be possible to merge my pull request in the near future. I am quite sure that there will be conflicts in I did not manage to squash my commits yet. I did all commits in the edit mode on the github website, unfortunately I am not familiar with Git CLI or Git Desktop, which seems to be necessary to be able to squash commits. |
Correct invoice balance with stock orders and deliveries
According to issue #1074, stock orders and deliveries were not correctly considered in invoice balances (invoice view and unpaid invoices), leading to unbalanced invoices in case of deliveries and/or stock orders.
This patch includes:
Example: the order of this invoice contains a stock-order with 36,16 €. so only 59,89 € of the order are considered in the total amount, together with the stock-delivery this sums up to a total amount of 96,05 €.