Merged in atie (pull request #12)

update laporan by tarikh
This commit is contained in:
izzati zulkifli
2023-07-30 04:05:34 +00:00
7 changed files with 696 additions and 11 deletions
@@ -31,7 +31,9 @@ use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use App\Models\Resit;
use App\Models\Customer;
use App\Models\LelongCawangan;
use App\Models\LelongTebus;
use App\Models\Tetapan;
use Carbon\Carbon;
@@ -661,6 +663,151 @@ class ReportAllController extends Controller
}
public function laporanlelongbydate()
{
$currentDate = Carbon::now();
$currentDate = $currentDate->toDateString();
$caw = Cawangan::all();
$tetapan = Tetapan::where('id','=',1)->first();
return view('laporan.carianbydate',compact('caw','tetapan', 'currentDate'));
}
public function docaribydate(Request $request)
{
// dd($request->all());
$tarikh_dari = date('d-m-Y', strtotime($request->tarikh_dari));
$t_dari = $request->tarikh_dari;
$tarikh_hingga = date('d-m-Y', strtotime($request->tarikh_hingga));
$t_hingga = $request->tarikh_hingga;
if($t_dari != null || $t_hingga != null)
{
$cawangan_all = Cawangan::orderBy('caw_name')->get();
$senarai = [];
$total_bil_lelong = 0;
foreach($cawangan_all as $cawangan){
$getsurat = LelongCawangan::on($cawangan->caw_code)
->where('t_lelong','>=',$t_dari)
->where('t_lelong','<=',$t_hingga);
// dd($getsurat->count('norujukan'));
$bil_lelong = $getsurat->count('norujukan');
$total_bil_lelong += $bil_lelong;
$total_berat = $getsurat->sum('berat');
$total_nilaimarhun = $getsurat->sum('nilaimarhun');
$total_hargajual = $getsurat->sum('hargajual');
$total_bakiupah = $getsurat->sum('bakiupah');
$total_baki = $getsurat->sum('baki');
$total_pembiayaan = $getsurat->sum('pinjaman');
$data = [
't_dari'=>$tarikh_dari,
't_hingga'=>$tarikh_hingga,
'bil_lelong'=>$bil_lelong,
'total_berat'=>$total_berat,
'total_nilaimarhun'=>$total_nilaimarhun,
'total_hargajual'=>$total_hargajual,
'total_bakiupah'=>$total_bakiupah,
'total_baki'=>$total_baki,
'total_pembiayaan'=>$total_pembiayaan,
'kodcaw'=>$cawangan->caw_code,
'caw_name'=>$cawangan->caw_name];
array_push($senarai,$data);
// dump($data);
}
// dd($data);
if($total_bil_lelong == 0)
{
return redirect()->route('reportbydate.laporanlelongbydate')
->with('failed','Tiada surat lelong');
}
return view('laporan.senaraitemplaporanbydate', compact( 't_dari',
't_hingga',
'getsurat',
'senarai',
'tarikh_dari',
'tarikh_hingga'
));
}
else
{
return redirect()->route('reportbydate.laporanlelongbydate')
->with('failed','Sila Masukkan Tarikh');
}
}
Public function docaribydate2(Request $request){
// dd($request->all());
$tarikh_dari = $request->tarikh_dari;
$t_dari = date('Y-m-d', strtotime($request->tarikh_dari));
// dd($t_dari);
$tarikh_hingga = $request->tarikh_hingga;
$t_hingga = date('d-m-Y', strtotime($request->tarikh_hingga));
if($t_dari != null || $t_hingga != null)
{
$cawangan_all = Cawangan::orderBy('caw_name')->get();
$senarai = [];
$total_bil_lelong = 0;
foreach($cawangan_all as $cawangan){
$getsurat = LelongCawangan::on($cawangan->caw_code)
->where('t_lelong','>=',$t_dari)
->where('t_lelong','<=',$t_hingga);
// dd($getsurat->count('norujukan'));
$bil_lelong = $getsurat->count('norujukan');
$total_bil_lelong += $bil_lelong;
$total_berat = $getsurat->sum('berat');
$total_nilaimarhun = $getsurat->sum('nilaimarhun');
$total_hargajual = $getsurat->sum('hargajual');
$total_bakiupah = $getsurat->sum('bakiupah');
$total_baki = $getsurat->sum('baki');
$total_pembiayaan = $getsurat->sum('pinjaman');
$data = [
't_dari'=>$tarikh_dari,
't_hingga'=>$tarikh_hingga,
'bil_lelong'=>$bil_lelong,
'total_berat'=>$total_berat,
'total_nilaimarhun'=>$total_nilaimarhun,
'total_hargajual'=>$total_hargajual,
'total_bakiupah'=>$total_bakiupah,
'total_baki'=>$total_baki,
'total_pembiayaan'=>$total_pembiayaan,
'kodcaw'=>$cawangan->caw_code,
'caw_name'=>$cawangan->caw_name];
array_push($senarai,$data);
// dump($data);
}
// dd($data);
}
$jum
if($request->type == 'pdf')
{
$pdf = PDF::loadView('laporan.senaraitemplaporanbydate_pdf', compact( 't_dari',
't_hingga',
'getsurat',
'senarai',
'tarikh_dari',
'tarikh_hingga'))
->setPaper('a4', 'potrait');
return $pdf->download('laporan lelong dari'.$t_dari.'hingga'.$t_hingga.'.pdf');
}else{
return view('laporan.senaraitemplaporanbydate', compact( 't_dari',
't_hingga',
'getsurat',
'senarai',
'tarikh_dari',
'tarikh_hingga'
));
}
}
+19 -10
View File
@@ -801,22 +801,31 @@
<span class="material-symbols-rounded sidebar-menu-item-expand">expand_more</span>
</div>
</a>
{{-- <ul class="list-unstyled collapse {{ (request()->is('reportbycaw/*')) ? 'show' : '' }}" id="reportallcawSubmenu">
<li class="{{ (request()->is('reportbycaw/lapbrglelongindexall/*') || request()->is('reportbycaw/lapbrglelongindexall') ) ? 'active' : '' }}">
<a href="{{url('reportbycaw/lapbrglelongindexall')}}">Barang Lelong by Batch</a>
</li>
</ul>
<ul class="list-unstyled collapse {{ (request()->is('reportbycaw/*')) ? 'show' : '' }}" id="reportallcawSubmenu">
<li class="{{ (request()->is('reportbycaw/lapbidaanpembidaindexall/*') || request()->is('reportbycaw/lapbidaanpembidaindexall') ) ? 'active' : '' }}">
<a href="{{url('reportbycaw/lapbidaanpembidaindexall')}}">Senarai Lelong Pembida by Batch</a>
</li>
</ul> --}}
<ul class="list-unstyled collapse {{ (request()->is('reportbycaw/*')) ? 'show' : '' }}" id="reportallcawSubmenu">
<li class="{{ (request()->is('reportbycaw/laporanlelongbycaw/*') || request()->is('reportbycaw/laporanlelongbycaw') ) ? 'active' : '' }}">
<a href="{{url('reportbycaw/laporanlelongbycaw')}}">Lelong Keseluruhan</a>
</li>
</ul>
</li>
<li class="{{ (request()->is('reportbydate/')) ? 'active' : '' }}">
<a href="#reportallcawbydateSubmenu" data-toggle="collapse" aria-expanded="false">
<div class="sidebar-menu">
<div class="sidebar-menu-main-title">
<span class="material-symbols-rounded sidebar-menu-item-main">
book
</span>
By Tarikh
</div>
<span class="material-symbols-rounded sidebar-menu-item-expand">expand_more</span>
</div>
</a>
<ul class="list-unstyled collapse {{ (request()->is('reportbydate/*')) ? 'show' : '' }}" id="reportallcawbydateSubmenu">
<li class="{{ (request()->is('reportbydate/laporanlelongbydate/*') || request()->is('reportbydate/laporanlelongbydate') ) ? 'active' : '' }}">
<a href="{{url('reportbydate/laporanlelongbydate')}}">Lelong Keseluruhan</a>
</li>
</ul>
</li>
<li>
<div class="sidebar-menu-title">Parameter</div>
</li>
@@ -0,0 +1,79 @@
@extends('layouts.app')
@section('content')
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/css/select2.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/js/select2.min.js"></script>
<div class="container">
<div class="row ">
<div class="col-10 mx-auto">
<div class="card">
<div class="card-header header-style">
<div class="header-style-title">
Carian Laporan Lelongan Mengikut Tarikh
</div>
</div>
<div class="card-body">
@if ($message = Session::get('failed'))
<div class="alert alert-danger">
{{ $message }}
</div>
@endif
<!-- <form action="{{route('reportbydate.docaribydate')}}" method="POST" enctype="multipart/form-data"> -->
<form action="{{route('reportbydate.docaribydate')}}" method="POST" enctype="multipart/form-data">
@csrf
<div id='loader'><img id="loader-image" src="../img/loadingmsg.gif" alt="Sila Tunggu Sebentar..." /></div>
<div class="form-group row">
<label for="tarikh_dari" class="col-sm-2 col-form-label">Tarikh Dari</label>
<div class="col-sm-3">
<input type="date" class="form-control" id="tarikh_dari" name="tarikh_dari" value = "">
</div>
<label for="tarikh_hingga" class="col-sm-2 col-form-label">Tarikh Hingga</label>
<div class="col-sm-3">
<input type="date" class="form-control" id="tarikh_hingga" name="tarikh_hingga" value = "">
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary">Carian</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
var date = '<?php echo $currentDate; ?>';
$('#caw').select2({
width: '100%',
placeholder: "Pilih Cawangan",
allowClear: true
});
$(document).ready(function () {
document.getElementById('tarikh_lelong').setAttribute("min", date);
$("input[name=fasa]").change(function(){
if($("#fasa1").is(':checked')){
$("#jbg").val('').prop("readonly", false);
}
if($("#fasa2").is(':checked')){
$("#jbg").val('12').prop("readonly", true);
}
});
});
</script>
<script>
$(function() {
$( "form" ).submit(function() {
$('#loader').show();
});
});
</script>
@endsection
@@ -0,0 +1,176 @@
@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 Lelongan Mengikut Cawangan
</div>
</div>
<div class="card-body">
@if ($message = Session::get('failed'))
<div class="alert alert-danger" style="margin-top:1%;">
<p>{{ $message }}</p>
</div>
@endif
{{-- @if (Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif --}}
{{-- <h3 class="pt-3" style="margin-left:1%;">Butiran Gadaian Mengikut Cawangan Lelongan Fasa {{$fasa}}</h3> --}}
<!-- <form action="{{route('analisa.janadata')}}" method="POST" enctype="multipart/form-data"> -->
<form id="exportpdf" action="{{route('reportbydate.docaribydate2')}}" method="POST" enctype="multipart/form-data">
<!-- <form action="{{route('analisa.importgadaifrommaster')}}" method="POST" enctype="multipart/form-data"> -->
@csrf
<input type="hidden" class="form-control" id="tarikh_dari" name="tarikh_dari" value="{{$tarikh_dari}}">
<input type="hidden" class="form-control" id="tarikh_hingga" name="tarikh_hingga" value="{{$tarikh_hingga}}">
<input type="hidden" name="type" id="typedonwload" value="">
<div class="container">
<div>
<div style="margin-top:2%; margin-bottom:2%;">
<p> <b>Dari : </b> {{ $tarikh_dari }}
<b>Hingga : </b>{{ $tarikh_hingga }}</p>
</div>
</div>
</div>
<table class="table text-right table-bordered" id="senaraitemplaporanbydate" style="width:100%">
<thead class="bg-primary text-white">
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th>Kod Cawangan</th>
<th>Cawangan</th>
<th>Bil Lelong</th>
<th>Berat (gm)</th>
<th>Pembiayaan (RM)</th>
<th>Harga Jual (RM)</th>
<th>Keuntungan (RM)</th>
<th>Baki Lelong (RM)</th>
{{-- <th class="text-center">Tindakan</th> --}}
</tr>
</thead>
<tbody>
@php $count = 1; @endphp
@foreach($senarai as $send)
@if($send['bil_lelong'] > 0)
<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>{{ $send['kodcaw'] }}</td>
<td style="white-space: nowrap;">{{ $send['caw_name'] }}</td>
<td>{{ $send['bil_lelong'] }} </td>
<td>{{ number_format($send['total_berat'], 2) }} </td>
<td>{{ number_format($send['total_pembiayaan'], 2) }} </td>
<td>{{ number_format($send['total_hargajual'] , 2) }} </td>
<td>{{ number_format($send['total_bakiupah'] , 2) }} </td>
<td>{{ number_format($send['total_baki'] , 2) }} </td>
{{-- <td>
<a href=" {{ route('analisa.tempbycawsimulasi', [$send['kodcaw'],$t_gadai1,$fasa]) }} " data-toggle="tooltip" data-placement="top" title="Butiran Gadaian"><i class="far fa-edit"></i></a>
</td>--}}
</tr>
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="2"><b>JUMLAH KESELURUHAN</b></td>
<td><b>{{ $total_marhun }}</b></td>
</tr>
</tfoot>
</table>
<div class="modal-footer; text-center" style="margin-top:2%; margin-bottom:2%;">
<a href="{{ route('reportbydate.laporanlelongbydate') }}" class="btn btn-primary" style="width:8%;">Kembali</a>
{{-- <button type="submit" class="btn btn-success">Jana Simulasi</button> --}}
</div>
</form>
</div>
</div>
</div>
<script>
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
var tablesenaraitemp = $('#senaraitemplaporanbydate').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-danger pl-4 pr-4 btn-sm export',
titleAttr: 'Export to PDF',
text: '<h8><b>PDF</b></h8>',
action: function ( e, dt, node, config ) {
$('#typedonwload').val('pdf');
$("#exportpdf").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
@@ -0,0 +1,194 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
#sim {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:10px;
border-collapse: collapse;
width: 100%;
}
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
border: 0px solid;
padding: 1px;
text-align: left;
}
#sim tr:nth-child(even){}
#sim tr {
border-bottom: 1px black;
}
#sim th {
border: 1px black;
text-align: center;
}
#sim2 th {
text-align: center;
border: 0px solid ;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.row {
margin-right:-5px;
margin-right:-5px;
}
.column {
float: right;
width: 100%;
padding: 5px;
}
/* Clearfix (clear floats) */
.row::after {
content: "";
clear: both;
display: table;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 200%;
border: 0px solid #ddd;
}
td {
/* text-align: right; */
padding: 16px;
border: 1px solid;
}
th{
text-align: center;
padding: 16px;
}
tr:nth-child(even) {
}
.font{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
<style>
/** Define now the real margins of every page in the PDF **/
body {
margin-top: 1cm;
/* margin-left: 2cm; */
/* margin-right: 2cm; */
margin-bottom: 2cm;
}
/** Define the header rules **/
header {
position: fixed;
top: -1cm;
left: 0cm;
right: 0cm;
height: 0cm;
/** Extra personal styles **/
/* background-color: #eaeaea; */
color: black;
text-align: center;
line-height: 1.5cm;
}
/** Define the footer rules **/
footer {
position: fixed;
bottom: 0cm;
left: 0cm;
right: 0cm;
height: 2cm;
/** Extra personal styles **/
/* background-color: #eaeaea; */
color: black;
text-align: center;
line-height: 1.5cm;
}
footer .pagenum:before {
content: counter(page);
}
.font{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
<body>
<header>
<div class="font"><u><b><h5>LAPORAN LELONGAN KESELURUHAN</h5></b></u></div>
</header>
<footer>
<div class="pagenum-container"><span class="pagenum"></span></div>
</footer>
<div class="font">
Dari: {{$tarikh_dari}}
Hingga: {{$tarikh_hingga}}<br><br>
</div>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead class="bg-primary text-white">
<tr>
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" id="checkall"></th> --}}
<th>Bil</th>
<th>Kod Cawangan</th>
<th>Cawangan</th>
<th>Bil Lelong</th>
<th>Berat (gm)</th>
<th>Pembiayaan (RM)</th>
<th>Harga Jual (RM)</th>
<th>Keuntungan (RM)</th>
<th>Baki Lelong (RM)</th>
{{-- <th class="text-center">Tindakan</th> --}}
</tr>
</thead>
<tbody>
@php $count = 1; @endphp
@foreach($senarai as $send)
@if($send['bil_lelong'] > 0)
<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>{{ $send['kodcaw'] }}</td>
<td style="white-space: nowrap;">{{ $send['caw_name'] }}</td>
<td>{{ $send['bil_lelong'] }} </td>
<td>{{ number_format($send['total_berat'], 2) }} </td>
<td>{{ number_format($send['total_pembiayaan'], 2) }} </td>
<td>{{ number_format($send['total_hargajual'] , 2) }} </td>
<td>{{ number_format($send['total_bakiupah'] , 2) }} </td>
<td>{{ number_format($send['total_baki'] , 2) }} </td>
{{-- <td>
<a href=" {{ route('analisa.tempbycawsimulasi', [$send['kodcaw'],$t_gadai1,$fasa]) }} " data-toggle="tooltip" data-placement="top" title="Butiran Gadaian"><i class="far fa-edit"></i></a>
</td>--}}
</tr>
@endif
@endforeach
</tbody>
</table>
</body>
@@ -0,0 +1,73 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col">
<div class="card">
<div class="card-header header-style">
<div class="header-style-title">
Laporan Lelongan Mengikut Tarikh
</div>
</div>
<div class="card-body">
@if ($message = Session::get('success'))
<div class="alert alert-success">
{{ $message }}
</div>
@endif
<form id="exportform" action="" method="POST">
<input type="hidden" name="type" value="User">
<table class="table table-bordered table-xl" id="tablenotislelong" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>Cawangan</th>
{{-- <th>Total Keseluruhan</th> --}}
{{-- <th>Bilangan Lelongan</th> --}}
</tr>
</thead>
<tbody>
@foreach ($cawangan_all as $bid)
<tr>
<td>{{$loop->iteration}}</td>
<td>
<a class="btn btn-success btn-sm m-1" href="{{ route('reportbycaw.laporanlelongbycawdetail',['cawid'=>$bid->cawangan_info->id]) }}" data-toggle="tooltip" data-placement="top" title="Senarai Lelong"><i class="fas fa-list"></i></a>
<b>{{ $bid->cawangan_info->caw_name}}</b>
</td>
{{-- <td><span class="badge badge-pill badge-info text-white" style="font-size:100%"> {{ $bid->cawangan_lelong_count}}</span></td> --}}
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
var tablenotislelong = $('#tablenotislelong').DataTable({
order: [[0, 'asc']],
"info": false,
"lengthChange": false,
"pageLength": 99,
dom: 'Bfrtip',
});
</script>
@endsection
+8 -1
View File
@@ -732,4 +732,11 @@ Route::group(['middleware' => ['permission:skoptugasan'],'prefix'=>'janakpi'], f
Route::get('/listdatakpidetailall/{kodcaw}',['as'=>'janakpi.listdatakpidetailall','uses'=>'KpiController@listdatakpidetailall']);
Route::post('/listdatakpidetailall2/{kodcaw}',['as'=>'janakpi.listdatakpidetailall2','uses'=>'KpiController@listdatakpidetailall2']);
Route::get('/hapusdatakpi/{recno}',['as'=>'janakpi.hapusdatakpi','uses'=>'KpiController@hapusdatakpi']);
});
});
Route::group(['middleware' => ['permission:reportbycaw'],'prefix'=>'reportbydate'], function () {
Route::get('/laporanlelongbydate',['as' =>'reportbydate.laporanlelongbydate','uses'=>'ReportAllController@laporanlelongbydate']);
Route::post('/docaribydate',['as'=>'reportbydate.docaribydate','uses'=>'ReportAllController@docaribydate']);
Route::post('/senaraitemplaporanbydate',['as'=>'reportbydate.senaraitemplaporanbydate','uses'=>'ReportAllController@senaraitemplaporanbydate']);
Route::post('/docaribydate2',['as'=>'reportbydate.docaribydate2','uses'=>'ReportAllController@docaribydate2']);
});