Add support for different tax rates at each practice location.
This will allow practice locations in different states, with different tax rates, to be hosted in a single OpenVPMS instance.
NOTE:: this change is only applicable to practice locations in the same timezone, as OpenVPMS stores all all timestamps in the local time of the OpenVPMS server.
To support this:
A new Practice level flag, Use Location Tax Rates will be added. This will be disabled by default, to reflect the existing tax behaviour.
A new Taxes field will be added to Practice Location, which indicates the tax rates applicable to a practice location
When Use Location Tax Rates is enabled, the tax rate for a product is determined as follows:
1. collect the tax rate lookups associated with the product. If there are none, collect the tax rates associated with the product type. If there are none, collect the tax rates associated with the practice
2. remove any tax rates not present on the practice location
3. remove any tax rates that the customer has exemptions for
4. sum the remaining rates
When Use Location Tax Rates is disabled, step 2 is ignored.
Charges will use the tax rates at the location that they were created in.
Supplier orders will use the tax rates at the location linked to their stock location.
Discounts calculated from an At-cost + Rate + Tax discount type will use the:
tax rates of the charge location for charges; or
tax rates of the current location for estimates. This is because estimates aren't associated with any location
When editing product prices, the Tax-inclusive Price will include the tax for the current practice location.
The Products - Information - Export exports product prices. When Use Location Tax Rates is enabled, this will export tax rates determined by the current location.
Any overdue balance that results in a fee being charged will use the customer's practice location to determine the tax rates.
If the customer doesn't have a practice location assigned, the current practice location will be used.
The following archetypes will change:
party.organisationPractice will have an optional boolean useLocationTaxRates flag added
party.organisationLocation will have a taxes node added, that may be assigned lookup.taxType lookups
The following functions are required for practices that use location based tax rates:
product:price(product,taxExPrice, taxInclusive, location)
The following reports need to be updated to use the new reporting functions:
Product List Report
Product Price List Report
Product Price Structure Report