Database Reference
In-Depth Information
9. Add a Set Field step next. Set the target field to Line Items::Price Each and
then set the calculated result to 50 .
This step tells the line item record how much money to charge for each hour worked.
If your hourly rate changes, you'll update this script step to reflect the new rate.
10. Add a second Set Field step below the first one. Set the target field to Line
Items::Quantity and then set the calculated result to $totalHours .
This step tells the line item record how many hours were worked on the job.
11. Add a third Set Field step below the second one. Set the target field to Line
Items::Description and then set the calculated result to Labor . Edit your TODO
items and then save the script .
Your time line items are labeled with static text describing the charge.
Your finished script should look like Figure 17-29 . Now that you're done, change the main
script's Perform Script step to run the Process Timeslips subscript and set its parameter to
$invoiceID .
The Process Expenses Subscript
Most of the lessons you learned in the Process Timeslips subscript apply to the Process Ex-
penses subscript, but there are some important differences. First, according to your business
rules, all labor is combined into one line item per invoice, but each expense is billed separ-
ately. So the steps that create a new line item will fall inside this script's loop so that you get
one new line item per expense. Second, you're gathering more bits of data for each expense,
so the steps that set data into Line Item fields are different from what you did for Timeslips.
But the overall process is still very similar. Here's what to do:
1. Add a Go to Layout step to the top of the Process Expenses script. Set the target
layout to Expenses .
You need to be on a layout tied to the Expenses table so you can check to see if any
records need to be processed.
2. Add an If test and set its calculation to Get(FoundCount) > 0 . Drag the End If
step down below your last comment placeholder .
The expense item processing steps shouldn't run if there are no expenses for the cur-
rent job.
Search WWH ::




Custom Search