Merge branch 'adminapi' into 'master'
Adminapi See merge request online-sistem1/api_arrahn!157
This commit is contained in:
@@ -2506,6 +2506,30 @@ class AdminPageController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function RemoveDraftWTD(Request $request){
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||
|
||||
DB::connection('mysql7')->beginTransaction();
|
||||
DB::connection($cawangan['mysql'])->beginTransaction();
|
||||
|
||||
try{
|
||||
$result1 = SerahBaki::on($cawangan['mysql'])->where('batchno',$request->batchno)->delete();
|
||||
$result2 = WTDDraft::on('mysql7')->where([['kodcaw',$request->kodcaw],['batchno_serah',$request->batchno]])->delete();
|
||||
|
||||
DB::connection($cawangan['mysql'])->commit();
|
||||
DB::connection('mysql7')->commit();
|
||||
|
||||
return response()->json($result1,200);
|
||||
}catch (\Exception $e) {
|
||||
DB::connection('mysql7')->rollback();
|
||||
DB::connection($cawangan['mysql'])->rollback();
|
||||
|
||||
return response()->json($e->getMessage(),400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function ProsesWTD(Request $request){
|
||||
|
||||
$current = Carbon::now();
|
||||
@@ -2576,7 +2600,7 @@ class AdminPageController extends Controller
|
||||
't_update' => $current->toDateString()));
|
||||
}
|
||||
|
||||
$serahbakiupdate = SerahBaki::on($cawangan['mysql'])->where('batchno',$batchno)->update(array('aktif' => 1));;
|
||||
$serahbakiupdate = SerahBaki::on($cawangan['mysql'])->where('batchno',$batchno)->update(array('aktif' => 1,'t_jual' => $current->toDateString(),'nopelanggan' => $request->nocek));;
|
||||
|
||||
return response()->json('success',200);
|
||||
|
||||
@@ -2738,8 +2762,10 @@ class AdminPageController extends Controller
|
||||
if($i == 13)
|
||||
{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where('tempoh','>',12)->count();
|
||||
}else if($i == 1){
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',0],['tempoh','<=',1.5]])->count();
|
||||
}else{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-1],['tempoh','<=',$i]])->count();
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-(0.5)],['tempoh','<=',$i+(0.5)]])->count();
|
||||
}
|
||||
${"tempoh".$i."sum"} = ${"tempoh".$i}->sum('bakipjm');
|
||||
array_push($arraycount,${"tempoh".$i."count"});
|
||||
@@ -2806,8 +2832,10 @@ class AdminPageController extends Controller
|
||||
if($i == 13)
|
||||
{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where('tempoh','>',12)->count();
|
||||
}else if($i == 1){
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',0],['tempoh','<=',1.5]])->count();
|
||||
}else{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-1],['tempoh','<=',$i]])->count();
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-(0.5)],['tempoh','<=',$i+(0.5)]])->count();
|
||||
}
|
||||
${"tempoh".$i."sum"} = ${"tempoh".$i}->sum('bakipjm');
|
||||
array_push($arraycount,${"tempoh".$i."count"});
|
||||
|
||||
@@ -483,7 +483,7 @@ class LelongController extends Controller
|
||||
|
||||
|
||||
$serahbaki = SerahBaki::on($cawangan['mysql'])
|
||||
->where('tarikh','<=', $request->tarikh)
|
||||
->where([['tarikh','<=', $request->tarikh],['aktif',1]])
|
||||
->sum('baki');
|
||||
|
||||
return response()->json($serahbaki,200);
|
||||
|
||||
@@ -22,6 +22,20 @@ use App\Moratorium;
|
||||
use App\Audit;
|
||||
use App\LookupWakil;
|
||||
|
||||
use App\StokAudit1;
|
||||
use App\StokAudit2;
|
||||
use App\StokAudit3;
|
||||
use App\StokAudit4;
|
||||
use App\StokAudit5;
|
||||
use App\StokAudit6;
|
||||
use App\StokAudit7;
|
||||
use App\StokAudit8;
|
||||
use App\StokAudit9;
|
||||
use App\StokAudit10;
|
||||
use App\StokAudit11;
|
||||
use App\StokAudit12;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Carbon\Carbon;
|
||||
@@ -1907,4 +1921,56 @@ class TebusController extends Controller
|
||||
return response(0);
|
||||
}
|
||||
|
||||
public function calculationKeuntunganPenggadai($kodcaw,Request $request)
|
||||
{
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$date = new Carbon($request->tarikh);
|
||||
$month_sebelum = $date->subMonth()->format('m');
|
||||
$month_sekarang = $date->format('m');
|
||||
$year_generate = $date->format('Y');
|
||||
|
||||
switch($month_sebelum){
|
||||
case '01': $audit_backdate = StokAudit1::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '02': $audit_backdate = StokAudit2::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '03': $audit_backdate = StokAudit3::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '04': $audit_backdate = StokAudit4::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '05': $audit_backdate = StokAudit5::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '06': $audit_backdate = StokAudit6::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '07': $audit_backdate = StokAudit7::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '08': $audit_backdate = StokAudit8::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '09': $audit_backdate = StokAudit9::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '10': $audit_backdate = StokAudit10::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '11': $audit_backdate = StokAudit11::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
case '12': $audit_backdate = StokAudit12::on($cawangan['mysql'])->where('tahun',$year_generate);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$audit_now = Gadai::on($cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['t_gadai','<=',$request->tarikh],['sttebus','=','']])
|
||||
->orWhere([['tagpalsu','=',0],['t_update','>',$request->tarikh],['sttebus','!=',''],['t_gadai','<=',$request->tarikh]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC');
|
||||
|
||||
$totaltunggakan_now = $audit_now->sum('tunggakan');
|
||||
$totaltunggakan_sebelum = $audit_backdate->sum('upahblmbyar');
|
||||
|
||||
|
||||
dd($totaltunggakan_now,$totaltunggakan_sebelum);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -477,6 +477,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
$router->get('cajperkhidmatanterkumpul/{kodcaw}',['uses'=>'LelongController@cajperkhidmatancalculation']);
|
||||
$router->get('CalculationHapusKira/{kodcaw}',['uses'=>'LaporanController@CalcHapusKira']);
|
||||
$router->get('Xtra/{kodcaw}',['uses'=>'LaporanController@CalcXtra']);
|
||||
$router->get('KeuntunganPenggadai/{kodcaw}',['uses'=>'TebusController@calculationKeuntunganPenggadai']);
|
||||
|
||||
|
||||
//LEJER AM//
|
||||
@@ -715,6 +716,7 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
||||
$router->post('wtd/process',['uses'=>'AdminPageController@ProsesWTD']);
|
||||
$router->get('wtd/rekod',['uses'=>'AdminPageController@rekodWTD']);
|
||||
$router->get('wtd/rekod/{batchno}',['uses'=>'AdminPageController@rekodWTDByBatchNo']);
|
||||
$router->post('wtd/delete',['uses'=>'AdminPageController@RemoveDraftWTD']);
|
||||
|
||||
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
||||
$router->get('laporan/aging',['uses'=>'AdminPageController@LaporanAging']);
|
||||
|
||||
Reference in New Issue
Block a user