update lelong dan simulasi
This commit is contained in:
@@ -360,16 +360,16 @@ class LelongController extends Controller
|
||||
]);
|
||||
|
||||
|
||||
if($lelongbid->save())
|
||||
{
|
||||
$updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
$updategadai->taglel = 1;
|
||||
$updategadai->save();
|
||||
// if($lelongbid->save())
|
||||
// {
|
||||
// $updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
// $updategadai->taglel = 1;
|
||||
// $updategadai->save();
|
||||
|
||||
|
||||
// $hapussimulasi = SimulasiBid::where('norujukan','=',$data->norujukan)->first();
|
||||
// $hapussimulasi->delete();
|
||||
}
|
||||
// // $hapussimulasi = SimulasiBid::where('norujukan','=',$data->norujukan)->first();
|
||||
// // $hapussimulasi->delete();
|
||||
// }
|
||||
|
||||
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id','=',$data->id)->get();
|
||||
foreach($simulasibidmarhun as $simbidmarhun)
|
||||
@@ -980,7 +980,7 @@ class LelongController extends Controller
|
||||
|
||||
|
||||
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
// ->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->where('lelong_id','=',$lelongid)->where('caw_id','=',$cawid)
|
||||
->select(
|
||||
'lelongbid.t_lelong',
|
||||
@@ -998,35 +998,52 @@ class LelongController extends Controller
|
||||
'lelongbid.baki',
|
||||
'lelongbid.bakiupah',
|
||||
'lelongbid.status_jual',
|
||||
'lelongbid.jbg',
|
||||
'gadai.pinjaman as pinjasal',
|
||||
'gadai.bakipjm',
|
||||
'gadai.bakihargajualan',
|
||||
'gadai.upah12',
|
||||
'gadai.ansakhir',
|
||||
'gadai.tempoh',
|
||||
'gadai.tempohbayar',
|
||||
'gadai.kadarupah',
|
||||
'gadai.nokp',
|
||||
'gadai.bakiupah as upah6bulan'
|
||||
'lelongbid.jbg'
|
||||
// 'gadai.pinjaman as pinjasal',
|
||||
// 'gadai.bakipjm',
|
||||
// 'gadai.bakihargajualan',
|
||||
// 'gadai.upah12',
|
||||
// 'gadai.ansakhir',
|
||||
// 'gadai.tempoh',
|
||||
// 'gadai.tempohbayar',
|
||||
// 'gadai.kadarupah',
|
||||
// 'gadai.nokp',
|
||||
// 'gadai.bakiupah as upah6bulan'
|
||||
)
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
|
||||
$arraymarhun = [];
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
|
||||
$customer = Customer::on('mysql2')
|
||||
->where('kpbaru','=',$cal['nokp'])
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
// 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);
|
||||
|
||||
$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'] = $keuntungan;
|
||||
$marhuns[$index1]['nama'] = $customer;
|
||||
|
||||
$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;
|
||||
array_push($arraymarhun,[
|
||||
'norujukan' => $cal['norujukan'],
|
||||
'tempoh' => $gadai['tempoh'],
|
||||
'nama' => $customer['nama'],
|
||||
'berat' => $cal['berat'],
|
||||
'nilaimarhun' => $cal['nilaimarhun'],
|
||||
'hargaasas' => $cal['hargaasas'],
|
||||
'hargajual' => $cal['hargajual'],
|
||||
't_jual' => $cal['t_jual'],
|
||||
'pinjaman' => $cal['pinjaman'],
|
||||
'pinjasal' => $gadai['pinjaman'],
|
||||
'bakiupah' => $cal['bakiupah'],
|
||||
'cajlelong' => $cal['cajlelong'],
|
||||
'baki' => $cal['baki'],
|
||||
'upah6bulan' => $gadai['bakiupah']
|
||||
]);
|
||||
}
|
||||
|
||||
$arrayinfo = [];
|
||||
@@ -1047,7 +1064,7 @@ class LelongController extends Controller
|
||||
->toArray();
|
||||
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
return view('lelong.senaraimarhun',compact('marhuns','lelongid','cawid','arrayinfo'));
|
||||
return view('lelong.senaraimarhun',compact('arraymarhun','marhuns','lelongid','cawid','arrayinfo'));
|
||||
}
|
||||
|
||||
public function deletemarhun(Request $request){
|
||||
@@ -2646,44 +2663,65 @@ class LelongController extends Controller
|
||||
{
|
||||
$keuntungan = 0;
|
||||
|
||||
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
$arraylistgadai = 0;
|
||||
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong_id','=',$lelongid)
|
||||
->where('caw_id','=',$cawid)
|
||||
->groupBy('gadai.nokp')
|
||||
->select('gadai.nokp')
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
->where('caw_id','=',$cawid);
|
||||
|
||||
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
|
||||
$datalelong = $marhun->get();
|
||||
$marhuns = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->select('nokp')
|
||||
->groupBy('nokp')->get();
|
||||
// dd($datagadai);
|
||||
$arraysag = [];
|
||||
|
||||
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
$customer = Customer::on('mysql2')
|
||||
->where('kpbaru','=',$cal['nokp'])
|
||||
$customer = Customer::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' )
|
||||
$listsag = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->where('nokp','=',$cal['nokp'])
|
||||
->get();
|
||||
// dd($listsag);
|
||||
// dd($listgadai);
|
||||
foreach($listsag as $index=>$listing){
|
||||
$ktlhbyr = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
$ktlhbyr = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
// dd($ktlhbyr);
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
$keuntungan = bcdiv(($listing['tempoh']-$listing['tempohbayar'])*$listing['kadarupah']/100*$listing['bakipjm'],1,1)-$beza_keuntungan;
|
||||
// dd($keuntungan);
|
||||
$listsag[$index]['ktlhbyr'] = $ktlhbyr;
|
||||
$listsag[$index]['keuntungan'] = $keuntungan;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $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);
|
||||
$marhuns[$index1]['nama'] = $customer;
|
||||
$marhuns[$index1]['listsag'] = $listsag;
|
||||
|
||||
|
||||
}
|
||||
return view('lelong.listsagbycust',compact('marhuns','lelongid','cawid','listsag','ktlhbyr'));
|
||||
|
||||
$arrayinfo = [];
|
||||
|
||||
$lelong_id = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->where('cawangan_lelong.lelong_id','=',$lelongid)
|
||||
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
||||
->groupBy('lelong_id')
|
||||
->get()->toArray();
|
||||
|
||||
|
||||
foreach($lelong_id as $laporan)
|
||||
{
|
||||
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporan['lelong_id'])
|
||||
->where('caw_id',$cawid)
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
return view('lelong.listsagbycust',compact('marhuns','lelongid','cawid','listsag','ktlhbyr','arrayinfo'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user