sa_ratescriptlanguage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sa_ratescriptlanguage [2023/04/11 13:51] Scott McMullensa_ratescriptlanguage [2023/04/19 14:22] (current) – [Indenting] Scott McMullen
Line 2: Line 2:
 ==== Introduction ==== ==== Introduction ====
 Temp Rate Scripts provide the mechanism for converting shifts into timesheet lines when the timesheet is completed. The script must be attached to the Rate Scheme which is being applied.\\ \\  Temp Rate Scripts provide the mechanism for converting shifts into timesheet lines when the timesheet is completed. The script must be attached to the Rate Scheme which is being applied.\\ \\ 
 +
 The Commands are listed below, followed by Examples. The Commands are listed below, followed by Examples.
 <note warning>Scripts are case sensitive.</note> <note warning>Scripts are case sensitive.</note>
 ==== Rate Script Commands ==== ==== Rate Script Commands ====
 |comment or rem| the remainder of the line is a comment and is ignored - when using //comment// you must preserve the current indent level| |comment or rem| the remainder of the line is a comment and is ignored - when using //comment// you must preserve the current indent level|
-|foreach shift|  |+|foreach shift| Start the script with this each time |
 |foreach dayslice|must be nested within foreach shift.| |foreach dayslice|must be nested within foreach shift.|
 |foreach timeslice paybandname | must be nested within foreach dayslice. In a rate scheme a pay band may have a start and end time - e.g. an Unsocial pay band may specify 1800 to 0600 as the Unsocial period which attracts a higher rate. Foreach timeslice uses the named pay band to further divide a dayslice into timeslices - those which do and do not fall within the specified time range. Use If intimeslice to determine whether the current slice is in the time range. Break treatment: Any break period is deducted from the longest slice; if slices are of equal length, then the break is deducted from the slice with the highest charge. | |foreach timeslice paybandname | must be nested within foreach dayslice. In a rate scheme a pay band may have a start and end time - e.g. an Unsocial pay band may specify 1800 to 0600 as the Unsocial period which attracts a higher rate. Foreach timeslice uses the named pay band to further divide a dayslice into timeslices - those which do and do not fall within the specified time range. Use If intimeslice to determine whether the current slice is in the time range. Break treatment: Any break period is deducted from the longest slice; if slices are of equal length, then the break is deducted from the slice with the highest charge. |
Line 39: Line 40:
 |%%thresholdsplit thresholdhours payband1name|payband2name%% | e.g. thresholdsplit 37.5 Basic%%|%%Overtime would treat any Basic total hours above the threshold figure of 37.5 as Overtime hours (i.e. shift them into the Overtime totals). **Note** that the separator between the pay bands is a vertical bar ''|''.| |%%thresholdsplit thresholdhours payband1name|payband2name%% | e.g. thresholdsplit 37.5 Basic%%|%%Overtime would treat any Basic total hours above the threshold figure of 37.5 as Overtime hours (i.e. shift them into the Overtime totals). **Note** that the separator between the pay bands is a vertical bar ''|''.|
 |%%thresholdadd thresholdhours payband1name|payband2name%% | e.g  thresholdadd 8 Basic%%|%%Overtime would add the first 8 hours of the current Foreach block as Basic with the remainder as Overtime. **Note** that the separator between the pay bands is a vertical bar ''|''. You can also omit the first pay band to leave the portion below the threshold in the pot for further processing. E.g. for multi-level thresholds or a lump sum for the basic. If the threshold is greater than 24 it treats it as an aggregate threshold for the whole timesheet.| |%%thresholdadd thresholdhours payband1name|payband2name%% | e.g  thresholdadd 8 Basic%%|%%Overtime would add the first 8 hours of the current Foreach block as Basic with the remainder as Overtime. **Note** that the separator between the pay bands is a vertical bar ''|''. You can also omit the first pay band to leave the portion below the threshold in the pot for further processing. E.g. for multi-level thresholds or a lump sum for the basic. If the threshold is greater than 24 it treats it as an aggregate threshold for the whole timesheet.|
