Merged in izzati-ujrah (pull request #78)

update if else dlm function blastwasapbysagkedua
This commit is contained in:
izzati zulkifli
2024-01-07 08:56:57 +00:00
+32 -20
View File
@@ -254,7 +254,9 @@ class CallCenterController extends Controller
// dd($cawangan['kodcaw']); // dd($cawangan['kodcaw']);
// dd($cawangan); // dd($cawangan);
$notisbycaw = NotisPeringatan::on('mysql7') $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() ->distinct()
->get(); ->get();
// dd($notisbycaw); // dd($notisbycaw);
@@ -274,7 +276,9 @@ class CallCenterController extends Controller
$cawnotis_all = []; $cawnotis_all = [];
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$notisbycaw = NotisPeringatan::on('mysql7') $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() ->distinct()
->get(); ->get();
@@ -567,6 +571,7 @@ class CallCenterController extends Controller
public function kemaskininotisperingatan(Request $request) public function kemaskininotisperingatan(Request $request)
{ {
// dd($request->all());
$notisid = $request->notisid; $notisid = $request->notisid;
$current = Carbon::now(); $current = Carbon::now();
$current = new Carbon(); $current = new Carbon();
@@ -591,6 +596,7 @@ class CallCenterController extends Controller
$checkgadai = Gadai::on($cawangan['mysql']) $checkgadai = Gadai::on($cawangan['mysql'])
->where([['norujukan','=',$notis['norujukan']]]) ->where([['norujukan','=',$notis['norujukan']]])
->first(); ->first();
if($checkgadai->sttebus == 'T' || $checkgadai->sttebus == 'L'){ if($checkgadai->sttebus == 'T' || $checkgadai->sttebus == 'L'){
$updatelistnotis=NotisPeringatan::on('mysql7') $updatelistnotis=NotisPeringatan::on('mysql7')
->where('norujukan','=', $notis['norujukan']) ->where('norujukan','=', $notis['norujukan'])
@@ -599,6 +605,22 @@ class CallCenterController extends Controller
->delete(); ->delete();
}elseif($checkgadai->sttebus == ''){ }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') $updatedata = NotisPeringatan::on('mysql7')
->where('norujukan',$notis['norujukan']) ->where('norujukan',$notis['norujukan'])
->where('notis_id','=', $notisid) ->where('notis_id','=', $notisid)
@@ -606,6 +628,7 @@ class CallCenterController extends Controller
->update([ ->update([
'jbg'=> $checkgadai->tempoh, 'jbg'=> $checkgadai->tempoh,
'pinjaman'=> $checkgadai->bakipjm, 'pinjaman'=> $checkgadai->bakipjm,
'bakiupah'=> $response
]); ]);
} }
} }
@@ -891,10 +914,13 @@ class CallCenterController extends Controller
->where('notisperingatan.peringatan',2) ->where('notisperingatan.peringatan',2)
->where('notisperingatan.tarikhnotis2','=', NULL) ->where('notisperingatan.tarikhnotis2','=', NULL)
->distinct() ->distinct()
->get(); ->get()->toArray();
// dd($notisbycaw); // dd($notisbycaw);
if(empty($notisbycaw)){
// dd(false);
return response()->json('failed');
}else{
// dd(true);
$arraynorujukan = $notisbycaw->pluck('norujukan')->toArray(); $arraynorujukan = $notisbycaw->pluck('norujukan')->toArray();
$gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) $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)); 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'); return response()->json('success');
} }
}
//}
// else{
// return response()->json('failed');
// }
// }
} }