LPA-Health-V2.0 - Health LPA Final

This commit is contained in:
Flatlogic Bot 2026-03-01 21:55:10 +00:00
parent 280bdd329b
commit 1593cab59c
6 changed files with 364 additions and 15 deletions

View File

@ -0,0 +1,251 @@
<?php
ob_start();
require_once __DIR__ . '/../db/config.php';
session_start();
require_once __DIR__ . '/../fpdf/fpdf.php';
if (!isset($_SESSION["user_id"]))
{
die('Authentication required. Please log in again.');
}
$user_id = $_SESSION["user_id"];
$lpa_id = isset($_GET['id']) ? (int)$_GET['id'] : null;
if (!$lpa_id)
{
die('LPA ID is required.');
}
// Fetch LPA data
$stmt = db()->prepare("SELECT * FROM lpa_applications WHERE id = ?");
$stmt->execute([$lpa_id]);
$lpa_data = $stmt->fetch();
if (!$lpa_data)
{
die('LPA not found.');
}
// Authorization check
if ((int)$lpa_data['user_id'] !== (int)$user_id && ($_SESSION['user_role'] ?? '') !== 'Super User') {
die('Unauthorized access.');
}
// Fetch attorneys
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'primary' ORDER BY id ASC");
$stmt->execute([$lpa_id]);
$primary_attorneys = $stmt->fetchAll();
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'replacement' ORDER BY id ASC");
$stmt->execute([$lpa_id]);
$replacement_attorneys = $stmt->fetchAll();
// Fetch notified persons
$stmt = db()->prepare("SELECT * FROM lpa_notified_persons WHERE application_id = ? ORDER BY id ASC");
$stmt->execute([$lpa_id]);
$notified_persons = $stmt->fetchAll();
$lpa_type = $lpa_data['lpa_type'] ?? 'Health & Welfare';
$is_hw = ($lpa_type === 'Health & Welfare');
class OfficialLPAPDF extends FPDF {
public $lpa_title = '';
function Header() {
$this->SetFont('Helvetica', 'B', 14);
$this->Cell(0, 10, $this->lpa_title, 0, 1, 'C');
$this->Ln(5);
}
function Footer() {
$this->SetY(-15);
$this->SetFont('Helvetica', 'I', 8);
$this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb} - LPA Ref: ' . $this->lpa_id, 0, 0, 'C');
}
function SectionHeader($title) {
$this->SetFont('Helvetica', 'B', 12);
$this->SetFillColor(200, 200, 200);
$this->Cell(0, 10, $title, 0, 1, 'L', true);
$this->Ln(2);
}
function FieldBox($label, $value, $h = 10) {
$this->SetFont('Helvetica', 'B', 9);
$this->Cell(40, $h, $label . ':', 1, 0, 'L');
$this->SetFont('Helvetica', '', 9);
$this->Cell(0, $h, $value, 1, 1, 'L');
}
}
$pdf = new OfficialLPAPDF();
$pdf->lpa_id = $lpa_id;
$pdf->lpa_title = $lpa_type . ' Lasting Power of Attorney ' . ($is_hw ? '(LP1H)' : '(LP1F)');
$pdf->AliasNbPages();
$pdf->AddPage();
// Section 1: The Donor
$pdf->SectionHeader('Section 1: The Donor');
$pdf->FieldBox('Full Name', $lpa_data['donor_name']);
$pdf->FieldBox('Other Names', $lpa_data['other_names']);
$pdf->FieldBox('Date of Birth', $lpa_data['donor_dob']);
$pdf->FieldBox('Email', $lpa_data['customer_email']);
$donor_addr = $lpa_data['donor_address_line1'] . (empty($lpa_data['donor_address_line2']) ? '' : ', ' . $lpa_data['donor_address_line2']) . ', ' . $lpa_data['donor_town'] . ', ' . $lpa_data['donor_postcode'];
$pdf->FieldBox('Address', $donor_addr);
$pdf->Ln(5);
// Section 2: The Attorneys
$pdf->SectionHeader('Section 2: The Attorneys');
$main_attorneys = array_slice($primary_attorneys, 0, 5);
$continuation_attorneys = array_slice($primary_attorneys, 5);
foreach ($main_attorneys as $idx => $att) {
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Attorney ' . ($idx + 1), 0, 1);
$pdf->FieldBox('Name', $name);
$pdf->FieldBox('Date of Birth', $att['dob']);
$pdf->FieldBox('Email', $att['email']);
$addr = $att['address_line1'] . (empty($att['address_line2']) ? '' : ', ' . $att['address_line2']) . ', ' . $att['town'] . ', ' . $att['postcode'];
$pdf->FieldBox('Address', $addr);
$pdf->Ln(2);
}
$pdf->Ln(5);
// Section 3: How should the attorneys make decisions?
$pdf->SectionHeader('Section 3: How should the attorneys make decisions?');
$pdf->FieldBox('Decision Type', $lpa_data['attorney_decision_type']);
$pdf->Ln(5);
// Section 4: Replacement Attorneys
$pdf->SectionHeader('Section 4: Replacement Attorneys');
$main_replacements = array_slice($replacement_attorneys, 0, 2);
$continuation_replacements = array_slice($replacement_attorneys, 2);
foreach ($main_replacements as $idx => $att) {
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Replacement Attorney ' . ($idx + 1), 0, 1);
$pdf->FieldBox('Name', $name);
$addr = $att['address_line1'] . (empty($att['address_line2']) ? '' : ', ' . $att['town'] . ', ' . $att['postcode']);
$pdf->FieldBox('Address', $addr);
$pdf->Ln(2);
}
$pdf->Ln(5);
// Section 5: Difference by type
if ($is_hw) {
$pdf->SectionHeader('Section 5: Life-Sustaining Treatment');
$pdf->FieldBox('Option Selected', $lpa_data['life_sustaining_treatment']);
} else {
$pdf->SectionHeader('Section 5: When can the attorneys make decisions?');
$pdf->FieldBox('Option Selected', $lpa_data['life_sustaining_treatment'] ?? 'Not specified');
}
$pdf->Ln(5);
// Section 6: People to Notify
$pdf->SectionHeader('Section 6: People to Notify');
foreach ($notified_persons as $idx => $np) {
if ($idx >= 5) break; // Main form usually has space for 5
$pdf->FieldBox('Person ' . ($idx + 1), $np['first_name'] . ' ' . $np['last_name'] . ' (' . $np['postcode'] . ')');
}
$pdf->Ln(5);
// Section 7: Preferences and Instructions
$pdf->SectionHeader('Section 7: Preferences and Instructions');
if (!function_exists('count_lines')) {
function count_lines($text) {
if (empty($text)) return 0;
return substr_count($text, "\n") + 1;
}
}
$pref_lines = count_lines($lpa_data['preferences']);
$instr_lines = count_lines($lpa_data['instructions']);
$pref_on_main = $lpa_data['preferences'];
$instr_on_main = $lpa_data['instructions'];
$pref_continuation = '';
$instr_continuation = '';
if (strlen($lpa_data['preferences']) > 800 || $pref_lines > 9) {
$pref_on_main = "See Continuation Sheet LPC";
$pref_continuation = $lpa_data['preferences'];
}
if (strlen($lpa_data['instructions']) > 800 || $instr_lines > 9) {
$instr_on_main = "See Continuation Sheet LPC";
$instr_continuation = $lpa_data['instructions'];
}
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Preferences', 0, 1);
$pdf->SetFont('Helvetica', '', 9);
$pdf->MultiCell(0, 6, $pref_on_main, 1, 'L');
$pdf->Ln(2);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Instructions', 0, 1);
$pdf->SetFont('Helvetica', '', 9);
$pdf->MultiCell(0, 6, $instr_on_main, 1, 'L');
$pdf->Ln(5);
// Section 8-10: Signatures and Certificate Provider (Skipped/Simplified for now as per Summary)
$pdf->SectionHeader('Section 8-10: Signatures & Certificate Provider');
$pdf->FieldBox('Certificate Provider', $lpa_data['certificate_provider_first_name'] . ' ' . $lpa_data['certificate_provider_last_name']);
$pdf->Ln(10);
// CONTINUATION SHEETS
if (!empty($continuation_attorneys) || !empty($continuation_replacements) || !empty($pref_continuation) || !empty($instr_continuation)) {
$pdf->AddPage();
$pdf->SetFont('Helvetica', 'B', 16);
$pdf->Cell(0, 10, 'Continuation Sheet LPC', 0, 1, 'C');
$pdf->Ln(10);
if (!empty($continuation_attorneys)) {
$pdf->SectionHeader('Section 2 (Continued): More Attorneys');
foreach ($continuation_attorneys as $idx => $att) {
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Attorney ' . ($idx + 6), 0, 1);
$pdf->FieldBox('Name', $name);
$pdf->FieldBox('Date of Birth', $att['dob']);
$pdf->FieldBox('Email', $att['email']);
$addr = $att['address_line1'] . (empty($att['address_line2']) ? '' : ', ' . $att['address_line2']) . ', ' . $att['town'] . ', ' . $att['postcode'];
$pdf->FieldBox('Address', $addr);
$pdf->Ln(2);
}
}
if (!empty($continuation_replacements)) {
$pdf->SectionHeader('Section 4 (Continued): More Replacement Attorneys');
foreach ($continuation_replacements as $idx => $att) {
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(0, 8, 'Replacement Attorney ' . ($idx + 3), 0, 1);
$pdf->FieldBox('Name', $name);
$addr = $att['address_line1'] . (empty($att['address_line2']) ? '' : ', ' . $att['town'] . ', ' . $att['postcode']);
$pdf->FieldBox('Address', $addr);
$pdf->Ln(2);
}
}
if (!empty($pref_continuation)) {
$pdf->SectionHeader('Section 7 (Continued): Preferences');
$pdf->SetFont('Helvetica', '', 9);
$pdf->MultiCell(0, 6, $pref_continuation, 1, 'L');
$pdf->Ln(5);
}
if (!empty($instr_continuation)) {
$pdf->SectionHeader('Section 7 (Continued): Instructions');
$pdf->SetFont('Helvetica', '', 9);
$pdf->MultiCell(0, 6, $instr_continuation, 1, 'L');
$pdf->Ln(5);
}
}
$filename = 'LPA_Official_Form_' . str_replace(' ', '_', ($lpa_data['donor_name'] ?? 'Form')) . '_' . date('Ymd') . '.pdf';
$pdf->Output('D', $filename);

