Merge branch 'amirah' into 'main'
update laporan lelong pembida by batch See merge request online-sistem1/lelong!366
This commit is contained in:
@@ -178,66 +178,82 @@ class ReportAllController extends Controller
|
||||
|
||||
$kali = $kali;
|
||||
$lelong = Lelong::where('kali','=',$kali)->first();
|
||||
// dd($lelong);
|
||||
|
||||
$cawanganlel = CawanganLelong::where('kali','=',$kali)->get();
|
||||
// dd($cawanganlel);
|
||||
|
||||
|
||||
$arraycaw = [];
|
||||
|
||||
$total_marhun = 0;
|
||||
$arraycaw = [];
|
||||
$total_hargaasas = 0;
|
||||
$total_marhun = 0;
|
||||
$total_berat = 0;
|
||||
$total_hargaasas = 0;
|
||||
$total_hargabida = 0;
|
||||
|
||||
$total_hargajual = 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')
|
||||
->join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.hargaasas','lelongbidder.hargabida','lelongbidder.status_bidder')
|
||||
->where('cawangan_lelong.caw_id','=',$cawlel->caw_id)
|
||||
->where('cawangan_lelong.lelong_id','=',$cawlel->lelong_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','cawangan_lelong.kali','lelongbid.hargajual')
|
||||
->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')
|
||||
->where('cawangan_lelong.lelong_id','=', $cawlel->lelong_id)
|
||||
->where('cawangan_lelong.kali','=',$kali)->first();
|
||||
|
||||
|
||||
|
||||
$packet = 0;
|
||||
$berat = 0;
|
||||
$berat = 0;
|
||||
$hargaasas = 0;
|
||||
$hargabida = 0;
|
||||
$hargajual = 0;
|
||||
|
||||
$id = $cawlel->lelong_id;
|
||||
|
||||
foreach($brglel as $index1=>$bid)
|
||||
|
||||
|
||||
foreach($databid as $index1=>$bid)
|
||||
{
|
||||
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$bid['id'])->get();
|
||||
$berat = $berat + $bid['berat'];
|
||||
|
||||
$hargaasas = $hargaasas + $bid['hargaasas'];
|
||||
$hargabida = $hargabida + $bid['hargabida'];
|
||||
|
||||
$hargajual = $hargajual + $bid['hargajual'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
array_push($arraycaw,[
|
||||
'id_cawangan'=> $cawangan['id'],
|
||||
'cawangan'=>$cawangan['caw_name'],
|
||||
't_lelong'=>$lelong['tarikh_lelong'],
|
||||
't_lelong'=>$t_lelong['tarikh_lelong'],
|
||||
'bil_marhun'=>sizeof($brglel),
|
||||
'bil_marhun'=>sizeof($databid),
|
||||
'berat'=>$berat,
|
||||
'hargaasas'=>$hargaasas,
|
||||
'hargabida'=>$hargabida,
|
||||
|
||||
'hargajual'=>$hargajual,
|
||||
]);
|
||||
|
||||
$total_marhun = $total_marhun + sizeof($brglel);
|
||||
$total_berat = $total_berat + $berat;
|
||||
|
||||
$total_marhun = $total_marhun + sizeof($databid);
|
||||
$total_berat = $total_berat + $berat;
|
||||
$total_hargaasas = $total_hargaasas + $hargaasas;
|
||||
$total_hargabida = $total_hargabida + $hargabida;
|
||||
$total_hargajual = $total_hargajual + $hargajual;
|
||||
|
||||
|
||||
|
||||
$data = Lelong::where('kali','=',$kali)
|
||||
->first();
|
||||
// dd($data);
|
||||
|
||||
}
|
||||
|
||||
@@ -245,15 +261,17 @@ class ReportAllController extends Controller
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.pdfsenarailapbidaanall',compact('arraycaw',
|
||||
'total_marhun',
|
||||
'total_berat',
|
||||
'total_hargaasas',
|
||||
'total_hargabida',
|
||||
'kali'))->setPaper('a4', 'potrait');
|
||||
'total_marhun',
|
||||
'total_berat',
|
||||
'total_hargaasas',
|
||||
'total_hargajual',
|
||||
'data',
|
||||
'kali'))->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Senarai Barang Lelong All.pdf');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -102,29 +102,28 @@ tr:nth-child(even) {
|
||||
</thead>
|
||||
|
||||
@foreach ($arraycaw as $index=>$caw)
|
||||
<tr>
|
||||
<td>{{$index+1}}</td>
|
||||
<td>@php
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $caw['t_lelong'] );
|
||||
$t_lelong = $myDateTime->format('d-m-Y');
|
||||
echo($t_lelong);
|
||||
@endphp</td>
|
||||
<td>{{ $caw['cawangan'] }}</td>
|
||||
<td>{{ $caw['bil_marhun'] }}</td>
|
||||
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($caw['hargabida'], 2, '.', ',') }}</td>
|
||||
<tr>
|
||||
<td>{{$index+1}}</td>
|
||||
<td style='white-space:nowrap;'>@php
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $caw['t_lelong'] );
|
||||
$t_lelong = $myDateTime->format('d-m-Y');
|
||||
echo($t_lelong);
|
||||
@endphp</td>
|
||||
<td>{{ $caw['cawangan'] }}</td>
|
||||
<td>{{ $caw['bil_marhun'] }}</td>
|
||||
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($caw['hargajual'], 2, '.', ',') }}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr>
|
||||
<td colspan="3"><b>JUMLAH KESELURUHAN</b></td>
|
||||
<td>{{ $total_marhun }}</td>
|
||||
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($total_hargabida, 2, '.', ',') }}</td>
|
||||
<td>{{ number_format($total_hargajual, 2, '.', ',') }}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user