From 4712b6d2d2f4ac0e344f285d328c295616efc839 Mon Sep 17 00:00:00 2001 From: "e.arrahn" Date: Sun, 8 Aug 2021 01:08:36 +0800 Subject: [PATCH 1/5] server latest --- app/Http/Controllers/LaporanController.php | 4 +-- app/Http/Controllers/LelongController.php | 26 ++++++++--------- app/Http/Controllers/PanjarController.php | 7 ----- config/database.php | 33 ---------------------- 4 files changed, 15 insertions(+), 55 deletions(-) diff --git a/app/Http/Controllers/LaporanController.php b/app/Http/Controllers/LaporanController.php index 53b42ff..9381385 100644 --- a/app/Http/Controllers/LaporanController.php +++ b/app/Http/Controllers/LaporanController.php @@ -58,7 +58,7 @@ class LaporanController extends Controller //b - $bilangan_gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$request->tarikh)->count(); + $bilangan_gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$request->tarikh)->where('pinjaman','>',0)->count(); $bilangan_tebus = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$request->tarikh)->count(); $bilangan_ansuran = Transaction::on('mysql7')->whereRaw('DATE(created_at) = ?',[$request->tarikh])->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]])->count(); $bilangan_customer_baru = Customer::on('mysql7')->where([['tarikhdaftar','=',$request->tarikh],['kodcaw',$request->kodcaw]])->count(); @@ -256,7 +256,7 @@ class LaporanController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); $laporan_terkumpul = []; - $gadai = Gadai::on($cawangan['mysql'])->where([['t_gadai','>=',$request->mula],['t_gadai','<=',$request->akhir]]); + $gadai = Gadai::on($cawangan['mysql'])->where([['t_gadai','>=',$request->mula],['t_gadai','<=',$request->akhir]])->where('pinjaman','>',0); $tebus = Tebus::on($cawangan['mysql'])->where([['t_tebus','>=',$request->mula],['t_tebus','<=',$request->akhir]]); $ansuran = Transaction::on('mysql7')->whereDate('created_at','>=',$request->mula)->whereDate('created_at','<=',$request->akhir)->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]]); diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 6bedf89..ea6992d 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -249,12 +249,12 @@ class LelongController extends Controller } }else{ $bakilelong = Lelong::on($cawangan['mysql']) - ->where('t_jual','>=',$request->mula) - ->where('t_jual','<=',$request->hingga) - ->where(function($query) use ($tarikhbaru){ - $query->whereNull('trkhtuntut') - ->orWhere('trkhtuntut','>',$tarikhbaru); - }) + ->where('trkhtuntut','>=',$request->mula) + ->where('trkhtuntut','<=',$request->hingga) + // ->where(function($query) use ($tarikhbaru){ + // $query->whereNull('trkhtuntut') + // ->orWhere('trkhtuntut','>',$tarikhbaru); + // }) ->where('baki','>=',0) ->sum('baki'); } @@ -263,13 +263,13 @@ class LelongController extends Controller ->sum('bayaran'); $rugilelong = Lelong::on($cawangan['mysql']) - ->where('t_jual','>=',$request->mula) - ->where('t_jual','<=',$request->hingga) - ->where(function($query) use ($tarikhbaru) - { - $query->whereNull('trkhtuntut') - ->orWhere('trkhtuntut','>',$tarikhbaru); - }) + ->where('trkhtuntut','>=',$request->mula) + ->where('trkhtuntut','<=',$request->hingga) + //->where(function($query) use ($tarikhbaru) + //{ + // $query->whereNull('t_jual') + // ->orWhere('t_jual','>',$tarikhbaru); + //}) ->where('baki','<',0) ->sum('baki'); diff --git a/app/Http/Controllers/PanjarController.php b/app/Http/Controllers/PanjarController.php index 6e1de5f..6583daa 100644 --- a/app/Http/Controllers/PanjarController.php +++ b/app/Http/Controllers/PanjarController.php @@ -195,13 +195,6 @@ class PanjarController extends Controller ->sum('bayaran'); - - if($kodcaw == 'APM') - { - $perubatan = $perubatan - 10; - $baikidanselenggara = $baikidanselenggara - 10; - } - $arraycalculation = ['bds' => $baikidanselenggara, 'perubatan' => $perubatan, 'keraian' => $keraian]; return response()->json($arraycalculation); diff --git a/config/database.php b/config/database.php index afbd7f8..da7a044 100644 --- a/config/database.php +++ b/config/database.php @@ -16,7 +16,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql2' => [ 'driver' => 'mysql', @@ -29,7 +28,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql3' => [ 'driver' => 'mysql', @@ -42,7 +40,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql4' => [ 'driver' => 'mysql', @@ -55,7 +52,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql5' => [ 'driver' => 'mysql', @@ -68,7 +64,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], @@ -83,7 +78,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], @@ -98,7 +92,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql8' => [ 'driver' => 'mysql', @@ -111,7 +104,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql9' => [ @@ -125,7 +117,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql10' => [ 'driver' => 'mysql', @@ -138,7 +129,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql11' => [ 'driver' => 'mysql', @@ -151,7 +141,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql12' => [ @@ -165,7 +154,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql13' => [ 'driver' => 'mysql', @@ -178,7 +166,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql14' => [ 'driver' => 'mysql', @@ -191,7 +178,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql15' => [ @@ -205,7 +191,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql16' => [ 'driver' => 'mysql', @@ -218,7 +203,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql17' => [ @@ -232,7 +216,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql18' => [ 'driver' => 'mysql', @@ -245,7 +228,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql19' => [ 'driver' => 'mysql', @@ -258,7 +240,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql20' => [ 'driver' => 'mysql', @@ -271,7 +252,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql21' => [ 'driver' => 'mysql', @@ -284,7 +264,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql22' => [ @@ -298,7 +277,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql23' => [ 'driver' => 'mysql', @@ -311,7 +289,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql24' => [ @@ -325,7 +302,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql25' => [ @@ -339,7 +315,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql26' => [ 'driver' => 'mysql', @@ -352,7 +327,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql27' => [ 'driver' => 'mysql', @@ -365,7 +339,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql28' => [ @@ -379,7 +352,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql29' => [ 'driver' => 'mysql', @@ -392,7 +364,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql30' => [ 'driver' => 'mysql', @@ -405,7 +376,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql31' => [ 'driver' => 'mysql', @@ -418,7 +388,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql32' => [ 'driver' => 'mysql', @@ -431,7 +400,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql33' => [ 'driver' => 'mysql', @@ -444,7 +412,6 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], ], ]; From 2d5a62cb1c5f1c2f77df63703c28a53361d875c1 Mon Sep 17 00:00:00 2001 From: afiq Date: Sun, 8 Aug 2021 01:45:39 +0800 Subject: [PATCH 2/5] fix scan --- app/Http/Controllers/GadaiController.php | 14 ++++++++++---- app/Http/Controllers/TebusController.php | 13 ++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index f7df114..b3f71e5 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -529,11 +529,17 @@ class GadaiController extends Controller public function barcodeScan($kodcaw,$norujukan){ $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'semakbarcode'=>'Lulus' - )); + $dahscan = Gadai::on($cawangan['mysql'])->where([['norujukan','=',$norujukan],['semakbarcode','Lulus']])->first(); - return response()->json($gadai,200); + if($dahscan){ + return response()->json('scanned'); + }else{ + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update([ + 'semakbarcode'=>'Lulus' + ]); + + return response()->json('success'); + } } public function checkSerahGadaian(Request $request){ diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 08e1499..12c0f76 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -580,10 +580,17 @@ class TebusController extends Controller public function tagterimaupdate($kodcaw,$norujukan){ $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $dahscan = Tebus::on($cawangan['mysql'])->where([['norujukan','=',$norujukan],['tagterima',1]])->first(); - $update_inoutmar = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'tagterima' => 1 - )); + if($dahscan){ + return response()->json('scanned'); + }else{ + $update_inoutmar = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'tagterima' => 1 + )); + + return response()->json('success'); + } } public function checkSerahTebus(Request $request){ From bb32bf88329660571c59ac3ed9e5645c97782866 Mon Sep 17 00:00:00 2001 From: afiq Date: Mon, 9 Aug 2021 01:21:20 +0800 Subject: [PATCH 3/5] admin page customer --- app/Http/Controllers/CustomerController.php | 82 +++++++++++++++++++++ routes/web.php | 1 + 2 files changed, 83 insertions(+) diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index ab8f95a..3b677e6 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -428,6 +428,88 @@ class CustomerController extends Controller return response()->json($customer_update, 200); } + public function customerUpdateAdmin(Request $request){ + $poskod = Poskod::on('mysql7')->where('poskod','=',$request->poskod)->first(); + + if($request->ic_asal != $request->icno){ + + $existing_customer = Customer::on('mysql7') + ->where('kplama','=',$request->icno) + ->orWhere('kpbaru','=',$request->icno) + ->get(); + + if($existing_customer->isEmpty()){ + $cawangan_all = Cawangan::on('mysql7')->get(); + foreach($cawangan_all as $index=> $cawangan){ + $gadai = Gadai::on($cawangan['mysql'])->where('nokp',$request->ic_asal)->update([ + 'nokp'=>$request->icno + ]); + } + + $data_asal = $customer_update = Customer::on('mysql7') + ->where('kplama','=',$request->ic_asal) + ->orWhere('kpbaru','=',$request->ic_asal) + ->first(); + + if($data_asal['kpbaru'] != null){ + $customer_update = Customer::on('mysql7') + ->where('kplama','=',$request->ic_asal) + ->orWhere('kpbaru','=',$request->ic_asal) + ->update(array( + 'kpbaru' => $request->icno, + 'telefon' => $request->telefon1, + 'telefon2' => $request->telefon2, + 'kodbank' => $request->kodbank, + 'noakaun' => $request->noakaun, + 'nota' => $request->nota, + 'nama' => $request->nama, + 'alamat1' => $request->alamat, + 'poskod' => $request->poskod, + 'koddaerah' => $poskod['koddaerah'], + 'kodnegeri' => $poskod['kodnegeri'] + )); + }else{ + $customer_update = Customer::on('mysql7') + ->where('kplama','=',$request->ic_asal) + ->orWhere('kpbaru','=',$request->ic_asal) + ->update(array( + 'kplama' => $request->icno, + 'telefon' => $request->telefon1, + 'telefon2' => $request->telefon2, + 'kodbank' => $request->kodbank, + 'noakaun' => $request->noakaun, + 'nota' => $request->nota, + 'nama' => $request->nama, + 'alamat1' => $request->alamat, + 'poskod' => $request->poskod, + 'koddaerah' => $poskod['koddaerah'], + 'kodnegeri' => $poskod['kodnegeri'] + )); + } + }else{ + return response()->json('existing'); + } + }else if($request->ic_asal == $request->icno){ + $customer_update = Customer::on('mysql7') + ->where('kplama','=',$request->icno) + ->orWhere('kpbaru','=',$request->icno) + ->update(array( + 'telefon' => $request->telefon1, + 'telefon2' => $request->telefon2, + 'kodbank' => $request->kodbank, + 'noakaun' => $request->noakaun, + 'nota' => $request->nota, + 'nama' => $request->nama, + 'alamat1' => $request->alamat, + 'poskod' => $request->poskod, + 'koddaerah' => $poskod['koddaerah'], + 'kodnegeri' => $poskod['kodnegeri'] + )); + } + + return response()->json($customer_update, 200); + } + public function listNorujukanMobile($nokp){ $cawangan_all = Cawangan::on('mysql7')->get(); $array_norujukan = []; diff --git a/routes/web.php b/routes/web.php index 57ef895..39240ed 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,6 +36,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->put('customers/update/khazanah/{nokp}', ['uses' => 'CustomerController@customerUpdateKhazanah']); $router->get('customers/laporan/{kodcaw}/{tarikh}',['uses'=>'CustomerController@getLaporanCustomers']); $router->get('customers/latest/{kodcaw}',['uses'=>'CustomerController@getLatestCustomer']); + $router->put('customers/information/update/admin', ['uses' => 'CustomerController@customerUpdateAdmin']); //Gadai API $router->get('gadai',['uses'=>'GadaiController@showAllGadais']); From 3ae009b3c7064aad3b2a1c1db865514a28b068a9 Mon Sep 17 00:00:00 2001 From: afiq Date: Mon, 9 Aug 2021 12:10:19 +0800 Subject: [PATCH 4/5] fix customer admin --- app/Http/Controllers/CustomerController.php | 17 +++++++++++++++++ routes/web.php | 1 + 2 files changed, 18 insertions(+) diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 3b677e6..3f28a59 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -63,6 +63,23 @@ class CustomerController extends Controller return response()->json($customer); } + public function showOneCustomerByICAdmin(Request $request){ + + // $cawangan_all = Cawangan::on('mysql7')->get(); + // $customer_all = []; + // foreach($cawangan_all as $index=>$cawangan){ + $customer = Customer::on('mysql7') + ->where('kplama','=',$request->ic) + ->orWhere('kpbaru','=',$request->ic) + ->first(); + // if($customer != null){ + // array_push($customer_all,$customer); + // } + // } + + return response()->json($customer); + } + public function showOneCustomerByICMobile($ic){ $cawangan_all = Cawangan::on('mysql7')->get(); diff --git a/routes/web.php b/routes/web.php index 39240ed..da3801b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -37,6 +37,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('customers/laporan/{kodcaw}/{tarikh}',['uses'=>'CustomerController@getLaporanCustomers']); $router->get('customers/latest/{kodcaw}',['uses'=>'CustomerController@getLatestCustomer']); $router->put('customers/information/update/admin', ['uses' => 'CustomerController@customerUpdateAdmin']); + $router->get('admin/customers/nokp/search',['uses'=>'CustomerController@showOneCustomerByICAdmin']); //Gadai API $router->get('gadai',['uses'=>'GadaiController@showAllGadais']); From 65931b6c771a9f67318599ae029febbc2d5a04af Mon Sep 17 00:00:00 2001 From: MUHD HAFIFIE Date: Thu, 12 Aug 2021 23:43:34 +0800 Subject: [PATCH 5/5] fix skit2 --- app/Http/Controllers/TebusController.php | 32 +++++++++++++++++++++++- app/Http/Controllers/TunaiController.php | 14 +++++++++++ config/database.php | 8 ++++++ routes/web.php | 3 +++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 12c0f76..e08ce36 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -1041,7 +1041,6 @@ class TebusController extends Controller $penghutangkaki = imbangdugalama::on($cawangan['mysql']) ->sum('penghutang'); - return response()->json($penghutangkaki,200); } @@ -1211,4 +1210,35 @@ class TebusController extends Controller return response($rebet); } + public function getUpahLamaToday($kodcaw,$norujukan) + { + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $listadvansur = Advansur::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->where('tarikh','=',$current->toDateString()) + ->orderBy('tarikh','desc') + ->get(); + + if(sizeof($listadvansur) > 0) + return response(1); + else + return response(0); + } + + public function removeUpahLamaToday($kodcaw,$norujukan) + { + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $removed = Advansur::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->delete(); + + if($removed) + return response(1); + else + return response(0); + } + } diff --git a/app/Http/Controllers/TunaiController.php b/app/Http/Controllers/TunaiController.php index b4f9725..ded94ed 100644 --- a/app/Http/Controllers/TunaiController.php +++ b/app/Http/Controllers/TunaiController.php @@ -272,6 +272,20 @@ class TunaiController extends Controller return response()->json($requestteller); } + public function getRequestTellerLaporanSerahanBerkala($kodcaw,Request $request) + { + + $current = Carbon::now(); + $current = new Carbon(); + + $requestteller=RequestTeller::on('mysql7') + ->where([['kodcaw','=',$kodcaw],['update','=',1],['serahan','>',0],['kodlaluan','=',$request->teller],['tarikh','=',$current->toDateString()]]) + ->orderBy('recno','desc') + ->first(); + + return response()->json($requestteller); + } + public function getRequestTellerByDate($kodcaw,Request $request) { diff --git a/config/database.php b/config/database.php index da7a044..eebc494 100644 --- a/config/database.php +++ b/config/database.php @@ -16,6 +16,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql2' => [ 'driver' => 'mysql', @@ -28,6 +29,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql3' => [ 'driver' => 'mysql', @@ -40,6 +42,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql4' => [ 'driver' => 'mysql', @@ -52,6 +55,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql5' => [ 'driver' => 'mysql', @@ -64,6 +68,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], @@ -78,6 +83,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], @@ -92,6 +98,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql8' => [ 'driver' => 'mysql', @@ -104,6 +111,7 @@ return [ 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, + 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'mysql9' => [ diff --git a/routes/web.php b/routes/web.php index eccfa04..15c0016 100644 --- a/routes/web.php +++ b/routes/web.php @@ -216,6 +216,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('advansurdetailsrange/{kodcaw}',['uses'=>'TebusController@advansurdetailsRange']); $router->post('ansuran/create/{kodcaw}',['uses'=>'TebusController@createAdvansur']); $router->get('advansur/{kodcaw}/{norujukan}',['uses'=>'TebusController@getAdvansurUpah']); + $router->get('upahlamatoday/{kodcaw}/{norujukan}',['uses'=>'TebusController@getUpahLamaToday']); + $router->post('removeupahlamatoday/{kodcaw}/{norujukan}',['uses'=>'TebusController@removeUpahLamaToday']); //POLIS API $router->get('polis/get/',['uses'=>'PolisController@getPolis']); @@ -296,6 +298,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->post('requestTeller/{kodcaw}',['uses' => 'TunaiController@createRequestTeller']); $router->get('requestTeller/get/{kodcaw}',['uses' => 'TunaiController@getRequestTeller']); $router->get('requestTeller/getlaporan/{kodcaw}',['uses' => 'TunaiController@getRequestTellerLaporanSerahan']); + $router->get('requestTeller/getlaporanberkala/{kodcaw}',['uses' => 'TunaiController@getRequestTellerLaporanSerahanBerkala']); $router->get('requestTeller/get/{kodcaw}/date',['uses' => 'TunaiController@getRequestTellerByDate']); $router->put('requestTeller/update/{kodcaw}',['uses' => 'TunaiController@updateRequestTeller']); $router->put('requestTeller/batal/{kodcaw}',['uses' => 'TunaiController@batalRequestTeller']);