I'm developing a shop. I'm trying to figure out: where should "total_grand_price" belong to?

"total_grand_price" = 
  price of all order items
  - discount
  + shipping
  + taxex
  +- etc....

Should it be a property of Order or Invoice? What up- and downsides of having it in either?

Also, could there be a case where there'll be several different invoices with a different TotalGrandPrice for the same Order? When can it happen?

  • The answer is "yes depending" – HorusKol Jun 30 '18 at 8:58
  • @HorusKol on what? – Pajarat Jun 30 '18 at 9:26
  • The requirements of your software – HorusKol Jun 30 '18 at 9:26
  • @HorusKol good requirements – Pajarat Jun 30 '18 at 10:47
  • What's an Order? What's an Invoice? Does the shop currently send multiple invoices for an order, or invoice multiple orders at once? Does an Invoice reference an Order? – Caleth Jul 10 '18 at 12:20

The "total_grand_price" should belong to invoice. Usually, an order includes details of the items that the customer wants to buy. The invoice includes details of what customer owes for the items he has bought. So, payment details are usually kept in invoice.

An order contains item pricing details. However, it does not contain discount, shipping etc. An invoice is the right place to keep that detailed bifurcation and the grand total.

It is possible to have an order splitted in multiple invoices such that all the invoices collectively fulfill the order. In such a case, the total grand price for each invoice would be different.

| improve this answer | |

When you think about it a bit more closer, such a total would be needed both in the order and the invoice.

If the company gets an order and cannot deliver some parts, then they only ship the parts available, and only those parts are in the invoice. So the grand total of an order and of the delivery are not necessarily the same.

And if the company gives rebates, like "10% off for all orders over $1000", then you definitely need both so you apply the 10% discount if $50 worth of goods from a $1025 order cannot be delivered.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.