ria/app/Views/report_pendingreqst.php
2025-04-23 19:12:08 +05:30

391 lines
10 KiB
PHP
Executable File

<script>
$(document).ready(function() {
$("#client_name").select2();
$("#item_name").select2();
$("#purchaseorder_number").select2();
});
</script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
table {
width: auto;
}
.dataTables_filter input {
padding: 4px;
}
.dataTables_filter {
/* width: 50%; */
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
/* float: right; */
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Reports</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Requisation</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title"><b> Pending </b></h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<!-- <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> -->
<div class="card-body">
<form method="post" action="<?php echo base_url('reportpending'); ?>">
<div class="row form-group has-feedback">
<div class="col-md-3">
<label for="to_date">
<?php echo 'Year'; ?>
</label>
<div class="input-group">
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach ($finyear as $item): {; ?>
<option
<?php echo (isset($givenYear) && $item->financial_year == $givenYear) ? "selected" : ""; ?>
value="<?php echo $item->financial_year; ?>">
<?php echo $item->financial_year; ?>
</option>
<?php }
endforeach; ?>
</select>
</div>
</div>
<div class="col-md-3">
<label for="to_date">
<?php echo 'Month'; ?>
</label>
<div class="input-group">
<select class="form-control" id="month" name="month">
<?php $monthArray = [
'January',
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
] ?>
<option value="">Select Month</option>
<?php foreach ($monthArray as $month): ?>
<option value="<?= $month ?>" <?php if (isset($givenMonth) && $givenMonth == $month) {
echo 'selected';
} ?>>
<?= $month ?>
</option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="col-md-3">
<label for="Aging_From">
<?php echo 'Aging From'; ?>
</label>
<div class="input-group">
<input name="aging_from" id="aging_from" style="padding:4px;" class="form-control">
</span>
</div>
</div>
<div class="col-md-3">
<label for="Aging_To">
<?php echo 'Aging To'; ?>
</label>
<div class="input-group">
<input name="aging_to" id="aging_to" style="padding:4px;" class="form-control">
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<label for="from_date">
<?php echo 'From Date'; ?>
</label>
<div class="input-group">
<input name="from_date" id="max-date" class="form-control datepicker"
value="<?php echo isset($givenFrm) ? $givenFrm : "" ?>">
</div>
</div>
<div class="col-md-3">
<label for="to_date">
<?php echo 'To Date'; ?>
</label>
<div class="input-group">
<input name="to_date" id="min-date" class="form-control datepicker"
value="<?php echo isset($givenTo) ? $givenTo : "" ?>">
</div>
</div>
<div class="col-md-6 text-right"><br>
<input type="button" class="btn btn-danger m-2" value="Reset" onclick="window.location.href='<?= base_url('reportpending') ?>';">
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report">
</div>
</div>
</form>
<table id="cc" class="table table-bordered table-hover wrap" style="background-color:#fff;width: 100% !important;">
<!-- <table class="table table-bordered table-hover" id="asset_list_table" style="background-color:#fff;font-size:12px;"> -->
<thead>
<tr>
<th>Requistion Date</th>
<th>Requistion Number</th>
<th>Requested By</th>
<th>Department</th>
<th>Requistion Type</th>
<th>Aging</th>
</tr>
</thead>
<tbody>
<?php if (!empty($pending_list)) {
foreach ($pending_list as $lis) {
?>
<tr>
<!-- <td><span><?php //$date = new DateTime($lis->ReqDate);echo $date->format('d-m-Y');
?></span></td>-->
<td><span><?php echo $lis->ReqDate ?></span></td>
<td><span><?php echo $lis->ReqNo ?></span></td>
<td><span><?php echo $lis->Requestedby ?></span></td>
<td><span><?php echo $lis->DepartmentName ?></span></td>
<td><span><?php echo $lis->ReqType ?></span></td>
<td align="right"><span><?php echo $lis->Aging ?></span></td>
</tr>
<?php
}
}
?>
</tbody>
<tfoot width="100%">
</tfoot>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
// Initialize the DataTable with only pagination enabled
var table = $('#cc').DataTable({
dom: 'Blfrtip',
buttons: [
{
extend: 'excel',
text: 'Excel',
}
],
paging: true, // Enable pagination
searching: true, // Disable search
ordering: false, // Disable column sorting
info: false, // Disable table information
lengthChange: false, // Disable page length options
pageLength: 10, // Default rows per page
responsive: true, // Keep responsive design
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
});
$(function() {
//var dateFormat = "mm/dd/yy",
from = $("#min-date")
.datepicker({
format: "mm/dd/yyyy",
defaultDate: "+0d",
changeMonth: true,
orientation: "bottom"
//numberOfMonths: 1
})
.on("change", function() {
to.datepicker("option", "minDate", getDate(this));
}),
to = $("#max-date").datepicker({
defaultDate: "+0d",
changeMonth: true,
orientation: "bottom"
//numberOfMonths: 1
})
.on("change", function() {
from.datepicker("option", "maxDate", getDate(this));
});
function getDate(element) {
var date;
try {
date = $.datepicker.parseDate(dateFormat, element.value);
} catch (error) {
date = null;
}
return date;
}
});
//$('.input-daterange').each(function() {
// $(this).datepicker('clearDates');
//});
// Extend dataTables search
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var min = (moment($('#min-date').val(), "DD/MM/YYYY").isValid()) ? ~~moment($('#min-date').val(), "DD/MM/YYYY").format("X") : null;
var max = (moment($('#max-date').val(), "DD/MM/YYYY").isValid()) ? ~~moment($('#max-date').val(), "DD/MM/YYYY").format("X") : null;
var ReqDate = ~~moment(data[0], "DD/MM/YYYY").format("X"); // Our date column in the table
// alert(min);
if (min == null && max == null) {
return true;
}
if (min == null && ReqDate <= max) {
return true;
}
if (max == null && ReqDate >= min) {
return true;
}
if (ReqDate <= max && ReqDate >= min) {
return true;
}
return false;
}
);
// Re-draw the table when the a date range filter changes
$('#min-date, #max-date').change(function() {
table.draw();
});
$('#my-table_filter').hide();
//total order value range
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var min = parseInt($('#min').val(), 10);
var max = parseInt($('#max').val(), 10);
var Aging = parseFloat(data[5]) || 0;
if ((isNaN(min) && isNaN(max)) ||
(isNaN(min) && Aging <= max) ||
(min <= Aging && isNaN(max)) ||
(min <= Aging && Aging <= max)) {
return true;
}
return false;
}
);
$(document).ready(function() {
//var table = $('#qdetails').DataTable();
// Event listener to the two range filtering inputs to redraw on input
$('#min, #max').keyup(function() {
table.draw();
});
});
//for clear button
function Reset() {
$('#min').val('');
$('#max').val('');
$('#min-date').val('');
$('#max-date').val('');
$('#financialyear').val('');
}
</script>