317 lines
15 KiB
PHP
Executable File
317 lines
15 KiB
PHP
Executable File
<style>
|
|
.Date-filter-form {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
/* Adjust the gap as needed */
|
|
}
|
|
|
|
.Date-filter-form input,
|
|
.Date-filter-form button {
|
|
padding: 5px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.Date-filter-form button {
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.Date-filter-form button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
.icon-button {
|
|
background: none;
|
|
border: none;
|
|
cursor: pointer;
|
|
color: #007bff;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.icon-button:hover {
|
|
color: #0056b3;
|
|
}
|
|
|
|
th,
|
|
td {
|
|
white-space: nowrap;
|
|
}
|
|
</style>
|
|
<style>
|
|
.dataTables_wrapper .top {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
|
|
</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);">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">Purchase Order List</h4>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div> <?php
|
|
helper('form');
|
|
$error = session()->getFlashdata('error');
|
|
if ($error) {
|
|
$type = "error";
|
|
echo show_alert($type, $error);
|
|
}
|
|
$success = session()->getFlashdata('success');
|
|
if ($success) {
|
|
$type = "success";
|
|
echo show_alert($type, $success);
|
|
}
|
|
?>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('purchaseorderListing'); ?>">
|
|
|
|
<label for="fromDate">From:</label>
|
|
<input class="form-control date_range form-date-search"
|
|
value="<?= $fromDate?>"
|
|
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
|
|
|
|
<label for="toDate">To:</label>
|
|
<input class="form-control date_range to-date-search"
|
|
value="<?= $toDate ?>"
|
|
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"
|
|
style="cursor:pointer;"
|
|
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
|
|
|
|
|
<div class="error" id="error"></div>
|
|
</form>
|
|
<div class="card-body" style="overflow-x:scroll;">
|
|
<table id="po_list" class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Created Date</th>
|
|
<th>PONO#</th>
|
|
<th>PO Type</th>
|
|
<th>Supplier Name</th>
|
|
<th style="text-align: right !important;">Total Order Value</th>
|
|
<th>PO Status</th>
|
|
<th>Delivery Option</th>
|
|
<th>Delivery Date</th>
|
|
<th>Delivery Schedule</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="poListTableBodyId">
|
|
<?php
|
|
if (!empty($POData)) {
|
|
$index = 0;
|
|
foreach ($POData as $record) {
|
|
$index = $index + 1;
|
|
?>
|
|
<tr id="<?php echo $index; ?>">
|
|
<td><?php $Pdt = new DateTime($record->CreatedDate);
|
|
$PODate = $Pdt->format('d-m-Y');
|
|
echo $PODate
|
|
?></td>
|
|
<td><?php echo $record->PONO ?></td>
|
|
<td><?php echo $record->ReqType ?></td>
|
|
|
|
<td><?php echo $record->SupplierName ?></td>
|
|
<td align="right"><?php echo $record->TotalOrderValue ?></td>
|
|
|
|
<!-- <td><?php echo $record->StatusName ?></td> -->
|
|
<td><?php
|
|
$statusMappings = [
|
|
'PO APPROVED' => 'AWAITING APPROVE',
|
|
'AWAITING RELEASE' => 'AWAITING APPROVE',
|
|
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
|
|
'PO RELEASED' => 'PO APPROVED',
|
|
];
|
|
|
|
if (isset($record->StatusName) && !empty($record->StatusName)) {
|
|
if (isset($statusMappings[$record->StatusName])) {
|
|
echo $statusMappings[$record->StatusName];
|
|
} else {
|
|
echo $record->StatusName;
|
|
}
|
|
} else {
|
|
echo "Status not provided";
|
|
}
|
|
?></td>
|
|
<td><?php $option = 'By Deliver Date';
|
|
if ($record->DeliveryOption == 1) {
|
|
$option = "By Schedule";
|
|
} else if ($record->DeliveryOption == 2) {
|
|
$option = "By Dispatch Instruction";
|
|
}
|
|
echo $option ?></td>
|
|
<td><?php
|
|
if ($record->DeliveryOption == 0) {
|
|
$Ddt = new DateTime($record->DeliveryDate);
|
|
$Deliverydt = $Ddt->format('d-m-Y');
|
|
echo $Deliverydt;
|
|
} else if ($record->DeliveryOption == 1) {
|
|
$Deliverydt = '';
|
|
echo $Deliverydt;
|
|
} ?></td>
|
|
<td><?php echo $record->DeliverySchedule ?></td>
|
|
|
|
<?php $statusCode = $record->StatusCode;
|
|
|
|
if ($statusCode == PO_DRAFT || $statusCode == PO_CREATED) {
|
|
|
|
|
|
|
|
?>
|
|
|
|
<td>
|
|
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
|
|
<a data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit Purchase Order details"
|
|
href="<?php echo base_url() . 'EditPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType. '&CapitalRange=' . $record->CapitalRange; ?>">
|
|
<i class="fa fa-pencil-alt" data-toggle="tooltip"> </i>
|
|
|
|
</a>
|
|
<?php } ?>
|
|
</td>
|
|
<?php
|
|
} else if ($statusCode == PO_AMENDED ) { ?>
|
|
<td>
|
|
<a data-toggle="tooltip" href="<?php echo base_url() . 'EditPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType. '&CapitalRange=' . $record->CapitalRange; ?>">
|
|
<i class="fa fa-eye" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Amendment Purchase Order details"></i>
|
|
|
|
</a>
|
|
</td>
|
|
<?php } else { ?>
|
|
<td>
|
|
|
|
|
|
|
|
<a data-toggle="tooltip" href="<?php echo base_url() . 'EditPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType
|
|
. '&CapitalRange=' . $record->CapitalRange; ?>"><i class="fa fa-eye" data-toggle="tooltip"
|
|
title="<?php echo $record->PONO; ?> - Click here to view Purchase Order details"></i>
|
|
</a>
|
|
|
|
|
|
<a data-toggle="tooltip" href="<?php echo base_url() . 'purchaseorder/CreatePOPrint?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType; ?>"
|
|
target="new"><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->PONO; ?>
|
|
- Click here to Print the Purchase Order details"></i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
<?php
|
|
} ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div> <!-- end card body-->
|
|
</div> <!-- end card -->
|
|
</div><!-- end col-->
|
|
</div>
|
|
</div>
|
|
</div> <!-- container -->
|
|
</div> <!-- content -->
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
|
|
// Initialize the DataTable
|
|
var table = $('#po_list').DataTable({
|
|
dom: 'Blfrtip',
|
|
buttons: [
|
|
{
|
|
extend: 'excel',
|
|
text: 'Excel',
|
|
exportOptions: {
|
|
columns: ':not(:last-child)' // Exclude the last column
|
|
}
|
|
}
|
|
],
|
|
pageLength: 10,
|
|
lengthMenu: [
|
|
[10, 20, 30, 50, -1],
|
|
[10, 20, 30, 50, "All"]
|
|
],
|
|
responsive: false,
|
|
ordering: false,
|
|
language: {
|
|
paginate: {
|
|
next: '<i class="fas fa-angle-right"></i>', // Next button icon
|
|
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
// Reset button functionality
|
|
$("#resetButton").click(function() {
|
|
$("#fromDate").val('');
|
|
$("#toDate").val('');
|
|
window.location='purchaseorderListing'
|
|
});
|
|
|
|
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#fromDate , #toDate').change(function() {
|
|
|
|
let fromDate = $('#fromDate').val();
|
|
let toDate = $('#toDate').val();
|
|
|
|
let fromDateObj = new Date(fromDate.split('-').reverse().join('-'));
|
|
let toDateObj = new Date(toDate.split('-').reverse().join('-'));
|
|
if (fromDateObj > toDateObj) {
|
|
alert('Incorrect Date Applied For Filter..!!');
|
|
$('#toDate').attr('min', fromDate);
|
|
$('#toDate').val('');
|
|
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|