Calculation service
The Calculation service calculates the price, discounts and tax amount for each line as well as creates summaries for the amount for the entire transactions and finally calculates the balance of the transaction
The calculation service receives the transaction with information about prices, discount lines so it does not use the services to get that information. It does use the tax service to get information about tax codes to calculate the tax amounts.
Tips!!! The calculation service also performs the discount comparisons to decide which discounts to use for each item. For more information on how this comparison works please see information in the LS One online help
Main functionality
Name | Description |
---|---|
CalculateTotals | Calculates the entire transaction; each item line and then the summaries and balance for the entire transaction |
CalculateLine | Calculates price, discount, net amounts, tax amounts and etc for one specific sale line item. Please note that this function should almost never used directly in code as it does not update the balance of the sale. When adding items to a sale during a customization CalculateTotals should be called. |
POS Operations
Almost all operations in the POS directly call the Calculation service.
Any blank operation or POS Plugin that changes the transaction needs to call the CalculateTotals function specifically before returning the transaction to the POS core.
If the transaction is being changed in a trigger or a service that is called from a POS operation there is usually no need to call CalculateTotals as each operation does that before returning the transaction to the LS One POS core. For transactions with a large number of items and multiple discount lines per item CalculateTotals can take a couple of seconds to execute so it should not be called except when it is absolutely necessary.
Development pack
To find this service in the development pack go to DevPack\Source\Core\Common_services
See also