Files
lelong/resources/views/kpi/senaraitempkpi.blade.php
Nur Izzati Zulkifli 1797de703a update tajuk
2023-07-27 14:00:35 +08:00

401 lines
24 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col mx-auto p-4">
<div class="card">
<div class="card-header header-style">
<div class="header-style-title">
Butiran Mengikut Jawatan: {{$nama_jawatan['namajawatan']}}<br>
</div>
Tahun: {{$tahun}}<br>
Bulan: {{$bulan}}
</div>
<div class="card-body">
@if ($message = Session::get('failed'))
<div class="alert alert-danger" style="margin-top:1%;">
<p>{{ $message }}</p>
</div>
@endif
<form action="{{route('janakpi.savedatakpi')}}" method="POST" enctype="multipart/form-data">
@csrf
{{-- <input type="hidden" name="helo"> --}}
<div id='loader'><img id="loader-image" src="../img/loadingmsg.gif" alt="Sila Tunggu Sebentar..." /></div>
<div class="container">
<div>
<div style="margin-top:2%; margin-bottom:2%;">
<input type="hidden" class="form-control" id="tahun" name="tahun" value="{{$tahun}}">
<input type="hidden" class="form-control" id="bulan" name="bulan" value="{{$bulan}}">
<input type="hidden" class="form-control" id="jawatan" name="jawatan" value="{{$jawatan}}">
</div>
</div>
</div>
<table class="table text-left table-bordered" id="senaraitemp" style="width:100%">
<thead class="bg-primary text-white">
@if($jawatan == 'pc')
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th align="center">Kod Cawangan</th>
<th align="center">Cawangan</th>
<th align="left">Nama Staff</th>
<th align="left">NoKP Staff</th>
<th>Bilangan SAG</th>
<th>Pembiayaan (RM)</th>
<th>Pendapatan (RM)</th>
<th>Pelanggan Baru</th>
{{-- <th class="text-center">Tindakan</th> --}}
</tr>
@elseif($jawatan == 'ppc')
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th align="center">Kod Cawangan</th>
<th align="center">Cawangan</th>
<th align="left">Nama Staff</th>
<th align="left">NoKP Staff</th>
<th>Aging (1-5bulan)</th>
{{-- <th>Markah</th> --}}
<th>Aging (6-12bulan)</th>
{{-- <th>Markah</th> --}}
<th>Aging (>12bulan)</th>
{{-- <th>Markah</th> --}}
<th>Penebusan (RM)</th>
{{-- <th class="text-center">Tindakan</th> --}}
</tr>
@elseif($jawatan == 'teller')
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th align="center">Kod Cawangan</th>
<th align="center">Cawangan</th>
<th align="left">Nama Staff</th>
<th align="left">NoKP Staff</th>
<th>Bil. SAG Gadaian</th>
<th>Pembiayaan (RM)</th>
<th>Bil. SAG Penebusan</th>
<th>Pembiayaan (RM)</th>
</tr>
@elseif($jawatan == 'penilai')
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th align="center">Kod Cawangan</th>
<th align="center">Cawangan</th>
<th align="left">Nama Staff</th>
<th align="left">NoKP Staff</th>
<th>Bil. SAG Gadaian</th>
<th>Pembiayaan (RM)</th>
</tr>
@endif
</thead>
<tbody>
@php $count = 1; @endphp
@foreach($senarai as $send)
{{-- {{dd($jawatan)}} --}}
{{-- @if($send['bilangan'] > 0) --}}
@if($jawatan == 'pc')
<tr>
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="caw[]" id="caw" value = "{{ $send['kodcaw'] }}" class="checkbox"></td> --}}
<td>{{ $count++ }}</td>
<td align="center">{{ $send['kodcaw'] }}<input type="hidden" class="form-control" id="kodcaw" name="kodcaw[]" value="{{$send['kodcaw']}}"></td>
<td align="left">{{ $send['caw_name'] }}<input type="hidden" class="form-control" id="caw_name" name="caw_name[]" value="{{$send['caw_name']}}"></td>
<td align="left" style="white-space: nowrap;">{{ $send['nama_staff'] }}<input type="hidden" class="form-control" id="nama_staff" name="nama_staff[]" value="{{$send['nama_staff']}}"></td>
<td align="left" style="white-space: nowrap;">{{ $send['nokpstaff'] }}<input type="hidden" class="form-control" id="nokpstaff" name="nokpstaff[]" value="{{$send['nokpstaff']}}"></td>
<td align="center">{{ $send['laporan_ringkasan']['bilangan_gadai'] }}<input type="hidden" class="form-control" id="bilangan_gadai" name="bilangan_gadai[]" value="{{ $send['laporan_ringkasan']['bilangan_gadai'] }}"></td>
<td align="right">{{ number_format($send['laporan_ringkasan']['total_gadai'], 2) }}<input type="hidden" class="form-control" id="total_gadai" name="total_gadai[]" value="{{ $send['laporan_ringkasan']['total_gadai'] }}"> </td>
<td align="right">{{ number_format($send['laporan_ringkasan']['upahsimpankaunter']+$send['laporan_ringkasan']['keuntungansebenarkaunter']+$send['laporan_ringkasan']['total_keuntungan_online'] , 2) }}<input type="hidden" class="form-control" id="pendapatan" name="pendapatan[]" value="{{ $send['laporan_ringkasan']['upahsimpankaunter']+$send['laporan_ringkasan']['keuntungansebenarkaunter']+$send['laporan_ringkasan']['total_keuntungan_online'] }}"> </td>
<td align="center">{{ $send['laporan_ringkasan']['bilangan_customer_baru'] }}<input type="hidden" class="form-control" id="bilangan_customer_baru" name="bilangan_customer_baru[]" value="{{ $send['laporan_ringkasan']['bilangan_customer_baru'] }}"> </td>
</tr>
@elseif($jawatan == 'ppc')
<tr>
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="caw[]" id="caw" value = "{{ $send['kodcaw'] }}" class="checkbox"></td> --}}
<td>{{ $count++ }}</td>
<td align="center">{{ $send['kodcaw'] }}<input type="hidden" class="form-control" id="kodcaw" name="kodcaw[]" value="{{$send['kodcaw']}}"></td>
<td align="left">{{ $send['caw_name'] }}<input type="hidden" class="form-control" id="caw_name" name="caw_name[]" value="{{$send['caw_name']}}"></td>
<td align="left" style="white-space: nowrap;">{{ $send['nama_staff'] }}<input type="hidden" class="form-control" id="nama_staff" name="nama_staff[]" value="{{$send['nama_staff']}}"></td>
<td align="left" style="white-space: nowrap;">{{ $send['nokpstaff'] }}<input type="hidden" class="form-control" id="nokpstaff" name="nokpstaff[]" value="{{$send['nokpstaff']}}"></td>
@php $jumpembiayaan = 1; @endphp
@foreach($send['aging'][0]['count'] as $index=>$total)
@php
$jumpembiayaan += $send['aging'][0]['sum'][$index];
@endphp
@endforeach
{{-- //1 - 6 Bulan --}}
@php $jumlahcount = 0;$jumlahsum = 0; @endphp
@foreach($send['aging'][0]['count'] as $index=>$ag)
@if ($index < 6)
@php
$jumlahcount += $ag; $jumlahsum += $send['aging'][0]['sum'][$index];
$percent = ($jumlahsum/$jumpembiayaan)*100;
@endphp
@if($percent <= '85.00')
@php
$markah = 100.00;
@endphp
@elseif($percent > '85.00' && $percent <= '90.00')
@php
$markah = 75.00;
@endphp
@elseif($percent > '90.00' && $percent <= '95.00')
@php
$markah = 50.00;
@endphp
@elseif($percent > '95.00' && $percent <= '100.00')
@php
$markah = 25.00;
@endphp
@elseif($percent > '100.00')
@php
$markah = 0.00;
@endphp
@endif
@endif
@endforeach
{{-- <td align="center">{{ number_format($percent,2) }}%</td> --}}
<td align="center">{{ number_format($percent,2) }}%<br><b>{{ number_format(($markah),2) }}%</b><input type="hidden" class="form-control" id="aging1" name="aging1[]" value="{{ number_format(($markah),2) }}"></td>
{{-- //>6 Bulan --}}
@php $jumlahcount = 0;$jumlahsum = 0; @endphp
@foreach($send['aging'][0]['sum'] as $index=>$ag)
@if ($index > 5 && $index < 12 )
@php
$jumlahsum += $send['aging'][0]['sum'][$index];
$percent = ($jumlahsum/$jumpembiayaan)*100;
@endphp
@if($percent <= '15.00')
@php
$markah = 100.00;
@endphp
@elseif($percent > '15.00' && $percent <= '16.00')
@php
$markah = 75.00;
@endphp
@elseif($percent > '16.00' && $percent <= '17.00')
@php
$markah = 50.00;
@endphp
@elseif($percent > '17.00' && $percent <= '18.00')
@php
$markah = 25.00;
@endphp
@elseif($percent > '18.00')
@php
$markah = 0.00;
@endphp
@endif
@endif
@endforeach
{{-- <td align="center">{{ number_format($percent,2) }}%</td> --}}
<td align="center">{{ number_format($percent,2) }}%<br><b>{{ number_format(($markah),2) }}%</b><input type="hidden" class="form-control" id="aging2" name="aging2[]" value="{{ number_format($markah,2) }}"></td>
{{-- >12 Bulan --}}
@php $jumlahcount = 0;$jumlahsum = 0; @endphp
@foreach($send['aging'][0]['sum'] as $index=>$ag)
@if ($index > 11 && $index < 14)
@php
$jumlahsum += $send['aging'][0]['sum'][$index];
$percent = ($jumlahsum/$jumpembiayaan)*100;
@endphp
@if($percent <= '1.00')
@php
$markah = 100.00;
@endphp
@elseif($percent > '1.00' && $percent <= '2.00')
@php
$markah = 75.00;
@endphp
@elseif($percent > '2.00' && $percent <= '3.00')
@php
$markah = 50.00;
@endphp
@elseif($percent > '3.00' && $percent <= '4.00')
@php
$markah = 25.00;
@endphp
@elseif($percent > '4.00')
@php
$markah = 0.00;
@endphp
@endif
@endif
@endforeach
{{-- <td align="center">{{ number_format(($jumlahsum/$jumpembiayaan)*100,2) }}%<input type="hidden" class="form-control" id="aging3" name="aging3[]" value="{{ number_format(($jumlahsum/$jumpembiayaan)*100,2) }}"></td> --}}
{{-- <td align="center">{{ number_format($percent,2) }}%</td> --}}
<td align="center">{{ number_format($percent,2) }}%<br><b>{{ number_format(($markah),2) }}%</b><input type="hidden" class="form-control" id="aging3" name="aging3[]" value="{{ number_format($markah,2) }}"></td>
<td align="right"> {{ number_format($send['laporan_ringkasan']['total_tebus'] , 2)}} <input type="hidden" class="form-control" id="total_tebus" name="total_tebus[]" value="{{ $send['laporan_ringkasan']['total_tebus'] }}"></td>
</tr>
@elseif($jawatan == 'teller')
<tr>
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="caw[]" id="caw" value = "{{ $send['kodcaw'] }}" class="checkbox"></td> --}}
<td>{{ $count++ }}</td>
<td align="center">{{ $send['kodcaw'] }}
@foreach($send['gadai'] as $index=>$kodcaw)
<input type="hidden" class="form-control" id="kodcaw" name="kodcaw[]" value="{{$kodcaw['kodcaw']}}"><br>
@endforeach</td>
<td align="left">{{ $send['caw_name'] }}<input type="hidden" class="form-control" id="caw_name" name="caw_name[]" value="{{$send['caw_name']}}"></td>
<td align="left" style="white-space: nowrap;">
{{-- {{dd($send['gadai'])}} --}}
@foreach($send['gadai'] as $index=>$nama)
{{ $nama['teller'] }}<input type="hidden" class="form-control" id="nama_staff" name="nama_staff[]" value="{{$nama['teller']}}"><br>
@endforeach
</td>
<td align="center">@foreach($send['gadai'] as $index=>$nama)
{{ $nama['nokpstaff']}}<input type="hidden" class="form-control" id="nokpstaff" name="nokpstaff[]" value="{{$nama['nokpstaff']}}"><br>
@endforeach</td>
<td align="center">@foreach($send['gadai'] as $index=>$nama)
{{ $nama['total_gadai'] }}<input type="hidden" class="form-control" id="total_gadai" name="total_gadai[]" value="{{ $nama['total_gadai']}}"><br>
@endforeach</td>
<td align="right">
@foreach($send['gadai'] as $index=>$nama)
{{ number_format($nama['total_pembiayaan'], 2) }}<input type="hidden" class="form-control" id="total_pembiayaan" name="total_pembiayaan[]" value="{{ $nama['total_pembiayaan']}}"> <br>
@endforeach
</td>
{{-- {{dd($send['tebus'])}} --}}
<td align="center">@foreach($send['tebus'] as $tebus)
{{ $tebus['total_tebus'] }}<input type="hidden" class="form-control" id="total_tebus" name="total_tebus[]" value="{{ $tebus['total_tebus']}}"><br>
@endforeach</td>
<td align="right">
@foreach($send['tebus'] as $tebus)
{{ number_format($tebus['total_penebusan'], 2) }} <input type="hidden" class="form-control" id="total_penebusan" name="total_penebusan[]" value="{{ $tebus['total_penebusan']}}"><br>
@endforeach
</td>
</tr>
@elseif($jawatan == 'penilai')
<tr>
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="caw[]" id="caw" value = "{{ $send['kodcaw'] }}" class="checkbox"></td> --}}
<td>{{ $count++ }}</td>
<td align="center">{{ $send['kodcaw'] }}
@foreach($send['gadaipenilai'] as $index=>$kodcaw)
<input type="hidden" class="form-control" id="kodcaw" name="kodcaw[]" value="{{$kodcaw['kodcaw']}}"><br>
@endforeach</td>
<td align="left">{{ $send['caw_name'] }}<input type="hidden" class="form-control" id="caw_name" name="caw_name[]" value="{{$send['caw_name']}}"></td>
<td align="left" style="white-space: nowrap;">
@foreach($send['gadaipenilai'] as $index=>$nama)
{{ $nama['penilai'] }}<input type="hidden" class="form-control" id="nama_staff" name="nama_staff[]" value="{{$nama['penilai']}}"><br>
@endforeach
</td>
<td align="center">@foreach($send['gadaipenilai'] as $index=>$nama)
{{ $nama['nokpstaff']}}<input type="hidden" class="form-control" id="nokpstaff" name="nokpstaff[]" value="{{$nama['nokpstaff']}}"><br>
@endforeach</td>
<td align="center">@foreach($send['gadaipenilai'] as $index=>$nama)
{{ $nama['total_gadai'] }}<input type="hidden" class="form-control" id="total_gadai" name="total_gadai[]" value="{{$nama['total_gadai']}}"><br>
@endforeach</td>
<td align="right">
@foreach($send['gadaipenilai'] as $index=>$nama)
{{ number_format($nama['total_pembiayaan'], 2) }}<input type="hidden" class="form-control" id="total_pembiayaan" name="total_pembiayaan[]" value="{{$nama['total_pembiayaan']}}"> <br>
@endforeach
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<div class="modal-footer; text-center" style="margin-top:2%; margin-bottom:2%;">
<a href="{{ route('janakpi.janaekpi') }}" class="btn btn-primary" style="width:8%;">Kembali</a>
<button type="submit" class="btn btn-success">Simpan Data</button>
</div>
</form>
</div>
</div>
</div>
<script>
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
var tablesenaraitemp = $('#senaraitempsimulasi').DataTable({
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 8,
"orderable": false
}
],
order: [[1, 'asc']],
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
// buttons: [
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addcaw',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Cawangan',
// action: function ( e, dt, node, config ) {
// // alert( 'Button activated' );
// // console.log('hye');
// $('#myModal').modal("show");
// $('#myModal').on('shown.bs.modal', function () {
// $('#rolename').trigger('focus')
// })
// }
// },
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Export to CSV',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
// ]
});
// $('.addcaw').tooltip();
// $('.export').tooltip();
// // $( '.dt-buttons').addClass('btn-group');
// $( '.addcaw').removeClass('dt-button');
// $( '.export').removeClass('dt-button');
</script>
<script type='text/javascript'>
$(document).ready(function(){
// Check or Uncheck All checkboxes
$("#checkall").change(function(){
var checked = $(this).is(':checked');
if(checked){
$(".checkbox").each(function(){
$(this).prop("checked",true);
});
}else{
$(".checkbox").each(function(){
$(this).prop("checked",false);
});
}
});
// Changing state of CheckAll checkbox
$(".checkbox").click(function(){
if($(".checkbox").length == $(".checkbox:checked").length) {
$("#checkall").prop("checked", true);
} else {
$("#checkall").prop("checked", false);
}
});
});
</script>
<script>
$(function() {
$( "form" ).submit(function() {
$('#loader').show();
});
});
</script>
@endsection