Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using  Business Rules, we can autofill not only the employee text boxes, but also the corresponding Reviewer box and Report Date. The employee information and the Reviewer name are automatically filled in using the credentials of the user who is logged in. The Report date will be filled in using a separate ruIe. The IRS Mileage Rate is a default value for that field. Here is an example of a rule to fill in the current date using the frevvo.currentdate function. Refer to the Rules Validator documentation for help troubleshooting your rules.

Code Block
if (form.load ){   
ReportDate.value = frevvo.currentDate(form);
}

...

Code Block
if (form.load && EmployeeName.value === '') {
  EmployeeName.value = _data.getParameter('subject.first.name') + ' ' +
                      _data.getParameter('subject.last.name');
  EmployeeEmail.value = _data.getParameter ('subject.email');
  Reviewer.value = _data.getParameter("subject.reports.to");
}

Refer to the Rules Validator documentation for help troubleshooting your rules.

Expense Report Section (to be filled in by Employee

...

Create a section called Expense Report as shown above. Employees will fill in this section to calculate their expenses. Use the Table control to make your grid. You will find information about adding, removing and moving columns in a table here,

Add these rules to perform the calculations in the Expense Report::

To compute the Mileage Expense:

Code Block
for (var i = 0; i < MilesTraveled.value.length; i++) {
  if (MilesTraveled[i].value > 0) {
    MileageExpense[i].value = MilesTraveled[i].value * IRSMileageRate.value;
  }
}

To calculate the Day's Total:

Code Block
for (var i = 0; i < Misc.value.length; i++)
{
    DaysTotal[i].value = Misc[i].value + Meals[i].value + Travel[i].value + MileageExpense[i].value;
}

And finally, to compute the Grand Total:

Code Block
var tot = 0;

for (var i = 0; i < DaysTotal.value.length; i++) {
  tot = tot + DaysTotal[i].value;
}
 
GrandTotal.value = tot;

if (ExpenseRepeat.itemRemoved) {var x;}

 

Approval Section (to be filled in by Manager)

...