===== Invoice Package Calculation Flows and Settings ===== ==== Allowed Difference ==== Allowed difference between package lines and sum of lines in the package after recalcualtion is controlled under: Tools → Company Settings → Invoicing → AllowedPackageRecalculationDifference. ==== Negative Profit ==== There can be the cases with a negative profit on a product inside a package and it was decided that //non package autoprice lines// (//NPAP// - a line for a product which has //'Package Autoprice'// setting disabled in //Tools -> Products//) in a package should not have profit at all (i. e. 0 profit). To solve that and other requests the following is implemented: **Note** In case of a multicurrency //total sell price// is not converted to //local sell price// for a package line after package recalculation. But it is converted when changes total sell price manually and when the package is created. I //Company Settings -> Settings -> Invoicing -> ResetNonPackageAutopriceLinesInPackage// Enabling resets sell price to be equal to expence for all non-package autoprice lines in a package). By default the setting is disabled. II While invoicing with above option enabled, it makes sell=exp for all non-package autoprice lines when adding them to a package (either when package is created or a new line is added into it), profit is 0. BUT, before this gets done, line sell price (with or w/o VAT) must be taken into account when calculating package sell price, so the sequence of creating a new package is: - Add line into package. - Calculate package sell. - Reset sell to exp for all NPAP lines. - Apply existing logic (like copying VAT from package to inner lines). III If above option is disabled (by default) - no changes for the non-package line (like it used to be before). === Billetkontoret A/S Flow === //ResetNonPackageAutopriceLinesInPackage// - enabled. //SuppressWarningWhenAddingNewLineForDifferenceInPackage// - disabled. So all 'non pap' lines are going to get 0 profit, difference comes into 'pap' lines. In case any difference can not be balanced, it appears in a new line (with a corresponding warning) or a message //'Can not balance'//. === JTB Stockholm Flow === //ResetNonPackageAutopriceLinesInPackage// - disabled. //SuppressWarningWhenAddingNewLineForDifferenceInPackage// - enabled. All product are set to non-pap. 'Balancing' product code is set to HF. So on balancing package there is no recalculation (since lines are non pap and they are frozen by option1). All difference goes to the new HF line, package gets balanced. ==== Invoice Package Rounding Difference ==== In case there was a package with a difference which could not be put on any line due to rounding logic, a warning occured that the package was not balanced. And system could not do anything with that. **The right way to avoid such situations is** to put the difference in a new line with a product which has unchecked //Package AutoPrice// ([[userdocs:travelwise:data_loading:products|Read More]]). For such purposes a product has to be selected in Company Settings to be applied for the difference each time. There used to be logics which allowed to have small (0.06) difference and such package was balanced. But currently it is disabled and all difference gets in a new line in case //AddingProductWithDiffInPacakges// is enabled. If it is disabled, then the functional is switched off and works as before. === How to control the setting === 1. By a checkbox in //Company Settings -> Settings -> Invoicing: AddingProductWithDiffInPackages//. //Enabled:// In case there is any difference in a package (even very small) it is put into a new invoice line. //Disabled:// Adding new line with the difference is disabled and the application allows to have difference not more than 0.06. 2. By a combobox in //Company Settings -> Settings -> Invoicing: ProductForPuttingDifferenceInPackages//. All products are returned in the combobox list. The selected product is going to be added for putting difference in packages after a corresponding warning. **Note** It works only in case //'AddingProductWithDiffInPacakges'// is enabled. 3. If //AddingProductWithDiffInPacakges// is enabled and there is selected product then: In Invoice/Offer in recalculation process: - if there is no difference - then package is balanced; - in case there is any difference (even very small) - waring promts user about adding a new line with the product: //In the package ... there is difference in Exp./Sell price= X.XX which can not be spread into package lines. Would you like to add new line with the product ... to the package and put the difference on it to make the package balanced?// Yes/No* ***** 4. Enabling of //Company Settings -> Settings -> Invoicing: SuppressWarningWhenAddingNewLineForDifferenceInPackage// turns off the warning on adding new line to balance a package. Disabled by default. Exp./Sell price Only 'Exp.' is returned in case we have difference in Exp. If we have difference in Sell price - then it should show only 'Sell'. Yes: New line with the selected product for //ProductForPuttingDifferenceInPackages// is added at the end of the package. It has Sell/Exp price = difference that we have. No: Nothing happens. User makes corrections. ==== Discount ==== To solve the problems for the lines with discount inside the package it was decided to remove their discount. When invoice line with discount gets into a package (when new package is created or line is added to existing package) the discount from line is removed. Discounted sell price is used for package total calculation, discount amount and % from the line are removed.