Skip to content
English
  • There are no suggestions because the search field is empty.

How Labor Items and Clock On/Off Work

Source: labor_items_controller.rb:128-205, invoice_item.rb:91-115, invoice_item.rb:206-211

  • Clock on/off is a toggle: checks for an existing open labor item (begin_time set, end_time null) for the same mechanic and invoice item
  • If an open item exists, end_time is set (clock off); if not, a new labor item is created with begin_time = now and in_progress = true
  • Labor counters on the invoice item track hours_worked and labor cost; add_to_labor_counters increases them, remove_from_labor_counters subtracts them
  • When hours_worked reaches zero, cost reverts to the product's base cost
  • Cannot change a line item away from labor type if labor_items (time entries) have been recorded against it
  • Labor items cannot be deleted from closed invoices or Xero-synced invoices
  • In-progress labor items (clocked on, not clocked off) block invoice processing
  • BUG: Local time conversion uses the company's UTC offset with an approximation for half-hour timezones -- non-"00" minutes are treated as "50" for the decimal offset calculation, which can cause approximately 20-minute discrepancies for zones like India (+5:30) or Adelaide (+9:30)

Support scenarios

  • "How does clock on/off work?" -> it is a toggle; first click starts the timer, second click stops it for the same mechanic on the same item
  • "I can't process because there's a labour item still clocked on" -> a mechanic's timer is still running; clock them off or delete the in-progress labor item
  • "The labour times are slightly off for my timezone" -> BUG: half-hour timezone offsets (like +9:30) are approximated, which can cause approximately 20-minute discrepancies
  • "Why can't I change this item away from labour type?" -> labor time entries exist; delete them first if you need to change the product type