Merge branch 'nisha' into 'main'

update report

See merge request online-sistem1/lelong!381
This commit is contained in:
Nur Izzati Zulkifli
2023-02-07 04:39:41 +00:00
5 changed files with 147 additions and 178 deletions
+85 -84
View File
@@ -78,82 +78,6 @@ class ReportAllController extends Controller
return view('lelongall.laporanlelongall', compact('lelong','arrayinfo'));
}
public function senaraibrglelongall(Request $request, $kali){
$kali = $kali;
$lelong = Lelong::where('kali','=',$kali)->first();
// dd($lelong);
$cawanganlel = CawanganLelong::where('kali','=',$kali)->get();
// dd($cawanganlel);
$arraycaw = [];
$total_marhun = 0;
$total_berat = 0;
$total_hargaasas = 0;
foreach($cawanganlel as $cawlel)
{
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
//$brglel = LelongBid::join('cawangan_lelong','cawangan_lelong.caw_id','=','lelongbid.caw_id')
$brglel = LelongBid:: join('cawangan_lelong', function ($join) {
$join->on('cawangan_lelong.caw_id', '=', 'lelongbid.caw_id')
->on('cawangan_lelong.lelong_id', '=', 'lelongbid.lelong_id');
})
->select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.hargaasas')
->where('cawangan_lelong.caw_id','=',$cawlel->caw_id)
->where('cawangan_lelong.lelong_id','=',$cawlel->lelong_id)
->where('cawangan_lelong.kali','=',$kali)
->get();
// dd($cawlel);
$t_lelong = Lelong::join('cawangan_lelong','cawangan_lelong.lelong_id','=','lelong.id')
->where('cawangan_lelong.lelong_id','=', $cawlel->lelong_id)
->where('cawangan_lelong.kali','=',$kali)->first();
$packet = 0;
$berat = 0;
$hargaasas = 0;
$id = $cawlel->lelong_id;
foreach($brglel as $index1=>$bid)
{
$marhun = LelongBidMarhun::where('lelongbid_id','=',$bid['id'])->get();
$berat = $berat + $bid['berat'];
$hargaasas = $hargaasas + $bid['hargaasas'];
}
array_push($arraycaw,[
'id_cawangan'=> $cawangan['id'],
'cawangan'=>$cawangan['caw_name'],
't_lelong'=>$t_lelong['tarikh_lelong'],
'bil_marhun'=>sizeof($brglel),
'berat'=>$berat,
'hargaasas'=>$hargaasas,
]);
$total_marhun = $total_marhun + sizeof($brglel);
$total_berat = $total_berat + $berat;
$total_hargaasas = $total_hargaasas + $hargaasas;
}
$pdf = PDF::loadView('pdf.listlelongall',compact('arraycaw',
'total_marhun',
'total_berat',
'total_hargaasas',
'kali'))->setPaper('a4', 'potrait');
return $pdf->download('Senarai Barang Lelong All.pdf');
}
public function lapbidaanpembidaindexall (){
@@ -273,7 +197,7 @@ class ReportAllController extends Controller
'data',
'kali'))->setPaper('a4', 'potrait');
return $pdf->download('Senarai Barang Lelong All.pdf');
return $pdf->download('Senarai Lelong Pembida By Batch.pdf');
@@ -329,13 +253,17 @@ class ReportAllController extends Controller
foreach($cawanganlel as $cawlel)
{
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
$databid = LelongBid::join('cawangan_lelong','cawangan_lelong.caw_id','=','lelongbid.caw_id')
->join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
$databid = LelongBid::join('cawangan_lelong', function ($join) {
$join->on('cawangan_lelong.caw_id', '=', 'lelongbid.caw_id')
->on('cawangan_lelong.lelong_id', '=', 'lelongbid.lelong_id');
})
//->join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
->select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun',
'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah')
->where('lelongbidder.status_bidder','=','1')
//->where('lelongbidder.status_bidder','=','1')
->where('cawangan_lelong.caw_id','=', $cawlel->caw_id)
->where('cawangan_lelong.lelong_id','=', $cawlel->lelong_id)
->where('cawangan_lelong.kali','=',$kali)
->get();
$t_lelong = Lelong::join('cawangan_lelong','cawangan_lelong.lelong_id','=','lelong.id')
@@ -541,14 +469,87 @@ class ReportAllController extends Controller
->setPaper('a4','potrait');
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
}
public function senaraibrglelongall(Request $request, $kali){
$kali = $kali;
$lelong = Lelong::where('kali','=',$kali)->first();
// dd($lelong);
$cawanganlel = CawanganLelong::where('kali','=',$kali)->get();
// dd($cawanganlel);
$arraycaw = [];
$total_marhun = 0;
$total_berat = 0;
$total_hargaasas = 0;
foreach($cawanganlel as $cawlel)
{
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
//$brglel = LelongBid::join('cawangan_lelong','cawangan_lelong.caw_id','=','lelongbid.caw_id')
$brglel = LelongBid:: join('cawangan_lelong', function ($join) {
$join->on('cawangan_lelong.caw_id', '=', 'lelongbid.caw_id')
->on('cawangan_lelong.lelong_id', '=', 'lelongbid.lelong_id');
})
->select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.hargaasas')
->where('cawangan_lelong.caw_id','=',$cawlel->caw_id)
->where('cawangan_lelong.lelong_id','=',$cawlel->lelong_id)
->where('cawangan_lelong.kali','=',$kali)
->get();
// dd($cawlel);
$t_lelong = Lelong::join('cawangan_lelong','cawangan_lelong.lelong_id','=','lelong.id')
->where('cawangan_lelong.lelong_id','=', $cawlel->lelong_id)
->where('cawangan_lelong.kali','=',$kali)->first();
$packet = 0;
$berat = 0;
$hargaasas = 0;
$id = $cawlel->lelong_id;
foreach($brglel as $index1=>$bid)
{
$marhun = LelongBidMarhun::where('lelongbid_id','=',$bid['id'])->get();
$berat = $berat + $bid['berat'];
$hargaasas = $hargaasas + $bid['hargaasas'];
}
array_push($arraycaw,[
'id_cawangan'=> $cawangan['id'],
'cawangan'=>$cawangan['caw_name'],
't_lelong'=>$t_lelong['tarikh_lelong'],
'bil_marhun'=>sizeof($brglel),
'berat'=>$berat,
'hargaasas'=>$hargaasas,
]);
$total_marhun = $total_marhun + sizeof($brglel);
$total_berat = $total_berat + $berat;
$total_hargaasas = $total_hargaasas + $hargaasas;
}
$pdf = PDF::loadView('pdf.listlelongall',compact('arraycaw',
'total_marhun',
'total_berat',
'total_hargaasas',
'kali'))->setPaper('a4', 'potrait');
return $pdf->download('Senarai Barang Lelong All.pdf');
}
+30 -66
View File
@@ -144,8 +144,6 @@ class ReportController extends Controller
return view('lelong.brgleldetails', compact('arraydetails'));
}
public function senaraibrglelongdetails ($lelong_id, $kodcaw){
$lelongs= LelongBid::where('lelong_id','=',$lelong_id)
@@ -1013,51 +1011,6 @@ class ReportController extends Controller
return view('marhun.ubahmarhun', compact('cawangan','lelong_id','getpengesahan'));
}
public function lapubahmarhunlelongindexpdf ($lelong_id, $kodcaw, $t_lelong){
$cawangan = Pengesahan::where('pengesahan.lelong_id', $lelong_id)
->where('pengesahan.status', 1)
->where('pengesahan.norujukan', 'LIKE', '%'.$kodcaw.'%')
->whereNotNull('pengesahan.disahkan_oleh')
->select('pengesahan.lelongbid_id','pengesahan.diminta_oleh','pengesahan.disahkan_oleh', 'pengesahan.disahkan_pada', 'pengesahan.norujukan', 'pengesahan.lelong_id')
->orderBy('pengesahan.lelongbid_id')
->distinct()
->get();
foreach($cawangan as $index1=>$caw)
{
$getpengesahan = Cawangan::where('caw_code', $kodcaw)->first();
$getdisahkanoleh = User::where('id', $caw['disahkan_oleh'])->first();
$getdimintaoleh = User::where('id', $caw['diminta_oleh'])->first();
$status = Pengesahan::where('lelongbid_id', $caw['lelongbid_id'])
->select('id as sahid','status_ubah', 'request_karat', 'request_berat', 'request_marhun')
->get();
$marhuns = LelongBidMarhun::where('lelongbid_id', $caw['lelongbid_id'])
->get()
->toArray();
$cawangan[$index1]['namacaw'] = $getpengesahan['caw_name'];
$cawangan[$index1]['disahkan_oleh'] = $getdisahkanoleh['name'];
$cawangan[$index1]['diminta_oleh'] = $getdimintaoleh['name'];
$cawangan[$index1]['detailmarhun']=$status;
$cawangan[$index1]['detail']=$marhuns;
}
$getpengesahan = Cawangan::where('caw_code', $kodcaw)->first();
// return view('pdf.laporanubahmarhun', compact('cawangan','lelong_id','getpengesahan','t_lelong'));
$pdf = PDF::loadView('pdf.laporanubahmarhun',compact('cawangan','lelong_id','getpengesahan','t_lelong'))
->setPaper('a4', 'potrait');
return $pdf->download('Senarai Ubah Marhun.pdf');
}
public function exportubahmarhun (){
$arraydetails = [];
@@ -1218,7 +1171,10 @@ class ReportController extends Controller
$arraydetails = [];
$total_berat = 0;
$total_hargaasas = 0;
$t_mula = $request->datemula;
$t_hingga = $request->datehingga;
$cawangan_id = $request->caw;
if($request->datemula == null){
@@ -1235,30 +1191,38 @@ class ReportController extends Controller
$hingga_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
}
$cawangan = Cawangan::where('cawangan.id',$cawangan_id)
->join('cawangan_lelong','cawangan.id','=','cawangan_lelong.caw_id')
->join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('lelongbid','cawangan.caw_code','=','lelongbid.kodcaw')
->where([['tarikh_lelong','>=',$request->datemula],['tarikh_lelong','<=',$request->datehingga]])
->select('norujukan','marhun','berat','hargaasas','cawangan_lelong.lelong_id','lelongbid.id','cawangan.caw_code')
->get()->toArray();
// $cawangan = Cawangan::join('cawangan_lelong','cawangan_lelong.caw_id','=','cawangan.id')
// ->join('lelong','lelong.id','=','cawangan_lelong.lelong_id')
// ->join('lelongbid','cawangan.caw_code','=','lelongbid.kodcaw')
// ->where('lelong.tarikh_lelong','>=',$t_mula)
// ->where('lelong.tarikh_lelong','<=',$t_hingga)
// ->where('cawangan_lelong.caw_id',$cawangan_id)
// ->select('cawangan.id','cawangan_lelong.lelong_id','cawangan.caw_code','lelongbid.norujukan','lelongbid.marhun','lelongbid.berat','lelongbid.hargaasas','lelong.tarikh_lelong','lelongbid.lelong_id')
// ->get()->toArray();
$namacaw = Cawangan::where('id',$cawangan_id)
->select('caw_name')
->get();
$cawangan = LelongBid::join('lelong','lelong.id','=','lelongbid.lelong_id')
->where('lelong.tarikh_lelong','>=',$t_mula)
->where('lelong.tarikh_lelong','<=',$t_hingga)
->where('lelongbid.caw_id',$cawangan_id)
->select('lelongbid.lelong_id','lelongbid.norujukan','lelongbid.marhun','lelongbid.berat','lelongbid.hargaasas','lelong.tarikh_lelong')
->get()->toArray();
//dd($cawangan);
foreach($cawangan as $index1=>$brglelong){
$data = LelongBid::where('id','=',$brglelong['id'])
->where('kodcaw','=',$brglelong['caw_code'])
->get();
$total_berat = $total_berat + ($data->sum('berat'));
$total_hargaasas = $total_hargaasas + ($data->sum('hargaasas'));
// $data = LelongBid::where('id','=',$brglelong['id'])
// ->where('kodcaw','=',$brglelong['caw_code'])
// ->select('norujukan','marhun','berat','hargaasas','id')
// ->get();
$total_berat = $total_berat + $brglelong['berat'];
$total_hargaasas = $total_hargaasas + $brglelong['hargaasas'];
}
// dd($total_berat);
return view('pdf.cetakbdbrglelong',compact('cawangan','total_berat','total_hargaasas'));
return view('pdf.cetakbdbrglelong',compact('cawangan','total_berat','total_hargaasas','namacaw','t_mula','t_hingga'));
}
+23 -19
View File
@@ -89,21 +89,19 @@ tr:nth-child(even) {
<table cellspacing="" cellpadding="5" text-align="left" border="0" height="25" align="left" id="sim">
<thead>
<br>
{{-- <tr>
@foreach ($arrayinfo as $laporan)
<td>Batch Lelong : {{$laporan['laporan']['lelong_id']}}</td>
<td>Tarikh Lelong : @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $laporan['laporan']['tarikh_lelong'] );
$t_lelong = $myDateTime->format('d-m-Y');
echo($t_lelong);
@endphp</td>
<td>Fasa : {{$laporan['laporan']['fasa']}}</td>
@foreach ($laporan['details'] as $details)
<td>Cawangan : {{$details['caw_name']}}
@endforeach
<tr>
@foreach ($namacaw as $item)
<td>Cawangan : {{$item->caw_name}}</td>
@endforeach
</tr> --}}
</tr>
@php
$tarikh_mula = date('d-m-Y', strtotime($t_mula));
$tarikh_hingga = date('d-m-Y', strtotime($t_hingga));
@endphp
<tr>
<td>Tarikh Lelong : {{ $tarikh_mula }} Hingga {{ $tarikh_hingga }}</td>
</tr>
</thead>
</table>
@@ -114,6 +112,8 @@ tr:nth-child(even) {
<thead>
<tr>
<th width="5%" align="left">No</th>
<th width="10%" align="left">Lelong ID</th>
<th width="10%" align="left">Tarikh Lelong</th>
<th width="25%" align="left">No Rujukan</th>
<th width="25%" align="left">Marhun</th>
<th width="25%" align="left">Berat (gm)</th>
@@ -124,16 +124,20 @@ tr:nth-child(even) {
@foreach ($cawangan as $item)
<tr>
<td>{{ $loop->iteration }} </td>
<td>{{ $item['lelong_id'] }}</td>
@php
$t_lelong = date('d-m-Y', strtotime($item['tarikh_lelong']));
@endphp
<td>{{ $t_lelong }}</td>
<td>{{ $item['norujukan'] }}</td>
<td>{{ $item['marhun'] }}</td>
<td>{{ $item['berat'] }}</td>
<td>{{ $item['hargaasas'] }}</td>
<td>{{ $item['marhun'] }}</td>
<td>{{ $item['berat'] }}</td>
<td>{{ $item['hargaasas'] }}</td>
</tr>
@endforeach
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td colspan="5" 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></td>
@@ -75,8 +75,8 @@ tr:nth-child(even) {
/** Define now the real margins of every page in the PDF **/
body {
margin-top: 1cm;
/* margin-left: 2cm; */
/* margin-right: 2cm; */
/*margin-left: 0cm;
margin-right: 1cm; */
margin-bottom: 2cm;
}
@@ -134,7 +134,7 @@ tr:nth-child(even) {
<th>Tempoh</th>
<th>Berat(gm)</th>
<th>Nilai Marhun (RM)</th>
<th>Pembiayaan Asal (RM)</th>
<!-- <th>Pembiayaan Asal (RM)</th> -->
<th>Baki Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Keuntungan Telah Bayar (RM)</th>
@@ -146,7 +146,7 @@ tr:nth-child(even) {
@foreach ($marhuns as $index=> $marhun)
<tr>
<td>{{$loop->iteration}}</td>
<td style='word-wrap' align="left">{{ $marhun['nama']['nama']}}</td>
<td style='word-wrap' align='left'>{{ $marhun['nama']['nama']}}</td>
<td style='word-wrap'>{{ $marhun['nokp']}}</td>
<td style='white-space:nowrap;'>@foreach ($marhun['listsag'] as $item)
{{-- {{$loop->iteration}}.{{ $item['norujukan'] }}<br> --}}
@@ -176,7 +176,7 @@ tr:nth-child(even) {
<strong>{{ number_format($jumnilaimarhun, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
<!-- <td align = 'right'>
@php $jumpinjasal = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
@@ -186,7 +186,7 @@ tr:nth-child(even) {
@endforeach
<strong>{{ number_format($jumpinjasal, 2, '.', ',') }}</strong>
</td>
</td> -->
<td align = 'right'>
@php $jumpinjaman = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@@ -39,7 +39,7 @@
<th>Tempoh</th>
<th>Berat Asal(gm)</th>
<th>Nilai Marhun Asal(RM)</th>
<th>Pembiayaan Asal (RM)</th>
<!-- <th>Pembiayaan Asal (RM)</th> -->
<th>Baki Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Keuntungan Telah Bayar (RM)</th>
@@ -86,7 +86,7 @@
<strong>{{ number_format($jumnilaimarhun, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
<!-- <td align = 'right'>
@php $jumpinjasal = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
@@ -96,7 +96,7 @@
@endforeach
<strong>{{ number_format($jumpinjasal, 2, '.', ',') }}</strong>
</td>
</td> -->
<td align = 'right'>
@php $jumpinjaman = 0;@endphp
@foreach ($marhun['listsag'] as $item)