update if else dlm function blastwasapbysagkedua

This commit is contained in:
Nur Izzati Zulkifli
2024-01-07 16:56:00 +08:00
parent 64fd0cc741
commit 5ae0e98cb2
+32 -20
View File
@@ -254,7 +254,9 @@ class CallCenterController extends Controller
// dd($cawangan['kodcaw']);
// dd($cawangan);
$notisbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$cawangan['kodcaw'])
->where('notisperingatan.notis_id',$notisid)
->where('notisperingatan.kodcaw',$cawangan['kodcaw'])
->where('notisperingatan.tarikhnotis1','=', NULL)
->distinct()
->get();
// dd($notisbycaw);
@@ -274,7 +276,9 @@ class CallCenterController extends Controller
$cawnotis_all = [];
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$notisbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
->where('notisperingatan.notis_id',$notisid)
->where('notisperingatan.kodcaw',$kodcaw)
->where('notisperingatan.tarikhnotis1', '=', NULL)
->distinct()
->get();
@@ -567,6 +571,7 @@ class CallCenterController extends Controller
public function kemaskininotisperingatan(Request $request)
{
// dd($request->all());
$notisid = $request->notisid;
$current = Carbon::now();
$current = new Carbon();
@@ -591,6 +596,7 @@ class CallCenterController extends Controller
$checkgadai = Gadai::on($cawangan['mysql'])
->where([['norujukan','=',$notis['norujukan']]])
->first();
if($checkgadai->sttebus == 'T' || $checkgadai->sttebus == 'L'){
$updatelistnotis=NotisPeringatan::on('mysql7')
->where('norujukan','=', $notis['norujukan'])
@@ -599,6 +605,22 @@ class CallCenterController extends Controller
->delete();
}elseif($checkgadai->sttebus == ''){
if($checkgadai->tagbaru == '0'){
// dd($notis['norujukan']);
$keuntungan = 'asal';
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
$master = new MasterServices($kodcaw);
$response = $master->kiraUpahTawarruq($kodcaw,$notis['norujukan'],$jeniskeuntungan);
}elseif($checkgadai->tagbaru == '1'){
$keuntungan = 'onepercent';
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
$master = new MasterServices($kodcaw);
$response = $master->kiraupahUjrahOnePercent($kodcaw,$notis['norujukan']);
}
// dd($response);
$updatedata = NotisPeringatan::on('mysql7')
->where('norujukan',$notis['norujukan'])
->where('notis_id','=', $notisid)
@@ -606,6 +628,7 @@ class CallCenterController extends Controller
->update([
'jbg'=> $checkgadai->tempoh,
'pinjaman'=> $checkgadai->bakipjm,
'bakiupah'=> $response
]);
}
}
@@ -891,10 +914,13 @@ class CallCenterController extends Controller
->where('notisperingatan.peringatan',2)
->where('notisperingatan.tarikhnotis2','=', NULL)
->distinct()
->get();
->get()->toArray();
// dd($notisbycaw);
if(empty($notisbycaw)){
// dd(false);
return response()->json('failed');
}else{
// dd(true);
$arraynorujukan = $notisbycaw->pluck('norujukan')->toArray();
$gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan)
@@ -937,22 +963,8 @@ class CallCenterController extends Controller
dispatch(new ARCCSMSPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq,$namapengguna));
}
}
// $updatestatusnotis=CawanganNotis::on('mysql7')
// ->where('notis_id','=', $notisid)
// ->where('kodcaw','=', $kodcaw)
// ->update(
// array('status'=> 2));
return response()->json('success');
}
//}
// else{
// return response()->json('failed');
// }
// }
}
}