update lelong simulasi payment new db mysql2
This commit is contained in:
@@ -40,6 +40,7 @@ use App\Models\Negeri;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\LelongTebus;
|
||||
use App\Models\Tetapan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
|
||||
|
||||
class LelongController extends Controller
|
||||
@@ -119,20 +120,15 @@ class LelongController extends Controller
|
||||
$total14Kp = 0;
|
||||
$total14K = 0;
|
||||
$total9K = 0;
|
||||
|
||||
$keuntungan = 0;
|
||||
$total_upahkeuntungan = 0;
|
||||
$total_upahkeuntungan2 = 0;
|
||||
$total_nilaimarhun = 0;
|
||||
$nilai_marhun = 0;
|
||||
$totalkeuntungan = 0;
|
||||
$totalkeuntungan2 = 0;
|
||||
$total_bakiupah = 0;
|
||||
|
||||
foreach($cawanganlel as $cawlel)
|
||||
{
|
||||
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
|
||||
$databid = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->select('lelongbid.bakiupah','lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun','lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12','gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
|
||||
$databid = LelongBid::select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun',
|
||||
'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah')
|
||||
->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$id)->get();
|
||||
|
||||
// dd($databid->toArray());
|
||||
@@ -140,12 +136,11 @@ class LelongController extends Controller
|
||||
$berat = 0;
|
||||
$pinjaman =0;
|
||||
$nilai_marhun = 0;
|
||||
$upah = 0;
|
||||
$bakiupah = 0;
|
||||
$hargaasas = 0;
|
||||
$cajlelong = 0;
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
$totalkeuntungan = 0;
|
||||
|
||||
foreach($databid as $index1=>$bid)
|
||||
{
|
||||
@@ -153,17 +148,11 @@ class LelongController extends Controller
|
||||
$berat = $berat + $bid['berat'];
|
||||
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
|
||||
$pinjaman =$pinjaman + $bid['pinjaman'];
|
||||
// $upah = $upah + $bid['upah'];
|
||||
$bakiupah = $bakiupah + $bid['bakiupah'];
|
||||
$hargaasas = $hargaasas + $bid['hargaasas'];
|
||||
$cajlelong = $cajlelong + $bid['cajlelong'];
|
||||
|
||||
|
||||
$keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
|
||||
$databid[$index1]['keuntungan'] = $keuntungan;
|
||||
|
||||
$total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
|
||||
$totalkeuntungan = $totalkeuntungan + $bid['bakiupah'];
|
||||
|
||||
|
||||
if($bid['baki'] > 0)
|
||||
{
|
||||
$bakilelong = $bakilelong + $bid['baki'];
|
||||
@@ -229,29 +218,25 @@ class LelongController extends Controller
|
||||
'berat'=>$berat,
|
||||
'n_marhun'=>$nilai_marhun,
|
||||
'pinjaman'=>$pinjaman,
|
||||
'upahsimpan'=>bcdiv($total_upahkeuntungan,1,1),
|
||||
'bakiupah'=>$totalkeuntungan,
|
||||
'upahsimpan'=>$bakiupah,
|
||||
'bakiupah'=>$bakiupah,
|
||||
'hargaasas'=>$hargaasas,
|
||||
'cajlelong'=>$cajlelong,
|
||||
'rugilelong'=>$rugilelong,
|
||||
'bakilelong'=>$bakilelong,
|
||||
]);
|
||||
|
||||
$total_upahkeuntungan2 = $total_upahkeuntungan2 + $total_upahkeuntungan;
|
||||
$total_marhun = $total_marhun + sizeof($databid);
|
||||
$total_berat = $total_berat + $berat;
|
||||
$total_pinjaman = $total_pinjaman + $pinjaman;
|
||||
$total_upah = $total_upah + 0;
|
||||
$total_hargaasas = $total_hargaasas + $hargaasas;
|
||||
$total_cazlelong = $total_cazlelong + $cajlelong;
|
||||
$total_rugilelong = $total_rugilelong + $rugilelong;
|
||||
$total_bakilelong = $total_bakilelong + $bakilelong;
|
||||
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
|
||||
$total_bakiupah = $total_bakiupah + $bakiupah;
|
||||
|
||||
|
||||
$totalkeuntungan2 = $totalkeuntungan2 + $totalkeuntungan;
|
||||
|
||||
|
||||
$data = Lelong::where('lelong.id','=',$lelong_id)
|
||||
->get();
|
||||
}
|
||||
@@ -283,11 +268,8 @@ class LelongController extends Controller
|
||||
'lelong_id',
|
||||
'jeniskarat',
|
||||
'data',
|
||||
'keuntungan',
|
||||
'total_upahkeuntungan',
|
||||
'total_nilaimarhun',
|
||||
'total_upahkeuntungan2',
|
||||
'totalkeuntungan2'));
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun'));
|
||||
}
|
||||
|
||||
public function create($id)
|
||||
@@ -436,7 +418,7 @@ class LelongController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('analisa.senaraisimulasi')
|
||||
return redirect()->route('lelong.senarailelong')
|
||||
->with('success','Create Lelong Berjaya');
|
||||
|
||||
}
|
||||
@@ -526,7 +508,9 @@ class LelongController extends Controller
|
||||
public function kemaskini(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
|
||||
$user = Auth::user();
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$lelkarat = lelKarat::where('lelong_id','=',$request->idlelong)->get();
|
||||
|
||||
foreach($lelkarat as $karat) //save old harga asas
|
||||
@@ -557,7 +541,13 @@ class LelongController extends Controller
|
||||
|
||||
foreach($lelongbid as $index1=>$bid)
|
||||
{
|
||||
$keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
|
||||
//$keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$bid['norujukan'])->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$bid['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
$keuntungan = bcdiv(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm'],1,1)-$beza_keuntungan;
|
||||
// dd($keuntungan);
|
||||
|
||||
$sumhargaasas = 0;
|
||||
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id','=',$bid->id)->get();
|
||||
foreach($lelongbidmarhun as $marhun)
|
||||
@@ -601,6 +591,16 @@ class LelongController extends Controller
|
||||
'bakiupah'=> bcdiv($keuntungan,1,1),
|
||||
'hargaasas'=> $sumhargaasas
|
||||
]);
|
||||
//insert loguser
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $bid['norujukan'];
|
||||
$loguser->nota = ' Kemaskini Harga Asas/Keuntungan '.bcdiv($keuntungan,1,1);
|
||||
$loguser->save();
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('lelong.show',$request->idlelong)
|
||||
@@ -1005,14 +1005,21 @@ class LelongController extends Controller
|
||||
'gadai.ansakhir',
|
||||
'gadai.tempoh',
|
||||
'gadai.tempohbayar',
|
||||
'gadai.kadarupah'
|
||||
'gadai.kadarupah',
|
||||
'gadai.nokp'
|
||||
)
|
||||
->get()->toArray();
|
||||
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
|
||||
|
||||
$customer = Customer::on('mysql2')
|
||||
->where('kpbaru','=',$cal['nokp'])
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
->first();
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$arrayinfo = [];
|
||||
@@ -1102,8 +1109,7 @@ class LelongController extends Controller
|
||||
$total9K = 0;
|
||||
|
||||
$keuntungan = 0;
|
||||
$total_upahkeuntungan = 0;
|
||||
$total_upahkeuntungan2 = 0;
|
||||
$total_bakiupah = 0;
|
||||
$total_nilaimarhun = 0;
|
||||
$nilai_marhun = 0;
|
||||
|
||||
@@ -1112,8 +1118,11 @@ class LelongController extends Controller
|
||||
foreach($cawanganlel as $cawlel)
|
||||
{
|
||||
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
|
||||
$databid = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->select('lelongbid.t_lelong','lelongbid.bakiupah','lelongbid.hargaasas','lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun','lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12','gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
|
||||
// $databid = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
// ->select('lelongbid.t_lelong','lelongbid.bakiupah','lelongbid.hargaasas','lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun','lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12','gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
|
||||
// ->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$id)->get();
|
||||
$databid = LelongBid::select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun',
|
||||
'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah')
|
||||
->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$id)->get();
|
||||
|
||||
// dd($databid->toArray());
|
||||
@@ -1121,13 +1130,12 @@ class LelongController extends Controller
|
||||
$berat = 0;
|
||||
$pinjaman =0;
|
||||
$nilai_marhun = 0;
|
||||
$upah = 0;
|
||||
$bakiupah = 0;
|
||||
$hargaasas = 0;
|
||||
$cajlelong = 0;
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
$cajlelong = 0;
|
||||
$totalkeuntungan = 0;
|
||||
|
||||
foreach($databid as $index1=>$bid)
|
||||
{
|
||||
@@ -1135,21 +1143,14 @@ class LelongController extends Controller
|
||||
$berat = $berat + $bid['berat'];
|
||||
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
|
||||
$pinjaman =$pinjaman + $bid['pinjaman'];
|
||||
// $upah = $upah + $bid['upah'];
|
||||
$bakiupah = $bakiupah + $bid['bakiupah'];
|
||||
$hargaasas = $hargaasas + $bid['hargaasas'];
|
||||
$cajlelong = $cajlelong + $bid['cajlelong'];
|
||||
|
||||
|
||||
$keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
|
||||
$databid[$index1]['keuntungan'] = $keuntungan;
|
||||
|
||||
$total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
|
||||
$totalkeuntungan = $totalkeuntungan + $bid['bakiupah'];
|
||||
|
||||
$lelongsim = Lelong::where('id',$id)->get();
|
||||
$sumcajlelong = $bid['hargaasas'] * ($lelongsim[0]['cajlelong']/100);
|
||||
$cajlelong = $cajlelong + bcdiv($sumcajlelong,1,1);
|
||||
$totalbaki = $bid['hargaasas'] - $bid['pinjaman'] - bcdiv($keuntungan,1,1) - bcdiv($sumcajlelong,1,1);
|
||||
$totalbaki = $bid['hargaasas'] - $bid['pinjaman'] - $bid['bakiupah'] - bcdiv($sumcajlelong,1,1);
|
||||
|
||||
if($totalbaki > 0)
|
||||
{
|
||||
@@ -1216,25 +1217,23 @@ class LelongController extends Controller
|
||||
'berat'=>$berat,
|
||||
'n_marhun'=>$nilai_marhun,
|
||||
'pinjaman'=>$pinjaman,
|
||||
'upahsimpan'=>bcdiv($total_upahkeuntungan,1,1),
|
||||
'bakiupah'=>$totalkeuntungan,
|
||||
'upahsimpan'=>$bakiupah,
|
||||
'bakiupah'=>$bakiupah,
|
||||
'hargaasas'=>$hargaasas,
|
||||
'cajlelong'=>$cajlelong,
|
||||
'rugilelong'=>$rugilelong,
|
||||
'bakilelong'=>$bakilelong,
|
||||
]);
|
||||
|
||||
$total_upahkeuntungan2 = $total_upahkeuntungan2 + $total_upahkeuntungan;
|
||||
$total_marhun = $total_marhun + sizeof($databid);
|
||||
$total_berat = $total_berat + $berat;
|
||||
$total_pinjaman = $total_pinjaman + $pinjaman;
|
||||
$total_upah = $total_upah + 0;
|
||||
$total_hargaasas = $total_hargaasas + $hargaasas;
|
||||
$total_cazlelong = $total_cazlelong + $cajlelong;
|
||||
$total_rugilelong = $total_rugilelong + $rugilelong;
|
||||
$total_bakilelong = $total_bakilelong + $bakilelong;
|
||||
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
|
||||
$totalkeuntungan2 = $totalkeuntungan2 + $totalkeuntungan;
|
||||
$total_bakiupah = $total_bakiupah + $bakiupah;
|
||||
|
||||
|
||||
$data = Lelong::where('lelong.id','=',$lelong_id)
|
||||
@@ -1268,11 +1267,8 @@ class LelongController extends Controller
|
||||
'lelong_id',
|
||||
'jeniskarat',
|
||||
'data',
|
||||
'keuntungan',
|
||||
'total_upahkeuntungan',
|
||||
'total_nilaimarhun',
|
||||
'total_upahkeuntungan2',
|
||||
'totalkeuntungan2'));
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun'));
|
||||
}
|
||||
|
||||
public function senaraimarhunsimulasi($lelongid, $cawid){
|
||||
@@ -1282,7 +1278,6 @@ class LelongController extends Controller
|
||||
|
||||
|
||||
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->where('lelong_id','=',$lelongid)->where('caw_id','=',$cawid)
|
||||
->select(
|
||||
'lelongbid.t_lelong',
|
||||
@@ -1298,25 +1293,33 @@ class LelongController extends Controller
|
||||
'lelongbid.baki',
|
||||
'lelongbid.bakiupah',
|
||||
'lelongbid.status_jual',
|
||||
'lelongbid.jbg',
|
||||
'gadai.bakipjm',
|
||||
'gadai.bakihargajualan',
|
||||
'gadai.upah12',
|
||||
'gadai.ansakhir',
|
||||
'gadai.tempoh',
|
||||
'gadai.tempohbayar',
|
||||
'gadai.kadarupah'
|
||||
'lelongbid.jbg'
|
||||
|
||||
)
|
||||
->get()->toArray();
|
||||
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
|
||||
// $customer = Customer::on('mysql2')
|
||||
// ->where('kpbaru','=',$cal['nokp'])
|
||||
// ->orWhere('kplama','=',$cal['nokp'])
|
||||
// ->first();
|
||||
|
||||
// $total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('keuntungan_rebet');
|
||||
// $total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('bayaran_keuntungan');
|
||||
// $beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
// // dd($total_untung_rebet);
|
||||
|
||||
$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);
|
||||
// // $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $beza_keuntungan)-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
|
||||
// $keuntungan = bcdiv(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm'],1,1)-$beza_keuntungan;
|
||||
// // dd($keuntungan);
|
||||
// $marhuns[$index1]['keuntungan'] = bcdiv($keuntungan,1,1);
|
||||
// // dd(bcdiv($keuntungan,1,1));
|
||||
// $marhuns[$index1]['nama'] = $customer;
|
||||
|
||||
$simulasilel = Lelong::where('id',$lelongid)->get();
|
||||
$sumcajlelong = $cal['hargaasas'] * ($simulasilel[0]['cajlelong']/100);
|
||||
$totalbaki = $cal['hargaasas'] - $cal['pinjaman'] - bcdiv($keuntungan,1,1) - bcdiv($sumcajlelong,1,1);
|
||||
$totalbaki = $cal['hargaasas'] - $cal['pinjaman'] - $cal['bakiupah'] - bcdiv($sumcajlelong,1,1);
|
||||
|
||||
$marhuns[$index1]['cajlelong'] = bcdiv($sumcajlelong,1,1);
|
||||
$marhuns[$index1]['baki'] = $totalbaki;
|
||||
@@ -1855,15 +1858,22 @@ class LelongController extends Controller
|
||||
|
||||
foreach($senaraisagtempoh as $index1=>$datatempoh)
|
||||
{
|
||||
//kemaskini keuntungan
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
$keuntungan = bcdiv(($datatempoh['tempoh']-$datatempoh['tempohbayar'])*$datatempoh['kadarupah']/100*$datatempoh['bakipjm'],1,1)-$beza_keuntungan;
|
||||
// dd($keuntungan);
|
||||
//kemaskini keuntungan baru
|
||||
$keuntungan = $datatempoh['bakipjm'] - ($datatempoh['bakihargajualan'] - ($datatempoh['upah12'] - $datatempoh['ansakhir'])-(($datatempoh['tempoh']-$datatempoh['tempohbayar'])*$datatempoh['kadarupah']/100*$datatempoh['bakipjm']) );
|
||||
$senaraisagtempoh[$index1]['keuntungan'] = $keuntungan;
|
||||
// $keuntungan = $datatempoh['bakipjm'] - ($datatempoh['bakihargajualan'] - ($datatempoh['upah12'] - $datatempoh['ansakhir'])-(($datatempoh['tempoh']-$datatempoh['tempohbayar'])*$datatempoh['kadarupah']/100*$datatempoh['bakipjm']) );
|
||||
// $senaraisagtempoh[$index1]['keuntungan'] = $keuntungan;
|
||||
|
||||
// dd($data['norujukan']);
|
||||
$updatetempoh = LelongBid::where('norujukan', $datatempoh['norujukan'])
|
||||
->where('lelong_id', $lelong_id)
|
||||
->first();
|
||||
$updatetempoh->jbg = $datatempoh['tempoh'];
|
||||
$updatetempoh->pinjaman = $datatempoh['bakipjm'];
|
||||
$updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
||||
$updatetempoh->update();
|
||||
//insert loguser
|
||||
@@ -2539,9 +2549,10 @@ class LelongController extends Controller
|
||||
// dd($request->lelongidasal);
|
||||
$id = $request->lelongidasal;
|
||||
$idbaru = $request->lelongidbaru;
|
||||
// dd($idbaru);
|
||||
$lelong = Lelong::where('id','=',$request->lelongidasal)->first();
|
||||
$cawanganlel = CawanganLelong::where('lelong_id','=',$id)->get();
|
||||
$lelkarat = Lelkarat::where('lelong_id','=',$id)->get();
|
||||
|
||||
|
||||
|
||||
// $simkarat = SimKarat::where('simulasi_id','=',$id)->get();
|
||||
// dd($t_lelong);
|
||||
@@ -2555,6 +2566,7 @@ class LelongController extends Controller
|
||||
$lelong1->kali = $lelong->kali;
|
||||
$lelong1->save();
|
||||
|
||||
$lelkarat = Lelkarat::where('lelong_id','=',$id)->get();
|
||||
foreach($lelkarat as $lelongkarat)
|
||||
{
|
||||
$lelkarat = new LelKarat;
|
||||
@@ -2565,7 +2577,7 @@ class LelongController extends Controller
|
||||
$lelkarat->harga2 = $lelongkarat->harga2;
|
||||
$lelkarat->save();
|
||||
}
|
||||
|
||||
$cawanganlel = CawanganLelong::where('lelong_id','=',$id)->get();
|
||||
foreach($cawanganlel as $caw)
|
||||
{
|
||||
$namacaw = CawanganLelong::join('cawangan','cawangan.id','=','cawangan_lelong.caw_id')
|
||||
@@ -2585,7 +2597,7 @@ class LelongController extends Controller
|
||||
}
|
||||
$caw_lelong = new CawanganLelong;
|
||||
$caw_lelong->batchlel = $batchno;
|
||||
$caw_lelong->lelong_id = $idbaru;
|
||||
$caw_lelong->lelong_id = $lelong1->id;
|
||||
$caw_lelong->caw_id = $caw->caw_id;
|
||||
$caw_lelong->online = $caw->online;
|
||||
$caw_lelong->lokasi = $caw->lokasi;
|
||||
@@ -2593,17 +2605,18 @@ class LelongController extends Controller
|
||||
$caw_lelong->kali = $caw->kali;
|
||||
$caw_lelong->save();
|
||||
|
||||
$datalelbid = LelongBid::where('caw_id','=',$caw->caw_id)->where('lelong_id',$id)->get();
|
||||
$datalelbid = LelongBid::where('caw_id','=',$caw->caw_id)->where('lelong_id',$id)->where('status_jual','=', 0)->get();
|
||||
$suratcaw = $datalelbid->all();
|
||||
foreach(array_chunk($suratcaw,100) as $data_chunk)
|
||||
{
|
||||
//dd($data);
|
||||
// dd($datalelbid);
|
||||
foreach($data_chunk as $data)
|
||||
{
|
||||
//dd($simulasi->id);
|
||||
$caw_lelsag = LelongBid::where('norujukan', $data->norujukan)
|
||||
->where('status_jual','=', 0)->first();
|
||||
$caw_lelsag->lelong_id = $idbaru;
|
||||
->first();
|
||||
// dd($caw_lelsag);
|
||||
$caw_lelsag->lelong_id = $lelong1->id;
|
||||
$caw_lelsag->update();
|
||||
|
||||
}
|
||||
@@ -2614,7 +2627,7 @@ class LelongController extends Controller
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->nota = 'Daftar Batch Lelong '.$namacaw->caw_code.'-'.$id.' Kepada '.$idbaru;
|
||||
$loguser->nota = 'Daftar Batch Lelong '.$namacaw->caw_code.'-'.$id.' Kepada '.$lelong1->id;
|
||||
$loguser->save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user