Spaces:
Running
Running
Upload 3 files
Browse files
easypay/includes/ApiValidator.php
CHANGED
|
@@ -170,11 +170,13 @@ class ApiValidator
|
|
| 170 |
*/
|
| 171 |
public function validateStudentExists($studentId)
|
| 172 |
{
|
| 173 |
-
$sql = "SELECT id, student_code,
|
| 174 |
-
CONCAT(last_name, ' ', first_name, ' ', COALESCE(other_name, '')) AS full_name,
|
| 175 |
-
admission_status
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
| 178 |
|
| 179 |
$stmt = $this->pdo->prepare($sql);
|
| 180 |
$stmt->execute(['student_id' => $studentId]);
|
|
|
|
| 170 |
*/
|
| 171 |
public function validateStudentExists($studentId)
|
| 172 |
{
|
| 173 |
+
$sql = "SELECT sr.id, sr.student_code,
|
| 174 |
+
CONCAT(sr.last_name, ' ', sr.first_name, ' ', COALESCE(sr.other_name, '')) AS full_name,
|
| 175 |
+
sr.admission_status,
|
| 176 |
+
al.level_name
|
| 177 |
+
FROM tb_student_registrations sr
|
| 178 |
+
LEFT JOIN tb_academic_levels al ON sr.level_id = al.id
|
| 179 |
+
WHERE sr.id = :student_id";
|
| 180 |
|
| 181 |
$stmt = $this->pdo->prepare($sql);
|
| 182 |
$stmt->execute(['student_id' => $studentId]);
|
easypay/includes/ReceiptGenerator.php
CHANGED
|
@@ -62,8 +62,16 @@ class ReceiptGenerator
|
|
| 62 |
}
|
| 63 |
}
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
// Header
|
| 66 |
-
$this->centerText($image, 18, 50,
|
| 67 |
$this->centerText($image, 10, 75, "...education for excellence", $grey);
|
| 68 |
$this->centerText($image, 10, 100, "1, Ebute - Igbogbo Road, Ipakodo, Ikorodu, Lagos, Nigeria", $black);
|
| 69 |
$this->centerText($image, 10, 120, "Phone No(s): 08027449739, 08077275777", $black);
|
|
@@ -111,13 +119,26 @@ class ReceiptGenerator
|
|
| 111 |
|
| 112 |
// Rows
|
| 113 |
$currY = $tableY + 30;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
if (isset($data['allocations']) && is_array($data['allocations'])) {
|
| 115 |
foreach ($data['allocations'] as $alloc) {
|
| 116 |
$desc = $alloc['description'];
|
| 117 |
-
$
|
| 118 |
-
$
|
| 119 |
-
$
|
| 120 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
$currY += 30;
|
| 123 |
|
|
@@ -140,9 +161,15 @@ class ReceiptGenerator
|
|
| 140 |
$currY += 30;
|
| 141 |
|
| 142 |
$totalPaid = number_format($data['total_paid'] ?? 0, 2);
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
-
// Show
|
|
|
|
| 145 |
$this->rightAlignText($image, 10, $cols[3] - 20, $currY, $totalPaid, $grey);
|
|
|
|
|
|
|
| 146 |
|
| 147 |
imageline($image, 40, $currY + 10, $width - 40, $currY + 10, $black);
|
| 148 |
|
|
|
|
| 62 |
}
|
| 63 |
}
|
| 64 |
|
| 65 |
+
// School Name Logic
|
| 66 |
+
$schoolName = "ACE JUNIOR COLLEGE";
|
| 67 |
+
$levelName = isset($data['level_name']) ? strtoupper($data['level_name']) : '';
|
| 68 |
+
// Check for Senior classes (SSS 1, SSS 2, SSS 3, or Senior)
|
| 69 |
+
if (strpos($levelName, 'SSS') !== false || strpos($levelName, 'SENIOR') !== false) {
|
| 70 |
+
$schoolName = "ACE SENIOR COLLEGE";
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
// Header
|
| 74 |
+
$this->centerText($image, 18, 50, $schoolName, $black);
|
| 75 |
$this->centerText($image, 10, 75, "...education for excellence", $grey);
|
| 76 |
$this->centerText($image, 10, 100, "1, Ebute - Igbogbo Road, Ipakodo, Ikorodu, Lagos, Nigeria", $black);
|
| 77 |
$this->centerText($image, 10, 120, "Phone No(s): 08027449739, 08077275777", $black);
|
|
|
|
| 119 |
|
| 120 |
// Rows
|
| 121 |
$currY = $tableY + 30;
|
| 122 |
+
$totalBilled = 0;
|
| 123 |
+
$totalPaidToDate = 0;
|
| 124 |
+
$totalBalance = 0;
|
| 125 |
+
|
| 126 |
if (isset($data['allocations']) && is_array($data['allocations'])) {
|
| 127 |
foreach ($data['allocations'] as $alloc) {
|
| 128 |
$desc = $alloc['description'];
|
| 129 |
+
$billedVal = $alloc['amount_billed'] ?? 0;
|
| 130 |
+
$paidVal = $alloc['amount'] ?? 0;
|
| 131 |
+
$paidToDateVal = $alloc['total_paid_to_date'] ?? 0;
|
| 132 |
+
$balanceVal = $alloc['balance'] ?? 0;
|
| 133 |
+
|
| 134 |
+
$totalBilled += $billedVal;
|
| 135 |
+
$totalPaidToDate += $paidToDateVal;
|
| 136 |
+
$totalBalance += $balanceVal;
|
| 137 |
+
|
| 138 |
+
$billed = number_format($billedVal, 2);
|
| 139 |
+
$paid = number_format($paidVal, 2);
|
| 140 |
+
$paidToDate = number_format($paidToDateVal, 2);
|
| 141 |
+
$balance = number_format($balanceVal, 2);
|
| 142 |
|
| 143 |
$currY += 30;
|
| 144 |
|
|
|
|
| 161 |
$currY += 30;
|
| 162 |
|
| 163 |
$totalPaid = number_format($data['total_paid'] ?? 0, 2);
|
| 164 |
+
$totalBilledStr = number_format($totalBilled, 2);
|
| 165 |
+
$totalPaidToDateStr = number_format($totalPaidToDate, 2);
|
| 166 |
+
$totalBalanceStr = number_format($totalBalance, 2);
|
| 167 |
|
| 168 |
+
// Show all totals
|
| 169 |
+
$this->rightAlignText($image, 10, $cols[2] - 20, $currY, $totalBilledStr, $grey);
|
| 170 |
$this->rightAlignText($image, 10, $cols[3] - 20, $currY, $totalPaid, $grey);
|
| 171 |
+
$this->rightAlignText($image, 10, $cols[4] - 20, $currY, $totalPaidToDateStr, $grey);
|
| 172 |
+
$this->rightAlignText($image, 10, $width - 40, $currY, $totalBalanceStr, $grey);
|
| 173 |
|
| 174 |
imageline($image, 40, $currY + 10, $width - 40, $currY + 10, $black);
|
| 175 |
|