Files
alrahma_sunday_school/app/Views/invoice_payment/pdf_template.php
T
2026-02-10 22:11:06 -05:00

77 lines
2.8 KiB
PHP

<?php
require_once APPPATH . 'ThirdParty/fpdf/fpdf.php';
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
$this->Image('images/logo.png', 10, 8, 33); // Adjust the path to the logo image
$this->SetFont('Arial', 'B', 16);
$this->Cell(0, 10, 'Al Rahma Sunday School Invoice', 0, 1, 'C');
$this->Ln(5);
}
// Page footer
function Footer()
{
$this->SetY(-15);
$this->SetFont('Arial', 'I', 8);
$this->Cell(0, 10, 'Page ' . $this->PageNo(), 0, 0, 'C');
}
// Parent Details Table
function ParentDetails($parent)
{
$this->SetFont('Arial', 'B', 12);
$this->Cell(0, 10, 'Parent Details', 0, 1, 'L');
$this->SetFont('Arial', '', 12);
$this->Cell(40, 10, 'First Name:', 0, 0, 'L');
$this->Cell(0, 10, $parent['firstparent_firstname'], 0, 1, 'L');
$this->Cell(40, 10, 'Last Name:', 0, 0, 'L');
$this->Cell(0, 10, $parent['firstparent_lastname'], 0, 1, 'L');
$this->Cell(40, 10, 'Email:', 0, 0, 'L');
$this->Cell(0, 10, $parent['firstparent_email'], 0, 1, 'L');
$this->Cell(40, 10, 'Phone:', 0, 0, 'L');
$this->Cell(0, 10, $parent['firstparent_phone'], 0, 1, 'L');
$this->Ln(10); // Add some space between sections
}
// Students Details Table
function StudentsDetails($students)
{
$this->SetFont('Arial', 'B', 12);
$this->Cell(0, 10, 'Students Details', 0, 1, 'L');
$this->SetFont('Arial', '', 12);
$this->Cell(60, 10, 'First Name', 1, 0, 'C');
$this->Cell(60, 10, 'Last Name', 1, 0, 'C');
$this->Cell(60, 10, 'Enrollment Status', 1, 1, 'C');
foreach ($students as $student) {
$this->Cell(60, 10, $student['student_firstname'], 1, 0, 'C');
$this->Cell(60, 10, $student['student_lastname'], 1, 0, 'C');
$this->Cell(60, 10, $student['enrolled'] ? 'enrolled' : 'withdrawn', 1, 1, 'C');
}
$this->Ln(10);
}
// Summary Table
function Summary($invoice)
{
$this->SetFont('Arial', 'B', 12);
$this->Cell(0, 10, 'Invoice Summary', 0, 1, 'L');
$this->SetFont('Arial', '', 12);
$this->Cell(90, 10, 'Total Amount', 1, 0, 'L');
$this->Cell(0, 10, number_format($invoice['total_amount'], 2) . ' USD', 1, 1, 'R');
$this->Cell(90, 10, 'Refund Amount', 1, 0, 'L');
$this->Cell(0, 10, number_format($invoice['refund_amount'], 2) . ' USD', 1, 1, 'R');
$this->Cell(90, 10, 'Net Amount', 1, 0, 'L');
$this->Cell(0, 10, number_format($invoice['total_amountAfter_refund'], 2) . ' USD', 1, 1, 'R');
$this->Cell(90, 10, 'Status', 1, 0, 'L');
$this->Cell(0, 10, ucfirst($invoice['status']), 1, 1, 'R');
$this->Ln(10);
}
}