• Mahmoud Aglan's avatar
    Fix all column mismatches between code and live database schema · 0cc5b982
    Mahmoud Aglan authored
    Critical SQL fixes (pages were crashing):
    - GlobalSearch: remove non-existent branch_id/invoice_number, fix relationship
    - RevenueWidget: payment_method → method
    - FinancialReport: line_total → total_amount, balance_due → due_amount
    - PaymentPlanCreate: rewrite to match actual payment_plans/installments schema
    
    High-priority display fixes (features showing null):
    - invoice_number → number (8 locations)
    - balance_due → due_amount (6 locations)
    - full_name_ar → full_name (7 locations, accessor doesn't exist)
    - payment_method → method in print view
    - subtotal → subtotal_amount
    - description → notes on invoice
    - line_total → total_amount on invoice items
    - receipt_number → reference on payment
    
    Medium fixes:
    - Dashboard: fix format() call on string time column
    - Participant card: access person fields via relationship
    
    Low fixes:
    - daily-financial-print: createdBy → creator relationship
    - reports-page: payment_method key → method
    
    Infrastructure:
    - Add migration for cash_session_id on payments table
    - Add cash_session_id to Payment model fillable
    - Fix float → decimal:2 casts on Evaluation/EvaluationScore
    - Update enum registry docs to match actual DB CHECK constraints
    Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    0cc5b982