migratation table tangguhlelong, laporan lelongtebus

This commit is contained in:
Amirah22
2022-08-03 11:14:14 +08:00
parent e05a4b4613
commit a42e4296c1
6 changed files with 338 additions and 1 deletions
+80
View File
@@ -31,6 +31,8 @@ use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use App\Models\Resit;
use App\Models\Customer;
use App\Models\LelongTebus;
use Carbon\Carbon;
@@ -503,6 +505,84 @@ class ReportController extends Controller
}
Public function lelongtebusindex (){
$arraydetails = [];
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('lelong_tebus','lelong.id','=','lelong_tebus.batch_no')
->select('lelong.id','lelong_id','tarikh_lelong','lelong.fasa','lelong_tebus.batch_no')
->distinct()
->orderBy('batch_no')
->get()
->toArray();
// dd($lelongid);
foreach($lelongid as $laporan){
$details = CawanganLelong ::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('lelong_id',$laporan['id'])
->distinct()
->orderBy('lelong_id')
->get()
->toArray();
array_push($arraydetails, ['laporan' =>$laporan,'details' =>$details]);
}
return view ('lelong.lelongtebusindex',compact('lelongid','arraydetails'));
}
Public function lelongtebus ($lelong_id, $kodcaw){
$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.caw_code',$kodcaw)
->where('cawangan_lelong.lelong_id','=',$lelong_id)
->select('lelong_id','tarikh_lelong','lelong.fasa')
->groupBy('lelong_id')
->get();
foreach($info as $laporancaw)
{
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('cawangan.caw_code',$kodcaw)
->where('lelong_id',$laporancaw['lelong_id'])
->get()
->toArray();
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
}
// dd($arrayinfocaw);
$laporantebus = LelongTebus::where('kodcaw',$kodcaw)
->get()->toArray();
// dd($laporantebus);
// 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.pdflelongtebus',compact('lelong_id','info','laporantebus','total_berat','total_hargaasas','total_hargalelong','arrayinfocaw'))
->setPaper('a4','potrait');
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
}
Public function simulasireport ($simulasi_id, $cawid){
$keuntungan = 0;