function kekata($x) { $abil = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas"); if ($x < 12) { $rx = " " . $abil[$x]; } elseif ($x < 20) { $rx = kekata($x - 10) . "Belas"; } elseif ($x < 100) { $rx = kekata($x / 10) . " Puluh" . kekata($x % 10); } elseif ($x < 200) { $rx = " seratus" . kekata($x - 100); } elseif ($x < 1000) { $rx = kekata($x / 100) . " Ratus" . kekata($x % 100); } elseif ($x < 2000) { $rx = " seribu" . kekata($x - 1000); } elseif ($x < 1000000) { $rx = kekata($x / 1000) . " Ribu" . kekata($x % 1000); } elseif ($x < 1000000000) { $rx = kekata($x / 1000000) . " Juta" . kekata($x % 1000000); } return $rx; }
function terbilang($x, $style) { if ($x < 0) { $hasil = "minus " . trim(kekata($x)); } else { $hasil = trim(kekata($x)); } switch ($style) { case 1: $hasil = strtoupper($hasil); break; case 2: $hasil = strtolower($hasil); break; case 3: $hasil = ucwords($hasil); break; default: $hasil = ucfirst($hasil); break; } return $hasil; }
if (!isset($tglKasBank[$rKode['noinvoice']])) { $tglKasBank[$rKode['noinvoice']] = '0000-00-00'; } if (!isset($ntrKasBank[$rKode['noinvoice']])) { $ntrKasBank[$rKode['noinvoice']] = ''; } $optTglJurnal = makeOption($dbname, 'keu_jurnalht', 'noreferensi,tanggal', "noreferensi='" . $ntrKasBank[$rKode['noinvoice']] . "' and noreferensi!=''"); $pdf->Cell(3 / 100 * $width, $height, $no, 1, 0, 'C', 1); $pdf->Cell(15 / 100 * $width, $height, $optNm[$rKode['kodeorg']], 1, 0, 'L', 1); $pdf->Cell(10 / 100 * $width, $height, $rKode['noinvoice'], 1, 0, 'L', 1); $pdf->Cell(7 / 100 * $width, $height, tanggalnormal($rKode['tanggal']), 1, 0, 'C', 1); $pdf->Cell(7 / 100 * $width, $height, tanggalnormal($optTglJurnal[$ntrKasBank[$rKode['noinvoice']]]), 1, 0, 'C', 1); $pdf->Cell(8 / 100 * $width, $height, $ntrKasBank[$rKode['noinvoice']], 1, 0, 'L', 1); $pdf->Cell(10 / 100 * $width, $height, $rKode['nopo'], 1, 0, 'L', 1); $pdf->Cell(12 / 100 * $width, $height, $optNmSupp[$rKode['kodesupplier']], 1, 0, 'L', 1); $pdf->Cell(8 / 100 * $width, $height, number_format($rKode['nilaiinvoice'], 2), 1, 0, 'R', 1); $pdf->Cell(5 / 100 * $width, $height, $rKode['nilaippn'], 1, 0, 'R', 1); $pdf->Cell(6 / 100 * $width, $height, tanggalnormal($rKode['jatuhtempo']), 1, 0, 'C', 1); $pdf->Cell(9 / 100 * $width, $height, $rKode['nofp'], 1, 1, 'L', 1); $totInvoice += $rKode['nilaiinvoice']; } $pdf->Cell(72 / 100 * $width, $height, $_SESSION['lang']['total'] . ": " . kekata($totInvoice), 1, 0, 'L', 1); $pdf->Cell(28 / 100 * $width, $height, number_format($totInvoice, 2), 1, 1, 'L', 1); } else { exit("Error: Data Kosong"); } $pdf->Output(); break; default: break; }
public function kekata($x) { $x = abs($x); $angka = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"); $temp = ""; if ($x < 12) { $temp = " " . $angka[$x]; } else { if ($x < 20) { $temp = kekata($x - 10) . " belas"; } else { if ($x < 100) { $temp = kekata($x / 10) . " puluh" . kekata($x % 10); } else { if ($x < 200) { $temp = " seratus" . kekata($x - 100); } else { if ($x < 1000) { $temp = kekata($x / 100) . " ratus" . kekata($x % 100); } else { if ($x < 2000) { $temp = " seribu" . kekata($x - 1000); } else { if ($x < 1000000) { $temp = kekata($x / 1000) . " ribu" . kekata($x % 1000); } else { if ($x < 1000000000) { $temp = kekata($x / 1000000) . " juta" . kekata($x % 1000000); } else { if ($x < 1000000000000) { $temp = kekata($x / 1000000000) . " milyar" . kekata(fmod($x, 1000000000)); } else { if ($x < 1000000000000000) { $temp = kekata($x / 1000000000000) . " trilyun" . kekata(fmod($x, 1000000000000)); } } } } } } } } } } return $temp; }