Merged in feature/customerlelong-v2 (pull request #352)
added customer info lelong for arrahnpay
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Cawangan;
|
||||
use App\Gadai;
|
||||
use App\GlDetail;
|
||||
use App\Http\Controllers\TebusController as TebusController;
|
||||
use App\Lelong;
|
||||
use App\Services\Loggers\OnlineTransactionLoggerService;
|
||||
use App\Services\OnePercentServices;
|
||||
use App\Support\v2\Calculation;
|
||||
@@ -767,8 +768,49 @@ class TransactionOnlineController extends Controller
|
||||
return 'rejected';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function CustomerInfoLelong(Request $request){
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$totalBakiLelong = 0;
|
||||
$totalRugiLelong = 0;
|
||||
|
||||
foreach ($cawangan_all as $index => $cawangan) {
|
||||
$gadai = Gadai::on($cawangan['mysql'])
|
||||
->where([['sttebus', '=', ''], ['nokp', '=', $request->ic]])
|
||||
->orderBy('t_gadai', 'desc')
|
||||
->get()->toArray();
|
||||
|
||||
if (sizeof($gadai) != 0) {
|
||||
foreach ($gadai as $gad) {
|
||||
$bakilelong = Lelong::on($cawangan['mysql'])
|
||||
->where(function($query) {
|
||||
$query->whereNull('trkhtuntut')
|
||||
->orWhere('trkhtuntut', '=', '');
|
||||
})
|
||||
->where('baki', '>=', 0)
|
||||
->sum('baki');
|
||||
|
||||
$rugilelong = Lelong::on($cawangan['mysql'])
|
||||
->where(function($query) {
|
||||
$query->whereNull('trkhtuntut')
|
||||
->orWhere('trkhtuntut', '=', '');
|
||||
})
|
||||
->where('baki','<',0)
|
||||
->sum('baki');
|
||||
}
|
||||
|
||||
$totalBakiLelong += $bakilelong;
|
||||
$totalRugiLelong += $rugilelong;
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Data retrieved successfully',
|
||||
'data' => [
|
||||
'bakilelong' => $totalBakiLelong,
|
||||
'rugilelong' => $totalRugiLelong,
|
||||
]
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,6 +788,7 @@ $router->group(['prefix'=>'portal'], function () use ($router){
|
||||
$router->get('transaksipelanggan/upah',['uses'=>'TransactionController@TransaksiUpah']);
|
||||
$router->get('searchsagonline',['uses'=>'TransactionOnlineController@searchSAGOnline']);
|
||||
$router->get('customer/info',['uses'=>'TransactionOnlineController@CustomerInfo']);
|
||||
$router->get('customer/info/lelong',['uses'=>'TransactionOnlineController@CustomerInfoLelong']);
|
||||
});
|
||||
|
||||
$router->group(['prefix'=>'admin'], function () use ($router){
|
||||
|
||||
Reference in New Issue
Block a user