Merge branch 'amirah' into 'main'

migratation table tangguhlelong, laporan lelongtebus

See merge request online-sistem1/lelong!140
This commit is contained in:
Nur Izzati Zulkifli
2022-08-03 03:16:23 +00:00
6 changed files with 338 additions and 1 deletions
+80
View File
@@ -31,6 +31,8 @@ use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use App\Models\Resit;
use App\Models\Customer;
use App\Models\LelongTebus;
use Carbon\Carbon;
@@ -503,6 +505,84 @@ class ReportController extends Controller
}
Public function lelongtebusindex (){
$arraydetails = [];
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('lelong_tebus','lelong.id','=','lelong_tebus.batch_no')
->select('lelong.id','lelong_id','tarikh_lelong','lelong.fasa','lelong_tebus.batch_no')
->distinct()
->orderBy('batch_no')
->get()
->toArray();
// dd($lelongid);
foreach($lelongid as $laporan){
$details = CawanganLelong ::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('lelong_id',$laporan['id'])
->distinct()
->orderBy('lelong_id')
->get()
->toArray();
array_push($arraydetails, ['laporan' =>$laporan,'details' =>$details]);
}
return view ('lelong.lelongtebusindex',compact('lelongid','arraydetails'));
}
Public function lelongtebus ($lelong_id, $kodcaw){
$total_berat = 0;
$total_hargaasas = 0;
$total_hargalelong = 0;
$arrayinfocaw = [];
$info = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('cawangan.caw_code',$kodcaw)
->where('cawangan_lelong.lelong_id','=',$lelong_id)
->select('lelong_id','tarikh_lelong','lelong.fasa')
->groupBy('lelong_id')
->get();
foreach($info as $laporancaw)
{
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('cawangan.caw_code',$kodcaw)
->where('lelong_id',$laporancaw['lelong_id'])
->get()
->toArray();
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
}
// dd($arrayinfocaw);
$laporantebus = LelongTebus::where('kodcaw',$kodcaw)
->get()->toArray();
// dd($laporantebus);
// foreach( $brglelpembida as $index1=>$totalbrglelpembida){
// $total_berat = $total_berat + $totalbrglelpembida['berat'];
// $total_hargaasas = $total_hargaasas + $totalbrglelpembida['hargaasas'];
// $total_hargalelong = $total_hargalelong + $totalbrglelpembida['hargabida'];
// }
$pdf = PDF::loadView('pdf.pdflelongtebus',compact('lelong_id','info','laporantebus','total_berat','total_hargaasas','total_hargalelong','arrayinfocaw'))
->setPaper('a4','potrait');
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
}
Public function simulasireport ($simulasi_id, $cawid){
$keuntungan = 0;
@@ -15,6 +15,7 @@ class CreateTangguhlelongTable extends Migration
{
Schema::create('tangguhlelong', function (Blueprint $table) {
$table->id();
$table->string('kodcaw');
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->string('norujukan');
@@ -258,6 +258,11 @@
<a href="{{url('report/lapbrglelpembidaindex')}}">Barang Lelong Pembida</a>
</li>
</ul>
<ul class="list-unstyled collapse {{ (request()->is('report/*')) ? 'show' : '' }}" id="reportSubmenu" >
<li class="{{ (request()->is('report/lelongtebusindex/*') || request()->is('report/lelongtebusindex') ) ? 'active' : '' }}">
<a href="{{url('report/lelongtebusindex')}}">Senarai Lelong Tebus</a>
</li>
</ul>
</li>
{{-- end laporan --}}
@@ -0,0 +1,85 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
<h3 class="pt-3" style="margin-left:1%;">Senarai Lelong Tebus</h3>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="" method="POST">
<input type="hidden" name="type" value="User">
<table class="table table-striped table-xl" id="tablenotislelong" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>ID Lelong</th>
<th>Tarikh Lelong</th>
<th>Fasa</th>
<th>Cawangan</th>
{{-- <th class="text-center">Muat Turun</th> --}}
</tr>
</thead>
<tbody>
@foreach ($arraydetails as $info)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $info['laporan']['batch_no']}}</td>
<td>@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $info['laporan']['tarikh_lelong'] );
$t_lelong = $myDateTime->format('d-m-Y');
echo($t_lelong);
@endphp</td>
<td>{{ $info['laporan']['fasa'] }}</td>
<td>
@foreach($info['details'] as $details)
<a href=" {{ route('report.lelongtebus', ['lelong_id'=>$info['laporan']['id'], 'kodcaw'=>$details['caw_code']]) }} " data-toggle="tooltip" data-placement="top" title="Senarai Barang Lelong"><i class="fas fa-download"></i></a>
<span class="m-2"> {{ $details['caw_name']}}</span><br>
@endforeach
</td>
{{-- <td class="text-center">
<a href="{{ route('report.lapbrglelpembida',$info['laporan']['lelong_id'],$details['caw_name']) }}" data-toggle="tooltip" data-placement="top" title="Senarai Barang Lelong Pembida" ><i class="fas fa-download"></i></a>
</td> --}}
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
var tablenotislelong = $('#tablenotislelong').DataTable({
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 3,
"orderable": false
}
],
order: [[1, 'asc']],
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
});
</script>
@endsection
@@ -0,0 +1,163 @@
<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:hover {}
#sim th {
text-align: left;
border: 0px solid;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.row {
margin-left:-5px;
margin-right:-5px;
}
.column {
float: left;
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: left;
padding: 16px;
}
th{
text-align: left;
padding: 16px;
background-color:gainsboro;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
<body>
<table width="100%" border="0" id="sim">
<tr>
<td width="50%"><h3>PERMODALAN KELANTAN BERHAD</h3></td>
</tr>
<tr>
<td colspan="2"><u><b>LAPORAN LELONG TEBUS</b></u></td>
</tr>
</table>
<table cellspacing="" cellpadding="5" text-align="left" border="0" height="25" align="left" id="sim">
<thead>
<br>
<tr>
<td>ID Lelong: {{$lelong_id}}</td>
@foreach ($info as $info)
<td>Tarikh Lelong: @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $info->tarikh_lelong );
$t_lelong = $myDateTime->format('d-m-Y');
echo($t_lelong);
@endphp</td>
<td>Fasa: {{$info->fasa}} </td>
@endforeach
@foreach ($arrayinfocaw as $laporancaw)
@foreach ($laporancaw['cawangan'] as $details)
<td>Cawangan : {{$details['caw_name']}}
@endforeach
@endforeach
</thead>
</table>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead>
<tr>
<th>No</th>
<th>Tarikh</th>
<th>No Rujukan</th>
<th>Nilai Marhun(RM)</th>
<th>Pinjaman(RM)</th>
<th>Keuntungan (RM)</th>
<th>Tempoh</th>
</tr>
</thead>
@foreach ($laporantebus as $laporan)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $laporan['tarikh']}}</td>
<td>{{ $laporan['norujukan'] }}</td>
<td>{{ number_format($laporan['nilaimarhun'], 2, '.', ',')}}</td>
<td>{{ number_format($laporan['pinjaman'], 2, '.', ',')}}</td>
<td>{{ number_format($laporan['upah'], 2, '.', ',')}}</td>
<td>{{$laporan['jbg']}}</td>
</tr>
@endforeach
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td><strong>{{ number_format($total_berat, 2, '.', ',') }}</strong></td>
<td><strong>{{ number_format($total_hargaasas, 2, '.', ',') }}</strong></td>
<td><strong>{{ number_format($total_hargalelong, 2, '.', ',') }}</strong></td>
<td></td>
</tr>
</table>
</tbody>
+4 -1
View File
@@ -363,6 +363,9 @@ Route::get('/laplelong/{lelong_id}/{kodcaw}',['as' =>'report.laplelong','uses'=>
Route::get('/lapbrglelpembidaindex',['as'=>'report.lapbrglelpembidaindex','uses'=>'ReportController@lapbrglelpembidaindex']);
Route::get('/lapbrglelpembida/{lelong_id}/{kodcaw}',['as'=>'report.lapbrglelpembida','uses'=>'ReportController@lapbrglelpembida']);
Route::get('/lelongtebusindex',['as'=>'report.lelongtebusindex','uses'=>'ReportController@lelongtebusindex']);
Route::get('/lelongtebus/{lelong_id}/{kodcaw}',['as'=>'report.lelongtebus','uses'=>'ReportController@lelongtebus']);
Route::get('/simulasireport/{simulasi_id}/{cawid}',['as'=>'report.simulasireport','uses'=>'ReportController@simulasireport']);
@@ -370,7 +373,7 @@ Route::get('/simulasireport/{simulasi_id}/{cawid}',['as'=>'report.simulasireport
});
//Report
//Report by cawangan
Route::group(['middleware' => ['permission:report'],'prefix'=>'reportcaw'], function () {
Route::get('laporancawindex',['as'=>'reportcaw.laporancawindex','uses'=>'ReportCawanganController@laporancawindex']);