222 lines
15 KiB
PHP
Executable File
222 lines
15 KiB
PHP
Executable File
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="float-right">
|
|
<!-- Add a "Print Addresses" button -->
|
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#printAddressesModal">Print Addresses</button>
|
|
<a href="<?= base_url() . "new_subscription_invoice/0"; ?>" class="btn btn-primary"><i class="ri-shield-user-line"></i> Add Subscription</a>
|
|
</div><!-- end col-->
|
|
<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_subcription" class="table w-100 nowrap">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th hidden></th>
|
|
<th>Invoice Date</th>
|
|
<th>Member Name</th>
|
|
<th>Member's Mobile</th>
|
|
<th>From Subscription</th>
|
|
<th>To Subscription</th>
|
|
<th>Expiring Status</th>
|
|
<th>Short-Code</th>
|
|
<th>Invoice Number</th>
|
|
<th>Total (₹) </th>
|
|
<th>Status</th>
|
|
<th align="center" id="action-column">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($invoice as $row) :
|
|
$invoice_date = date('d/m/Y', strtotime($row['invoice_date']));
|
|
$from_date = date('d/m/Y', strtotime($row['from_subscription']));
|
|
$to_date = date('d/m/Y', strtotime($row['to_subscription']));
|
|
|
|
// Calculate days remaining
|
|
// if ($currentDate < $fromDateTime) {
|
|
// $interval = $fromDateTime->diff($toDateTime);
|
|
// } else {
|
|
// $interval = $currentDate->diff($toDateTime);
|
|
// }
|
|
|
|
$fromDateTime = new DateTime($row['from_subscription']);
|
|
$toDateTime = new DateTime($row['to_subscription']);
|
|
$currentDate = new DateTime();
|
|
$currentDate->setTime(0, 0, 0);
|
|
$toDateTime->setTime(0, 0, 0);
|
|
|
|
// Calculate days remaining
|
|
$interval = $currentDate->diff($toDateTime);
|
|
$daysRemaining = $interval->days;
|
|
if ($currentDate > $toDateTime) {
|
|
$daysRemaining = -$daysRemaining;
|
|
}
|
|
if ($daysRemaining < 0) {
|
|
$class = 'text-danger';
|
|
$message = "Expired" . ($row['renewed'] != null ? " " . '(Renewed)' : '');
|
|
} elseif ($daysRemaining == 0) {
|
|
$class = 'text-danger';
|
|
$message = "Expires Today" . ($row['renewed'] != null ? " " . '(Renewed)' : '');
|
|
} elseif ($daysRemaining == 1) {
|
|
$class = 'text-warning';
|
|
$message = "Expires Tomorrow" . ($row['renewed'] != null ? " " . '(Renewed)' : '');
|
|
} elseif ($daysRemaining <= 7) {
|
|
$class = 'text-warning';
|
|
$message = "Expires in $daysRemaining days". ($row['renewed'] != null ? " " . '(Renewed)' : '');
|
|
} else {
|
|
$class = 'text-success';
|
|
$message = "Expires in $daysRemaining days". ($row['renewed'] != null ? " " . '(Renewed)' : '');
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td hidden><?= $row['invoice_date'] ?></td>
|
|
<td data-order="<?= strtotime($row['invoice_date']); ?>"><?= $invoice_date; ?></td>
|
|
<td data-order="<?= $row['customer_name']; ?>"><?= $row['customer_name']; ?></td>
|
|
<td data-order="<?= $row['mobile_no']; ?>"><?= $row['mobile_no']; ?></td>
|
|
<td data-order="<?= strtotime($row['from_subscription']); ?>"><?= $from_date; ?></td>
|
|
<td data-order="<?= strtotime($row['to_subscription']); ?>"><?= $to_date; ?></td>
|
|
<td data-order="<?= $message; ?>"><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
|
<td data-order="<?= $row['scheme_code']; ?>"><?= $row['scheme_code']; ?></td>
|
|
<td data-order="<?= $row['invoice_number']; ?>"><?= $row['invoice_number']; ?></td>
|
|
<td style="text-align: end;" data-order="<?= $row['total_amount']; ?>"><?=$row['total_amount']; ?></td>
|
|
<td data-order="<?= $row['status']; ?>"><?= $row['status']; ?></td>
|
|
<td>
|
|
<a href="<?= base_url() . "new_subscription_invoice/" . $row['invoice_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['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
|
<a style="display: none;" href="<?= base_url("print_address_/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
|
<a href="<?= base_url("print_address_landscape/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-fill"></i></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- Scheme List Modal -->
|
|
<!-- Create a modal for scheme selection -->
|
|
<div class="modal fade" id="printAddressesModal" tabindex="-1" role="dialog" aria-labelledby="printAddressesModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="printAddressesModalLabel">Select Schemes to Print Addresses</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<!-- Create a form to select schemes and download details -->
|
|
<!-- ... Inside the modal in subscriber_list.php ... -->
|
|
|
|
<form action="<?= base_url('subscription/download_details'); ?>" method="post">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<?php
|
|
// $uniqueSchemes = [];
|
|
// foreach ($subscriber as $scheme) :
|
|
// if (!in_array($scheme['title'], $uniqueSchemes)) {
|
|
// $uniqueSchemes[] = $scheme['title'];
|
|
//log_message('info',json_encode($membershipbooks));
|
|
if (!empty($membershipbooks)) :
|
|
if(!empty($active_schemes)):
|
|
foreach ($membershipbooks as $scheme) :
|
|
foreach($active_schemes as $active):
|
|
if ($scheme->short_code == $active['short_code']):
|
|
?>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="selected_schemes[]" value="<?= $scheme->book_ids; ?>"checked>
|
|
<label class="form-check-label"><?= $scheme->short_code; ?></label>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
endforeach;
|
|
endforeach;
|
|
endif;
|
|
endif;
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="form-group">
|
|
<label>Select Subscription Type:</label>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="download_type" id="activeOption" value="active" checked>
|
|
<label class="form-check-label" for="activeOption">Active Membership Customer</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="download_type" id="expiredOption" value="expired">
|
|
<label class="form-check-label" for="expiredOption">Expired Membership Customer</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="download_type" id="bothOption" value="both">
|
|
<label class="form-check-label" for="bothOption">Both</label>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label class="form-check-label">Select Action:</label>
|
|
<div style="display:none" class="form-check">
|
|
<input class="form-check-input" type="radio" name="action" value="1">
|
|
<label class="form-check-label">1</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="action" value="2" checked>
|
|
<label class="form-check-label">2 x 4(A4)</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div style="text-align: end;margin-top: 2rem;"> <!-- Adjust the margin as needed -->
|
|
<button type="submit" class="btn btn-primary">Download Details</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div> <!-- end card body-->
|
|
</div> <!-- end card -->
|
|
</div><!-- end col-->
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
var actionColumnIndex = $('#action-column').index();
|
|
$('#scroll-horizontal-datatable_subcription').DataTable({
|
|
"order": [ [0, "desc"] ],
|
|
"columnDefs": [{ "targets": [actionColumnIndex], "orderable": false }]
|
|
});
|
|
});
|
|
</script>
|