|
|
|
@@ -42,6 +42,9 @@ use App\Services\MasterServices;
|
|
|
|
|
use App\Daerah;
|
|
|
|
|
use App\Poskod;
|
|
|
|
|
use App\Negeri;
|
|
|
|
|
use App\NotisJbg;
|
|
|
|
|
use App\NotJbg;
|
|
|
|
|
use App\CawanganNotisJbg;
|
|
|
|
|
use Log;
|
|
|
|
|
|
|
|
|
|
use App\Services\OnePercentServices;
|
|
|
|
@@ -1080,25 +1083,450 @@ class CallCenterController extends Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return response()->json('success');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getcawnotiskemaskini($notisid)
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
//carian untuk notis jbg
|
|
|
|
|
public function getJbgGadai($kodcaw,Request $request)
|
|
|
|
|
{
|
|
|
|
|
// return 1;
|
|
|
|
|
//$kodcaw = $request->kodcaw;
|
|
|
|
|
$jbgmula = $request->jbgmula;
|
|
|
|
|
$jbghingga = $request->jbghingga;
|
|
|
|
|
|
|
|
|
|
$arraybatch = [];
|
|
|
|
|
$batchnotis = Notis::on('mysql7')->where('id',$notisid)->get();
|
|
|
|
|
$cawangan_all = Cawangan::on('mysql7')->get();
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
foreach ($batchnotis as $index => $cawangan){
|
|
|
|
|
$notis = CawanganNotis::on('mysql7')
|
|
|
|
|
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw')
|
|
|
|
|
->where('notis_id',$notisid)->get();
|
|
|
|
|
// dd($jbghingga, $jbgmula);
|
|
|
|
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
|
|
|
|
$gadaian = Gadai::on($cawangan['mysql'])
|
|
|
|
|
->where([['tagpalsu','=',0],['tempoh','>=',$jbgmula],['tempoh','<=',$jbghingga],['sttebus','=',''],['taglel','=',0]])
|
|
|
|
|
->orderBy('t_gadai', 'ASC')
|
|
|
|
|
->orderBy('sirig', 'ASC');
|
|
|
|
|
|
|
|
|
|
$arraynorujukan = $gadaian->pluck('norujukan')->toArray();
|
|
|
|
|
$rekodgadai = $gadaian->get();
|
|
|
|
|
|
|
|
|
|
$totalrekod = $gadaian->count('norujukan');
|
|
|
|
|
$totalberat = $gadaian->sum('berat');
|
|
|
|
|
$totalnilaimarhun = $gadaian->sum('nilaimarhun');
|
|
|
|
|
$totalpinjaman = $gadaian->sum('pinjaman');
|
|
|
|
|
$totalbakipjm = $gadaian->sum('bakipjm');
|
|
|
|
|
$totaltunggakan = $gadaian->sum('tunggakan');
|
|
|
|
|
|
|
|
|
|
$arrayrekod = ['rekod' => $rekodgadai, 'totalsag' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpembiayaan'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan];
|
|
|
|
|
//dd($arrayrekod);
|
|
|
|
|
return response()->json($arrayrekod,200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getbatchnotisjbg(Request $request){
|
|
|
|
|
$currentDate = Carbon::now();
|
|
|
|
|
$tarikh_daftar = $currentDate->toDateString();
|
|
|
|
|
$jbgmula = $request->jbgmula;
|
|
|
|
|
$jbghingga = $request->jbghingga;
|
|
|
|
|
|
|
|
|
|
$notis = NotJbg::create([
|
|
|
|
|
'tarikh_notjbg' => $tarikh_daftar,
|
|
|
|
|
'daritempoh' => $jbgmula,
|
|
|
|
|
'hinggatempoh' => $jbghingga,
|
|
|
|
|
'sts_notis' => 1,
|
|
|
|
|
'notiskali' => 1
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$batchnotis = NotJbg::on('mysql7')->orderBy('id','desc')->first()->id;
|
|
|
|
|
|
|
|
|
|
return response()->json($batchnotis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function insertdatagadaijbg($kodcaw,Request $request)
|
|
|
|
|
{
|
|
|
|
|
$jbgmula = $request->jbgmula;
|
|
|
|
|
$jbghingga = $request->jbghingga;
|
|
|
|
|
$notisid = $request->notisid;
|
|
|
|
|
$currentDate = Carbon::now();
|
|
|
|
|
// $currentDate = $currentDate->toDateString();
|
|
|
|
|
$tarikh_daftar = $currentDate->toDateString();
|
|
|
|
|
$sag_cawangans = [];
|
|
|
|
|
$bil_surat = 0;
|
|
|
|
|
// dd($kodcaw);
|
|
|
|
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
|
|
|
|
|
|
|
|
|
$datagadaijbg = Gadai::on($cawangan['mysql'])
|
|
|
|
|
->where([['tagpalsu','=',0],['tempoh','>=',$jbgmula],['tempoh','<=',$jbghingga],['sttebus','=',''],['taglel','=',0]])
|
|
|
|
|
->orderBy('t_gadai', 'ASC')
|
|
|
|
|
->orderBy('sirig', 'ASC');
|
|
|
|
|
// ->get();
|
|
|
|
|
array_push($sag_cawangans,['data'=>$datagadaijbg->get()]);
|
|
|
|
|
//dd($sag_cawangans);
|
|
|
|
|
|
|
|
|
|
foreach($sag_cawangans as $index=>$cawnotis){
|
|
|
|
|
// dd($cawnotis);
|
|
|
|
|
$caw_notis = new CawanganNotisJbg;
|
|
|
|
|
$caw_notis->notjbg_id = $notisid;
|
|
|
|
|
$caw_notis->kodcaw = $kodcaw;
|
|
|
|
|
$caw_notis->notiskali = 1;
|
|
|
|
|
$caw_notis->daritempoh = $jbgmula;
|
|
|
|
|
$caw_notis->hinggatempoh = $jbghingga;
|
|
|
|
|
$caw_notis->status = 1;
|
|
|
|
|
$caw_notis->save();
|
|
|
|
|
//dd($caw_notis);
|
|
|
|
|
$notiscaw = $cawnotis['data'];
|
|
|
|
|
|
|
|
|
|
$notis_jbg_arr = [];
|
|
|
|
|
$now = Carbon::now();
|
|
|
|
|
foreach($notiscaw as $call)
|
|
|
|
|
{
|
|
|
|
|
$notis_to_be_inserted = new NotisJbg();
|
|
|
|
|
$notis_to_be_inserted->notjbg_id = $notisid;
|
|
|
|
|
$notis_to_be_inserted->tarikh_daftar = $tarikh_daftar;
|
|
|
|
|
$notis_to_be_inserted->kodcaw = $kodcaw;
|
|
|
|
|
$notis_to_be_inserted->norujukan = $call->norujukan;
|
|
|
|
|
$notis_to_be_inserted->nokp = $call->nokp;
|
|
|
|
|
$notis_to_be_inserted->jbg = $call->tempoh;
|
|
|
|
|
$notis_to_be_inserted->kadarupah = $call->kadarupah;
|
|
|
|
|
$notis_to_be_inserted->nilaimarhun = $call->nilaimarhun;
|
|
|
|
|
$notis_to_be_inserted->pinjaman = $call->bakipjm;
|
|
|
|
|
$notis_to_be_inserted->bakiupah = $call->bakiupah;
|
|
|
|
|
$notis_to_be_inserted->berat = $call->berat;
|
|
|
|
|
$notis_to_be_inserted->marhun = $call->marhun;
|
|
|
|
|
$notis_to_be_inserted->percentpinj = $call->percentpinj;
|
|
|
|
|
$notis_to_be_inserted->notiskali = '1';
|
|
|
|
|
$notis_jbg_arr[] = $notis_to_be_inserted->attributesToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$notis_jbg_collection = collect($notis_jbg_arr);
|
|
|
|
|
|
|
|
|
|
NotisJbg::insert($notis_jbg_arr);
|
|
|
|
|
}
|
|
|
|
|
return response()->json("success");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function senarainotisjbg()
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
|
|
|
|
|
$arraybatch = [];
|
|
|
|
|
$batchnotis = NotJbg::on('mysql7')->get();
|
|
|
|
|
// $cawangan_all = Cawangan::on('mysql7')->get();
|
|
|
|
|
// $cawnotis_all = [];
|
|
|
|
|
// foreach ($batchnotis as $index => $cawangan){
|
|
|
|
|
// $notis = CawanganNotis::on('mysql7')->get();
|
|
|
|
|
// if(sizeof($notis) != 0){
|
|
|
|
|
// array_push($cawnotis_all,$notis);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
return response()->json($batchnotis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getcawnotisjbg($notisid)
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
|
|
|
|
|
$arraybatch = [];
|
|
|
|
|
$batchnotisjbg = NotJbg::on('mysql7')->where('id',$notisid)->get();
|
|
|
|
|
$cawangan_all = Cawangan::on('mysql7')->get();
|
|
|
|
|
$cawnotisjbg_all = [];
|
|
|
|
|
foreach ($batchnotisjbg as $index => $cawangan){
|
|
|
|
|
$notis = CawanganNotisJbg::on('mysql7')
|
|
|
|
|
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notisjbg.kodcaw')
|
|
|
|
|
->where('cawangan_notisjbg.notjbg_id',$notisid)->get();
|
|
|
|
|
if(sizeof($notis) != 0){
|
|
|
|
|
array_push($cawnotisjbg_all,$notis);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return response()->json($cawnotisjbg_all);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getcawnotisjbgbycaw(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
|
|
|
|
|
$kodcaw = $request->kodcaw;
|
|
|
|
|
$notisid = $request->notisid;
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
|
|
|
|
|
$arraybatch = [];
|
|
|
|
|
$batchnotis = CawanganNotisJbg::on('mysql7')
|
|
|
|
|
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notisjbg.kodcaw')
|
|
|
|
|
->where('cawangan_notisjbg.notjbg_id',$notisid)->get();
|
|
|
|
|
|
|
|
|
|
foreach ($batchnotis as $index => $cawangan){
|
|
|
|
|
$notis = NotisJbg::on('mysql7')
|
|
|
|
|
->where('notisjbg.notjbg_id',$notisid)
|
|
|
|
|
->where('notisjbg.kodcaw',$cawangan['kodcaw'])
|
|
|
|
|
->distinct()
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$totalsagjbg = $notis->count('norujukan');
|
|
|
|
|
|
|
|
|
|
//$batchnotis [$index]['totalsag'] = $notis->count('norujukan');
|
|
|
|
|
//dd($totalsagjbg);
|
|
|
|
|
// if(sizeof($notis) != 0){
|
|
|
|
|
array_push($cawnotis_all,['namacaw'=>$batchnotis, 'detailbycaw' => $notis, 'totalsagjbg' =>$totalsagjbg]);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
// dd($cawnotis_all);
|
|
|
|
|
|
|
|
|
|
// $arrayrekod = ['rekod' => $cawnotis_all,'totalsagjbg' =>$totalsagjbg];
|
|
|
|
|
return response()->json($cawnotis_all);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bycawnotisjbg($kodcaw,$notisid)
|
|
|
|
|
{
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
|
|
|
|
|
$notisjbgbycaw = NotisJbg::on('mysql7')
|
|
|
|
|
->where('notisjbg.notjbg_id',$notisid)->where('notisjbg.kodcaw',$kodcaw)
|
|
|
|
|
->distinct()
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$notisjbgbycawarray = $notisjbgbycaw->toArray();
|
|
|
|
|
|
|
|
|
|
foreach($notisjbgbycawarray as $index=>$cal){
|
|
|
|
|
$customer = Customer::where('kpbaru','=',$cal['nokp'])
|
|
|
|
|
->orWhere('kplama','=',$cal['nokp'])
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
$notisjbgbycawarray[$index]['namacust'] = $customer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
array_push($notisjbgbycawarray);
|
|
|
|
|
return response()->json($notisjbgbycawarray);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bysagnotisjbg($kodcaw,$notisid,$id)
|
|
|
|
|
{
|
|
|
|
|
$notissag = NotisJbg::on('mysql7')
|
|
|
|
|
//->join('customer','customer.kplama','||','customer.kpbaru','=','notisjbg.nokp')
|
|
|
|
|
->where('notisjbg.notjbg_id',$notisid)->where('notisjbg.kodcaw',$kodcaw)->where('notisjbg.id',$id)
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
return response()->json($notissag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bysagnotisjbgCustomer($kodcaw,$notisid,$id)
|
|
|
|
|
{
|
|
|
|
|
$notissag = NotisJbg::on('mysql7')
|
|
|
|
|
//->join('customer','customer.kplama','||','customer.kpbaru','=','notisjbg.nokp')
|
|
|
|
|
->where('notisjbg.notjbg_id',$notisid)->where('notisjbg.kodcaw',$kodcaw)->where('notisjbg.id',$id)
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
$nokp = $notissag['nokp'];
|
|
|
|
|
// $notissagbyjbgarray = $notissagbyjbg->toArray();
|
|
|
|
|
|
|
|
|
|
// foreach($notissagbyjbgarray as $index=>$cal){
|
|
|
|
|
$cust_info = Customer::where('kpbaru','=',$notissag['nokp'])
|
|
|
|
|
->orWhere('kplama','=',$notissag['nokp'])
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
// $notissagbyjbgarray[$index]['namacust'] = $customer;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return response()->json($cust_info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bycawnotisjbg2($kodcaw,$notisid)
|
|
|
|
|
{
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
|
|
|
|
$notisjbgbycaw = NotisPeringatan::on('mysql7')
|
|
|
|
|
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->distinct()
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray();
|
|
|
|
|
$notisnokp = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->select('nokp')
|
|
|
|
|
->groupBy('nokp')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
foreach($notisnokp as $index1=>$cal){
|
|
|
|
|
$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp'])
|
|
|
|
|
->orWhere('kplama','=',$cal['nokp'])
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
// ->where('nokp','=',$cal['nokp'])
|
|
|
|
|
->where('nokp', 'like', '%'.$cal['nokp'].'%')
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$listsag = Gadai::on($cawangan['mysql'])
|
|
|
|
|
->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
->where('nokp','=',$cal['nokp'])
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
foreach($listsag as $index1=>$sag){
|
|
|
|
|
if($sag['tagbaru'] == '0'){
|
|
|
|
|
$keuntungan = 'asal';
|
|
|
|
|
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
|
|
|
|
$master = new MasterServices($kodcaw);
|
|
|
|
|
$response = $master->kiraUpahTawarruq($kodcaw,$sag['norujukan'],$jeniskeuntungan);
|
|
|
|
|
//dd($response);
|
|
|
|
|
}elseif($sag['tagbaru'] == '1'){
|
|
|
|
|
$keuntungan = 'onepercent';
|
|
|
|
|
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
|
|
|
|
$master = new MasterServices($kodcaw);
|
|
|
|
|
$response = $master->kiraupahUjrahOnePercent($kodcaw,$sag['norujukan']);
|
|
|
|
|
}
|
|
|
|
|
return response()->json($notis);
|
|
|
|
|
|
|
|
|
|
$listsag[$index1]['keuntungan'] = $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$notisnokp[$index1]['info'] = $customer;
|
|
|
|
|
$notisnokp[$index1]['listsag'] = $listsag;
|
|
|
|
|
$notisnokp[$index1]['listnotis'] = $listnotis;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$totalrekod = $notisjbgbycaw->sum('pinjaman');
|
|
|
|
|
$totalberat = $notisjbgbycaw->sum('berat');
|
|
|
|
|
$totalnilaimarhun = $notisjbgbycaw->sum('nilaimarhun');
|
|
|
|
|
$totalpinjaman = $notisjbgbycaw->sum('pinjaman');
|
|
|
|
|
$totalbakipjm = $notisjbgbycaw->sum('bakipjm');
|
|
|
|
|
$totaltunggakan = $notisjbgbycaw->sum('tunggakan');
|
|
|
|
|
|
|
|
|
|
$arrayrekod = ['rekod' => $notisnokp, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan];
|
|
|
|
|
// dd($arrayrekod);
|
|
|
|
|
return response()->json($arrayrekod,200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bysagnotisjbg2($kodcaw,$notisid,$nokp)
|
|
|
|
|
{
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
|
|
|
|
$notisjbgbycaw = NotisPeringatan::on('mysql7')
|
|
|
|
|
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
|
|
|
|
|
->where('nokp',$nokp)
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->distinct()
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray();
|
|
|
|
|
$notisnokp = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->select('nokp')
|
|
|
|
|
->groupBy('nokp')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
// dd($notisnokp);
|
|
|
|
|
foreach($notisnokp as $index1=>$cal){
|
|
|
|
|
|
|
|
|
|
$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
// ->where('nokp','=',$cal['nokp'])
|
|
|
|
|
->where('nokp', 'like', '%'.$cal['nokp'].'%')
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$listsag = Gadai::on($cawangan['mysql'])
|
|
|
|
|
->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
->where('nokp','=',$cal['nokp'])
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
foreach($listsag as $index11=>$sag){
|
|
|
|
|
if($sag['tagbaru'] == '0'){
|
|
|
|
|
$keuntungan = 'asal';
|
|
|
|
|
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
|
|
|
|
$master = new MasterServices($kodcaw);
|
|
|
|
|
$response = $master->kiraUpahTawarruq($kodcaw,$sag['norujukan'],$jeniskeuntungan);
|
|
|
|
|
//dd($response);
|
|
|
|
|
}elseif($sag['tagbaru'] == '1'){
|
|
|
|
|
$keuntungan = 'onepercent';
|
|
|
|
|
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
|
|
|
|
$master = new MasterServices($kodcaw);
|
|
|
|
|
$response = $master->kiraupahUjrahOnePercent($kodcaw,$sag['norujukan']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$listsag[$index11]['keuntungan'] = $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$notisnokp[$index1]['listsag'] = $listsag;
|
|
|
|
|
$notisnokp[$index1]['listnotis'] = $listnotis;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$getstatusremark = NotisPeringatan::on('mysql7')->where('nokp', $nokp)
|
|
|
|
|
//->whereIn('norujukan', $arraynorujukan)
|
|
|
|
|
->where('notis_id',$notisid)
|
|
|
|
|
->where('notisperingatan.peringatan',2)
|
|
|
|
|
// ->select('statuscall,remark1')
|
|
|
|
|
->groupBy('nokp')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$arrayrekod = ['rekodnotis' => $notisnokp, 'getstatusremark' => $getstatusremark];
|
|
|
|
|
// dd($arrayrekod);
|
|
|
|
|
return response()->json($arrayrekod,200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bysagnotisjbgCustomer2($kodcaw,$notisid,$nokp)
|
|
|
|
|
{
|
|
|
|
|
$notissag = NotisPeringatan::on('mysql7')
|
|
|
|
|
//->join('customer','customer.kplama','||','customer.kpbaru','=','notisjbg.nokp')
|
|
|
|
|
->where('notis_id',$notisid)->where('kodcaw',$kodcaw)->where('nokp',$nokp)
|
|
|
|
|
->where('peringatan',2)
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
$nokp = $notissag['nokp'];
|
|
|
|
|
// $notissagbyjbgarray = $notissagbyjbg->toArray();
|
|
|
|
|
|
|
|
|
|
// foreach($notissagbyjbgarray as $index=>$cal){
|
|
|
|
|
$cust_info = Customer::where('kpbaru','=',$notissag['nokp'])
|
|
|
|
|
->orWhere('kplama','=',$notissag['nokp'])
|
|
|
|
|
->first();
|
|
|
|
|
|
|
|
|
|
// $notissagbyjbgarray[$index]['namacust'] = $customer;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return response()->json($cust_info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getcawnotiskemaskini($notisid)
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
|
|
|
|
|
$arraybatch = [];
|
|
|
|
|
$batchnotis = Notis::on('mysql7')->where('id',$notisid)->get();
|
|
|
|
|
$cawangan_all = Cawangan::on('mysql7')->get();
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
foreach ($batchnotis as $index => $cawangan){
|
|
|
|
|
$notis = CawanganNotis::on('mysql7')
|
|
|
|
|
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw')
|
|
|
|
|
->where('notis_id',$notisid)->get();
|
|
|
|
|
}
|
|
|
|
|
return response()->json($notis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updatecall($kodcaw,$notisid,$nokp, Request $request)
|
|
|
|
|
{
|
|
|
|
|
$current = Carbon::now();
|
|
|
|
|
$current = new Carbon();
|
|
|
|
|
$harini = $current->toDateString();
|
|
|
|
|
$cawnotis_all = [];
|
|
|
|
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
|
|
|
|
$notiscall = NotisPeringatan::on('mysql7')
|
|
|
|
|
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
|
|
|
|
|
->where('nokp',$nokp)
|
|
|
|
|
//->where('notisperingatan.peringatan',2)
|
|
|
|
|
->distinct()
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$arraynorujukan = $notiscall->pluck('norujukan')->toArray();
|
|
|
|
|
|
|
|
|
|
$updateNotisCall = NotisPeringatan::on('mysql7')
|
|
|
|
|
->where('nokp', $nokp)
|
|
|
|
|
->where('notis_id', $notisid)->update([
|
|
|
|
|
'tarikhcall1'=> $harini,
|
|
|
|
|
'remark1'=> $request->nota,
|
|
|
|
|
'statuscall'=> $request->statuscall,
|
|
|
|
|
'caller'=>$request->caller
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return response()->json('success');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function senarainotisperingatankedua()
|
|
|
|
|
{
|
|
|
|
|