This calculator sets the quantity of the product to the sum of the quantities of child products.
Example configuration string:
AllowNegativeSum=true;ProductsToAdd=JET A REFUEL (USA);ProductsToSubtract=JET A DEFUEL (USA)This video show how this can be used for a maintenance hangar that does de-fueling and refueling.
Calculator settings
- ProductsToAdd (string; default="")
Comma-separated list of product codes whose quantities are added to the sum. Example: ProductsToAdd=FUEL,AVGAS. If a child order line matches one of these products, its quantity is added to the parent's quantity. - ProductsToSubtract (string; default="")
Comma-separated list of product codes whose quantities are subtracted from the sum. Example: ProductsToSubtract=DEFUEL. If a child order line matches one of these products, its quantity is subtracted from the parent's quantity. - AllowNegativeSum (bool; default=false)
If true, allows the calculated sum to be negative. If false, a warning is shown when the sum is negative (e.g., when closing the order).
Important Notes
- Purpose: Sets the parent order line's quantity to the sum of its child order lines' quantities.
- Unit conversion: Quantities are automatically converted to the parent order line's unit if the child units differ.
- Product matching: Only child order lines with products matching ProductsToAdd or ProductsToSubtract are included in the calculation.
- Validation: If both ProductsToAdd and ProductsToSubtract are empty, a warning is shown indicating that at least one product should be configured.
- Stock mutations: If the order line has a stock mutation, the calculated quantity is also set in the stock mutation's AbsoluteQuantity field.
- Calculation logic: For each child order line:
- If the child's product is in ProductsToAdd, its quantity is added.
- If the child's product is in ProductsToSubtract, its quantity is subtracted.
- If the child's product is in both lists, subtraction takes precedence (the quantity is subtracted).
- Quantities are converted to the parent's unit before summing.
Example configuration string
AllowNegativeSum=true;ProductsToAdd=JET A REFUEL (USA);ProductsToSubtract=JET A DEFUEL (USA)
This configuration adds quantities from JET A REFUEL (USA) and JET A DEFUEL (USA) child products, subtracts quantities from JET A DEFUEL (USA) child products, and allows negative sums.
Comments
0 comments
Please sign in to leave a comment.