228 lines
9.7 KiB
PHP
228 lines
9.7 KiB
PHP
<style>
|
||
.pagination {
|
||
margin: 0px !important;
|
||
}
|
||
</style>
|
||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
|
||
<!-- Latest DataTables Buttons CSS -->
|
||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.3.4/css/buttons.dataTables.min.css">
|
||
<style>
|
||
.dataTables_wrapper .dataTables_length select {
|
||
background-color:white !important;
|
||
}
|
||
.dataTables_wrapper .dataTables_filter input {
|
||
background-color: white !important;
|
||
}
|
||
button.dt-button, div.dt-button, a.dt-button, input.dt-button {
|
||
background-color: white !important;
|
||
}
|
||
.dataTables_length, label{
|
||
display: flex !important;
|
||
}
|
||
.dataTables_wrapper .dataTables_filter {
|
||
text-align: center;
|
||
}
|
||
.dataTables_wrapper .dataTables_length {
|
||
float: left;
|
||
}
|
||
.dataTables_wrapper .dt-buttons {
|
||
float: right;
|
||
}
|
||
.dataTables_wrapper .clear {
|
||
clear: both;
|
||
}
|
||
th, td {
|
||
white-space: nowrap;
|
||
}
|
||
.dataTables_wrapper {
|
||
width: 100%;
|
||
overflow-x: auto;
|
||
}
|
||
</style>
|
||
<div class="content-wrapper">
|
||
<!-- Content Header (Page header) -->
|
||
|
||
<!-- Main content -->
|
||
<section class="content">
|
||
<div class="row">
|
||
<div class="col-xs-12">
|
||
<div class="box">
|
||
<div class="box-header">
|
||
<center>
|
||
<h3 class="box-title"> Purchase Order List</h3>
|
||
</center>
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?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-md-12">
|
||
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
|
||
?> </div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body">
|
||
<table id="dataTableHistoriek" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
|
||
<thead style="background-color: #ddd;">
|
||
<tr>
|
||
<th style="display:none;"></th>
|
||
<th>PO Date</th>
|
||
<th>PONO#</th>
|
||
<th>PO Type</th>
|
||
<th>Supplier Name</th>
|
||
<th>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><?php
|
||
if (!empty($POData)) {
|
||
$index = 0;
|
||
foreach ($POData as $record) {
|
||
$index = $index + 1;
|
||
?>
|
||
<tr id="<?php echo $index; ?>">
|
||
<td style="display:none;"><?php echo $record->PODate ?></th>
|
||
<td align="right"><?php $Pdt = new DateTime($record->PODate);
|
||
$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 align="right"><?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> <a data-toggle="tooltip" href="<?php echo base_url() . 'EditPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType . '&CapitalRange=' . $record->CapitalRange; ?>"><i class="fa fa-pencil" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit 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>
|
||
<!-- /.box-body -->
|
||
</div>
|
||
<!-- /.box -->
|
||
|
||
</div>
|
||
<!-- /.col -->
|
||
</div>
|
||
<!-- /.row -->
|
||
</section>
|
||
<!-- /.content -->
|
||
</div>
|
||
<!-- /.content-wrapper -->
|
||
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
|
||
<!-- Latest DataTables JS -->
|
||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||
<!-- Latest DataTables Buttons JS -->
|
||
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
|
||
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>
|
||
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
|
||
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
|
||
|
||
<script>
|
||
$(function () {
|
||
$.fn.dataTable.moment('DD-MM-YYYY');
|
||
$('#dataTableHistoriek').DataTable({
|
||
"paging": true,
|
||
"lengthChange": true,
|
||
"scrollCollapse": true,
|
||
"searching": true,
|
||
"ordering": true,
|
||
"info": true,
|
||
"scrollX": true,
|
||
"autoWidth": true,
|
||
"pageLength": 10,
|
||
"order": [[0, "desc"]], // Assuming the "Created Date" is the first column and you want to order by it in descending order
|
||
"dom": '<"top"lBf>rt<"bottom"ip><"clear">', // Custom layout
|
||
"buttons": [
|
||
{
|
||
extend: 'excelHtml5',
|
||
text: 'Export to Excel',
|
||
title: 'Purchase Order',
|
||
exportOptions: {
|
||
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
|
||
}
|
||
},
|
||
{
|
||
extend: 'pdfHtml5',
|
||
text: 'Export to PDF',
|
||
title: 'Purchase Order',
|
||
exportOptions: {
|
||
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
|
||
}
|
||
}
|
||
]
|
||
});
|
||
});
|
||
</script>
|