ria/app/Views/POlist.php
2024-07-22 02:56:19 +00:00

161 lines
6.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
.pagination {
margin: 0px !important;
}
</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>#</th>
<th>PONO#</th>
<th>PO Type</th>
<th>PO Date</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 align="left"><?php echo $index; ?></td>
<td><?php echo $record->PONO ?></td>
<td><?php echo $record->ReqType ?></td>
<td align="right"><?php $Pdt = new DateTime($record->PODate);
$PODate = $Pdt->format('d-m-Y');
echo $PODate
?></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>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</a> &nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp;</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> -->
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
$(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
$('#dataTableHistoriek').DataTable({
"paging": true,
"ordering": true,
"scrollCollapse": true,
"searching": true,
//"columnDefs" : [{"targets":3, "type":"date"}],
"bInfo": true
});
});
</script>