edited route test to panjar

This commit is contained in:
hafifierahman
2024-11-10 22:32:28 +08:00
parent 494408a5cc
commit 00f077544b
3 changed files with 20 additions and 11 deletions
+12 -5
View File
@@ -8,39 +8,46 @@ use App\Denominasi;
use App\Services\CashFlow\TellerServices;
use Illuminate\Http\Request;
use App\Services\Miscellaneous\PanjarServices;
use Log;
use Carbon\Carbon;
class DenominasiController extends Controller
{
public function test($kodcaw,Request $request){
public function cashdeposit($kodcaw,Request $request){
$teller = new TellerServices($kodcaw);
$response = $teller->CashDeposit($request);
return response()->json($response);
}
public function test2($kodcaw,Request $request){
public function cashwithdraw($kodcaw,Request $request){
$teller = new TellerServices($kodcaw);
$response = $teller->CashWithdrawals($request);
return response()->json($response);
}
public function test3($kodcaw,Request $request){
public function createpanjar($kodcaw,Request $request){
$teller = new PanjarServices($kodcaw);
$response = $teller->create($request);
return response()->json($response);
}
public function test4($kodcaw,Request $request){
public function deletepanjar($kodcaw,Request $request){
$teller = new PanjarServices($kodcaw);
$response = $teller->delete($request);
return response()->json($response);
}
public function getPerubatanAmount($kodcaw,Request $request){
$teller = new PanjarServices($kodcaw);
$response = $teller->getPerubatanAmount($request->tuntutoleh);
return response()->json($response);
}
public function listdenominasi($kodcaw)
{
$current = Carbon::now();
@@ -368,8 +368,10 @@ class PanjarServices
}
public function getPerubatanAmount($tuntutanoleh){
$current = Carbon::now();
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $this->cawangan)->first();
$panjar = Panjar::on($cawangan['mysql'])->where('kategori','Belanja AM - Perubatan')->where('tuntutoleh',$tuntutanoleh)->sum('bayaran');
$panjar = Panjar::on($cawangan['mysql'])->whereYear('tarikh',$current->year)->where('kategori','Belanja AM - Perubatan')->where('tuntutoleh',$tuntutanoleh)->sum('bayaran');
return $panjar;
}
+5 -5
View File
@@ -648,11 +648,11 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('/cawangan/getcawnotisall/{kodcaw}',['uses'=>'CawanganCallCenterController@getcawnotisall']);
$router->get('/cawangan/bycawnotisperingatan/{kodcaw}/{notisid}',['uses'=>'CawanganCallCenterController@bycawnotisperingatan']);
$router->post('test/updatetunai/{kodcaw}',['uses'=>'DenominasiController@test']);
$router->post('test/serahantunai/{kodcaw}',['uses'=>'DenominasiController@test2']);
$router->post('test/createpanjar/{kodcaw}',['uses'=>'DenominasiController@test3']);
$router->post('test/deletepanjar/{kodcaw}',['uses'=>'DenominasiController@test4']);
$router->post('panjar/updatetunai/{kodcaw}',['uses'=>'DenominasiController@cashdeposit']);
$router->post('panjar/serahantunai/{kodcaw}',['uses'=>'DenominasiController@cashwithdraw']);
$router->post('panjar/createpanjar/{kodcaw}',['uses'=>'DenominasiController@createpanjar']);
$router->post('panjar/deletepanjar/{kodcaw}',['uses'=>'DenominasiController@deletepanjar']);
$router->get('panjar/getperubatan/{kodcaw}',['uses'=>'DenominasiController@getPerubatanAmount']);
});