fix financial and certificates

This commit is contained in:
root
2026-06-05 01:51:08 -04:00
parent d28d11e2e5
commit ad968eaff7
94 changed files with 9654 additions and 214 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
class CertificateRecord extends BaseModel
{
protected $table = 'certificate_records';
public $timestamps = true;
protected $fillable = [
'certificate_number',
'verification_token',
'student_id',
'student_name',
'grade',
'cert_date',
'school_year',
'class_section_id',
'issued_by',
'issued_at',
'created_at',
'updated_at',
];
protected $casts = [
'student_id' => 'integer',
'class_section_id' => 'integer',
'issued_by' => 'integer',
'cert_date' => 'date',
'issued_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
+8
View File
@@ -20,6 +20,11 @@ class FinalExam extends BaseModel
'class_section_id',
'updated_by',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -35,6 +40,9 @@ class FinalExam extends BaseModel
// score is often numeric; adjust if yours is integer
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
class FinanceBalanceCarryforward extends BaseModel
{
protected $guarded = [];
protected $table = 'finance_balance_carryforwards';
protected $casts = ['source_invoice_ids_json' => 'array', 'metadata_json' => 'array'];
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class FinanceFollowUpNote extends BaseModel
{
protected $guarded = [];
protected $table = 'finance_follow_up_notes';
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class FinanceNotificationLog extends BaseModel
{
protected $guarded = [];
protected $table = 'finance_notification_logs';
}
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class FinanceNotificationPreference extends BaseModel
{
protected $guarded = [];
protected $table = 'finance_notification_preferences';
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class FinanceReceiptSequence extends BaseModel
{
protected $guarded = [];
protected $table = 'finance_receipt_sequences';
}
+8
View File
@@ -22,6 +22,11 @@ class Homework extends BaseModel
'updated_by',
'homework_index',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -38,6 +43,9 @@ class Homework extends BaseModel
// keep numeric; change to 'integer' if your scores are whole numbers
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class InvoiceInstallment extends BaseModel
{
protected $guarded = [];
protected $table = 'invoice_installments';
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class InvoiceInstallmentPlan extends BaseModel
{
protected $guarded = [];
protected $table = 'invoice_installment_plans';
}
+8
View File
@@ -20,6 +20,11 @@ class MidtermExam extends BaseModel
'class_section_id',
'updated_by',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -35,6 +40,9 @@ class MidtermExam extends BaseModel
// score can be decimal; change to 'integer' if it's whole number
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
+2 -1
View File
@@ -50,7 +50,8 @@ class NavItem extends BaseModel
return static::query()
->where('menu_parent_id', $parentId)
->where('is_enabled', 1)
->orderBy('sort_order', 'asc')
->orderBy('label', 'asc')
->orderBy('id', 'asc')
->get()
->toArray();
}
+8
View File
@@ -20,6 +20,11 @@ class Participation extends BaseModel
'class_section_id',
'updated_by',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -35,6 +40,9 @@ class Participation extends BaseModel
// score is numeric; change to 'integer' if it is whole number
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class PaymentCarryforwardAllocation extends BaseModel
{
protected $guarded = [];
protected $table = 'payment_carryforward_allocations';
}
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class PaymentInstallmentAllocation extends BaseModel
{
protected $guarded = [];
protected $table = 'payment_installment_allocations';
}
+9 -1
View File
@@ -23,6 +23,11 @@ class Project extends BaseModel
'updated_by',
'project_index',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -45,7 +50,10 @@ class Project extends BaseModel
'class_section_id' => 'integer',
'updated_by' => 'integer',
'project_index' => 'integer',
'score' => 'decimal:2', // or 'float' if you prefer
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime', // or 'float' if you prefer
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
+8
View File
@@ -17,6 +17,11 @@ class Quiz extends BaseModel
'updated_by',
'quiz_index',
'score',
'max_points',
'status',
'excused_reason',
'locked_at',
'locked_by',
'comment',
'semester',
'school_year',
@@ -31,6 +36,9 @@ class Quiz extends BaseModel
'updated_by' => 'integer',
'quiz_index' => 'integer',
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
class SectionPlacementBatch extends BaseModel
{
protected $table = 'section_placement_batches';
public const STATUS_DRAFT = 'draft';
public const STATUS_FINALIZED = 'finalized';
public const STATUS_CANCELLED = 'cancelled';
public const STATUS_SUPERSEDED = 'superseded';
protected $fillable = [
'from_school_year',
'to_school_year',
'from_grade_level_id',
'to_grade_level_id',
'section_capacity_used',
'total_students',
'section_count',
'algorithm',
'configuration_snapshot_json',
'preview_snapshot_json',
'created_by',
'finalized_by',
'finalized_at',
'status',
];
protected $casts = [
'from_grade_level_id' => 'integer',
'to_grade_level_id' => 'integer',
'section_capacity_used' => 'integer',
'total_students' => 'integer',
'section_count' => 'integer',
'created_by' => 'integer',
'finalized_by' => 'integer',
'finalized_at' => 'datetime',
];
public function students(): HasMany
{
return $this->hasMany(SectionPlacementBatchStudent::class, 'batch_id');
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SectionPlacementBatchStudent extends BaseModel
{
protected $table = 'section_placement_batch_students';
public $timestamps = false;
protected $fillable = [
'batch_id',
'student_id',
'student_type',
'source_decision_id',
'source_enrollment_id',
'final_score',
'placement_score',
'score_band',
'placement_band_reason',
'planned_section_index',
'assigned_section_id',
'assignment_order',
'was_override',
'override_reason',
'created_at',
];
protected $casts = [
'batch_id' => 'integer',
'student_id' => 'integer',
'source_decision_id' => 'integer',
'source_enrollment_id' => 'integer',
'final_score' => 'float',
'placement_score' => 'float',
'planned_section_index' => 'integer',
'assigned_section_id' => 'integer',
'assignment_order' => 'integer',
'was_override' => 'boolean',
'created_at' => 'datetime',
];
public function batch(): BelongsTo
{
return $this->belongsTo(SectionPlacementBatch::class, 'batch_id');
}
}
+7
View File
@@ -25,6 +25,9 @@ class SemesterScore extends BaseModel
'ptap_score',
'test_avg',
'semester_score',
'calculation_mode',
'calculation_policy_version',
'snapshot_id',
'semester',
'school_year',
];
@@ -52,6 +55,7 @@ class SemesterScore extends BaseModel
'ptap_score' => 'decimal:2',
'test_avg' => 'decimal:2',
'semester_score' => 'decimal:2',
'snapshot_id' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
@@ -169,6 +173,9 @@ class SemesterScore extends BaseModel
'ptap_score' => ['nullable', 'numeric', 'min:0'],
'test_avg' => ['nullable', 'numeric', 'min:0'],
'semester_score' => ['nullable', 'numeric', 'min:0'],
'calculation_mode' => ['nullable', 'string', 'in:legacy,strong'],
'calculation_policy_version' => ['nullable', 'string', 'max:50'],
'snapshot_id' => ['nullable', 'integer', 'min:1'],
];
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SemesterScoreSnapshot extends BaseModel
{
protected $table = 'semester_score_snapshots';
protected $fillable = [
'student_id',
'school_id',
'class_section_id',
'semester',
'school_year',
'grading_profile_id',
'grading_profile_version',
'calculation_mode',
'calculation_policy_version',
'input_json',
'calculation_json',
'semester_score',
'calculated_by',
'calculated_at',
];
protected $casts = [
'student_id' => 'integer',
'school_id' => 'integer',
'class_section_id' => 'integer',
'grading_profile_id' => 'integer',
'input_json' => 'array',
'calculation_json' => 'array',
'semester_score' => 'decimal:2',
'calculated_by' => 'integer',
'calculated_at' => 'datetime',
];
public function semesterScore(): BelongsTo
{
return $this->belongsTo(SemesterScore::class, 'snapshot_id');
}
}