Files
alrahma_sunday_school/app/Models/WithdrawalFinancialCalculationModel.php
root d906a915d6
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Failing after 1m20s
add refund logic and fix books inventory logic
2026-08-22 13:44:25 -04:00

43 lines
1.9 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class WithdrawalFinancialCalculationModel extends Model
{
protected $table = 'withdrawal_financial_calculations';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $useTimestamps = true;
protected $allowedFields = [
'version', 'enrollment_id', 'student_id', 'parent_id', 'invoice_id',
'school_year', 'policy_version', 'annual_fee_includes_books',
'school_year_start_date', 'enrollment_date', 'withdrawal_request_date',
'total_instructional_weeks', 'total_chargeable_days',
'studied_calendar_days', 'studied_weeks', 'annual_fee_allocation_cents',
'issued_book_charge_cents', 'annual_instruction_cents',
'earned_tuition_cents', 'other_charge_cents', 'retained_charge_cents',
'original_invoice_charge_cents', 'invoice_adjustment_cents',
'adjusted_invoice_charge_cents',
'valid_payment_cents', 'completed_payout_cents', 'open_reservation_cents',
'refundable_credit_cents', 'new_refund_request_cents', 'balance_due_cents',
'book_evidence_json', 'explanation_json', 'calculation_hash',
'active_posted_key', 'books_discount_eligible', 'status', 'superseded_by_id',
'override_reason', 'overridden_at', 'overridden_by',
'calculated_by', 'posted_by', 'calculated_at', 'posted_at',
];
protected $validationRules = [
'version' => 'required|integer|greater_than[0]',
'enrollment_id' => 'required|integer',
'student_id' => 'required|integer',
'parent_id' => 'required|integer',
'school_year' => 'required|string|max_length[16]',
'annual_fee_includes_books' => 'required|in_list[1]',
'total_instructional_weeks' => 'required|integer|greater_than[0]',
'status' => 'required|in_list[preview,posted,superseded,requires_review]',
];
}