update report
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user