Table of Contents

There are many occasions where we need to spread costs between line items, particularly where the cost is a setup which occurs once for products priced in different line items. This page describes a simple but effective way to do this. It will work in situations where the cost is divided equally between line items and is not dependent on variables within the line item such as quantity or area. It can also be achieved for those situations but a more elegant solution is needed.

Concept

The concept is to spread a setup cost, for example $45, across a number of line items. For example, we often have requests for plotter-driven contour cuts of printed material. To make the order and subsequent invoice easier to understand, the salesperson may create several line items for different images which will be printed and cut at the same time. When they check the CotourCut option, Cyrious cfl_referenceautomatically adds a charge which for this discussion is $45. However, we do not want to charge $45 for each line item; so we need to have each line item “share” this cost.

To do this we use a checkbox – ContourCut – to indicate the cut. We use a number variable ContourCutCharge to capture the cost. When ContourCut is checked, the ContourCutCharge variable is populated with the Cost amount through a Default formula in the variables formula page.. Because the YES/NO Variable is a Boolean Varable, it is set to 1 each time it is checked. The VariableTotal(ContourCut) function will return the sum of all the “ones” or in effect the number of line items in which the variable is checked. In other words, if checked in 3 line items, the formula VariableTotal(ContourCut) will return a value of 3. We then divide the setup charge of $45 by the number of times the variable has been checked, effectively spreading the cost. To assure that we don't have division by 0 errors, we use the MAX() function which will return the greatest of the two numbers selected.

Cautions

Steps

  1. Create the YES/No Variable to be used to indicate the activity.
  2. Create the number variable – in this case ContourCutCharge – to capture the cost. On the Variable form where it says Use Formula, enter a formula like the following (substitute your variables and constants numbers). The Max() function prevents a Division By Zero error. (We have simplified this example to make it more understandable. In practice we would use a User Constant instead of a number like 45. We create a temporary variable using the Declare function to keep the formulas as simple and understandable as possible.

code format="Delphi"

If we have a contour cut, see how many we have and then divide our total charge by that number

IF ContourCut

THEN 45/Max(1, VariableTotal(ContourCut) )

ELSE 0

ENDIF

<code>

  1. Open an Order or Estimate and test this code by creating three of 4 line items with the YES/NO checked. You should see the amount decrement as you add line items.

Source

Contributor: Steve Gillispie, Acorn Sign Graphics Date: 3/5/2011 Version: Control 04.50.1102.0401