Merge branch 'atie' into 'main'

update lelong simulasi payment new db mysql2

See merge request online-sistem1/lelong!111
This commit is contained in:
Nur Izzati Zulkifli
2022-07-07 04:02:52 +00:00
14 changed files with 487 additions and 137 deletions
+96 -83
View File
@@ -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();
}
+3 -3
View File
@@ -218,7 +218,7 @@ class PembidaController extends Controller
$listwinner = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
->join('payment', 'lelongbidder.payment_id', '=', 'payment.id')
->where('lelongbidder.status_bidder', 1)
->where('payment.status', 1)
// ->where('payment.status', 1)
->where('lelongbidder.status_payment', 1)
->where('lelongbid.lelong_id', $request->lelong_id)
->where('lelongbid.kodcaw', $request->kodcaw)
@@ -241,7 +241,7 @@ class PembidaController extends Controller
foreach($SAGWin as $index2=>$sag)
{
// dd($sag->payment_id);
if($sag)
{
$detailspayment = Payment::where('id', $sag->payment_id)->first();
@@ -300,7 +300,7 @@ class PembidaController extends Controller
$infos = LelongBid::join('cawangan', 'lelongbid.kodcaw', '=', 'cawangan.caw_code')
->join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
->where('lelongbidder.user_id', $user_id)
->where('lelongbidder.payment_id', $payment_id)
// ->where('lelongbidder.payment_id', $payment_id)
->where('cawangan.caw_code', $kodcaw)
->where('lelongbid.kodcaw', $kodcaw)
// ->where('lelongbidder.status_payment', 1)
+110 -37
View File
@@ -29,6 +29,8 @@ use App\Models\LelKarat;
use App\Models\LogUser;
use App\Models\LelongTebus;
use App\Models\Tetapan;
use App\Models\Customer;
use App\Models\TransaksiKeuntungan;
@@ -69,15 +71,8 @@ class SimulasiController extends Controller
// dd($fasa);
// dd($fasa);
//create simulasi
$simulasi = new Simulasi;
$simulasi->tarikh_lelong = $request->tarikh_lelong;
$simulasi->harga_emas_asas = $request->hargaasas;
$simulasi->jbg = $request->jbg;
$simulasi->cajlelong = $request->cajlelong;
$simulasi->fasa = $request->fasa;
$simulasi->kali = $request->kali;
$simulasi->save();
$simulasi_id = $simulasi->id;
// $simulasi_id = $simulasi->id;
$jbgadai = ($t_lelong->subMonths($bulan))->toDateString();
if($request->fasa == '1'){
$surat = Gadai::where('t_gadai','<=',$jbgadai)
@@ -106,7 +101,15 @@ class SimulasiController extends Controller
{
return redirect()->route('analisa.janasimulasi')
->with('failed','Tiada surat untuk di lelong');
}
}
$simulasi = new Simulasi;
$simulasi->tarikh_lelong = $request->tarikh_lelong;
$simulasi->harga_emas_asas = $request->hargaasas;
$simulasi->jbg = $request->jbg;
$simulasi->cajlelong = $request->cajlelong;
$simulasi->fasa = $request->fasa;
$simulasi->kali = $request->kali;
$simulasi->save();
$cawangan = Cawangan::all();
@@ -155,6 +158,7 @@ class SimulasiController extends Controller
// dd($data_chunk);
foreach($data_chunk as $data)
{
$simulasibid = SimulasiBid::create([
"simulasi_id" => $simulasi->id,
"caw_id" => $cawsimulasi->id,
@@ -302,16 +306,19 @@ class SimulasiController extends Controller
$total14Kp = 0;
$total14K = 0;
$total9K = 0;
$total_upahkeuntungan2 = 0;
$total_bakiupah = 0;
$total_nilaimarhun = 0;
foreach($cawangansim as $cawsim)
{
$cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
$databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
->select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12',
'gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
// $databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
// ->select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
// 'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12',
// 'gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
// ->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
$databid = SimulasiBid::select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','simulasibid.bakiupah')
->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
// ->toArray();
@@ -319,14 +326,14 @@ class SimulasiController extends Controller
$berat = 0;
$nilai_marhun = 0;
$pinjaman =0;
$upah = 0;
$bakiupah = 0;
$hargaasas = 0;
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
$keuntungan = 0;
$total_upahkeuntungan = 0;
// $keuntungan = 0;
// $total_upahkeuntungan = 0;
foreach($databid as $index1=>$bid)
@@ -336,16 +343,16 @@ class SimulasiController extends Controller
// $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
$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;
// $keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
// $databid[$index1]['keuntungan'] = $keuntungan;
// $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
$total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
// // $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
// $total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
@@ -415,7 +422,8 @@ class SimulasiController extends Controller
'berat'=>$berat,
'n_marhun'=>$nilai_marhun,
'pinjaman'=>$pinjaman,
'upahsimpan'=>bcdiv($total_upahkeuntungan,1,1),
'upahsimpan'=>$bakiupah,
'bakiupah'=>$bakiupah,
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
@@ -426,13 +434,12 @@ class SimulasiController extends Controller
$total_marhun = $total_marhun + sizeof($databid);
$total_berat = $total_berat + $berat;
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
//dd($nilai_marhun);
$total_pinjaman = $total_pinjaman + $pinjaman;
$total_hargaasas = $total_hargaasas + $hargaasas;
$total_cazlelong = $total_cazlelong + $cajlelong;
$total_rugilelong = $total_rugilelong + $rugilelong;
$total_bakilelong = $total_bakilelong + $bakilelong;
$total_upahkeuntungan2 = $total_upahkeuntungan2 + $total_upahkeuntungan;
$total_bakiupah = $total_bakiupah + $bakiupah;
$data = Simulasi::where('simulasi.id','=',$simulasi_id)
@@ -468,9 +475,8 @@ class SimulasiController extends Controller
'simulasi_id',
'jeniskarat',
'data',
'total_upahkeuntungan',
'total_nilaimarhun',
'total_upahkeuntungan2'
'total_bakiupah',
'total_nilaimarhun'
));
}
@@ -502,6 +508,9 @@ class SimulasiController extends Controller
public function kemaskini(Request $request)
{
// dd($request->idsimulasi);
$user = Auth::user();
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$simkarat = SimKarat::where('simulasi_id','=',$request->idsimulasi)->get();
foreach($simkarat as $karat) //save old harga asas
@@ -531,7 +540,13 @@ class SimulasiController extends Controller
//dd($simulasibid);
foreach($simulasibid as $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;
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])->get();
// dd($simulasibidmarhun);
@@ -580,6 +595,16 @@ class SimulasiController extends Controller
'cajlelong'=> bcdiv($sumcajlelong,1,1),
'baki'=> $totalbaki,
]);
//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();
//dd($sumcajlelong);
@@ -835,16 +860,21 @@ class SimulasiController 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'] = $keuntungan;
$marhuns[$index1]['keuntungan'] = $keuntungan;
$marhuns[$index1]['nama'] = $customer;
}
@@ -1125,7 +1155,7 @@ class SimulasiController extends Controller
$lelongtebus->teller = $user->name;
$lelongtebus->norujukan = $data['norujukan'];
$lelongtebus->batch_no = $simulasi_id;
$lelongtebus->nilai_marhun = $data['nilaimarhun'];
$lelongtebus->nilaimarhun = $data['nilaimarhun'];
$lelongtebus->pinjaman = $data['pinjaman'];
$lelongtebus->upah = $data['bakiupah'];
$lelongtebus->jbg = $data['jbg'];
@@ -1155,18 +1185,27 @@ class SimulasiController extends Controller
$query->select('norujukan')
->from('gadai');
})
->select('gadai.norujukan','gadai.tempoh')
->select('gadai.tempoh','gadai.tempohbayar','gadai.kadarupah','gadai.norujukan','gadai.tempoh','gadai.bakipjm')
->get()->toArray();
// dd($senaraisagtempoh);
foreach($senaraisagtempoh as $datatempoh)
{
// dd($data['norujukan']);
//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);
//update dalam simulasibid
$updatetempoh = SimulasiBid::where('norujukan', $datatempoh['norujukan'])
->where('simulasi_id', $simulasi_id)
->first();
$updatetempoh->jbg = $datatempoh['tempoh'];
$updatetempoh->pinjaman = $datatempoh['bakipjm'];
$updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
$updatetempoh->update();
//insert loguser
$loguser = new LogUser;
$loguser->user_id = $user->id;
@@ -1174,7 +1213,7 @@ class SimulasiController extends Controller
$loguser->username = $user->username;
$loguser->nama_user = $user->name;
$loguser->norujukan = $datatempoh['norujukan'];
$loguser->nota = ' Kemaskini Tempoh '.$simulasi_id;
$loguser->nota = $simulasi_id.' Kemaskini Tempoh/Bakipjm/Keuntungan' ;
$loguser->save();
}
@@ -1188,5 +1227,39 @@ class SimulasiController extends Controller
return redirect()->route('analisa.senaraisimulasi')
->with('success','Kemaskini Berjaya');
}
public function listsagbycust($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)
->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 = SimulasiBid::join('gadai', 'gadai.norujukan','=','simulasibid.norujukan')
->where('gadai.nokp','=',$cal['nokp'])
->get();
// dd($listsag);
// $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;
}
return view('simulasi.listsagbycust',compact('marhuns','simulasi_id','cawid','listsag'));
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
use HasFactory;
protected $connection = 'mysql2';
protected $table = 'customer';
protected $fillable = [
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransaksiKeuntungan extends Model
{
protected $connection = 'mysql2';
protected $table = 'transaksi_keuntungan';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'norujukan','bayaran_keuntungan','tarikh_bayaran','kodcaw','bayaran_pembiayaan','keuntungan_rebet'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+8 -5
View File
@@ -75,11 +75,11 @@ return [
'mysql2' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'name',
'username' => 'username',
'password' => "password",
'host' => env('DB_HOST_2', '127.0.0.1'),
'port' => env('DB_PORT_2', '3306'),
'database' => env('DB_DATABASE_2', 'forge'),
'username' => env('DB_USERNAME_2', 'forge'),
'password' => env('DB_PASSWORD_2', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
@@ -92,6 +92,9 @@ return [
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
@@ -48,6 +48,7 @@
<tr>
<th>No</th>
<th>No Rujukan</th>
<th>Nama Pelanggan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>N. Marhun (RM)</th>
@@ -67,6 +68,7 @@
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $marhun['norujukan']}}</td>
<td>{{ $marhun['nama']['nama']}}</td>
<td>{{ $marhun['jbg']}}</td>
<td>{{ $marhun['berat'] }}</td>
<td>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
+2 -2
View File
@@ -34,7 +34,7 @@
<td>Pembiayaan Keseluruhan : RM{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
</tr>
<tr>
<td>Keuntungan Keseluruhan : RM{{ number_format($totalkeuntungan2, 2, '.', ',') }}</td>
<td>Keuntungan Keseluruhan : RM{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
</tr>
<tr>
@foreach($data as $data1)
@@ -113,7 +113,7 @@
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($totalkeuntungan2, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
@@ -34,7 +34,7 @@
<td>Pembiayaan Keseluruhan : RM{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
</tr>
<tr>
<td>Keuntungan Keseluruhan : RM{{ number_format($totalkeuntungan2, 2, '.', ',') }}</td>
<td>Keuntungan Keseluruhan : RM{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
</tr>
<tr>
@foreach($data as $data1)
@@ -113,7 +113,7 @@
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($totalkeuntungan2, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
@@ -55,7 +55,7 @@
@endif
</td>
<td>
<a href="{{ route('pembida.detailsbidaan', [ 'user_id'=>$winner['details']['id'], 'payment_id'=>$winner['payment_id'][0]['payment_id'], $kodcaw ]) }}" data-toggle="tooltip" data-placement="top" title="Butiran Bidaan"><i class="far fa-list-alt"></i></a>
<a href="{{ route('pembida.detailsbidaan', [ 'user_id'=>$winner['details']['id'], $kodcaw ]) }}" data-toggle="tooltip" data-placement="top" title="Butiran Bidaan"><i class="far fa-list-alt"></i></a>
</td>
</tr>
@endforeach
@@ -0,0 +1,224 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<div class="text-left pt-4">
<a href="{{ route('analisa.listsagbycust',[$simulasi_id,'cawid'=>$cawid]) }}" class="btn btn-success">Senarai Nama Pelangan</a>
</div>
<form id="deletesag" action="{{route('analisa.deletemarhunlel')}}" method="POST">
@csrf
<input type="hidden" name="simulasi_id" value="{{$simulasi_id}}">
<input type="hidden" name="cawid" value="{{$cawid}}">
<table class="table table-striped table-xl" id="marhun" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>Nama Pelanggan</th>
<th>No.Rujukan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
<th>Harga Asas (RM)</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan (RM)</th>
<th>Caj Lelong (%)</th>
<th>Baki Lelong (RM)</th>
<!-- <th>Tindakan</th> -->
</tr>
</thead>
<tbody>
@foreach ($marhuns as $index=> $marhun)
<tr>
<td>{{$loop->iteration}}</td>
<td style='word-wrap'>{{ $marhun['nama']['nama']}}</td>
<td style='word-wrap'>@foreach ($marhun['listsag'] as $item)
{{$loop->iteration}}. {{ $item['norujukan'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['listsag'] as $item)
{{ $item['tempoh'] }}<br>
@endforeach</td>
<td align = 'right'>
@php $jumberat = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumberat = $jumberat + $item['berat'];
@endphp
{{ number_format($item['berat'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumberat, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumnilaimarhun = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumnilaimarhun = $jumnilaimarhun + $item['nilaimarhun'];
@endphp
{{ number_format($item['nilaimarhun'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumnilaimarhun, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumhargaasas = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumhargaasas = $jumhargaasas + $item['hargaasas'];
@endphp
{{ number_format($item['hargaasas'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumhargaasas, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumpinjaman = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumpinjaman = $jumpinjaman + $item['pinjaman'];
@endphp
{{ number_format($item['pinjaman'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumpinjaman, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumbakiupah = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumbakiupah = $jumbakiupah + $item['bakiupah'];
@endphp
{{ number_format($item['bakiupah'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumbakiupah, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumcajlelong = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumcajlelong = $jumcajlelong + $item['cajlelong'];
@endphp
{{ number_format($item['cajlelong'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumcajlelong, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumbaki = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumbaki = $jumbaki + $item['baki'];
@endphp
{{ number_format($item['baki'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumbaki, 2, '.', ',') }}</strong>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
$("#btndelete").prop("disabled", true);
function btnDelete(e) {
var count = 0;
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
if($(this).prop('checked') === true)
{
count = count + 1;
}
// $(this).prop('checked', e.checked);
})
if(count != 0)
{
$("#btndelete").prop("disabled", false);
}
else
{
$("#btndelete").prop("disabled", true);
}
// let checkbox = $('#checkboxdata').val();
// console.log(checkbox)
// $("#btndelete").prop("disabled", checkboxdata.length === 0);
}
function confirm() {
$.confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'red',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-danger',
action: function () {
$("#deletesag").submit();
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
}
var tablemarhun = $('#marhun').DataTable( {
"columnDefs": [
{
"targets": 13,
"orderable": false
},
// {
// "targets": 4,
// "orderable": false
// }
],
// order: [[1, 'asc']],
// "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 10000000,
dom: 'Bfrtip',
// buttons: [
// // 'copy', 'excel', 'pdf'
// // { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm adduser',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Pengguna',
// action: function ( e, dt, node, config ) {
// alert( 'Button activated' );
// }
// },
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Export to CSV',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
// ]
});
</script>
@endsection
@@ -12,6 +12,9 @@
<p>{{ $message }}</p>
</div>
@endif
<div class="text-left pt-4">
<a href="{{ route('analisa.listsagbycust',[$simulasi_id,$cawid]) }}" class="btn btn-success">Senarai Nama Pelangan</a>
</div>
<form id="deletesag" action="{{route('analisa.deletemarhunlel')}}" method="POST">
@csrf
<input type="hidden" name="simulasi_id" value="{{$simulasi_id}}">
@@ -20,7 +23,8 @@
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>No Rujukan</th>
<th>No Rujukan</th>
<th>Nama Pelanggan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
@@ -38,6 +42,7 @@
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $marhun['norujukan']}}</td>
<td>{{ $marhun['nama']['nama']}}</td>
<td>{{ number_format($marhun['tempoh'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
@@ -32,7 +32,7 @@
<td>Pembiayaan Keseluruhan : RM{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
</tr>
<tr>
<td>Keuntungan Keseluruhan : RM{{ number_format($total_upahkeuntungan2, 2, '.', ',') }}</td>
<td>Keuntungan Keseluruhan : RM{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
</tr>
<tr>
@foreach($data as $data1)
@@ -112,7 +112,7 @@
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upahkeuntungan2, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakiupah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
+2
View File
@@ -77,6 +77,8 @@ Route::group(['middleware' => ['permission:analisa'],'prefix'=>'analisa'], funct
Route::get('/tempbycawsimulasi/{details}/{t_lelong}/{fasa}',['as'=>'analisa.tempbycawsimulasi','uses'=>'SimulasiController@tempbycawsimulasi']);
Route::get('/kemaskinidata/{simulasi_id}',['as'=>'analisa.kemaskinidata','uses'=>'SimulasiController@kemaskinidata']);
//listsagbycust
Route::get('/listsagbycust/{simulasi_id}/{cawid}',['as'=>'analisa.listsagbycust','uses'=>'SimulasiController@listsagbycust']);
});
Route::group(['middleware' => ['permission:sistem'],'prefix'=>'sistem'], function () {