graph LR START[💼 Shift
Completed
& Rated] START --> CALC[📊 INTERNAL

Calculate Invoice
• Hours worked
• Rates × Hours
• Overtime calc
• Platform fees
• Tax amounts] CALC --> GENERATE[📄 INTERNAL

Generate Invoice
• Create PDF
• Invoice number
• Line items
• Due date] GENERATE --> SAVE[💾 INTERNAL

Save to Database
• Store invoice
• Status: pending
• Track history] SAVE --> SEND[📧 API INTEGRATION

SendGrid
• Send email
• Track delivery
• Reliable inbox] SEND --> CLIENT[📱 Client
Reviews
Invoice] CLIENT --> DECISION{Approve or
Dispute?} DECISION -->|⚠️ Dispute| DISPUTE[🔧 INTERNAL

Handle Dispute
• Admin reviews
• Adjustments
• Re-calculate] DISPUTE --> SAVE DECISION -->|✅ Approve| PAY[💳 API INTEGRATION

Stripe
• Credit card
• ACH transfer
• Payment tracking] PAY --> CONFIRM[💾 INTERNAL

Update Status
• Mark as paid
• Record payment
• Update reports] CONFIRM --> PAYOUT[💰 API INTEGRATION

Stripe Connect
• Pay staff
• Direct deposit
• Automated] PAYOUT --> RECORD[📊 INTERNAL

Track Payments
• Staff earnings
• Payment history
• Reports] RECORD --> DONE[✅ Complete] style START fill:#E1F5FF style CALC fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style GENERATE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style SAVE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style DISPUTE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style CONFIRM fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style RECORD fill:#FFF9E6,stroke:#F9A825,stroke-width:3px style SEND fill:#E3F2FD,stroke:#1976D2,stroke-width:3px style PAY fill:#E3F2FD,stroke:#1976D2,stroke-width:3px style PAYOUT fill:#E3F2FD,stroke:#1976D2,stroke-width:3px style DONE fill:#90EE90