Flow Proses — Sistem Sewa Alat Berat

Quotation → Sales Order → SPK → Invoice → Payment → Payroll → SPK Close → Report

Accepted / Active / Paid
Dalam Proses
Menunggu Approval
Closed / Final
Rejected / Void
Refund
Payroll
Catatan: Setiap dokumen menggunakan ULID sebagai PK dan nomor sequential human-readable (mis. QT-202605-001). Semua data ter-isolasi per perusahaan via TenantScope. Setiap mutasi dicatat di forensic_audit_logs. Hover pada node untuk detail.
Phase 1 — Prapenjualan (Sales)
MASTER DATA SIAP
Client • Unit • Operator • Sales
Buat Quotation
CreateQuotationAction — No: QT-YYYYMM-NNN
Draft
Review & Edit Quotation
UpdateQuotationAction — hitung total_estimasi
Draft
Presentasi ke Client
Kirim penawaran — tunggu konfirmasi
Menunggu Keputusan
Tolak Quotation
RejectQuotationAction
Rejected
Void Quotation
VoidQuotationAction
Void
Terima Quotation
AcceptQuotationAction
Accepted
▼ LANJUT KE PHASE 2
Phase 2 — Sales Order (Negosiasi & Kontrak)
Buat Sales Order (SO)
CreateSalesOrderAction — No: SO-YYYYMM-NNN
harga_deal • diskon • PPN • payment_terms
Baru Dibuat
requires_approval=false requires_approval=true
Langsung Aktif
Tidak perlu approval
Active
Menunggu Approval
Status: PendingApproval
Pending Approval
Approve Tolak
Approve SO
ApproveSalesOrderAction
Active
Tolak SO
RejectApproval
Void
SO Aktif — Siap Diproses
SO Active → buat SPK & Invoice
Relasi: SO → SPK (1:1) & Invoice (1:N)
Active
▼ LANJUT KE PHASE 3 (SPK) & PHASE 5 (INVOICE) SECARA PARALEL
Phase 3 — SPK / Work Order (Operasional Lapangan)
Buat SPK
CreateSpkAction — No: SPK-YYYYMM-NNN
Lines: Unit + Operator + HM keluar + WH sewa
Active
Deploy SPK
DeploySpkAction
Unit: available → rented | Log HM: rental_start
Active
OPERASI LAPANGAN (berlangsung)
Unit berjalan • Operator bekerja
Input Work Hour harian → Phase 4
Running…
Perpanjang Selesai Normal Force Close
Perpanjang SPK
ExtendStandardSpkAction
ExtendCreditOverride
→ Invoice tambahan
Extension
Lanjut Operasi
↩ Loop ke Operasi Lapangan
Tutup SPK (Normal)
CloseSpkAction
Input HM kembali per unit
Unit → available | Log: rental_end
Closed
Cek Sisa WH
sisa_wh = wh_sewa − wh_terpakai
Jika > 0 → trigger Refund (Phase 6)
Force Close SPK
ForceCloseSpkAction
Perlu izin override_hm
Wajib alasan + attachment
Force Closed
Phase 4 — Input Jam Kerja Operator (Harian, Paralel saat SPK Active)
Input Work Hour Harian
CreateWorkHourAction
Per operator per hari — wh_hari_ini × rate_per_jam_snapshot
WorkHourLog
Koreksi Work Hour (opsional)
UpdateWorkHourAction / DeleteWorkHourAction
Hanya bisa sebelum lock ke Payroll
Optional
Akumulasi wh_terpakai
Σ(wh_hari_ini) per SPK Line per Operator
→ Dasar kalkulasi Refund & Payroll
Terakumulasi
Phase 5 — Invoice & Pembayaran
Buat Invoice
CreateInvoiceAction — No: INV-YYYYMM-NNN
subtotal • PPN • total | due_date dari SO
Unpaid
Review / Edit Invoice
UpdateInvoiceAction (sebelum Paid) — lampirkan attachment
Unpaid
Kirim ke Client
Invoice + Due Date dikirim ke client
Menunggu Bayar
Konfirmasi Pembayaran
ConfirmPaymentAction
tanggal_bayar • jumlah_bayar • bukti_transfer_url
Diproses
Invoice LUNAS
InvoiceStatus::Paid — Payment terkonfirmasi
Journal entry diposting
Paid
Void Invoice Void Payment
Void Invoice
VoidInvoiceAction
(hanya sebelum Paid)
Void
Void Payment
VoidPaymentAction
Invoice → kembali Unpaid
Reverted
Phase 6 — Refund (Triggered saat SPK Close jika sisa_wh > 0)
Buat Refund Request
CreateRefundAction
sisa_wh × rate = nilai_refund
Tier ditentukan oleh nilai refund
Pending
Tier Single (1 approval) Tier Dual (2 approval)
Tier Single
Nilai refund kecil
1 level approval
Single
Approve Refund
ApproveRefundAction
Approved
Tier Dual
Nilai refund besar
2 level approval
Dual
Approve L1 (Manager)
ApproveL1RefundAction
Approved L1
Approve L2 (Director)
ApproveRefundAction
Approved
Bayar Refund ke Client
MarkPaidRefundAction
bukti_transfer • bank_account_to • paid_tanggal_bayar
Paid
Tolak Refund Credit Override Review
Tolak Refund
RejectRefundAction
+ reject_reason wajib diisi
Rejected
Credit Override Review
CreditOverrideReviewAction
Invoice belum lunas
Under Review
Phase 7 — Payroll Operator (Periodik)
Generate Payroll Period
GeneratePayrollAction
Kumpulkan WorkHourLog → hitung total_wh × rate
Generating → Draft
Review & Adjustment
AddAdjustmentAction — Bonus / Potongan
Draft, bisa diubah sebelum Final
Draft
Approve Adjustment (jika perlu)
ApproveAdjustmentAction
(requires_adjustment_approval = true)
Menunggu
Execute Payroll
ExecutePayrollAction
Period → Final (immutable) | Lock WH | Generate slip
Final
Bayar Gaji Operator
MarkPaidAction per PayrollLine
paid_at • paid_by • paid_note | atau: ToggleDeferAction
Paid
Cancel (hanya saat Draft)
Cancel Payroll
CancelPayrollAction (hanya Draft)
WH lock dibersihkan
Cancelled
Phase 8 — Penyelesaian Dokumen
SPK: Closed
Semua lines habis
Unit → Available
HM Log: rental_end
Closed
SO: Closed
Invoice lunas
Refund selesai
SO → Closed
Closed
QT: Accepted
Semua dokumen linked
Siklus complete
Complete
SIKLUS SELESAI
Journal terposting • Forensic audit log lengkap
Phase 9 — Report & Monitoring
Report Sales
QT → SO konversi
Per sales / client
Sales
Report A/R Aging
Invoice overdue
Outstanding per client
Finance
Report Work Hour
WH per operator/SPK
Utilisasi HM unit
Operasional
Report Payroll
Total payout per periode
Slip gaji operator
HR/Payroll
Audit Log
forensic_audit_logs
Security & RBAC audit
Security
Ringkasan Status Flow per Dokumen
Dokumen Status Flow No. Format Relasi Key
Quotation Draft → Accepted / Rejected / Void QT-YYYYMM-NNN → SalesOrder (1:1)
Sales Order PendingApproval → Active → Closed / Void SO-YYYYMM-NNN → SPK (1:1), → Invoice (1:N)
SPK Active → Closed / Void SPK-YYYYMM-NNN → SpkLine (1:N), → WorkHourLog
Invoice Unpaid → Paid / Void INV-YYYYMM-NNN → Payment (1:1)
WorkHourLog Free → Locked (ke PayrollLine) → SpkLine, → Operator, → PayrollLine
RefundRequest Pending → ApprovedL1 → Approved → Paid / Rejected → SpkLine, → SalesOrderLine
PayrollPeriod Generating → Draft → Final / Cancelled → PayrollLine (1:N) → WorkHourLog

Dibuat dari source code aktual — hover pada setiap node untuk detail action class & field yang terlibat