ria/app/Views/Report_pending_purchase.php
2024-10-14 17:32:30 +05:30

488 lines
15 KiB
PHP
Executable File

<script>
$(document).ready(function() {
$("#client_name").select2();
$("#item_name").select2();
});
</script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
th {
/* width: auto !important; */
}
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-6">
<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);">Purchase</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Purchase Order</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title"><b> Pending Purchase Order </b><br><br><?php echo $headline ?></h4>
</li>
</ol>
</div>
</div>
</div>
<div class="col-6 text-right">
</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("Report_pending_purchase"); ?>">
<div class="form-group">
<div class="row">
<div class="col-4">
<label for="client_name">
<?php echo 'Supplier'; ?>
</label>
<select class="form-control" id="client_name" name="client_name">
<option value="">Select Supplier</option>
<?php
foreach ($cust as $item): { ?>
<option value="<?php echo $item->SupplierName; ?>"><?php echo $item->SupplierName; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-4">
<label for="client_name">
<?php echo 'Material'; ?>
</label>
<select class="form-control" id="item_name" name="item_name">
<option value="">Select Material</option>
<?php
foreach ($material as $it): { ?>
<option value="<?php echo $it->MaterialName; ?>"><?php echo $it->MaterialName; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-2">
<label for="to_date">
<?php echo 'Year'; ?>
</label>
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach ($finyear as $item): { ?>
<option value="<?php echo $item->financial_year; ?>"><?php echo $item->financial_year; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-2">
<label for="to_date">
<?php echo 'Month'; ?>
</label>
<div class="input-group">
<select class="form-control" id="month" name="month">
<option value="">Select Month</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<label for="from_date">
<?php echo 'From Date'; ?>
</label>
<div class="input-group">
<input name="from_date" id="max-date" class="form-control datepicker">
</div>
</div>
<div class="col-4">
<label for="to_date">
<?php echo 'To Date'; ?>
</label>
<div class="input-group">
<input name="to_date" id="min-date" class="form-control datepicker">
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-2 text-right"><br>
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report">
</div>
</div>
</div>
<div class="form-group has-feedback">
</div>
<!-- </form> -->
<!-- <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></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 style="text-align:center, width:10%">PO Date</th>
<th style="text-align:center, width:14%">PO No</th>
<th style="text-align:center, width:15%">Supplier Name</th>
<th style="text-align:center, width:17%">Material Name</th>
<th style="text-align:center, width:10%">Category</th>
<th style="text-align:center, width:9%">Ordered Quantity</th>
<th style="text-align:center, width:9%">Received Quantity</th>
<th style="text-align:center, width:10%">Pending Quantity</th>
</tr>
</thead>
<tbody>
<?php if (!empty($ppurchse)) {
$mvt = 0.00;
$yqt = 0.00;
$yvt = 0.00;
foreach ($ppurchse as $rel) {
$cat = $rel->category;
?>
<tr>
<!-- <td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php //echo $rel->sid;
?>&ab=<?php //echo $ab;
?>&mid=<?php //echo $rel->mid;
?>"><?php //echo $rel->supplier_name;
?></a>
</span></td>-->
<td><span>
<?php echo $rel->pdate; ?>
</span></td>
<td><span>
<?php echo $rel->po; ?>
</span></td>
<td><span>
<?php echo $rel->supplier; ?>
</span></td>
<td><span>
<?php echo $rel->material; ?>
</span></td>
<td><span>
<?php echo $rel->category; ?>
</span></td>
<td style="text-align:right"><span><?php
$mvt = $mvt + round($rel->quantity);
?>
<?php echo round($rel->quantity); ?>
</span></td>
<td style="text-align:right"><span><?php
$yqt = $yqt + round($rel->received);
?>
<?php echo round($rel->received); ?>
</span></td>
<td style="text-align:right"><span><?php
$yvt = $yvt + round($rel->pending);
?>
<?php echo round($rel->pending); ?>
</span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right">
<strong>
<?php {
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo $mvt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo $yqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo $yvt;
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</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() {
// $.fn.dataTable.moment('DD-MM-YYYY');
// table = $('#cc').DataTable({
// "language": {
// "emptyTable": "<center> Data Not Found ! </center>"
// },
// "aaSorting": [
// [0, "desc"]
// ],
// "pageLength": 10,
// "lengthMenu": [10, 25, 50, 100],
// "autoWidth": false,
// orderCellsTop: true,
// "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
// "<'row'<'col-md-6'><'col-md-6'>>" +
// "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
// buttons: [
// // {
// // extend: 'excelHtml5',
// // footer: 'true',
// // //messageTop: $('h3').text(),
// // title: $('h3').text(),
// // exportOptions: {
// // columns: ':visible'
// // }
// // },
// 'colvis'
// ],
// "footerCallback": function(row, data, start, end, display) {
// var api = this.api(),
// data;
// // Remove the formatting to get integer data for summation
// var intVal = function(i) {
// return typeof i === 'string' ?
// parseFloat(i.replace(/[^0-9]+/g, "") * 1) :
// typeof i === 'number' ?
// parseFloat(i) : 0;
// };
// TotalOrderedQTY = api
// .column(5, {
// search: 'applied'
// })
// .data()
// .reduce(function(a, b) {
// return intVal(a) + intVal(b);
// }, 0);
// $(api.column(5).footer()).html(TotalOrderedQTY.toFixed().bold());
// TotalRcvdQTY = api
// .column(6, {
// search: 'applied'
// })
// .data()
// .reduce(function(a, b) {
// return intVal(a) + intVal(b);
// }, 0);
// $(api.column(6).footer()).html(TotalRcvdQTY.toFixed().bold());
// TotalPendingQTY = api
// .column(7, {
// search: 'applied'
// })
// .data()
// .reduce(function(a, b) {
// return intVal(a) + intVal(b);
// }, 0);
// $(api.column(7).footer()).html(TotalPendingQTY.toFixed().bold());
// }
// });
// Initialize the DataTable
var table = $('#cc').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [
[0, 'desc']
], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
});
$('#mySelect').on('change', function() {
table
.column(4)
.search(this.value)
.draw();
});
$(function() {
var dateFormat = 'dd-mm-yyyy';
// Initialize min-date (Start Date)
var from = $("#min-date").datepicker({
format: dateFormat,
autoclose: true,
todayHighlight: true,
clearBtn: true,
orientation: 'bottom'
}).on('changeDate', function(e) {
// When a date is selected in #min-date, update the minDate option for #max-date
// to.datepicker('setStartDate', e.date);
});
// Initialize max-date (End Date)
var to = $("#max-date").datepicker({
format: dateFormat,
// startDate: new Date(), // Start date cannot be in the past
autoclose: true,
todayHighlight: true,
clearBtn: true,
orientation: 'bottom'
}).on('changeDate', function(e) {
// When a date is selected in #max-date, update the endDate option for #min-date
from.datepicker('setStartDate', e.date);
});
});
</script>