107 lines
5.8 KiB
PHP
107 lines
5.8 KiB
PHP
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="float-right">
|
|
<a href="<?= base_url() . "new_receipt/0"; ?>" class="btn btn-primary"><i class="ri-currency-line"></i> Add Receipt </a>
|
|
</div>
|
|
<br>
|
|
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
|
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
|
|
<?php if (session()->getFlashdata('success')) : ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<?= session('success') ?>
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (session()->getFlashdata('error')) : ?>
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<?= session('error') ?>
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<div class="table-responsive">
|
|
<table id="scroll-horizontal-datatable_wrapper" class="table w-100 nowrap">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th hidden></th>
|
|
<th align="center" >Receipt Number</th>
|
|
<th align="center" >Receipt Date</th>
|
|
<th align="center" >Donor Name</th>
|
|
<th align="center" >Amount</th>
|
|
<th align="center">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($receipt as $row) :
|
|
?>
|
|
<tr>
|
|
<td hidden><?= $row['receipt_id']; ?></td>
|
|
<td><?= $row['receipt_number']; ?></td>
|
|
<td><?= date("d-m-Y", strtotime($row['receipt_date'])); ?> </td>
|
|
<td >
|
|
<?php foreach ($Donors as $DonorData) : ?>
|
|
<?= $row['doner_id'] === $DonorData->doner_id ? $DonorData->first_name . $DonorData->last_name : ''; ?>
|
|
<?php endforeach; ?>
|
|
</td>
|
|
<td><?= $row['amount']; ?></td>
|
|
<td>
|
|
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>
|
|
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div> <!-- end card body-->
|
|
</div> <!-- end card -->
|
|
</div><!-- end col-->
|
|
</div><!-- end row-->
|
|
<!-- <script>
|
|
function openPdfInNewTab(pdfUrl) {
|
|
window.open(pdfUrl, '_blank');
|
|
}
|
|
</script> -->
|
|
<!-- <script>
|
|
$(document).ready(function() {
|
|
$("#addNewButton").click(function() {
|
|
// Show the pop-up modal
|
|
$("#invoiceTypeModal").modal("show");
|
|
});
|
|
|
|
$("#confirmInvoiceType").click(function() {
|
|
// Get the selected invoice type
|
|
var selectedType = $("input[name='invoiceType']:checked").val();
|
|
|
|
// Redirect the user to the appropriate form based on the selected type
|
|
if (selectedType === "subscription") {
|
|
// Redirect to the subscription invoice form
|
|
window.location.href = "<?= base_url('new_subscription_invoice/0'); ?>"; // Update the URL as needed
|
|
} else if (selectedType === "book") {
|
|
// Redirect to the book invoice form
|
|
window.location.href = "<?= base_url('new_receipt/0'); ?>"; // Update the URL as needed
|
|
}
|
|
});
|
|
|
|
// Close the modal when the close button is clicked
|
|
$("#invoiceTypeModal .close").click(function() {
|
|
$("#invoiceTypeModal").modal("hide");
|
|
});
|
|
});
|
|
</script> -->
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#scroll-horizontal-datatable_wrapper').DataTable({
|
|
"order": [
|
|
[0, "desc"]
|
|
] // 4 is the column index of "created_on" in your table
|
|
// Other DataTables configuration options
|
|
});
|
|
});
|
|
</script>
|