BBnepal-Accounts/application/views/inventory/list-expenses.php

436 lines
22 KiB
PHP
Raw Permalink Normal View History

2024-07-10 12:43:19 +00:00
<div class="wraper responsive-width">
<main class="long-tbl-main students_list_table" id="main">
<?php
$currency_symbol = $school_info['currency_symbol'];
?>
<div class="from-group adding-class form-group_lng " style="width: 95%;">
<a href="<?= base_url() ?>admin/addExpeses/0"><button type="button" class="btn btn-outline-primary btn-sm">Add Expenses</button></a>
</div>
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<form method="post" action="<?php echo base_url(); ?>admin/listExpeses">
<div class="subsec_sec">
<div class="subject_r">
<div class="subject_lsec">
<div class="subject_lhead">Expenses List</div>
<!-- tab added -->
<div class="top-filter mb-0 mt-4" style="display: block;">
<div class="row">
<div class="col-md-3 pr-0">
<div class="form-group mb-0 pr-1">
<label class="has-float-label">
<select id="course" class="form-control custom-select" placeholder="Select Expense Type" name="filter-expense-type">
<option value=" "> Select Expense Type</option>
<?php if (isset($expenses_types) || !empty($expenses_types)) {
foreach ($expenses_types as $row) { ?>
<option value="<?php echo $row['expenseId'] ?>" <?php echo set_select('filter-expense-type', $row['expenseId'], (!empty($s_expense_type) ? TRUE : FALSE)); ?>>
<?php echo $row['expenseTitle']; ?></option>
<?php }
} ?>
</select>
<span>Expense Type</span>
</label>
</div>
</div>
<div class="col-md-3 pr-0 pl-2">
<div class="form-group mb-0">
<div class="date-fil-row">
<!-- <label>Start date</label> -->
<label class="has-float-label">
<input type="text" id="start_date" name="filter-Sdate" class=" form-control nepal-date" placeholder='dd-mm-yyyy' value="<?php echo (!empty($sdate)) ? $sdate : ''; ?>" <?php echo set_select('filter-Sdate', (!empty($sdate)) ? $sdate : '', (!empty($sdate) ? TRUE : FALSE)); ?>>
<span>Start Date</span>
</label>
</div>
<div class="text-danger cierr"><?php echo form_error('filter-Sdate'); ?></div>
</div>
</div>
<div class="col-md-3 pr-0 pl-0">
<div class="form-group mb-0">
<div class="date-fil-row">
<!-- <label>End date</label> -->
<label class="has-float-label">
<input type="text" id="end_date" name="filter-Edate" class="form-control nepal-date" placeholder='dd-mm-yyyy' value="<?php echo (!empty($edate)) ? $edate : ''; ?>" <?php echo set_select('filter-Edate', (!empty($edate)) ? $edate : '', (!empty($edate) ? TRUE : FALSE)); ?>>
<span>End Date</span>
</label>
</div>
<div class="text-danger cierr"><?php echo form_error('filter-Edate'); ?></div>
</div>
</div>
<div class="col-md-3 pr-0 pl-0">
<div class="row d-flex justify-content-center pl-2">
<input type="submit" name="filterSubmit" id="filter_reset" class="btn btn-outline-success w-100 col-md-6" value="Filter">
<a class="col-md-6 pl-0 pr-0 row d-flex justify-content-center" href="<?php echo base_url() ?>admin/listExpeses">
<button type="button" name="reset_filter" id="reset_filter" value="reset_filter" class="subject_addbtn p-0 subject_addbtn_nobg ml-4"><i class="fas fa-redo"></i>Reset</button>
</a>
</div>
</div>
</div>
</div>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if ($this->session->flashdata('danger')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('danger') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<hr>
<div class="applicnts-list-wrap ">
<div class="">
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th>Sl.No</th>
<th>Title</th>
<th>Type</th>
<th>Paid Date</th>
<th class="noExport">View File </th>
<th>Description </th>
<th>Quantity</th>
<th>Amount</th>
<th>Total Amount</th>
<th class="noExport">Action </th>
</tr>
</thead>
<tbody>
<?php if ($expenses_data) {
foreach ($expenses_data as $key => $value) { ?>
<tr>
<td><?php echo $key + 1; ?></td>
<td><?php echo $value['title']; ?></td>
<td>
<?php
foreach ($expenses_types as $e_type) {
if ($value['expense_type'] == $e_type['expenseId']) {
if ($value['expense_s_type'] != '') {
echo $e_type['expenseTitle'] . ' <label class="text-small text-muted">(' . ucwords($value['expense_s_type']) . ')</label>';
} else {
echo $e_type['expenseTitle'];
}
}
}
?>
</td>
<td><?php echo $value['paid_date']; ?> </td>
<td><?php if (!empty($value['file_path'])) { ?>
<div class="sub_viewbtn" title="edit" onclick="view_image('<?php echo base_url($value['file_path']); ?>')">
<i class="fa fa-image"></i>
</div>
<?php } else {
echo '-';
} ?>
</td>
<td><?php echo substr($value['description'], 0, 20) . '-'; ?></td>
<td><?php echo $value['quantity']; ?></td>
<td><?php echo $value['amount']; ?></td>
<td><?php echo $value['total_amount']; ?></td>
<td>
<div class="sub_tabbtnsec stud_tabbtnsec">
<div class="sub_viewbtn" data-toggle="tooltip" title="edit">
<a href="<?= base_url() ?>admin/addExpeses/<?php echo $value['id'] ?>">
<i class="fas fa-pencil-alt"></i>
</a>
</div>
<div class="sub_delbtn" data-toggle="tooltip" title="Remove">
<a data-toggle="modal" onclick="examdel(<?php echo $value['id']; ?>)" href="#deleteModal">
<i class="fas fa-trash-alt"></i>
</a>
</div>
</div>
</td>
</tr>
<?php }
} ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th> </th>
<th></th>
<th></th>
<th style="font-size:13px;" class="text-center"> In <?= $currency_symbol; ?></th>
<th style="font-size:13px" class="text-center"></th>
<th style="font-size:13px;" class="text-center"></th>
<th style="font-size:13px;" class="text-center"></th>
<th></th>
<!-- <th></th> -->
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- admin template section end -->
<div class="viewDoc delete-modal-wrap">
<div class="modal fade" id="deleteModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div class="delete-modal">
<i class="far fa-times-circle"></i>
<input type="hidden" id="thid" />
<h4>Are you sure?</h4>
<p>Are you sure you want to delete this Expenses?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#thid').val());">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal " id="imageModal" role="dialog" style="padding-top: 100px !important;">
<!-- Modal Content (The Image) -->
<img class="modal-content_img" id="get_image">
</div>
</main>
<!--End right-top side-->
<style type="text/css">
/* The Modal (background) */
.imageModal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 4;
/* Sit on top */
padding-top: 100px !important;
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.9);
/* Black w/ opacity */
}
/* Modal Content (Image) */
.modal-content_img {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
/* Add Animation - Zoom in the Modal */
.modal-content_img {
animation-name: zoom;
animation-duration: 0.6s;
}
@keyframes zoom {
from {
transform: scale(0)
}
to {
transform: scale(1)
}
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px) {
.modal-content_img {
width: 100%;
}
}
</style>
</div>
<?php
$theExportHeader = 'Expense List';
?>
<script>
function examdel(icn) {
$('#thid').val(icn);
}
$(document).ready(function() {
var currency_symbol = "<?php echo $currency_symbol; ?>";
var jsTheExportHeader = '<?php echo $theExportHeader; ?>';
$('.user-drpdown').click(function() {
$('.drpdown-items').toggle();
});
//table js
$('#tbl1').DataTable({
"lengthMenu": [
[-1],
["All"]
],
"bLengthChange": false,
"dom": 'lBfrtip',
"buttons": [{
extend: 'pdfHtml5',
title: 'Student List',
orientation: 'landscape',
exportOptions: {
columns: [1, 2, 3, 4, 5, 6, 7, 8]
}
},
{
extend: 'excelHtml5',
header: true,
footer: true,
title: jsTheExportHeader,
exportOptions: {
columns: "thead th:not(.noExport)",
rows: function(indx, rowData, domElement) {
return $(domElement).css("display") != "none";
}
},
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
$('row c[r^="C"]', sheet).attr('s', '2');
}
}
],
"footerCallback": function(row, data, start, end, display) {
for (let td_count = 7; td_count <= 8; td_count++) {
var api = this.api(),
data;
// Remove the formatting to get integer data for summation
var intVal = function(i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
total = api
.column(td_count)
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
// Total over this page
pageTotal = api
.column(td_count, {
page: 'current'
})
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(td_count).footer()).html(
//currency_symbol + ' ' + pageTotal + ' ( ' + currency_symbol + ' ' + total + ' total )'
pageTotal
);
}
}
});
//table js end
/* Select your element */
let NDate = NepaliFunctions.GetCurrentBsDate();
let todayDate = `${NDate.year}-${NDate.month}-${NDate.day}`;
/* Initialize Datepicker with options */
$('#start_date').nepaliDatePicker({
disableAfter: todayDate,
language: 'english',
});
$('#end_date').nepaliDatePicker({
disableAfter: todayDate,
language: 'english',
});
// nepali date end
});
</script>
<script type="text/javascript">
function deletedata(id) {
let url = window.location.pathname.split('/');
let postUrl = url[1] + '/' + url[2];
// console.log('admin/delete-section/'+postUrl + id);
window.location.replace('<?php echo base_url() ?>' + 'admin/delete_expenses/' + id);
}
function view_image(documentPath) {
var src1 = documentPath;
$("#get_image").attr("src", src1);
$("#imageModal").modal('show');
}
</script>