update, simulasi pdf, lelong pdf, simulasi by caw pdf
This commit is contained in:
@@ -30,6 +30,8 @@ use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use App\Models\Customer;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ReportController extends Controller
|
||||
@@ -501,6 +503,86 @@ class ReportController extends Controller
|
||||
}
|
||||
|
||||
|
||||
Public function simulasireport ($simulasi_id, $cawid){
|
||||
|
||||
$keuntungan = 0;
|
||||
|
||||
$marhuns = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
|
||||
// ->join('gadai','simulasibid.norujukan','=','gadai.norujukan')
|
||||
->where('simulasi_id','=',$simulasi_id)
|
||||
->where('caw_id','=',$cawid)
|
||||
->select(
|
||||
'simulasibid.t_lelong',
|
||||
'simulasibid.kodcaw',
|
||||
'cawangan.caw_name',
|
||||
'simulasibid.norujukan',
|
||||
'simulasibid.pinjaman',
|
||||
'simulasibid.berat',
|
||||
'simulasibid.nilaimarhun',
|
||||
'simulasibid.hargaasas',
|
||||
'simulasibid.bakiupah',
|
||||
'simulasibid.cajlelong',
|
||||
'simulasibid.baki',
|
||||
'simulasibid.status_jual',
|
||||
'simulasibid.jbg'
|
||||
// 'gadai.bakipjm',
|
||||
// 'gadai.bakihargajualan',
|
||||
// 'gadai.upah12',
|
||||
// 'gadai.ansakhir',
|
||||
// 'gadai.tempoh',
|
||||
// 'gadai.tempohbayar',
|
||||
// 'gadai.kadarupah',
|
||||
// 'gadai.nokp'
|
||||
|
||||
)
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
$arraymarhun = [];
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
// dd($cal);
|
||||
$gadai = Gadai::on($cal['kodcaw'])
|
||||
->where('norujukan','=',$cal['norujukan'])
|
||||
->first();
|
||||
// dd($gadai);
|
||||
$customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
||||
->orWhere('kplama','=',$gadai['nokp'])
|
||||
->first();
|
||||
// dd($customer);
|
||||
|
||||
// $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
|
||||
$marhuns[$index1]['keuntungan'] = $keuntungan;
|
||||
$marhuns[$index1]['nama'] = $customer;
|
||||
|
||||
array_push($arraymarhun,[
|
||||
'norujukan' => $cal['norujukan'],
|
||||
'tempoh' => $gadai['tempoh'],
|
||||
'nama' => $customer['nama'],
|
||||
'berat' => $cal['berat'],
|
||||
'nilaimarhun' => $cal['nilaimarhun'],
|
||||
'hargaasas' => $cal['hargaasas'],
|
||||
'pinjaman' => $cal['pinjaman'],
|
||||
'bakiupah' => $cal['bakiupah'],
|
||||
'cajlelong' => $cal['cajlelong'],
|
||||
'baki' => $cal['baki'],
|
||||
]);
|
||||
|
||||
|
||||
$datacaw = Cawangan::where('id','=',$cawid)
|
||||
|
||||
->get();
|
||||
}
|
||||
|
||||
$pdf = PDF::loadView('pdf.pdfsimulasireport',compact('arraymarhun','marhuns','simulasi_id','cawid','keuntungan','datacaw'))
|
||||
->setPaper('a4','potrait');
|
||||
|
||||
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user