### Calculation Rules for Order Rows

Calculation rules concerning the order specification data are described below. Variables beginning with "pmt" represent field data sent to the new payment interface. Variables beginning with "Calc" are calculated values used to check the validity of interface field data.

Gross and net prices have the following relationship:

`pmt_row_price_gross = round ( pmt_row_price_net * ( 1 + 0.01 * pmt_row_vat ) )`

IF net price was supplied (pmt_row_price_net):

Row sum after reducing the discount, without VAT:

```CalcRowAmountExVAT = round (
round ( pmt_row_quantity * pmt_row_price_net ) *
( 1 - 0.01 * pmt_row_discountpercentage )
)
```

IF gross price was supplied (pmt_row_price_gross):

Row sum after reducing the discount, without VAT:

```CalcRowUnitNetPrice = round (
pmt_row_price_gross / ( 1 + 0.01 * pmt_row_vat )
)
CalcRowAmountExVAT = round (
round ( pmt_row_quantity * CalcRowUnitNetPrice ) *
( 1 - 0.01 * pmt_row_discountpercentage )
)```

Row sum of VAT (VAT is calculated based on the reduced net price):

`CalcRowVAT = round (CalcRowAmountExVAT * ( 0.01 * pmt_row_vat ))`

Row total amount (payable in effect on the gross amount):

`CalcTotalRowAmount = round ( CalcRowAmountExVAT + CalcRowVAT )`

The gross price of the whole order:

```== pmt_amount + pmt_sellercosts
== sum ( CalcTotalRowAmount )```

pmt_amount

`== total sum of CalcTotalRowAmount for product and service rows (types 1, 4, 5 and 6)`

pmt_sellercosts

`== total sum of postal and handling cost rows (types 2 and 3)`

In the interfaces all the money amounts and percentages must be presented with two decimals using comma as the decimal delimiter.