update function simulasi rekod
This commit is contained in:
@@ -999,6 +999,7 @@ class LelongController extends Controller
|
||||
'lelongbid.bakiupah',
|
||||
'lelongbid.status_jual',
|
||||
'lelongbid.jbg',
|
||||
'gadai.pinjaman as pinjasal',
|
||||
'gadai.bakipjm',
|
||||
'gadai.bakihargajualan',
|
||||
'gadai.upah12',
|
||||
@@ -1006,9 +1007,11 @@ class LelongController extends Controller
|
||||
'gadai.tempoh',
|
||||
'gadai.tempohbayar',
|
||||
'gadai.kadarupah',
|
||||
'gadai.nokp'
|
||||
'gadai.nokp',
|
||||
'gadai.bakiupah as upah6bulan'
|
||||
)
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
|
||||
@@ -1017,6 +1020,10 @@ class LelongController extends Controller
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
->first();
|
||||
|
||||
$ktlhbyr = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('bayaran_keuntungan');
|
||||
// dd($ktlhbyr);
|
||||
$marhuns[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
|
||||
$keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
|
||||
$marhuns[$index1]['keuntungan'] = bcdiv($keuntungan,1,1);
|
||||
$marhuns[$index1]['nama'] = $customer;
|
||||
@@ -2635,6 +2642,49 @@ class LelongController extends Controller
|
||||
->with('success','Create Lelong Berjaya');
|
||||
|
||||
}
|
||||
public function listsagbycust($lelongid, $cawid)
|
||||
{
|
||||
$keuntungan = 0;
|
||||
|
||||
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->where('lelong_id','=',$lelongid)
|
||||
->where('caw_id','=',$cawid)
|
||||
->groupBy('gadai.nokp')
|
||||
->select('gadai.nokp')
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
$customer = Customer::on('mysql2')
|
||||
->where('kpbaru','=',$cal['nokp'])
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
->first();
|
||||
|
||||
$listsag = LelongBid::join('gadai', 'gadai.norujukan','=','lelongbid.norujukan')
|
||||
->where('gadai.nokp','=',$cal['nokp'])
|
||||
->select('lelongbid.bakiupah', 'gadai.bakiupah as 6bulan','lelongbid.norujukan','lelongbid.nilaimarhun','lelongbid.berat','lelongbid.hargaasas','lelongbid.pinjaman','gadai.pinjaman as pinjasal','gadai.tempoh' )
|
||||
->get();
|
||||
// dd($listsag);
|
||||
foreach($listsag as $index=>$listing){
|
||||
$ktlhbyr = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
// dd($ktlhbyr);
|
||||
$listsag[$index]['ktlhbyr'] = $ktlhbyr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $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;
|
||||
$marhuns[$index1]['listsag'] = $listsag;
|
||||
// $marhuns[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
// dd($total_untung_asal);
|
||||
|
||||
|
||||
}
|
||||
return view('lelong.listsagbycust',compact('marhuns','lelongid','cawid','listsag','ktlhbyr'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user