Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
pokeloken
/
collections
:
index.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php require_once('/home/leadltht/fastlinkinternet.com/administrator/data-provider/config.php'); // Ensure the correct path to config.php if ($_settings->chk_flashdata('success')): ?> <script> alert_toast("<?php echo $_settings->flashdata('success') ?>",'success') </script> <?php endif; ?> <div class="card card-outline card-primary"> <div class="card-header"> <h3 class="card-title">List of Collections</h3> <div class="card-tools"> <a href="javascript:void(0)" id="create_new" class="btn btn-flat btn-primary"><span class="fas fa-plus"></span> Add New</a> </div> </div> <div class="card-body"> <div class="container-fluid"> <div class="container-fluid"> <?php if ($_settings->userdata('type') == 1): // Check if the user is an admin ?> <table class="table table-bordered table-stripped"> <colgroup> <col width="5%"> <col width="10%"> <col width="15%"> <col width="5%"> <col width="8%"> <col width="10%"> <col width="8%"> <col width="10%"> <col width="10%"> <col width="8%"> <col width="15%"> <col width="15%"> </colgroup> <thead> <tr class="bg-gradient-secondary"> <th>#</th> <th>Payment Date</th> <th>Payment Name</th> <th>Amount</th> <th>Discounted Amount</th> <th>Discount Reason</th> <th>Payment Method</th> <th>Client</th> <th>Receipt</th> <th>Collected By</th> <th>Note</th> <th>Action</th> </tr> </thead> <tbody> <?php $i = 1; $qry = $conn->query("SELECT c.*, CONCAT(m.firstname, ' ', COALESCE(m.middlename,''), ' ', m.lastname) as fullname from collection_list c inner join member_list m on c.member_id = m.id order by date(c.date_collected) desc, CONCAT(m.firstname, ' ', COALESCE(m.middlename,''), ' ', m.lastname) asc "); while($row = $qry->fetch_assoc()): ?> <tr> <td class="text-center"><?php echo $i++; ?></td> <td><?php echo date("Y-m-d",strtotime($row['date_collected'])) ?></td> <td><?php echo ucwords($row['name_of_payment']) ?></td> <td class="text-right"><?php echo format_num($row['total_amount']) ?></td> <td class="text-right"><?php echo format_num($row['discount_amount']) ?></td> <td><?php echo ucwords($row['discount_reason']) ?></td> <td><?php echo ucwords($row['collection_method']) ?></td> <td> <div><?php echo ucwords($row['fullname']) ?></div> </td> <td><?php echo ucwords($row['receipt']) ?></td> <td><?php echo ucwords($row['collected_by']) ?></td> <td><?php echo htmlspecialchars($row['note']) ?></td> <td align="center"> <button type="button" class="btn btn-flat btn-default btn-sm dropdown-toggle dropdown-icon" data-toggle="dropdown"> Action <span class="sr-only">Toggle Dropdown</span> </button> <div class="dropdown-menu" role="menu"> <a class="dropdown-item view_data" href="javascript:void(0)" data-id="<?= $row['id'] ?>"><span class="fa fa-eye text-dark"></span> View</a> <div class="dropdown-divider"></div> <a class="dropdown-item edit_data" href="javascript:void(0)" data-id="<?php echo $row['id'] ?>"><span class="fa fa-edit text-primary"></span> Edit</a> <div class="dropdown-divider"></div> <a class="dropdown-item delete_data" href="javascript:void(0)" data-id="<?php echo $row['id'] ?>"><span class="fa fa-trash text-danger"></span> Delete</a> </div> </td> </tr> <?php endwhile; ?> </tbody> </table> <?php endif; // End of admin check ?> </div> </div> </div> </div> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.css"> <!-- Include jQuery and DataTables JS --> <script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script> <script> $(document).ready(function(){ $('#create_new').click(function(){ uni_modal('Add New Collection',"collections/manage_collection.php","large") }) $('.view_data').click(function(){ uni_modal('View Collection Details',"collections/view_collection.php?id="+$(this).attr('data-id'),"mid-large") }) $('.edit_data').click(function(){ uni_modal('Update Collection Details',"collections/manage_collection.php?id="+$(this).attr('data-id'),"large") }) $('.delete_data').click(function(){ _conf("Are you sure to delete this Collection permanently?","delete_collection",[$(this).attr('data-id')]) }) $('table th, table td').addClass('align-middle px-2 py-1') // Initialize DataTables $('.table').DataTable({ "pageLength": 10, // Default number of entries to show "lengthMenu": [50, 100], // Options for 'Show entries' dropdown "searching": true // Enable the search bar }); }); function delete_collection(id){ start_loader(); $.ajax({ url: _base_url_ + "classes/Master.php?f=delete_collection", method: "POST", data: { id: id }, dataType: "json", error: err => { console.log(err); alert_toast("An error occurred.", 'error'); end_loader(); }, success: function(resp) { if (typeof resp === 'object' && resp.status === 'success') { location.reload(); } else { alert_toast("An error occurred.", 'error'); end_loader(); } } }); } </script>