feature/modal-online-pendahuluan
This commit is contained in:
@@ -2588,7 +2588,6 @@ class KhazanahController extends Controller
|
||||
//print lejer_AM
|
||||
public function cetak_lejer_am(Request $request)
|
||||
{
|
||||
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
@@ -2596,29 +2595,32 @@ class KhazanahController extends Controller
|
||||
$cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$num = $request->num;
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
|
||||
if($request->datetimepicker1 == null){
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
}else {
|
||||
// fix: bagi default value supaya $tarikh_mula / $tarikh_akhir tak undefined
|
||||
$tarikh_mula = $tarikh_cetak;
|
||||
$tarikh_akhir = $tarikh_cetak;
|
||||
|
||||
if($request->datetimepicker1 != null){
|
||||
$split_date = explode('-', $request->datetimepicker1);
|
||||
$tarikh_mula = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
|
||||
}
|
||||
|
||||
if($request->datetimepicker2 == null){
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
}
|
||||
else{
|
||||
if($request->datetimepicker2 != null){
|
||||
$split_date = explode('-', $request->datetimepicker2);
|
||||
$tarikh_akhir = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
|
||||
}
|
||||
|
||||
// ambil 'had' daripada modal_online melalui API (VaultController@CalculationModalOnlineLejer)
|
||||
$had_response = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get($api_url . '/api/ModalOnlineLejer/' . $auth_user['cawangan'], [
|
||||
'mula' => $tarikh_mula,
|
||||
'hingga' => $tarikh_akhir,
|
||||
])->json();
|
||||
|
||||
$had_modal_online = $had_response['had'] ?? 0;
|
||||
|
||||
$lejeramdata = Lejeram::orderBy('glcode')->get();
|
||||
$lejeram = array();
|
||||
@@ -2628,8 +2630,6 @@ class KhazanahController extends Controller
|
||||
|
||||
foreach($lejeramdata as $index => $lejer)
|
||||
{
|
||||
|
||||
|
||||
if($lejer->api_redirect != null)
|
||||
{
|
||||
${$lejer['variable']} = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). $lejer['api_redirect'] . $auth_user['cawangan'], ['mula' => $tarikh_mula, 'hingga' => $tarikh_akhir])->json();
|
||||
@@ -2659,6 +2659,12 @@ class KhazanahController extends Controller
|
||||
$kredit = ${$lejer['variable']}[$lejer->namakredit];
|
||||
}
|
||||
|
||||
// tambah 'had' modal_online khusus untuk Pendahuluan Daripada HQ
|
||||
if($lejer->glcode == '7000/102')
|
||||
{
|
||||
$kredit = floatval($kredit) + $had_modal_online;
|
||||
}
|
||||
|
||||
$totalkredit += floatval($kredit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user