Chuyển tới nội dung chính

Trip Status Workflow

This page documents the updated trip lifecycle shown in the workflow diagram. The model removes the old Upcoming and In Progress states and keeps a single post-approval status: Approved.

Overview​

The trip workflow starts with company-level routing:

  1. A trip is created.
  2. If the company does not use trip proposals, the workflow is not applicable.
  3. If the company uses trip proposals but does not use expenses, the trip follows the standard flow.
  4. If the company uses both trip proposals and expenses, the trip follows the expense flow.

Status Definitions​

Statustrips.status enumMeaning
Pending0 (pending)Trip proposal was submitted and is waiting for approval.
Approved1 (approved)Trip was approved and the trip end datetime has not passed yet.
Awaiting Re-declarationDerived, not stored in trips.statusTrip end has passed and the system is waiting for the employee to re-declare, if re-declaration is enabled.
Pending Re-declarationDerived, not stored in trips.statusRe-declaration was submitted and is waiting for approver action.
Awaiting ExpenseDerived, not stored in trips.statusThe trip is waiting for expense submission and reimbursement processing.
CompletedDerived, not stored in trips.statusThe trip is finished and no further action is required.
Rejected2 (rejected)The trip proposal or re-declaration was rejected.
Canceled3 (canceled)The trip was canceled before completion.
Confirmed4 (confirmed)The trip was confirmed and is ready to continue through the applicable workflow.

Type Definitions​

Typetrips.type enumMeaning
Personal0 (personal)Personal trip.
Business1 (business)Business trip.

Date-Based Completion Rule​

For the standard flow, a trip becomes Completed when:

current_datetime > trip_end_datetime

Status calculation rules:

  • Pending: waiting for approval.
  • Approved: trip_end_datetime has not passed.
  • Completed: trip_end_datetime has passed.
  • Rejected: rejected by the approver.
  • Canceled: canceled before completion.

Use the full datetime value, including time and timezone, when evaluating completion.

Flow 1: Standard Trip Flow​

This flow applies when trip proposals are enabled and expenses are not used.

Transitions​

  1. Submission creates a trip in Pending.
  2. If the approver accepts the proposal, the trip moves to Approved.
  3. While the trip end datetime has not passed, the trip stays Approved.
  4. After the trip end datetime passes, the trip moves to Completed.
  5. If the approver rejects the proposal, the trip moves to Rejected.
  6. If the employee edits and resubmits after rejection, the trip re-enters the approval flow.

Key Point​

In the standard flow, there is only one post-approval state before completion:

Pending -> Approved -> Completed

If rejected, the path is:

Pending -> Rejected

Flow 2: Expense Flow With Re-declaration Enabled​

This flow applies when the company uses expenses and requires re-declaration after the trip ends.

Transitions​

  1. The trip is first approved and remains Approved while the trip end datetime has not passed.
  2. Once the trip end datetime passes, the trip moves to Awaiting Re-declaration.
  3. If the employee does not re-declare, the trip remains in Awaiting Re-declaration.
  4. If the employee submits a re-declaration, the trip moves to Pending Re-declaration.
  5. If the approver rejects the re-declaration, the trip moves to Rejected.
  6. If the approver accepts the re-declaration, the trip moves to Awaiting Expense.
  7. After expense submission and reimbursement, the trip moves to Completed.

Journey Summary​

Successful path:

Pending -> Approved -> Awaiting Re-declaration -> Pending Re-declaration -> Awaiting Expense -> Completed

Rejected path:

Pending -> Approved -> Awaiting Re-declaration -> Pending Re-declaration -> Rejected

Flow 3: Expense Flow With Re-declaration Disabled​

This flow applies when the company uses expenses but does not require re-declaration.

Transitions​

  1. The trip is approved and remains Approved while the trip end datetime has not passed.
  2. After the trip end datetime passes, the trip moves directly to Awaiting Expense.
  3. Once expenses are submitted and reimbursement is processed, the trip moves to Completed.

Journey Summary​

Pending -> Approved -> Awaiting Expense -> Completed

Routing Rules​

Use these rules to determine which flow applies:

  • If trip proposals are disabled, the trip proposal workflow does not apply.
  • If trip proposals are enabled and expenses are disabled, use the standard trip flow.
  • If trip proposals are enabled and expenses are enabled, use an expense flow.
  • If expenses are enabled, re-declaration settings determine whether the trip goes through Awaiting Re-declaration and Pending Re-declaration before Awaiting Expense.

Implementation Notes​

  • Do not manually mark trips as Completed in the standard flow.
  • Completed should be derived dynamically or by scheduled recalculation based on trip end datetime.
  • Rejected and Canceled are terminal states until the employee submits a new or edited request.
  • All comparisons against trip end must use the full datetime value rather than only the calendar date.