This guide explains how payroll is calculated. It covers how wages, leave, deductions, and totals are worked out on a seafarer’s payslip.
Key Concepts
Standard Values Used in Payroll
Constant | Value | What it Means |
days_in_month | 30.0000 | Payroll always treats a month as 30 days. (Industry standard.) |
money_decimal_places | 2 | Money is shown to 2 decimal places |
Time_decimal_places | 4 | Time (days, hours) is shown to 4 decimal places |
default_rounding_mode | half_even | A standard rounding methods that avoids bias over time |
How a “Full Month” Works
Payroll always checks whether someone worked a full calendar month or only part of it.
Step 1: Count actual days worked
raw_days = Date.diff(end_date, start_date) + 1
Step 2: Compare with the calendar month
If the person worked the full calendar month → payroll treats it as 30 days
If not → payroll uses the actual days worked
Example
Month | Calendar Days | Raw Days | Full Month? | Quantity |
January | 31 | 31 | Yes | 30.0000 |
February | 28 | 28 | Yes | 30.0000 |
January (mid-month sign on) | 31 | 16 | No | 16.0000 |
This rule is important because it is used in all calculations.
Rounding Rules
Each item is rounded individually (not just the final total)
What you see on screen is exactly what is stored in the system
Money is rounded to 2 decimal places
Time values are rounded to 4 decimal places
Exception: Leave balances
Leave balances are stored with full precision to avoid small rounding errors adding up over time. They are only rounded when shown on screen.
Earning Items (How Pay Is Calculated)
There are three main ways earnings are calculated:
1. Monthly (Prorated Rate)
Used for salary-based items like basic wage.
Formula
current_value = base_amount * (quantity / 30)
Example
Scenario | base_amount | Quantity | current_value |
Full month | $1,000.00 | 30.0000 | $1,000.00 |
Partial month | $1,000.00 | 15.0000 | $500.00 |
2. Daily Rate
current_value = rate * quantity
Field | Value |
Rate | $25.00 |
Quantity | 10.0000 |
current_value | $250.00 |
3. Hourly Rate
current_value = rate * quantity
Field | Value |
Rate | $12.50 |
Quantity | 8.0000 |
current_value | $100.00 |
Salary Adjustment
This ensures the total pay matches the agreed contract salary.
salary_adjustment = agreed_salary - wage_scale_earnings_total
Field | Value |
Contract salary | $2,500.00 |
Wage scale total | $2,480.00 |
Adjustment | $20.00 |
Leave Paid Out (Liquidated Leave)
When leave is paid instead of taken:
liquidated_amount = ending_balance_amount * (liquidated_days / ending_balance_days)
This value is already calculated and simply added to the payslip.
Deductions
Deductions are simple:
No formulas
Just a fixed amount
Rounded to 2 decimal places
Examples:
Union dues
Cash advances
Leave Calculations
Leave Accrual (Earning Leave)
Step 1: Daily leave value
rate = monthly_amount / 30
Field | Value |
monthly_amount | $250.00 |
Rate | $8.33 |
Step 2: Leave earned
accrued_days = (quantity / 30) * leave_days
Full Month Example
Field | Value |
Quantity | 30.0000 |
leave_days | 8.0000 |
accrued_days | 8.0000 |
Partial Month Example
Field | Value |
Quantity | 15.0000 |
leave_days | 8.0000 |
accrued_days | 4.0000 |
Step 3: Leave value
accrued_amount = rate * accrued_days
Leave Balance (Running Total)
Each month:
ending_balance = previous_balance + new accrual
Balances are kept with full precision to avoid rounding errors over time.
Leave Paid Out
When leave is cashed out:
liquidated_amount = ending_balance_amount * (liquidated_days / ending_balance_days)
After payment:
Leave days decrease
Leave balance decreases
Allotments (Sending Money to Others)
Allotments are payments sent to other accounts.
Key Points
Fixed amount per allotment
Can be one-time or recurring
Only counted once they are marked as paid
Total
allotments_total = sum(amount where paid = true)
Payslip Totals
How totals are calculated
earnings_total = sum of earnings
deductions_total = sum of deductions
allotments_total = sum of paid allotments
current_total = earnings_total - deductions_total - allotments_total
grand_total = current_total + previous_balance
Example
Field | Value |
earnings_total | $2,500.00 |
deductions_total | $150.00 |
allotments_total | $800.00 |
previous_balance | $200.00 |
current_total | $1,550.00 |
grand_total | $1,750.00 |
Travel and Onboard Days
Onboard Days
Always counted inclusive (both start and end days count)
onboard_days = sign_off_date - sign_on_date + 1
Travel Days
Counted separately to avoid double counting
Example
Left home Jan 1, signed on Jan 3 → 2 travel days
Signed off Mar 28, arrived home Mar 30 → 2 travel days
Payslip Creation (What Happens Automatically)
When a payslip is created, the system:
Finds relevant contracts
Calculates earnings
Applies salary adjustments
Calculates leave earned
Carries forward leave balance
Copies recurring allotments
Calculates totals
Payslip Lifecycle
Draft → Finalized
Once finalized:
Cannot be changed
A full snapshot is stored for reporting
Example Payslip Summary
Earnings
Item | Value |
Basic Wage | $2,000.00 |
Fixed Overtime | $750.00 |
Leave Pay | $250.00 |
Travel Allowance | $30.00 |
Salary Adjustment | $50.00 |
Overtime | $192.36 |
Total | $3,272.30 |
Deductions
Item | Value |
Union Dues | $25.00 |
Cash Advance | $200.00 |
Total | $225.00 |
Allotments
Item | Value |
Total Paid | $1,700.00 |
Final Summary
Earnings $3,272.36
- Deductions $225.00
- Allotments $1,700.00
-----------------------------
Current Total $1,347.36
+ Previous Balance $350.00
-----------------------------
Grand Total $1,697.36
FAQ
Why is a month always 30 days?
This is a maritime industry standard. It ensures consistency across contracts and payroll calculations.
Why doesn’t the payslip match calendar days?
Payroll uses a standard 30-day system, not actual calendar days.
Why are some values slightly rounded?
Each item is rounded individually to avoid hidden discrepancies.
Why is the leave balance not perfectly rounded?
Leave balances are stored with full precision to avoid small errors building up over time.
What is a salary adjustment?
It ensures the final pay matches the agreed contract salary.
Why are allotments deducted?
They represent money sent to other accounts, such as family or agents.