Billing Formula Builder, Withholding Formula Builder
  • 08 Feb 2024
  • 5 Minutes to read

Billing Formula Builder, Withholding Formula Builder


Article Summary

Use the Billing Formula Builder to modify existing billing formulas or, in rare cases, to create new ones from scratch. Most often you’ll work with Procare technical support to determine the formulas most appropriate for your situation. Much of this information also applies to creating Payroll Withholding Formulas.

Billing formulas are written using a set of code based functions. Learning to write formulas is comparable to learning a computer scripting language. Some functions are relatively simple to use while others can be complex. This article describes the “functions” used to create formulas and is intended for persons with strong computer and scripting skills.

Getting There

  1. From the Procare Home screen go to Configuration > System > Family Accounting > Billing Formulas.
  2. Dbl-click a formula to open it (or create a New Formula).
    Hint: Use the Time & Schedule button to add sample in/out times on which to test your formula.

image

Functions & Examples of Use

Line[n] Returns the answer from a particular line where n is a line number like 1, 2, or 3, etc.
Example: Line[3]

Sum[n1, n2] Returns the sum of consecutive line numbers where n1 is the beginning line number and n2 is the ending line number.
Example: Sum[20, 26]

Max[n1,n2] Returns number n1 or n2 whichever is greater, for example the sum of lines 20 through 26 or zero.
Example: Max[Sum[20, 26], 0]

Choose[x, n1, n2, n3, n4, n5] Returns a number in position n1 through n10 based on the answer for x. “x” may be any valid equation whose result is a number 1 through 10. If x were 3 the result would be the third number over (in position n3).
Example: Choose[Line[4], 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]

Table[value, n1, n2, amount, percentage] Checks the “value” to see if it falls between n1 and n2. If so the result will be the “amount” plus the “percentage” multiplied by any part of the “value” that exceeds n1.
Example: Table[Line[3], 100, 200, 75, 15]. If the value is between 100 and 200 the answer is 75 plus 15% of anything above 100.
Note: Although typically used for payroll tax calculations, the “Table” function may be used in Billing Formulas. See: Payroll Formula Builder

If[condition, true, false]
Returns the answer in the “true” or “false” position based on the condition. Example: If[Line[20] > Line[18], 15, 25]

Int[n]
Rounds to nearest integer (whole number). If n were 2.50, the result would be 3. If n were 2.49, the result would be 2. Example: Int[Line[20]].

RUp[n]
Rounds up to the next integer (whole number). If n were 2.50, the result would be 3. If n were 2.49, the result would also be 3. Example: Int[Line[20]].

RDown[n]
Rounds down to the previous integer (whole number). If n were 2.50, the result would be 2. If n were 2.49, the result would also be 2. Example: Int[Line[20]].

DPart[n]
Returns the decimal part of the number. If n were 2.499 the result would be 0.499.
Example: DPart[Line[20]].

Abs[n]
Returns the absolute value of the number. If n were -5 (negative) or 5 (positive) the result would be 5.0 (positive).
Example: Abs[Line[20]].

Neg[n] Negates a value
Returns the opposite value of the number. If n were -5 (negative) the result would be 5.0 (positive), however if n were 5 (positive) the result would be -5.0 (negative). Example: Neg[Line[20]].

ChkVal[value, n1, n2,”If value not in this range display my custom message.”]
Checks to see if a value is in a specific range. If the “value” were 10, with n1 of 50 and n2 of 100, then an error would be returned since 10 is not between 50 and 100. Useful to make sure a variable falls within certain parameters. Example: ChkVal[Var[rate], 4.25, 6.75,”The rate entered is not within the allowed range.”].

Note: If an error is returned during Automated Formula Billing or Payroll Check Calculation you’ll be alerted and the account with the problem value will not be processed. A generic error message will be displayed or you may enter your own custom message as part of the formula.

Sched[day, start time, end time] Can reference a single week day or loop through days
Returns number of scheduled hours for the specified day/time period. A single day would be written as: Sched[Mon, 7:00am, 6:00pm]. A loop could be written as:

Loop[Days] Total[Sched[Days, 7:00am, 6:00pm]] Loop[End]
Attend[day, start time, end time] Can reference a single week day or loop through days
Returns number of attended hours for the specified day/time period. A single day would be written as: Attend[Mon, 7:00am, 6:00pm]. A loop could be written as:

Loop[Days] Total[Attend[Days, 7:00am, 6:00pm]] Loop[End]
OTime[day, start time, end time] Can reference a single week day or loop through days
Returns number of overtime (non-scheduled) hours for the specified day/time period. This means the child must come within the time frame on their individual schedule. A single day would be written as: OTime[Mon, 7:00am, 6:00pm]. A loop could be written as:

Loop[Days] Total[OTime[Days, 7:00am, 6:00pm]] Loop[End]
Attend[day, start time, end time] – Sched[day, start time, end time]
Subtract scheduled hours from attended hours to determine “Extra Hours”. This means the child may come any time during the day as long as they do not exceed the number of hours on their schedule. Use the “Max” function to make sure you do not get a negative number for a result. A single day would be written as: Attend[Mon, 7:00am, 6:00pm] – Sched[Mon, 7:00am, 6:00pm]. A loop could be written as:

Loop[Days] Attend[Days, 7:00am, 6:00pm] Sched[Days, 7:00am, 6:00pm] Max[(Line[1] – Line[2]), 0] Loop[End]

Var[variable name]
Uses the value of the named variable assigned to a child/employee. Example: Var[rate] would use the variable named “rate” assigned to each child. Useful when an hourly rate varies from one person to another. See: How to Create a Variable.

Loop[Days], Total [], Loop[End]
Begin and end a loop to loop through days in the selected date range. Used “Total” in a loop to maintain a running total on a specific line. “Days” may be used in lieu of individual days of the week like “Mon”, “Tue”, “Wed”, etc.
Example:

Loop[Days] Total[Sched[Days, 7:00am, 6:00pm]] Total[Attend[Mon, 12:00am, 12:00am]] Total[If[Attend[Days, 12:00am, 12:00am] > 0, 1, 0]] Loop[End]
Print[]

Creates a print record text comments (in quotes) like “Total days = ” and values from particular lines, variables, etc.
Examples: Print[“Total days = “Line[24]], Print[“Rate: “Var[rate]].

Following can be used in a Print Statement to show a date
{StartDate} is the beginning of the date range
{EndDate} is the ending of the date range
{Today} is the actual day billing occurred (not the post date). The Post Date itself is recorded on the Ledger.


Was this article helpful?