Advertisement
Guest User

fpdf case

a guest
Jul 7th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. error_reporting(0);
  4. if (empty($_SESSION['username']) AND empty($_SESSION['passuser'])){
  5.   include("login.php");
  6. }
  7. else
  8. {
  9.  
  10.   function FormatNoTrans($num) {
  11.     $num = $num;
  12.     switch (strlen($num)) {
  13.       case 1 : $NoTrans = "0000".$num; break;
  14.       case 2 : $NoTrans = "000".$num; break;
  15.       case 3 : $NoTrans = "00".$num; break;
  16.       case 4 : $NoTrans = "0".$num; break;
  17.       default: $NoTrans = $num;
  18.     }  
  19.     return $NoTrans;
  20.   }
  21.   include("koneksi.php");
  22.   include_once "terbilang.php";
  23.   $get = "SELECT
  24.            b.TglMohon, b.denda_kp, b.denda_sk, b.total, b.retrib_kp, b.retrib_sk, b.thn_lewat_kp,
  25.            b.thn_lewat_sk, b.bulan_lewat_sk, b.bulan_lewat_kp, b.persen_kp, b.persen_sk, b.kode_trayek,
  26.            b.id_sk, b.id_kp, b.denda_kp,b.denda_sk, c.Pemilik, c.Alamat
  27.          FROM  
  28.            tbl_data_nota b, tbl_data_pkb c
  29.          WHERE
  30.            b.id=$_GET[id] AND c.id=b.id_pkb";
  31.   $exe= mysql_query($get);
  32.   $jml= mysql_num_rows($exe);
  33.   $show = mysql_fetch_array($exe);
  34.   if ($show['id_sk']!=0){$sk=" SK ";}
  35.   if ($show['id_kp']!=0){$kp=" KP ";}
  36.   if ($show['denda_sk']!=0){$dendask=" SK ";}
  37.   if ($show['denda_kp']!=0){$dendakp=" KP ";}
  38.   if ($show['thn_lewat_kp']!=0) {$thn_lewat_kp=" KP ";}
  39.   if ($show['thn_lewat_sk']!=0) {$thn_lewat_sk=" SK ";}
  40.   $no_sk=FormatNoTrans($show[no_sk]);
  41.   $no_kp=FormatNoTrans($show[id]);
  42.   $dsk       = $show['retrib_sk']*$show['persen_sk']/(100);
  43.   $totaldsk  = $dsk;
  44.   $dkp       = $show['retrib_kp']*$show['persen_kp']/(100);
  45.   $totaldkp  = $dkp;
  46.   $sk        = $show['retrib_sk']*$show['thn_lewat_sk'];
  47.   $totalsk   = $sk;
  48.   $kp        = $show['retrib_kp']*$show['thn_lewat_kp'];
  49.   $totalkp   = $kp;
  50.   $total1    = $totalsk+$show['denda_sk'];
  51.   $total2    = $totalkp+$show['denda_kp'];
  52.   $total3    = $totalkp+$totalsk;
  53.   $total4    = $show['denda_sk']+$show['denda_kp'];
  54.   $total5    = $total1+$total2;
  55.   $terbilang = toTerbilang($totalsk+$totalkp+$totaldsk+$totaldkp);
  56.   include 'fpdf/fpdf.php';
  57.   $pdf = new FPDF('L','cm','Legal');
  58.   $pdf->AddPage();
  59.   $pdf->SetFont('Arial','',10);
  60.   $pdf->Cell('12', 1, '', 0, 0);
  61.   $pdf->Cell('12', 1, '', 0, 0);
  62.   $pdf->Cell('12', 1, '', 0, 1);
  63.   $pdf->Cell('12', 2, '', 0, 0);
  64.   $pdf->Cell('12', 2, "            ".substr(tgl_indojam($show['TglMohon']), 3), 0, 0);
  65.   $pdf->Cell('12', 2, '', 0, 1);
  66.   $pdf->Cell('12', 1.5, "                                             ".$show['Pemilik'], 0, 0);
  67.   $pdf->Cell('12', 1.5, "        ".$show['Alamat'], 0, 0);
  68.   $pdf->Cell('12', 1.5, '', 0, 1);
  69.   $pdf->Cell('1', 0.8, '', 0, 0);
  70.   $pdf->Cell('5', 0.8, '', 0, 0);
  71.   $pdf->Cell('3', 0.8, '', 0, 0);
  72.   $pdf->Cell('6', 0.8, '', 0, 0);
  73.   $pdf->Cell('4', 0.8, '', 0, 0);
  74.   $pdf->Cell('4', 0.8, '', 0, 0);
  75.   $pdf->Cell('4', 0.8, '', 0, 0);
  76.   $pdf->Cell('4', 0.8, '', 0, 0);
  77.   $pdf->Cell('5', 0.8, '', 0, 1);
  78.   $pdf->Cell('1', 1.2, '', 0, 0);
  79.   $pdf->Cell('5', 1.2, '', 0, 0);
  80.   $pdf->Cell('3', 1.2, '', 0, 0);
  81.   $pdf->Cell('6', 1.2, '', 0, 0);
  82.   $pdf->Cell('4', 1.2, '', 0, 0);
  83.   $pdf->Cell('4', 1.2, '', 0, 0);
  84.   $pdf->Cell('4', 1.2, '', 0, 0);
  85.   $pdf->Cell('4', 1.2, '', 0, 0);
  86.   $pdf->Cell('5', 1.2, '', 0, 1);
  87.   $pdf->Cell('1', 0.8, '      1', 0, 0);
  88.   $pdf->Cell('5', 0.8, '         IJIN TRAYEK LOKAL', 0, 0);
  89.   $pdf->Cell('3', 0.8, '           4.02.03.11.04', 0, 0);
  90.   $pdf->Cell('6', 0.8, '         Perda No.10 Tahun 2012', 0, 0);
  91.   $pdf->Cell('4', 0.8, '', 0, 0);
  92.   $pdf->Cell('4', 0.8, '', 0, 0);
  93.   $pdf->Cell('4', 0.8, '', 0, 0);
  94.   $pdf->Cell('4', 0.8, '', 0, 0);
  95.   $pdf->Cell('5', 0.8, '', 0, 1);
  96.   $pdf->Cell('1', 0.8, '', 0, 0);
  97.   $pdf->Cell('5', 0.8, '', 0, 0);
  98.   $pdf->Cell('3', 0.8, '', 0, 0);
  99.   $pdf->Cell('6', 0.8, '         PERPANJANGAN KP', 0, 0);
  100.   $pdf->Cell('4', 0.8, '         1 Kendaraan', 0, 0);
  101.   $pdf->Cell('4', 0.8, "                      ".$show['retrib_kp']." x " .$show['thn_lewat_kp']." Thn ", 0, 0);
  102.   $pdf->Cell('4', 0.8, "                ".$totalkp, 0, 0);
  103.   $pdf->Cell('4', 0.8, '', 0, 0);
  104.   $pdf->Cell('5', 0.8, "      ".$totalkp, 0, 1);
  105.   $pdf->Cell('1', 0.8, '', 0, 0);
  106.   $pdf->Cell('5', 0.8, '', 0, 0);
  107.   $pdf->Cell('3', 0.8, '', 0, 0);
  108.   $pdf->Cell('6', 0.8, '         PERPANJANGAN SK', 0, 0);
  109.   $pdf->Cell('4', 0.8, '         1 Kendaraan', 0, 0);
  110.   $pdf->Cell('4', 0.8, "                    ".$show['retrib_sk']." x " .$show['thn_lewat_sk']." Thn ", 0, 0);
  111.   $pdf->Cell('4', 0.8, "                ".$totalsk, 0, 0);
  112.   $pdf->Cell('4', 0.8, '', 0, 0);
  113.   $pdf->Cell('5', 0.8, "      ".$totalsk, 0, 1);
  114.   $pdf->Cell('1', 0.8, '', 0, 0);
  115.   $pdf->Cell('5', 0.8, '', 0, 0);
  116.   $pdf->Cell('3', 0.8, '', 0, 0);
  117.   $pdf->Cell('6', 0.8, '          DENDA SK', 0, 0);
  118.   $pdf->Cell('4', 0.8, "          ".$show['bulan_lewat_sk']."  Bulan ", 0, 0);
  119.   $pdf->Cell('4', 0.8, "                    ".$show['retrib_sk']." x ".$show['persen_sk']." %", 0, 0);
  120.   $pdf->Cell('4', 0.8, '', 0, 0);
  121.   $pdf->Cell('4', 0.8, "      ".$totaldsk, 0, 0);
  122.   $pdf->Cell('5', 0.8, "          ".$totaldsk, 0, 1);
  123.   $pdf->Cell('1', 0.8, '', 0, 0);
  124.   $pdf->Cell('5', 0.8, '', 0, 0);
  125.   $pdf->Cell('3', 0.8, '', 0, 0);
  126.   $pdf->Cell('6', 0.8, '          DENDA KP', 0, 0);
  127.   $pdf->Cell('4', 0.8, "          ".$show['bulan_lewat_kp']." Bulan ", 0, 0);
  128.   $pdf->Cell('4', 0.8, "                      ".$show['retrib_kp']." x ".$show['persen_kp']." %", 0, 0);
  129.   $pdf->Cell('4', 0.8, '', 0, 0);
  130.   $pdf->Cell('4', 0.8, "      ".$totaldkp, 0, 0);
  131.   $pdf->Cell('5', 0.8, "          ".$totaldkp, 0, 1);
  132.   $pdf->Cell('1', 0.8, '', 0, 0);
  133.   $pdf->Cell('5', 0.8, '', 0, 0);
  134.   $pdf->Cell('3', 0.8, '', 0, 0);
  135.   $pdf->Cell('6', 0.8, '', 0, 0);
  136.   $pdf->Cell('4', 0.8, '', 0, 0);
  137.   $pdf->Cell('4', 0.8, '', 0, 0);
  138.   $pdf->Cell('4', 0.8, '', 0, 0);
  139.   $pdf->Cell('4', 0.8, '', 0, 0);
  140.   $pdf->Cell('5', 0.8, '', 0, 1);
  141.   $pdf->Cell('1', 2, '', 0, 0);
  142.   $pdf->Cell('5', 2, '', 0, 0);
  143.   $pdf->Cell('3', 2, '', 0, 0);
  144.   $pdf->Cell('6', 2, '', 0, 0);
  145.   $pdf->Cell('4', 2, '', 0, 0);
  146.   $pdf->Cell('4', 2, '', 0, 0);
  147.   $pdf->Cell('4', 2, '', 0, 0);
  148.   $pdf->Cell('4', 2, '', 0, 0);
  149.   $pdf->Cell('5', 2, '', 0, 1);
  150.   $pdf->Cell('1', 1.5, '', 0, 0);
  151.   $pdf->Cell('5', 1.5, '', 0, 0);
  152.   $pdf->Cell('3', 1.5, '', 0, 0);
  153.   $pdf->Cell('6', 1.5, '', 0, 0);
  154.   $pdf->Cell('4', 1.5, '', 0, 0);
  155.   $pdf->Cell('4', 1.5, '', 0, 0);
  156.   $pdf->Cell('4', 1.5, '', 0, 0);
  157.   $pdf->Cell('4', 1.5, '', 0, 0);
  158.   $pdf->Cell('5', 1.5, '', 0, 1);
  159.   $pdf->Cell('1', 0.8, '', 0, 0);
  160.   $pdf->Cell('5', 0.8, '', 0, 0);
  161.   $pdf->Cell('3', 0.8, '', 0, 0);
  162.   $pdf->Cell('6', 0.8, '', 0, 0);
  163.   $pdf->Cell('5.5', 0.8, '', 0, 0);
  164.   $pdf->Cell('4', 0.8, '                          ', 0, 0);
  165.   $pdf->Cell('3', 0.8, "".$totalkp+$totalsk, 0, 0);
  166.   $pdf->Cell('4', 0.8, "".$totaldkp+$totaldsk, 0, 0);
  167.   $pdf->Cell('5', 0.8, ''.$totalsk+$totalkp+$totaldsk+$totaldkp, 0, 1);
  168.   $pdf->Cell('1', 0.8, '', 0, 0);
  169.   $pdf->Cell('5', 0.8, '', 0, 0);
  170.   $pdf->Cell('3', 0.8, '', 0, 0);
  171.   $pdf->Cell('6', 0.8, '', 0, 0);
  172.   $pdf->Cell('4', 0.8, '', 0, 0);
  173.   $pdf->Cell('4', 0.8, '', 0, 0);
  174.   $pdf->Cell('4', 0.8, '', 0, 0);
  175.   $pdf->Cell('4', 0.8, '', 0, 0);
  176.   $pdf->Cell('5', 0.8, '', 0, 1);
  177.   $pdf->Cell('1', 0.8, '', 0, 0);
  178.   $pdf->Cell('5', 0.8, '', 0, 0);
  179.   $pdf->Cell('30', 0.8, "                                                                           ".$terbilang." RUPIAH " , 0, 1);
  180.   $pdf->Cell('1', 0.8, '', 0, 0);
  181.   $pdf->Cell('5', 0.8, '', 0, 0);
  182.   $pdf->Cell('3', 0.8, '', 0, 0);
  183.   $pdf->Cell('6', 0.8, '', 0, 0);
  184.   $pdf->Cell('4', 0.8, '', 0, 0);
  185.   $pdf->Cell('4', 0.8, '', 0, 0);
  186.   $pdf->Cell('4', 0.8, '', 0, 0);
  187.   $pdf->Cell('4', 0.8, '', 0, 0);
  188.   $pdf->Cell('5', 0.8, '', 0, 1);
  189.   $pdf->Cell('1', 0.8, '', 0, 0);
  190.   $pdf->Cell('5', 0.8, '', 0, 0);
  191.   $pdf->Cell('3', 0.8, '', 0, 0);
  192.   $pdf->Cell('6', 0.8, '', 0, 0);
  193.   $pdf->Cell('4', 0.8, '', 0, 0);
  194.   $pdf->Cell('4', 0.8, '', 0, 0);
  195.   $pdf->Cell('4', 0.8, '', 0, 0);
  196.   $pdf->Cell('4', 0.8, 'LILIS LISNAWATI', 0, 0);
  197.   $pdf->Cell('5', 0.8, '', 0, 1);
  198.   $pdf->Cell('1', 0.5, '', 0, 0);
  199.   $pdf->Cell('5', 0.5, '', 0, 0);
  200.   $pdf->Cell('3', 0.5, '', 0, 0);
  201.   $pdf->Cell('6', 0.5, '', 0, 0);
  202.   $pdf->Cell('4', 0.5, '', 0, 0);
  203.   $pdf->Cell('4', 0.5, '', 0, 0);
  204.   $pdf->Cell('4', 0.5, '', 0, 0);
  205.   $pdf->Cell('4', 0.5, '', 0, 0);
  206.   $pdf->Cell('5', 0.5, '', 0, 1);
  207.   $pdf->Cell('1', 0.5, '', 0, 0);
  208.   $pdf->Cell('5', 0.5, 'H.MARDANI, SE, M.Si', 0, 0);
  209.   $pdf->Cell('3', 0.5, '', 0, 0);
  210.   $pdf->Cell('6', 0.5, '', 0, 0);
  211.   $pdf->Cell('4', 0.5, '', 0, 0);
  212.   $pdf->Cell('4', 0.5, '', 0, 0);
  213.   $pdf->Cell('4', 0.5, '', 0, 0);
  214.   $pdf->Cell('4', 0.5, '', 0, 0);
  215.   $pdf->Cell('5', 0.5, '', 0, 1);
  216.   $pdf->Cell('1', 0.5, '', 0, 0);
  217.   $pdf->Cell('5', 0.5, '      19621101198409 1003', 0, 0);
  218.   $pdf->Cell('3', 0.5, '', 0, 0);
  219.   $pdf->Cell('6', 0.5, '', 0, 0);
  220.   $pdf->Cell('4', 0.5, '', 0, 0);
  221.   $pdf->Cell('4', 0.5, '', 0, 0);
  222.   $pdf->Cell('4', 0.5, '', 0, 0);
  223.   $pdf->Cell('4', 0.5, '', 0, 0);
  224.   $pdf->Cell('5', 0.5, '', 0, 1);
  225.   $pdf->Output();
  226. }
  227. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement