update report using relation, fix error jana notis 30 hari
This commit is contained in:
@@ -81,7 +81,6 @@ class ReportCawanganController extends Controller
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
||||
->get()->toArray();
|
||||
// dd($brglelongcaw);
|
||||
|
||||
$keuntungan=0;
|
||||
$total_hargaasas = 0;
|
||||
|
||||
@@ -89,23 +89,12 @@ class ReportController extends Controller
|
||||
$arrayinfo = [];
|
||||
|
||||
|
||||
$lelongid = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
||||
->where('cawangan.caw_code', $kodcaw)
|
||||
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
||||
->groupBy('lelong_id')
|
||||
->get()->toArray();
|
||||
$test = Lelong::with(['cawangan','lelongBid'])
|
||||
->find($lelong_id);
|
||||
|
||||
foreach($lelongid as $laporan)
|
||||
{
|
||||
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporan['lelong_id'])
|
||||
->where('cawangan.caw_code', $kodcaw)
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
$cawangan = $test->cawangan;
|
||||
$lelong_bid = $test->lelongBid;
|
||||
|
||||
|
||||
|
||||
$keuntungan=0;
|
||||
@@ -113,39 +102,14 @@ class ReportController extends Controller
|
||||
$total_berat = 0;
|
||||
|
||||
|
||||
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong_id','=',$lelong_id)
|
||||
->where('lelongbid.kodcaw', $kodcaw);
|
||||
|
||||
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
|
||||
$datasimulasi = $marhun->get();
|
||||
|
||||
foreach($datasimulasi as $index=>$totharga){
|
||||
$total_hargaasas = $lelong_bid->sum('hargaasas');
|
||||
$total_berat = $lelong_bid->sum('berat');
|
||||
|
||||
$total_hargaasas = $total_hargaasas + $totharga['hargaasas'];
|
||||
$total_berat = $total_berat + $totharga['berat'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
$marhuns = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
|
||||
foreach($marhuns as $index1=>$upah)
|
||||
{
|
||||
|
||||
$listsag = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->where('nokp','=',$upah['nokp'])
|
||||
->get();
|
||||
|
||||
|
||||
}
|
||||
$marhuns[$index1]['listsag'] = $listsag;
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.listlelong',compact('arrayinfo','marhuns','lelong_id','keuntungan','total_hargaasas',
|
||||
'total_berat','datasimulasi'))
|
||||
$pdf = PDF::loadView('pdf.listlelong',compact('cawangan','lelong_bid','total_hargaasas','total_berat'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Senarai Barang Lelong.pdf');
|
||||
|
||||
@@ -31,6 +31,8 @@ use App\Models\CawanganLelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\Customer;
|
||||
|
||||
|
||||
use DateTime;
|
||||
|
||||
@@ -282,15 +284,28 @@ class TamatKontController extends Controller
|
||||
|
||||
foreach($getsurat as $index1=>$surats)
|
||||
{
|
||||
$senarai = Gadai::on($user->kodcaw)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
|
||||
$customer = Customer::where('kpbaru','=',$surats['nokp'])
|
||||
->orWhere('kplama','=',$surats['nokp'])
|
||||
->get();
|
||||
|
||||
$listsag = Gadai::on($user->kodcaw)
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
|
||||
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
|
||||
|
||||
// foreach($listsag as $index=>$listing){
|
||||
|
||||
// $bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
|
||||
|
||||
// }
|
||||
|
||||
// $ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
|
||||
|
||||
$getsurat[$index1]['list_norujukan'] = $senarai;
|
||||
$getsurat[$index1]['nama'] = $customer;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
|
||||
}
|
||||
@@ -303,7 +318,8 @@ class TamatKontController extends Controller
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'));
|
||||
'ktlhbyr'
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user