update function notisjbg

This commit is contained in:
nishaMuhd
2024-01-18 12:44:43 +08:00
parent f39356c075
commit 6693cef354
+16 -14
View File
@@ -1332,25 +1332,27 @@ class CallCenterController extends Controller
$notisjbgbycaw = NotisPeringatan::on('mysql7') $notisjbgbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw) ->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
->where('notisperingatan.peringatan',2) ->where('notisperingatan.peringatan',2)
->distinct() //->distinct() //asal
->get(); ->orderBy('nokp')
->get(); //asal
$arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray(); $arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray(); //asal
$notisnokp = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
$notisnokp = NotisPeringatan::whereIn('norujukan', $arraynorujukan)
->where('notisperingatan.peringatan',2) ->where('notisperingatan.peringatan',2)
->select('nokp') ->select('nokp')
->groupBy('nokp') ->groupBy('nokp')
->get(); ->get(); // asal
foreach($notisnokp as $index1=>$cal){ foreach($notisnokp as $index=>$cal){ //asal
$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) //$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) //asal
$customer = Customer::where('kpbaru','=',$cal['nokp'])
->orWhere('kplama','=',$cal['nokp']) ->orWhere('kplama','=',$cal['nokp'])
->first(); ->first();
$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) //$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) //asal
// ->where('nokp','=',$cal['nokp']) $listnotis = NotisPeringatan::whereIn('norujukan', $arraynorujukan)
->where('nokp', 'like', '%'.$cal['nokp'].'%') ->where('nokp','=',$cal['nokp'])
->where('notisperingatan.peringatan',2)
->get(); ->get();
$listsag = Gadai::on($cawangan['mysql']) $listsag = Gadai::on($cawangan['mysql'])
@@ -1375,9 +1377,9 @@ class CallCenterController extends Controller
$listsag[$index2]['keuntungan'] = $response; $listsag[$index2]['keuntungan'] = $response;
} }
$notisnokp[$index1]['info'] = $customer; $notisnokp[$index]['info'] = $customer;
$notisnokp[$index1]['listsag'] = $listsag; $notisnokp[$index]['listsag'] = $listsag;
$notisnokp[$index1]['listnotis'] = $listnotis; $notisnokp[$index]['listnotis'] = $listnotis;
} }