Advertisement
murdanieko

Simulasi PKE

Sep 22nd, 2022
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.42 KB | None | 0 0
  1. <?php
  2.  
  3. $harga_emas_gr = request()->gold_price ?? 900000;
  4. $input_kebutuhan = request()->amount_ask ?? 5;
  5. $jangka_waktu = request()->termin ?? 12;
  6.  
  7. $total_harga = $harga_emas_gr * $input_kebutuhan;
  8. $uang_muka = 0.2 * $harga_emas_gr * $input_kebutuhan;
  9. $rekomendasi_pencairan = ($harga_emas_gr * $input_kebutuhan) - $uang_muka;
  10. $rate_margin = 0.17; # 17%
  11. $angsuran = $rekomendasi_pencairan * ($rate_margin / 12)*(((1+($rate_margin / 12)) ** $jangka_waktu )/(((1+($rate_margin / 12)) ** $jangka_waktu )-1));
  12. $pokok = $rekomendasi_pencairan;
  13. $margin_ujroh = ($angsuran * $jangka_waktu) - $rekomendasi_pencairan;
  14. $total_kewajiban = $pokok + $margin_ujroh;
  15.  
  16. if ( request()->amount_ask ) : ?>
  17.     Harga Emas per Gram = <?php echo number_format( $harga_emas_gr ) ?> / gram<br>
  18.     Input Kebutuhan = <?php echo number_format( $input_kebutuhan ) ?> gram<br>
  19.     Jangka Waktu = <?php echo number_format( $jangka_waktu ) ?> bulan<br>
  20.     Total Harga = <?php echo number_format( $total_harga ) ?> <br>
  21.     Uang Muka = <?php echo number_format( $uang_muka ) ?> <br>
  22.     Rekomendasi Pencairan = <?php echo number_format( $rekomendasi_pencairan ) ?> <br>
  23.     Angsuran = <?php echo number_format( $angsuran ) ?> <br>
  24.     Pokok = <?php echo number_format( $pokok ) ?> <br>
  25.     Margin Ujroh = <?php echo number_format( $margin_ujroh ) ?> <br>
  26.     Total Kewajiban = <?php echo number_format( $total_kewajiban ) ?> <br>
  27.  
  28.  
  29. <?php endif; ?>
  30.  
  31. <table class="table">
  32.     <thead>
  33.         <tr>
  34.             <th>angs. ke.</th>
  35.             <th>sisa pokok</th>
  36.             <th>angs. pokok</th>
  37.             <th>angs. margin</th>
  38.             <th>angs. total</th>
  39.             <th>rate</th>
  40.         </tr>
  41.     </thead>
  42.  
  43.     <tbody>
  44.         <?php
  45.             $s_pokok = $rekomendasi_pencairan;
  46.         ?>
  47.  
  48.         <?php for($s = 1; $s <= $jangka_waktu; $s++): ?>
  49.         <tr>
  50.             <?php
  51.                 $angs_margin = $s_pokok * $rate_margin / 12;
  52.                 $angs_pokok  = $angsuran - $angs_margin;
  53.                 $s_pokok     = $s_pokok - $angs_pokok;
  54.             ?>
  55.  
  56.             <td><?php echo $s ?></td>
  57.             <td><?php echo number_format($s_pokok) ?></td>
  58.             <td><?php echo number_format($angs_pokok) ?></td>
  59.             <td><?php echo number_format($angs_margin) ?></td>
  60.             <td><?php echo number_format($angsuran) ?></td>
  61.             <td>17%</td>
  62.         </tr>
  63.         <?php endfor; ?>
  64.     </tbody>
  65. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement