| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /laragon/www/sop2/application/views/report/ |
Upload File : |
<?php
date_default_timezone_set('Asia/Jakarta');
function time_elapsed_string( $time )
{
$time_difference = time() - $time;
if( $time_difference < 1 ) { return 'less than 1 second ago'; }
$condition = array( 12 * 30 * 24 * 60 * 60 => 'year',
30 * 24 * 60 * 60 => 'month',
24 * 60 * 60 => 'day',
60 * 60 => 'hour',
60 => 'minute',
1 => 'second'
);
foreach( $condition as $secs => $str )
{
$d = $time_difference / $secs;
if( $d >= 1 )
{
$t = round( $d );
return 'about ' . $t . ' ' . $str . ( $t > 1 ? 's' : '' ) . ' ago';
}
}
}
function ditolak(){
$tampil = '<a href="#" class="btn btn-secondary btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-cancel"></i>
</span>
<span class="text">Ditolak </span>
</a>';
return $tampil;
}
function target(){
$tampil = '<a href="#" class="btn btn-success btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-flag"></i>
</span>
<span class="text">Targeted </span>
</a>';
return $tampil;
}
function gk_target(){
$tampil = '<a href="#" class="btn btn-warning btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-exclamation-triangle"></i>
</span>
<span class="text">Not Targeted</span>
</a>';
return $tampil;
}
function itung_menit($date_awal, $date_akhir){
$awal = strtotime($date_awal);
$akhir = $date_akhir; //strtotime($date_akhir);
$diff = $akhir - $awal;
//$jam = floor($diff / (60 * 60));
//$menit = $diff - ( $jam * (60 * 60) );
$menit = floor($diff/(60*60*60*60*60)).' menit' ;
//$detik = $diff % 60;
//echo 'Waktu tinggal: ' . $jam . ' jam, ' . floor( $menit / 60 ) . ' menit, ' . $detik . ' detik';
//if($jam>0){
//return $jam . ' jam, ' . floor( $menit / 60 ) . ' menit, ' . $detik . ' detik';
//}else{
//return floor( $menit / 60 ) . ' menit, ' . $detik . ' detik';
//}
return $menit;
}
?>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800"><?= $title; ?></h1>
<!-- Page Heading 2-->
<h4 class="mb-4 text-gray-800 mt-3"><span class="badge badge-info"><?= $title2; ?></span></h4>
<hr>
<a href="<?= base_url('report/index'); ?>" class="btn btn-success mb-2"><i class="fa fa-home" ></i> Reload </a>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-body">
<div class="row">
<form action="<?= base_url('report/filter'); ?>" method="post">
<label class="ml-3">From Date:</label>
<input type="text" id="filter1" name="fromDate" class="ml-2 mb-3" autocomplete="off" value="<?php if (isset($_POST['fromDate'])) echo $_POST['fromDate'] ?>">
<label class="ml-3">To Date:</label>
<input type="text" id="filter2" name="toDate" class="ml-2 mb-3" autocomplete="off" value="<?php if (isset($_POST['toDate'])) echo $_POST['toDate'] ?>">
<input type="submit" style="height: 32px" name="but_search" value="Search">
</form>
</div>
<div class="table-responsive">
<?= form_error('menu', '<div class="alert alert-danger" role="alert">', '</div>'); ?>
<?= $this->session->flashdata('message'); ?>
<table class="table table-bordered" id="myTable" width="100%" cellspacing="0">
<thead>
<tr>
<th style="text-align: center; vertical-align: middle;">NO</th>
<th style="text-align: center; vertical-align: middle;">DATE CREATED</th>
<th style="text-align: center; vertical-align: middle;">DESCRIPTIONS</th>
<th style="text-align: center; vertical-align: middle;">SKPD</th>
<th style="text-align: center; vertical-align: middle;">NOMINAL</th>
<th style="text-align: center; vertical-align: middle;">TARGET<br>(<?= $timesop['totalwkt']; ?> Menit)</th>
<th style="text-align: center; vertical-align: middle;">STATUS</th>
</tr>
</thead>
<tbody>
<?php $no=1; foreach($act_ as $a): ?>
<?php
$hit_proses = itung_menit(strtotime($a['dt_created']),$a['timingend']);
?>
<tr class="odd gradeX">
<td style="vertical-align: middle;"><?= $no++;?></td>
<td style="vertical-align: middle;"><?= date('d-M-Y H:i:00', strtotime($a['dt_created'])); ?></td>
<td style="vertical-align: middle;"><?= $a['description']; ?></td>
<td style="vertical-align: middle;"><?= $a['name']; ?></td>
<td style="vertical-align: middle; text-align: right;"><?= number_format($a['nominal']); ?></td>
<td style="vertical-align: middle; text-align: center;">
<?php if ($a['jmlrec'] < $sumjob['totaljob'] ) : ?>
<?php if ($a['stat'] == 0) : ?>
<a class="badge badge-danger"><?= time_elapsed_string(strtotime($a['dt_created'])) ; ?></a>
<?php else : ?>
<a></a>
<?php endif; ?>
<?php else : ?>
<a class="badge badge-success">
<?php
echo $hit_proses;
?>
</a>
<?php endif; ?>
</td>
<td style="vertical-align: middle; text-align: center;">
<?php if ($a['stat'] == 0) : ?>
<?php if ($a['jmlrec'] >= $sumjob['totaljob'] && $hit_proses <= $timesop['totalwkt']) : ?>
<a><?= target() ; ?></a>
<?php elseif ($a['jmlrec'] >= $sumjob['totaljob'] && $hit_proses > $timesop['totalwkt']) : ?>
<a><?= gk_target() ; ?></a>
<?php else : ?>
<a></a>
<?php endif; ?>
<?php else : ?>
<a><?= ditolak() ; ?></a> <!--status cancel-->
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<script>
$(document).ready(function () {
$('#myTable').DataTable({
dom: 'Bfrtip',
buttons: [
{
extend: 'copyHtml5',
text: '<i class="fa fa-clone"> Copy</i>',
titleAttr: 'Copy'
},
{
extend: 'excelHtml5',
text: '<i class="fa fa-table"> Excel</i>',
titleAttr: 'Excel'
},
{
extend: 'csvHtml5',
text: '<i class="fa fa-file"> CSV</i>',
titleAttr: 'CSV'
},
{
extend: 'pdfHtml5',
text: '<i class="fa fa-file-pdf"> PDF</i>',
titleAttr: 'PDF'
},
{
extend: 'print',
text: '<i class="fa fa-print"> Print</i>',
titleAttr: 'Print'
}
] });
});
</script>
<script type="text/javascript">
$(function () {
$('#filter1').datetimepicker({
format: 'Y-m-d H:i:00',
autoclose: true,
pickTime: false,
clear: true,
todayBtn: true
});
$('#filter2').datetimepicker({
format: 'Y-m-d H:i:00',
autoclose: true,
pickTime: false,
clear: true,
todayBtn: true
});
});
</script>
<script type="text/javascript">
function reload(){
location.reload();
}
</script>