-|addlumpsum x paybandname | like add but exactly x hours are added, regardless of the actual hours specified in the shift (provided that they are greater than zero). Any break is ignored.|+|addlumpsum x paybandname | like add but exactly x hours are added, regardless of the actual hours specified in the shift (provided that they are greater than zero). Any break is ignored. Need to use and on the next line, also does not work if paybands have expenses ticked.|
 |addupto time paybandname | an alternative method of time-slicing. E.g. addupto 06:00 Early. Must be used inside a foreach dayslice but NOT inside a foreach timeslice. May have a series of adduptos with increasing times to slice up the day. Each one reduces the residual amounts in the block to prevent double posting. As with timeslice, breaks are deducted from the largest slice.| |addupto time paybandname | an alternative method of time-slicing. E.g. addupto 06:00 Early. Must be used inside a foreach dayslice but NOT inside a foreach timeslice. May have a series of adduptos with increasing times to slice up the day. Each one reduces the residual amounts in the block to prevent double posting. As with timeslice, breaks are deducted from the largest slice.|
 |showrate paybandname | the payband is added to the timesheet but with zero hours, as a place-holder for edits at completion time.| |showrate paybandname | the payband is added to the timesheet but with zero hours, as a place-holder for edits at completion time.|
 +
 +
 +
  
  
Line 49: Line 53:
 \\ \\
 ==== Indenting ==== ==== Indenting ====
 +
 +Nesting the Commands
 +
 +We start off with
 +<sxh>
 +foreach shift
 +-foreach dayslice
 +--foreach timeslice
 +--foreach timeslicedefault  (same as foreach timeslice)
 +</sxh>
 +Within each band we add the required details for days and times. You don’t need to use all, but it needs to be in that order. \\ \\
 +
 +
 The number of leading spaces indenting each command is used to determine which commands are affected by //foreach// and //if// commands. E.g. if the leading space is removed from the final //post// command in the second example above, it will be outside the //foreach// shift loop, and the effect will be to post summary pay band totals for the timesheet as a whole (i.e. not more than one timesheet line per pay band).  The number of leading spaces indenting each command is used to determine which commands are affected by //foreach// and //if// commands. E.g. if the leading space is removed from the final //post// command in the second example above, it will be outside the //foreach// shift loop, and the effect will be to post summary pay band totals for the timesheet as a whole (i.e. not more than one timesheet line per pay band). 
 \\ \\ \\ \\
Line 67: Line 84:
 <sxh> <sxh>
 foreach shift foreach shift
- add Basic+-add Basic
 thresholdsplit 37.0 Basic|Overtime thresholdsplit 37.0 Basic|Overtime
 post post
Line 75: Line 92:
 <sxh> <sxh>
 foreach shift foreach shift
-.if shift N +-if shift N 
-..add Night +--add Night 
-.foreach dayslice +-foreach dayslice 
-..if day Sunday +--if day Sunday 
-...add Weekend +---add Weekend 
-..if day Saturday +--if day Saturday 
-...add Weekend +---add Weekend 
-..add Basic +--add Basic 
-.post+-post
 </sxh> </sxh>
  
Line 92: Line 109:
  if shift SI  if shift SI
   Addlumpsum 1 Sleep In   Addlumpsum 1 Sleep In
 +  and
  foreach dayslice  foreach dayslice
   if day Holiday   if day Holiday
Line 112: Line 130:
 ---add Basic  ---add Basic 
 -post -post
 +</sxh>
 +
 +With Specified Dates and Thresholdsplit.
 +
 +<sxh>
 +foreach shift
 +-foreach dayslice
 +--if day 25
 +---add Basic Plus
 +--if day 30/05
 +---add Basic Plus
 +--if day 99
 +---add Basic Plus
 +--if day 01/06/2021
 +---add Basic Plus
 +--add Basic
 +thresholdsplit 37.5 Basic|Overtime
 +post
 +</sxh>
 +
 +
 +Using addlumpsum, charge and payonly.
 +
 +<sxh>
 +foreach shift
 +-addlumpsum 1 Mileage
 +-and
 +-add CHARGEONLY Bonus
 +-and
 +-add PAYONLY Commission
 +-and
 +-if day weekend
 +--add Basic
 +-if day weekday
 +--add Basic
 +post
 </sxh> </sxh>
  
Line 140: Line 194:
  If shift SD  If shift SD
   Addlumpsum 1 Day   Addlumpsum 1 Day
 +  and
  If shift E  If shift E
   Addlumpsum 0.65 Day   Addlumpsum 0.65 Day
 +  and
  If shift LA  If shift LA
   Addlumpsum 0.5 Day   Addlumpsum 0.5 Day
 +  and
  Post  Post
 </sxh> </sxh>
  • sa_ratescriptlanguage.1681221099.txt.gz
  • Last modified: 2023/04/11 13:51
  • by Scott McMullen