update laporan by cawangan
This commit is contained in:
@@ -105,6 +105,289 @@ class ReportCawanganController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function indexbrgleldetailscaw(request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('lelong.indexbrgleldetailscaw',compact('lelongid'));
|
||||
}
|
||||
|
||||
public function laporanbrgleldetailscaw($lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
|
||||
$lelongs= LelongBid::where('lelong_id','=',$lelong_id)
|
||||
->where('kodcaw','=',$user['kodcaw'])
|
||||
->get()->toArray();
|
||||
|
||||
$arraycaw= [];
|
||||
|
||||
$total_berat = 0;
|
||||
$berat = 0;
|
||||
|
||||
$total_harga = 0;
|
||||
$harga = 0;
|
||||
|
||||
$total_nmarhun = 0;
|
||||
$nilai_marhun = 0;
|
||||
|
||||
$total_hargaasas = 0;
|
||||
$hargaasas = 0;
|
||||
|
||||
foreach($lelongs as $index1=>$lelong){
|
||||
|
||||
$marhun= LelongBidMarhun::where('lelongbid_id','=',$lelong['id'])
|
||||
// ->where('kodcaw','=',$user['kodcaw'])
|
||||
->get();
|
||||
|
||||
$total_berat = $total_berat + ($marhun->sum('berat'));
|
||||
$total_harga = $total_harga + ($marhun->sum('harga'));
|
||||
$total_nmarhun = $total_nmarhun + ($marhun->sum('n_marhun'));
|
||||
$total_hargaasas = $total_hargaasas + ($marhun->sum('hargaasas'));
|
||||
|
||||
$lelongs[$index1]['detailmarhun']=$marhun;
|
||||
|
||||
}
|
||||
|
||||
array_push($arraycaw,[
|
||||
'berat'=>$berat,
|
||||
'harga'=>$harga,
|
||||
'n_marhun'=>$nilai_marhun,
|
||||
'hargaasas'=>$hargaasas
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.laporanbrgleldetailscaw',compact('lelongs','arraycaw','total_nmarhun','total_berat','total_harga','total_hargaasas'
|
||||
))->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Senarai Lelong Details.pdf');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function indexnamapembidacaw(){
|
||||
$user = Auth::user();
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('lelong.indexnamapembidacaw',compact('lelongid'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function laporannamapembidacaw($lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
|
||||
|
||||
$arraydetails = [];
|
||||
$arrayinfocaw = [];
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->select('lelong_id','tarikh_lelong')
|
||||
->groupBy('lelong_id')
|
||||
->get();
|
||||
|
||||
foreach($lelongid as $laporancaw)
|
||||
{
|
||||
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporancaw['lelong_id'])
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
||||
}
|
||||
|
||||
|
||||
$laporanpembida= LelongBid::join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->select('lelongbid_id','norujukan','hargaasas')
|
||||
->where('lelongbid.lelong_id','=',$lelong_id)
|
||||
->groupBy('lelongbid_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
|
||||
foreach($laporanpembida as $laporan)
|
||||
{
|
||||
$details = LelongBidder::where('lelongbid_id',$laporan['lelongbid_id'])
|
||||
->orderBy('hargabida','desc')
|
||||
->orderBy('masa_bidaan','asc')
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arraydetails,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
|
||||
$pdf = PDF::loadView('pdf.laporannamapembidacaw', compact('lelongid','arraydetails','lelong_id','lelongid','cawangan','arrayinfocaw'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Senarai Nama Bidaan Pembida.pdf');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function indexlelfullcaw (){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('lelong.indexlelfullcaw',compact('lelongid'));
|
||||
|
||||
}
|
||||
|
||||
public function laporanlelfullcaw($lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
|
||||
$total_nmarhun = 0;
|
||||
$total_pembiayaan = 0;
|
||||
$total_upahsimpan = 0;
|
||||
$total_cajlelong = 0;
|
||||
$total_hargalelong = 0;
|
||||
$total_bakirugi = 0;
|
||||
$total_hargaasas = 0;
|
||||
$arrayinfocaw = [];
|
||||
|
||||
$info = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
||||
->select('lelong_id','tarikh_lelong')
|
||||
->groupBy('lelong_id')
|
||||
->get();
|
||||
|
||||
foreach($info as $laporancaw)
|
||||
{
|
||||
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporancaw['lelong_id'])
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
||||
}
|
||||
|
||||
$laporanlelong= LelongBid::join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id','=',$lelong_id)
|
||||
->where('lelongbidder.status_bidder','=','1')
|
||||
->select('lelongbid.norujukan','lelongbid.nilaimarhun','lelongbid.pinjaman','lelongbid.upahsimpan',
|
||||
'lelongbid.cajlelong','lelongbidder.hargabida','lelongbid.baki','lelongbid.hargaasas','lelongbidder.nama_bidder')
|
||||
->get()->toArray();
|
||||
|
||||
foreach($laporanlelong as $index1=>$laplelong)
|
||||
{
|
||||
|
||||
$total_nmarhun = $total_nmarhun + $laplelong['nilaimarhun'];
|
||||
$total_pembiayaan = $total_pembiayaan + $laplelong['pinjaman'];
|
||||
$total_upahsimpan = $total_upahsimpan + $laplelong['upahsimpan'];
|
||||
$total_cajlelong = $total_cajlelong + $laplelong['cajlelong'];
|
||||
$total_hargalelong = $total_hargalelong + $laplelong['hargabida'];
|
||||
$total_bakirugi = $total_bakirugi + $laplelong['baki'];
|
||||
$total_hargaasas = $total_hargaasas + $laplelong['hargaasas'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.laporanlelfullcaw',compact('info','lelong_id','laporanlelong','lelong_id','total_nmarhun','total_pembiayaan',
|
||||
'total_upahsimpan','total_cajlelong','total_hargalelong','total_bakirugi','total_hargaasas','arrayinfocaw'))
|
||||
|
||||
->setPaper('a4', 'potrait');
|
||||
return $pdf->download('Laporan Lelong Keseluruhan.pdf');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function indexbrglelpembidacaw(){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('lelong.indexbrglelpembidacaw',compact('lelongid'));
|
||||
|
||||
}
|
||||
|
||||
public function laporanbrglelpembidacaw($lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
|
||||
$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_lelong.lelong_id','=',$lelong_id)
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->select('lelong_id','tarikh_lelong')
|
||||
->groupBy('lelong_id')
|
||||
->get();
|
||||
|
||||
foreach($info as $laporancaw)
|
||||
{
|
||||
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporancaw['lelong_id'])
|
||||
->where('cawangan.caw_code','=',$user['kodcaw'])
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
||||
}
|
||||
|
||||
$brglelpembida = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->where('gadai.kodcaw','=',$user['kodcaw'])
|
||||
->where('lelongbid.lelong_id','=',$lelong_id)
|
||||
->where('lelongbidder.status_bidder','=','1')
|
||||
->get()->toArray();
|
||||
|
||||
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.laporanbrglelpembidacaw',compact('lelong_id','info','brglelpembida','total_berat','total_hargaasas','total_hargalelong','arrayinfocaw'))
|
||||
->setPaper('a4','potrait');
|
||||
|
||||
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user