Server for Point Of Sale is a Web Service, available 24/7/365, which keeps a data of POS terminals (cash registers) in a central place and collects cash transactions
How to print a receipt? How to report historical information about sale? What’s calculation rules?
- Netto – price without tax
- Brutto – price with tax
- Vat – tax amount measured in currency amount
- Vat rate – tax amount measured in percent
- General information ( cash register name , cashier name, receipt number, date of receipt)
- Products list where each list item is called “Sale product”
- Sale product contains: Product name, Amount, Price, optional Discount and other fields
- Receipt total
- Vat rate sums
- Additional information (CU serial, corporate Id)
- Discount may be given to the whole receipt, as well to a a specific sale product
- Discount is either Absolute or Relative but not both at the same time
Relative. Discount amount is measured in percents
and here is how butto calculated with the discount:
vanillabrutto = f(netto, vat)
Absolute. Discount amount is measured in currency
but it’s a bit harder to calculate butto using absolte discount. The idea that the absolute discount is given to every sale product depending on it’s sale vanila brutto
Sale product represents a line in a receipt for every product and defines:
- absolute discount
- relative discount
- discount – general amount of the discount measured in currency
- deltaunit – defines whether the good is measureable or not
- vanilla delta – amount of goods
- vanilla brutto – price of all the products with tax included, but without discount:
- netto – price without tax but including discount
- vat – amount of tax measured in currency including discount
- brutto – price with tax and discount:
- effective netto – price without tax but with the discount per sale product and with the discount for the whole receipt
- effective vat – tax measured in currency with the discount per sale product and with the discount for the whole receipt
- effective brutto – price with tax but with the discount per sale product and with the discount for the whole receipt
Vat rate sum
Vat rate sum defines how receipt total is splitted between vat rates. Each vat rate sum contains:
- VAT rate
- vanilla VAT – sum of all VAT amount measured in currency of every sale product for this VAT class
- vanilla netto – sum of all netto of every sale product for this VAT class
- vanilla brutto – sum of all brutto of every sale product for this VAT class
- vat – sum of all VAT of every sale product for this VAT class including discount of the whole receipt. In vat rate sum entry it’s calculated as
- netto – sum of all netto of every sale products for this VAT class including discount of the whole receipt.
- brutto – sum of all brutto of every sale products for this VAT class including discount of the whole receipt. To calculate brutto distract discount from vanilla brutto, which is calculated as described at Discount chapter above.
Sale is an entity that represents the whole receipt. Sale is a synonym of receipt. It contains following attributes:
- Vanilla brutto – sum of all brutto of every sale product
- Sale absolute discount
- Sale relative discount
- Sale discount – total discount measured in currency
- Sale brutto – sum of all brutto of every sale product including all taxes and discounts
- Sale vat – amount of tax measured in currency of all sale products including all taxes and discounts
Currency format and calculation rules
Server makes calculations based on information to validate Sale entity. Here is some rules that API and server use:
- all calculations are made using ordinal numbers only
- all currencies are kept with two digit percision (and multiplied to 100 in order to be kept as ordinal)
- all percents are between 0 and 100 including
- the result of calculation is rounded to nearest ordinal
For instance the following formula
at the server.
Due to the fact that all the fields are rounded down to two digits after point there are rounding errors. The calculation graph has cycle reference (the fork) therefore when two ways comes together there can be a rounding cent (or few cents) and they have to be handled.
Sale.brutto is the target point where two branches ends and can be different for each branch. One branch is where brutto is sum of all vat rate sums. Another branch is where brutto is sum of all effective brutto.
Here is an example: let’s take three products $30 each. And there is a Sale.discount 33%. Sale brutto becomes $10, but effective brutto of every product can’t be nor $3.33 neither $3.34 because $3.33 ×3 ≠ $10 and $3.34 ×3 ≠ $10.
There is a solution: it is allowed to change every effective field (effective brutto, effective netto, effective vat) after the calculation is done. But never more than 1 cent.
Example above will be solved as 3.33$ + 3.33$ + 3.34$ = 10$.
Full working example
…with formulas can be found at the spreadsheet.
© 2015-2023 Server For Pos. All rights reserved.