- core/utils.py: render_to_pdf() wrapper for xhtml2pdf - core/templates/core/pdf/payslip_pdf.html: A4 PDF payslip (matches V2 layout) - core/templates/core/email/payslip_email.html: HTML email body for Spark - core/templates/core/payslip.html: browser payslip detail page with print - core/views.py: add payslip_detail view, wire email+PDF into process_payment - core/urls.py: add payroll/payslip/<pk>/ route - config/settings.py: add SPARK_RECEIPT_EMAIL setting - payroll_dashboard.html: add "View" payslip link in Payment History tab All templates show adjustments (bonuses, deductions, overtime, loan repayments) as line items. Amounts always show 2 decimal places. Email failure does not roll back payment — handled gracefully with warning message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1022 B
1022 B
Payslip Feature Design — 22 Feb 2026
Goal
Complete the payment workflow: when "Pay" is clicked, generate a PDF payslip and email it to Spark. Also add a payslip detail page for viewing/printing past payslips.
Files
core/utils.py— render_to_pdf() xhtml2pdf wrappercore/templates/core/pdf/payslip_pdf.html— A4 PDF templatecore/templates/core/email/payslip_email.html— HTML email bodycore/templates/core/payslip.html— Browser payslip detail pagecore/views.py— payslip_detail view + email in process_paymentcore/urls.py— payroll/payslip//config/settings.py— SPARK_RECEIPT_EMAIL + DEFAULT_FROM_EMAIL
Flow
process_payment → atomic(create record, link logs/adjs, update loans) → email PDF to Spark → redirect
Key: V2 → V5 field mapping
- record.amount → record.amount_paid
- worker.id_no → worker.id_number
- worker.phone_no → worker.phone_number
- loan.balance → loan.remaining_balance
- loan.amount → loan.principal_amount