function to_word($number) { $words = ""; $arr_number = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"); if ($number < 12) { $words = " " . $arr_number[$number]; } else { if ($number < 20) { $words = to_word($number - 10) . " belas"; } else { if ($number < 100) { $words = to_word($number / 10) . " puluh " . to_word($number % 10); } else { if ($number < 200) { $words = "seratus " . to_word($number - 100); } else { if ($number < 1000) { $words = to_word($number / 100) . " ratus " . to_word($number % 100); } else { if ($number < 2000) { $words = "seribu " . to_word($number - 1000); } else { if ($number < 1000000) { $words = to_word($number / 1000) . " ribu " . to_word($number % 1000); } else { if ($number < 1000000000) { $words = to_word($number / 1000000) . " juta " . to_word($number % 1000000); } else { $words = "undefined"; } } } } } } } } return $words; }
<tr> <td><span style="margin-left: 50px;">Denda <?php echo $records->jenis_pembayaran; $denda = $records->prosentase_denda * $jumlah / 100; ?> </span></td> <td class="rata_kanan">Rp. <?php echo number_format($denda, 2, '.', ','); ?> </td> </tr> <?php } ?> <tr > <td>Total Pembayaran</td> <td class="rata_kanan">Rp. <?php echo number_format($total = $jumlah + $denda, 2, '.', ','); ?> </td> </tr> <tr> <td colspan="2"><br />Terbilang <span class="border" style="margin-left: 30px;">#<?php echo ucwords(to_word($total) . " rupiah"); ?> #</span></td> </tr> </table> </div>
<td style="border-bottom-style: solid;border-width:thin; font-size: 11px"> </td> </tr> <tr> <td style="font-size: 11px">Jumlah</td> <td> </td> <td style="border-bottom-style: solid;border-width:thin; font-size: 11px">Rp. <strong><?php echo number_format($par['par_paid'], 0, ',', '.'); ?> </strong>,-</td> </tr> <tr> <td style="font-size: 11px">Terbilang</td> <td> </td> <td style="border-bottom-style: solid;border-width:thin; font-size: 11px"><span class="cap"><?php $this->load->helper('tanggal'); echo to_word($par['par_paid']); ?> Rupiah</span></td> </tr> </table> <table width="100%"> <tr> <td> </td> <td width="320"> </td> <td style="font-size: 11px"> </td> <td style="border-bottom-style: solid;border-width:thin; font-size: 11px">Cileungsi, <span class="cap"><?php echo pretty_date($par['par_input_date'], 'd F Y', False); ?> </span></td> </tr> </table><br>