fix
This commit is contained in:
@@ -3693,5 +3693,179 @@ class KhazanahController extends Controller
|
||||
'Content-Disposition' => 'inline; filename='.$download['filename']
|
||||
]);
|
||||
}
|
||||
|
||||
public function JanaPermohonan(Request $request){
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
|
||||
$permohonan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/admin/permohonan/get/'.$auth_user['cawangan'] . '/' . $request->mohonid)->json();
|
||||
$permohonan = $permohonan[0];
|
||||
$caw = CawanganAR::where('kodcaw',$auth_user['cawangan'])->get()->toArray();
|
||||
$jeniscawangan = $caw[0]['syarikat'];
|
||||
|
||||
$current = Carbon::now();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
|
||||
$ahli = '';
|
||||
$fullname = '';
|
||||
switch($jeniscawangan){
|
||||
case 'PKB' : $fullname = 'PERMODALAN KELANTAN BERHAD';
|
||||
break;
|
||||
case 'SYIRKAH' : $fullname = 'JOINT VENTURE PKB AND KRKB';
|
||||
break;
|
||||
case 'KPKB' : $fullname = 'JOINT VENTURE PKB AND KPKB';
|
||||
break;
|
||||
case 'BMMB' : $fullname = 'JOINT VENTURE MVSB AND PKB';
|
||||
$ahli = 'Ahli JMC';
|
||||
break;
|
||||
}
|
||||
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
|
||||
$tarikhcetakan = $myDateTime->format('d-m-Y');
|
||||
|
||||
|
||||
$ringgittext = '';
|
||||
if($permohonan['jumlah_diluluskan'] !== null)
|
||||
{
|
||||
|
||||
$decones = array(
|
||||
'01' => "Satu",
|
||||
'02' => "Dua",
|
||||
'03' => "Tiga",
|
||||
'04' => "Empat",
|
||||
'05' => "Lima",
|
||||
'06' => "Enam",
|
||||
'07' => "Tujuh",
|
||||
'08' => "Lapan",
|
||||
'09' => "Sembilan",
|
||||
10 => "Sepuluh",
|
||||
11 => "Sebelas",
|
||||
12 => "Dua Belas",
|
||||
13 => "Tiga Belas",
|
||||
14 => "Empat Belas",
|
||||
15 => "Lima Belas",
|
||||
16 => "Enam Belas",
|
||||
17 => "Tujuh Belas",
|
||||
18 => "Lapan Belas",
|
||||
19 => "Sembilan Belas"
|
||||
);
|
||||
$ones = array(
|
||||
0 => " ",
|
||||
1 => "Satu",
|
||||
2 => "Dua",
|
||||
3 => "Tiga",
|
||||
4 => "Empat",
|
||||
5 => "Lima",
|
||||
6 => "Enam",
|
||||
7 => "Tujuh",
|
||||
8 => "Lapan",
|
||||
9 => "Sembilan",
|
||||
10 => "Sepuluh",
|
||||
11 => "Sebelas",
|
||||
12 => "Dua Belas",
|
||||
13 => "Tiga Belas",
|
||||
14 => "Empat Belas",
|
||||
15 => "Lima Belas",
|
||||
16 => "Enam Belas",
|
||||
17 => "Tujuh Belas",
|
||||
18 => "Lapan Belas",
|
||||
19 => "Sembilan Belas"
|
||||
);
|
||||
$tens = array(
|
||||
0 => "",
|
||||
2 => "Dua Puluh",
|
||||
3 => "Tiga Puluh",
|
||||
4 => "Empat Puluh",
|
||||
5 => "Lima Puluh",
|
||||
6 => "Enam Puluh",
|
||||
7 => "Tujuh Puluh",
|
||||
8 => "Lapan Puluh",
|
||||
9 => "Sembilan Puluh"
|
||||
);
|
||||
$hundreds = array(
|
||||
"Ratus",
|
||||
"Ribu",
|
||||
"Juta",
|
||||
"bilion",
|
||||
"trilion"
|
||||
); //limit t quadrillion
|
||||
|
||||
$num = number_format($permohonan['jumlah_diluluskan'],2,".",",");
|
||||
// dd($num);
|
||||
$num_arr = explode(".",$num);
|
||||
$wholenum = $num_arr[0];
|
||||
$decnum = $num_arr[1];
|
||||
$whole_arr = array_reverse(explode(",",$wholenum));
|
||||
krsort($whole_arr);
|
||||
$ringgittext = "";
|
||||
|
||||
|
||||
|
||||
foreach($whole_arr as $key => $i){
|
||||
if($i > 0 && $i < 20){
|
||||
$ringgittext .= $ones[$i];
|
||||
}
|
||||
elseif($i < 100){
|
||||
$ringgittext .= $tens[substr($i,0,1)];
|
||||
$ringgittext .= " ".$ones[substr($i,1,1)];
|
||||
}
|
||||
else{
|
||||
$ringgittext .= $ones[substr($i,0,1)]." ".$hundreds[0];
|
||||
$ringgittext .= " ".$tens[substr($i,1,1)];
|
||||
$ringgittext .= " ".$ones[substr($i,2,1)];
|
||||
}
|
||||
if($key > 0){
|
||||
$ringgittext .= " ".$hundreds[$key]." ";
|
||||
}
|
||||
}
|
||||
|
||||
$text = preg_replace('/\s+/', ' ', $ringgittext);
|
||||
$trimmed_str = rtrim($text);
|
||||
|
||||
$ringgittext = $trimmed_str." Ringgit";
|
||||
|
||||
if($decnum > 0){
|
||||
$ringgittext .= " dan ";
|
||||
if($decnum < 20){
|
||||
$ringgittext .= $decones[$decnum];
|
||||
}
|
||||
elseif($decnum < 100){
|
||||
$ringgittext .= $tens[substr($decnum,0,1)];
|
||||
$ringgittext .= " ".$ones[substr($decnum,1,1)];
|
||||
}
|
||||
$ringgittext = $ringgittext." sen";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return view('print.jana_permohonan', compact('cawangan_detail','api_url','permohonan','jeniscawangan','fullname','tarikhcetakan','ringgittext'));
|
||||
}
|
||||
|
||||
public function ProsesPermohonan(Request $request)
|
||||
{
|
||||
$imageName = 'JanaanPC_' .time().'.'.$request->image->extension();
|
||||
$data = base64_encode($request->image->get());
|
||||
|
||||
$updatelulus = Http::accept('application/'.$request->image->extension())->post(config('api.url') . '/admin/permohonan/updatejanapc',[
|
||||
'status' => $request->status,
|
||||
'dataimage' => $data,
|
||||
'imagename' => $imageName,
|
||||
'imagetype' => $request->image->extension(),
|
||||
'mohonid' => $request->mohonid
|
||||
])->json();
|
||||
|
||||
|
||||
if($updatelulus)
|
||||
{
|
||||
return response('success');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user