update kemaskini notis peringatan by caw
This commit is contained in:
@@ -203,16 +203,27 @@ class CallCenterController extends Controller
|
|||||||
$current = new Carbon();
|
$current = new Carbon();
|
||||||
|
|
||||||
$arraybatch = [];
|
$arraybatch = [];
|
||||||
$batchnotis = Notis::on('mysql7')->get();
|
// $batchnotis = Notis::on('mysql7')->get();
|
||||||
// $cawangan_all = Cawangan::on('mysql7')->get();
|
// return response()->json($batchnotis);
|
||||||
// $cawnotis_all = [];
|
$batchnotis = Notis::on('mysql7')
|
||||||
// foreach ($batchnotis as $index => $cawangan){
|
->get();
|
||||||
// $notis = CawanganNotis::on('mysql7')->get();
|
$cawnotis_all = [];
|
||||||
// if(sizeof($notis) != 0){
|
foreach ($batchnotis as $index => $cawangan){
|
||||||
// array_push($cawnotis_all,$notis);
|
$idnotis = $cawangan['id'];
|
||||||
// }
|
$tarikh_notis = $cawangan['tarikh_notis'];
|
||||||
// }
|
$daritempoh = $cawangan['daritempoh'];
|
||||||
return response()->json($batchnotis);
|
$notis = CawanganNotis::on('mysql7')
|
||||||
|
->join('notisperingatan', 'notisperingatan.kodcaw', '=', 'cawangan_notis.kodcaw')
|
||||||
|
->where('notisperingatan.notis_id',$cawangan['id'])
|
||||||
|
->where('notisperingatan.peringatan','1')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
$totalsag = $notis->count('norujukan');
|
||||||
|
if(sizeof($notis) != 0){
|
||||||
|
array_push($cawnotis_all,['id' => $idnotis, 'tarikh_notis' => $tarikh_notis, 'daritempoh' => $daritempoh,'totalsag' => $totalsag, 'detail' => $notis]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response()->json($cawnotis_all);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getcawnotis($notisid)
|
public function getcawnotis($notisid)
|
||||||
@@ -227,7 +238,36 @@ class CallCenterController extends Controller
|
|||||||
foreach ($batchnotis as $index => $cawangan){
|
foreach ($batchnotis as $index => $cawangan){
|
||||||
$notis = CawanganNotis::on('mysql7')
|
$notis = CawanganNotis::on('mysql7')
|
||||||
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw')
|
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw')
|
||||||
->where('notis_id',$notisid)->get();
|
->where('notis_id',$notisid)
|
||||||
|
->get();
|
||||||
|
foreach ($notis as $index1 => $bil){
|
||||||
|
$notisperingatanall = NotisPeringatan::on('mysql7')
|
||||||
|
->where('notis_id',$notisid)
|
||||||
|
->where('kodcaw',$bil['kodcaw'])
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$notisperingatan = NotisPeringatan::on('mysql7')
|
||||||
|
->where('notis_id',$notisid)
|
||||||
|
->where('kodcaw',$bil['kodcaw'])
|
||||||
|
->where('peringatan',1)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$notisperingatankedua = NotisPeringatan::on('mysql7')
|
||||||
|
->where('notis_id',$notisid)
|
||||||
|
->where('kodcaw',$bil['kodcaw'])
|
||||||
|
->where('peringatan',2)
|
||||||
|
->get();
|
||||||
|
// dd($notisperingatan);
|
||||||
|
|
||||||
|
$totalsag = $notisperingatanall->count('norujukan');
|
||||||
|
$bakitotalsag = $notisperingatan->count('norujukan');
|
||||||
|
$bakitotalsagkedua = $notisperingatankedua->count('norujukan');
|
||||||
|
$notis[$index1]['totalsag'] = $totalsag;
|
||||||
|
$notis[$index1]['bakitotalsag'] = $bakitotalsag;
|
||||||
|
$notis[$index1]['bakitotalsagkedua'] = $bakitotalsagkedua;
|
||||||
|
// dd($bil['kodcaw'],$totalsag);
|
||||||
|
}
|
||||||
|
|
||||||
if(sizeof($notis) != 0){
|
if(sizeof($notis) != 0){
|
||||||
array_push($cawnotis_all,$notis);
|
array_push($cawnotis_all,$notis);
|
||||||
}
|
}
|
||||||
@@ -259,13 +299,21 @@ class CallCenterController extends Controller
|
|||||||
->where('notisperingatan.peringatan','=', 1)
|
->where('notisperingatan.peringatan','=', 1)
|
||||||
->distinct()
|
->distinct()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
$notisbycawall = NotisPeringatan::on('mysql7')
|
||||||
|
->where('notisperingatan.notis_id',$notisid)
|
||||||
|
->where('notisperingatan.kodcaw',$cawangan['kodcaw'])
|
||||||
|
// ->where('notisperingatan.peringatan','=', 1)
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
// dd($notisbycaw);
|
// dd($notisbycaw);
|
||||||
|
|
||||||
$totalsag = $notisbycaw->count('norujukan');
|
$totalsag = $notisbycaw->count('norujukan');
|
||||||
|
$totalsagall = $notisbycawall->count('norujukan');
|
||||||
$totalbakipjm = $notisbycaw->sum('pinjaman');
|
$totalbakipjm = $notisbycaw->sum('pinjaman');
|
||||||
|
|
||||||
// if(sizeof($notis) != 0){
|
// if(sizeof($notis) != 0){
|
||||||
array_push($cawnotis_all,['namacaw' => $notis, 'detailbycaw' => $notisbycaw,'totalsag' =>$totalsag,'totalbakipjm' =>$totalbakipjm]);
|
array_push($cawnotis_all,['namacaw' => $notis, 'detailbycaw' => $notisbycaw,'totalsag' =>$totalsag,'totalsagall' =>$totalsagall,'totalbakipjm' =>$totalbakipjm]);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
return response()->json($cawnotis_all);
|
return response()->json($cawnotis_all);
|
||||||
@@ -605,33 +653,91 @@ class CallCenterController extends Controller
|
|||||||
->where('notis_id','=', $notisid)
|
->where('notis_id','=', $notisid)
|
||||||
->where('kodcaw','=', $kodcaw)
|
->where('kodcaw','=', $kodcaw)
|
||||||
->delete();
|
->delete();
|
||||||
|
//save log audit
|
||||||
|
$audit = new Audit();
|
||||||
|
$audit->users = $request->kodlaluan;
|
||||||
|
$audit->actions = 'Keluar Tebus';
|
||||||
|
$audit->norujukan = $notis['norujukan'];
|
||||||
|
$audit->kodcaw = $kodcaw;
|
||||||
|
$audit->created_at = $current;
|
||||||
|
$audit->updated_at = $current;
|
||||||
|
$audit->save();
|
||||||
|
|
||||||
}elseif($checkgadai->sttebus == ''){
|
}elseif($checkgadai->sttebus == ''){
|
||||||
|
$telahbayar = $checkgadai->hargajualan - $checkgadai->bakihargajualan;
|
||||||
|
$upah6bln_raw = $checkgadai->bakiupah - 0.5;
|
||||||
if($checkgadai->tagbaru == '0'){
|
|
||||||
// dd($notis['norujukan']);
|
if($checkgadai->lelong_tawarruq == '1'){ //fasa1
|
||||||
$keuntungan = 'asal';
|
if(bcdiv($telahbayar,1,1) >= bcdiv($upah6bln_raw,1,1)){
|
||||||
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
//deletelist
|
||||||
$master = new MasterServices($kodcaw);
|
$updatelistnotis=NotisPeringatan::on('mysql7')
|
||||||
$response = $master->kiraUpahTawarruq($kodcaw,$notis['norujukan'],$jeniskeuntungan);
|
->where('norujukan','=', $notis['norujukan'])
|
||||||
}elseif($checkgadai->tagbaru == '1'){
|
->where('notis_id','=', $notisid)
|
||||||
$keuntungan = 'onepercent';
|
->where('kodcaw','=', $kodcaw)
|
||||||
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
|
->delete();
|
||||||
$master = new MasterServices($kodcaw);
|
//update tagnotis
|
||||||
$response = $master->kiraupahUjrahOnePercent($kodcaw,$notis['norujukan']);
|
$updatedata = Gadai::on($cawangan['mysql'])
|
||||||
}
|
->where('norujukan',$notis['norujukan'])
|
||||||
// dd($response);
|
->update([
|
||||||
|
'tagnotis'=> '0'
|
||||||
$updatedata = NotisPeringatan::on('mysql7')
|
]);
|
||||||
->where('norujukan',$notis['norujukan'])
|
//save log audit
|
||||||
->where('notis_id','=', $notisid)
|
$audit = new Audit();
|
||||||
->where('kodcaw','=', $kodcaw)
|
$audit->users = $request->kodlaluan;
|
||||||
->update([
|
$audit->actions = 'Keluar Notis';
|
||||||
'jbg'=> $checkgadai->tempoh,
|
$audit->norujukan = $notis['norujukan'];
|
||||||
'pinjaman'=> $checkgadai->bakipjm,
|
$audit->kodcaw = $kodcaw;
|
||||||
'bakiupah'=> $response
|
$audit->created_at = $current;
|
||||||
]);
|
$audit->updated_at = $current;
|
||||||
|
$audit->save();
|
||||||
|
}else{
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedata = NotisPeringatan::on('mysql7')
|
||||||
|
->where('norujukan',$notis['norujukan'])
|
||||||
|
->where('notis_id','=', $notisid)
|
||||||
|
->where('kodcaw','=', $kodcaw)
|
||||||
|
->update([
|
||||||
|
'jbg'=> $checkgadai->tempoh,
|
||||||
|
'pinjaman'=> $checkgadai->bakipjm,
|
||||||
|
'bakiupah'=> $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}elseif($checkgadai->lelong_tawarruq == '0'){ //fasa2
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedata = NotisPeringatan::on('mysql7')
|
||||||
|
->where('norujukan',$notis['norujukan'])
|
||||||
|
->where('notis_id','=', $notisid)
|
||||||
|
->where('kodcaw','=', $kodcaw)
|
||||||
|
->update([
|
||||||
|
'jbg'=> $checkgadai->tempoh,
|
||||||
|
'pinjaman'=> $checkgadai->bakipjm,
|
||||||
|
'bakiupah'=> $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -651,7 +757,6 @@ class CallCenterController extends Controller
|
|||||||
->where('peringatan', 1)
|
->where('peringatan', 1)
|
||||||
->where('tarikhnotis1','<>', NULL)
|
->where('tarikhnotis1','<>', NULL)
|
||||||
->get();
|
->get();
|
||||||
// dd($listnotis,);
|
|
||||||
foreach($listnotis as $index=> $notis){
|
foreach($listnotis as $index=> $notis){
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$notis['kodcaw'])->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$notis['kodcaw'])->first();
|
||||||
$detail = Gadai::on($cawangan['mysql'])
|
$detail = Gadai::on($cawangan['mysql'])
|
||||||
@@ -660,7 +765,7 @@ class CallCenterController extends Controller
|
|||||||
$tarikhmatang = Carbon::parse($detail['t_matang']);
|
$tarikhmatang = Carbon::parse($detail['t_matang']);
|
||||||
|
|
||||||
if($detail['lelong_tawarruq'] == 1){
|
if($detail['lelong_tawarruq'] == 1){
|
||||||
$t_perlunotis = ($tarikhmatang->subDays(14))->format('d-m-Y');
|
$t_perlunotis = ($tarikhmatang->subDays(14))->format('Y-m-d');
|
||||||
if($t_perlunotis <= $today){
|
if($t_perlunotis <= $today){
|
||||||
$updatedata = NotisPeringatan::on('mysql7')
|
$updatedata = NotisPeringatan::on('mysql7')
|
||||||
->where('norujukan',$notis['norujukan'])
|
->where('norujukan',$notis['norujukan'])
|
||||||
@@ -730,11 +835,19 @@ class CallCenterController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
// dd($notisbycaw);
|
// dd($notisbycaw);
|
||||||
|
|
||||||
|
$notisbycawall = NotisPeringatan::on('mysql7')
|
||||||
|
->where('notisperingatan.notis_id',$notisid)
|
||||||
|
->where('notisperingatan.kodcaw',$cawangan['kodcaw'])
|
||||||
|
// ->where('notisperingatan.peringatan','=', 1)
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
$totalsag = $notisbycaw->count('norujukan');
|
$totalsag = $notisbycaw->count('norujukan');
|
||||||
|
$totalsagall = $notisbycawall->count('norujukan');
|
||||||
$totalbakipjm = $notisbycaw->sum('pinjaman');
|
$totalbakipjm = $notisbycaw->sum('pinjaman');
|
||||||
|
|
||||||
// if(sizeof($notis) != 0){
|
// if(sizeof($notis) != 0){
|
||||||
array_push($cawnotis_all,['namacaw' => $notis, 'detailbycaw' => $notisbycaw,'totalsag' =>$totalsag,'totalbakipjm' =>$totalbakipjm]);
|
array_push($cawnotis_all,['namacaw' => $notis, 'detailbycaw' => $notisbycaw,'totalsag' =>$totalsag,'totalsagall' =>$totalsagall,'totalbakipjm' =>$totalbakipjm]);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
return response()->json($cawnotis_all);
|
return response()->json($cawnotis_all);
|
||||||
@@ -987,4 +1100,37 @@ class CallCenterController extends Controller
|
|||||||
return response()->json($notis);
|
return response()->json($notis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function senarainotisperingatankedua()
|
||||||
|
{
|
||||||
|
$current = Carbon::now();
|
||||||
|
$current = new Carbon();
|
||||||
|
|
||||||
|
$arraybatch = [];
|
||||||
|
// $batchnotis = Notis::on('mysql7')->get();
|
||||||
|
// return response()->json($batchnotis);
|
||||||
|
$batchnotis = Notis::on('mysql7')
|
||||||
|
// ->join('cawangan_notis', 'cawangan_notis.notis_id', '=', 'notis.id')
|
||||||
|
// ->distinct()
|
||||||
|
->get();
|
||||||
|
// $cawangan_all = Cawangan::on('mysql7')->get();
|
||||||
|
$cawnotis_all = [];
|
||||||
|
foreach ($batchnotis as $index => $cawangan){
|
||||||
|
$idnotis = $cawangan['id'];
|
||||||
|
$tarikh_notis = $cawangan['tarikh_notis'];
|
||||||
|
$daritempoh = $cawangan['daritempoh'];
|
||||||
|
$notis = CawanganNotis::on('mysql7')
|
||||||
|
->join('notisperingatan', 'notisperingatan.kodcaw', '=', 'cawangan_notis.kodcaw')
|
||||||
|
->where('notisperingatan.notis_id',$cawangan['id'])
|
||||||
|
// ->where('cawangan_notis.kodcaw',$cawangan['kodcaw'])
|
||||||
|
->where('notisperingatan.peringatan','2')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$totalsag = $notis->count('norujukan');
|
||||||
|
if(sizeof($notis) != 0){
|
||||||
|
array_push($cawnotis_all,['id' => $idnotis, 'tarikh_notis' => $tarikh_notis, 'daritempoh' => $daritempoh,'totalsag' => $totalsag, 'detail' => $notis]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response()->json($cawnotis_all);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -870,6 +870,7 @@ $router->group(['prefix'=>'arcc'], function () use ($router){
|
|||||||
$router->get('getdatanotiskedua/{kodcaw}/{notisid}/{fasa}',['uses'=>'CallCenterController@getdatanotiskedua']);
|
$router->get('getdatanotiskedua/{kodcaw}/{notisid}/{fasa}',['uses'=>'CallCenterController@getdatanotiskedua']);
|
||||||
$router->post('/notis/blastwasapbysagkedua',['uses'=>'CallCenterController@blastwasapbysagkedua']);
|
$router->post('/notis/blastwasapbysagkedua',['uses'=>'CallCenterController@blastwasapbysagkedua']);
|
||||||
$router->get('getcawnotiskemaskini/{notisid}',['uses'=>'CallCenterController@getcawnotiskemaskini']);
|
$router->get('getcawnotiskemaskini/{notisid}',['uses'=>'CallCenterController@getcawnotiskemaskini']);
|
||||||
|
$router->get('senarainotisperingatankedua',['uses'=>'CallCenterController@senarainotisperingatankedua']);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user