View File

@ -1,10 +1,12 @@
<?php
session_start();
ob_start();
require_once __DIR__ . '/../db/config.php';
session_start();
require_once __DIR__ . '/../fpdf/fpdf.php';
if (!isset($_SESSION["user_id"])) {
die('Authentication required.');
if (!isset($_SESSION["user_id"]))
{
die('Authentication required. Please log in again.');
}
$user_id = $_SESSION["user_id"];
@ -24,7 +26,7 @@ if (!$lpa_data) {
}
// Authorization check
if ($lpa_data['user_id'] != $user_id && ($_SESSION['user_role'] ?? '') !== 'Super User') {
if ((int)$lpa_data['user_id'] !== (int)$user_id && ($_SESSION['user_role'] ?? '') !== 'Super User') {
die('Unauthorized access.');
}
@ -43,9 +45,11 @@ $stmt->execute([$lpa_id]);
$notified_persons = $stmt->fetchAll();
class LPAPDF extends FPDF {
public $lpa_type_title = 'Lasting Power of Attorney';
function Header() {
$this->SetFont('Helvetica', 'B', 15);
$this->Cell(0, 10, 'Health and Welfare Lasting Power of Attorney', 0, 1, 'C');
$this->Cell(0, 10, $this->lpa_type_title, 0, 1, 'C');
$this->SetFont('Helvetica', 'I', 9);
$this->Cell(0, 5, 'Summary Draft (Not a registered legal document)', 0, 1, 'C');
$this->Ln(10);
@ -73,6 +77,7 @@ class LPAPDF extends FPDF {
}
$pdf = new LPAPDF();
$pdf->lpa_type_title = ($lpa_data['lpa_type'] ?? 'Health and Welfare') . ' Lasting Power of Attorney';
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAutoPageBreak(true, 15);
@ -141,9 +146,14 @@ if (empty($replacement_attorneys)) {
}
$pdf->Ln(5);
// 5. Life Sustaining
$pdf->SectionTitle('5. Life-Sustaining Treatment');
$pdf->Field('Option', $lpa_data['life_sustaining_treatment']);
// 5. Section 5 varies by type
if (($lpa_data['lpa_type'] ?? '') === 'Property & Financial') {
$pdf->SectionTitle('5. When can the attorneys make decisions?');
$pdf->Field('Option', $lpa_data['life_sustaining_treatment'] ?? 'Not specified'); // Reusing field for simplicity if needed
} else {
$pdf->SectionTitle('5. Life-Sustaining Treatment');
$pdf->Field('Option', $lpa_data['life_sustaining_treatment']);
}
$pdf->Ln(5);
// 6. Witness Information

View File

@ -236,6 +236,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
exit;
}
// Check if max 3 replacement attorneys reached
$count_stmt = db()->prepare("SELECT count(*) FROM lpa_attorneys WHERE lpa_id = ? AND type = 'replacement'");
$count_stmt->execute([$lpa_id]);
if ((int)$count_stmt->fetchColumn() >= 3) {
echo json_encode(['success' => false, 'error' => 'A maximum of 3 replacement attorneys is allowed.']);
exit;
}
$stmt = db()->prepare("INSERT INTO lpa_attorneys (lpa_id, type, title, first_name, last_name, email, dob, address_line1, address_line2, address_line3, town, postcode) VALUES (?, 'replacement', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->execute([$lpa_id, $title, $first_name, $last_name, $email, $dob, $address1, $address2, $address3, $town, $postcode]);

View File

@ -110,7 +110,7 @@ foreach ($notified_persons as $np) {
"postcode" => $np["postcode"]
];
}
session_write_close();
?>
<!DOCTYPE html>
<html lang="en">
@ -292,6 +292,18 @@ foreach ($notified_persons as $np) {
</div>
<?php endif; ?>
<?php if (count($attorneys) > 5): ?>
<div class="alert alert-info py-3 px-4 mb-4">
<div class="d-flex align-items-center">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-3 text-primary"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>
<div>
<div class="fw-bold">Additional Attorneys Noted</div>
<div class="small text-muted">You have added more than 5 attorneys. Any attorneys beyond the first 5 will be moved to a Continuation Sheet LPC in the official form.</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="card bg-light border-0 p-4 mb-4">
<h3 class="h6 fw-bold mb-4">Add an Attorney</h3>
<form id="lpaFormStep2" class="lpa-form" method="POST" action="api/save_lpa.php">
@ -464,7 +476,19 @@ foreach ($notified_persons as $np) {
</div>
<?php endif; ?>
<div class="card bg-light border-0 p-4 mb-4">
<?php if (count($replacement_attorneys) >= 3): ?>
<div class="alert alert-info py-3 px-4 mb-4">
<div class="d-flex align-items-center">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-3 text-primary"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>
<div>
<div class="fw-bold">Maximum Replacement Attorneys Reached</div>
<div class="small text-muted">You have added the maximum allowed (3) replacement attorneys. If you need more, please use a Continuation Sheet LPC manually.</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="card bg-light border-0 p-4 mb-4 <?php echo (count($replacement_attorneys) >= 3) ? "d-none" : ""; ?>">
<h3 class="h6 fw-bold mb-4">Add a Replacement Attorney</h3>
<form id="lpaFormStep4" class="lpa-form" method="POST" action="api/save_lpa.php">
<input type="hidden" name="step" value="4">
@ -719,6 +743,14 @@ foreach ($notified_persons as $np) {
<p class="mb-2">Your attorneys dont have to follow your preferences but they should keep them in mind. For examples of preferences, see the Guide, part A7.</p>
<p class="mb-3 text-muted small">Preferences use words like prefer and would like</p>
<textarea class="form-control" name="preferences" rows="6" placeholder="Enter your preferences here..."><?php echo htmlspecialchars($lpa_data['preferences'] ?? ''); ?></textarea>
<div class="d-flex justify-content-between mt-1">
<small class="text-muted"><span id="pref_char_count">0</span> / 800 characters</small>
<small class="text-muted"><span id="pref_line_count">0</span> / 9 lines</small>
</div>
<div id="pref_warning" class="alert alert-info py-2 px-3 mt-2 small d-none">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>
Exceeding limits will move this section to a Continuation Sheet (LPC).
</div>
</div>
<div class="mb-5">
@ -727,6 +759,14 @@ foreach ($notified_persons as $np) {
<p class="mb-2 text-danger small fw-semibold">Be careful if you give instructions that are not legally correct they would have to be removed before your LPA could be registered.</p>
<p class="mb-3 text-muted small">Instructions use words like must and have to</p>
<textarea class="form-control" name="instructions" rows="6" placeholder="Enter your instructions here..."><?php echo htmlspecialchars($lpa_data['instructions'] ?? ''); ?></textarea>
<div class="d-flex justify-content-between mt-1">
<small class="text-muted"><span id="instr_char_count">0</span> / 800 characters</small>
<small class="text-muted"><span id="instr_line_count">0</span> / 9 lines</small>
</div>
<div id="instr_warning" class="alert alert-info py-2 px-3 mt-2 small d-none">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>
Exceeding limits will move this section to a Continuation Sheet (LPC).
</div>
</div>
<div class="mt-5 mb-5 pt-4 border-top d-flex justify-content-between align-items-center">
@ -807,7 +847,7 @@ foreach ($notified_persons as $np) {
</option>
<?php endforeach; ?>
<option value="new" <?php echo ($attorney['witness_first_name'] && !empty($attorney['witness_address_line1']) && empty($selected)) ? 'selected' : ''; ?>>Enter a new witness...</option>
<option value="later" <?php echo (empty($attorney['witness_first_name']) && !empty($attorney['witness_postcode']) === false && empty($selected) && !empty($attorney['id'])) ? '' : ''; ?>>I will add witness details manually later</option>
<option value="later">I will add witness details manually later</option>
</select>
</div>
@ -1073,7 +1113,7 @@ foreach ($notified_persons as $np) {
<div class="mt-5 mb-5 pt-4 border-top d-flex justify-content-between align-items-center">
<a href="apply.php?step=11&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 11</a>
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 13</button>
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 12</button>
</div>
</form>
<?php elseif ($step === 13): ?>
@ -1451,7 +1491,8 @@ foreach ($notified_persons as $np) {
<div class="mt-5 mb-5 pt-4 border-top d-flex justify-content-between align-items-center">
<a href="apply.php?step=13&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 13</a>
<div class="d-flex gap-2">
<a href="api/generate_pdf.php?id=<?php echo $lpa_id; ?>" target="_blank" class="btn btn-outline-primary btn-lg px-4">Download Summary PDF</a>
<a href="/api/generate_pdf.php?id=<?php echo $lpa_id; ?>" class="btn btn-outline-primary btn-lg px-4 me-2">Download Summary PDF</a>
<a href="/api/generate_official_pdf.php?id=<?php echo $lpa_id; ?>" class="btn btn-primary btn-lg px-4">Download Official Form</a>
<button type="submit" class="btn btn-success btn-lg px-5">Confirm & Submit Application</button>
</div>
</div>

View File

@ -222,4 +222,43 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
});
});
// Preferences and Instructions counters
function updateTextCounters(textarea, charCountId, lineCountId, warningId) {
const text = textarea.value;
const charCount = text.length;
const lineCount = text === "" ? 0 : text.split('\n').length;
const charCountEl = document.getElementById(charCountId);
const lineCountEl = document.getElementById(lineCountId);
const warningEl = document.getElementById(warningId);
if (charCountEl) charCountEl.innerText = charCount;
if (lineCountEl) lineCountEl.innerText = lineCount;
if (warningEl) {
if (charCount > 800 || lineCount > 9) {
warningEl.classList.remove('d-none');
if (charCountEl) charCountEl.classList.add('text-danger');
if (lineCountEl) lineCountEl.classList.add('text-danger');
} else {
warningEl.classList.add('d-none');
if (charCountEl) charCountEl.classList.remove('text-danger');
if (lineCountEl) lineCountEl.classList.remove('text-danger');
}
}
}
const prefTextarea = document.querySelector('textarea[name="preferences"]');
const instrTextarea = document.querySelector('textarea[name="instructions"]');
if (prefTextarea) {
prefTextarea.addEventListener('input', () => updateTextCounters(prefTextarea, 'pref_char_count', 'pref_line_count', 'pref_warning'));
updateTextCounters(prefTextarea, 'pref_char_count', 'pref_line_count', 'pref_warning');
}
if (instrTextarea) {
instrTextarea.addEventListener('input', () => updateTextCounters(instrTextarea, 'instr_char_count', 'instr_line_count', 'instr_warning'));
updateTextCounters(instrTextarea, 'instr_char_count', 'instr_line_count', 'instr_warning');
}
});

View File

@ -143,7 +143,7 @@ try {
$next_step = ($lpa['step_reached'] < 14) ? $lpa['step_reached'] + 1 : 14;
?>
<a href="/apply.php?step=<?php echo $next_step; ?>&id=<?php echo $lpa['id']; ?>" class="btn btn-sm btn-outline-secondary px-3 rounded-pill">Continue</a>
<a href="api/generate_pdf.php?id=<?php echo $lpa['id']; ?>" class="btn btn-sm btn-outline-primary px-3 ms-2 rounded-pill">Download PDF</a>
<a href="/api/generate_pdf.php?id=<?php echo $lpa['id']; ?>" class="btn btn-sm btn-outline-primary px-3 ms-2 rounded-pill">Download PDF</a>
</td>
</tr>
<?php endforeach; ?>