fix
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Cawangan;
|
||||
use DateTime;
|
||||
|
||||
class PermohonanController extends Controller
|
||||
@@ -54,12 +55,143 @@ class PermohonanController extends Controller
|
||||
$current = Carbon::now();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
|
||||
$permohonan=Http::get(config('api.url').'/admin/permohonan/get/'. $request->cawangan .'/'. $request->mohonid)->json();
|
||||
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
|
||||
$tarikhcetakan = $myDateTime->format('d-m-Y');
|
||||
|
||||
$permohonan=Http::get(config('api.url').'/admin/permohonan/get/'. $request->cawangan .'/'. $request->mohonid)->json();
|
||||
$caw = Cawangan::where('kodcaw',$request->cawangan)->get()->toArray();
|
||||
$jeniscawangan = $caw[0]['syarikat'];
|
||||
|
||||
return view('permohonan.cetakanfull', compact('cawangan_detail','permohonan','tarikhcetakan'));
|
||||
$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;
|
||||
}
|
||||
|
||||
$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('permohonan.cetakanfull', compact('ringgittext','jeniscawangan','fullname','cawangan_detail','permohonan','tarikhcetakan'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user