Documentation Index
Fetch the complete documentation index at: https://docs.ledgerbox.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Pay Stub model extracts and structures information from pay stubs, including employee and employer information, pay period details, and financial calculations.
Schema Structure
| Field | Type | Description |
|---|
EmployeeAddress | string? | Address of the employee |
EmployeeName | string? | Name of the employee |
EmployeeSSN | string? | Social security number |
| Field | Type | Description |
|---|
EmployerAddress | string? | Address of the employer |
EmployerName | string? | Name of the employer |
| Field | Type | Description |
|---|
PayDate | string? | Date of salary payment |
PayPeriodStartDate | string? | Start date of the pay period |
PayPeriodEndDate | string? | End date of the pay period |
Current Period Amounts
| Field | Type | Description |
|---|
CurrentPeriodGrossPay | number? | Gross pay of the current period |
CurrentPeriodTaxes | number? | Taxes of the current period |
CurrentPeriodDeductions | number? | Deductions of the current period |
CurrentPeriodNetPay | number? | Net pay of the current period |
Year to Date Amounts
| Field | Type | Description |
|---|
YearToDateGrossPay | number? | Year-to-date gross pay |
YearToDateTaxes | number? | Year-to-date taxes |
YearToDateDeductions | number? | Year-to-date deductions |
YearToDateNetPay | number? | Year-to-date net pay |
Type Definitions
import type {
PeriodAmounts,
PayStub,
PayStubResponse,
StrictPayStubResponse
} from '@your-package/models';
Validation Rules
Basic Validation
- All fields are optional by default
Strict Validation
The following fields are required in strict mode:
- EmployeeName
- EmployerName
- PayDate
- CurrentPeriodGrossPay
- CurrentPeriodNetPay
Example Usage
import { validatePayStub } from '@your-package/models';
// Example pay stub data
const payStubData = {
EmployeeName: "John A. Doe",
EmployerName: "Contoso Corporation",
PayDate: "2024-02-26",
CurrentPeriodGrossPay: 744.10,
CurrentPeriodTaxes: 410.10,
CurrentPeriodDeductions: 0,
CurrentPeriodNetPay: 334.00,
YearToDateGrossPay: 2744.10,
YearToDateTaxes: 855.90,
YearToDateDeductions: 0,
YearToDateNetPay: 1888.20
};
// Validate the pay stub
const validatedPayStub = validatePayStub(payStubData);
// Access validated data through result property
console.log(validatedPayStub.result.CurrentPeriodNetPay);
Date Handling
The model accepts dates in multiple formats:
- ISO 8601 datetime strings
- YYYY-MM-DD format
All dates are converted to ISO format during validation.
Best Practices
- Always validate pay stubs:
const payStub = validatePayStub(payStubData);
- Access data through the result property:
const netPay = payStub.result.CurrentPeriodNetPay;
- Handle optional fields appropriately:
const taxes = payStub.result.CurrentPeriodTaxes || 0;
- Verify required fields in strict mode:
if (!payStub.result.EmployeeName || !payStub.result.PayDate) {
// Handle missing required fields
}
- Calculate totals carefully:
const netPay = (payStub.result.CurrentPeriodGrossPay || 0) -
(payStub.result.CurrentPeriodTaxes || 0) -
(payStub.result.CurrentPeriodDeductions || 0);