Guest User

controller_utang

a guest
Mar 8th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. public function getKartuPiutang()
  2.     {
  3.         $tgl = $this->input->post('tgl');
  4.         $supplier = $this->input->post('id');
  5.  
  6.         $pecah      = explode(" - ",$tgl);
  7.         $tglawal    = date_format(date_create($pecah[0]),"Y-m-d");
  8.         $tglakhir   = date_format(date_create($pecah[1]),"Y-m-d");
  9.         $data       = $this->M_pempers->kartupiutang($supplier,$tglawal,$tglakhir)->result();
  10.         ?>
  11.         <thead>
  12.             <tr>
  13.                 <th colspan="2"><center>INVOICE</center></th><th colspan="2"><center>BUKTI</center></th><th colspan="2"></th>
  14.             </tr>
  15.             <tr class="success">
  16.                 <th><center>TGL</center></th><th><center>NO</center></th><th><center>TGL</center></th><th><center>NO</center></th>
  17.                 <th><center>PIUTANG</center></th><th><center>BAYAR</center></th>
  18.             </tr>  
  19.         </thead>
  20.         <tbody>
  21.             <?php
  22.             $dpp = 0;
  23.             $diskon = 0;
  24.             $ppn    = 0;
  25.             $invoice = 0;
  26.             $piutang =0;
  27.             foreach($data as $a)
  28.             {
  29.                 $invoice = $a->invoice_value;
  30.                 $diskon = $invoice * $a->discount_value/100;
  31.                 $ppn    = $invoice *$a->ppn/100;
  32.                 $dpp  = $invoice - $disc;
  33.                 $piutang = $dpp+$ppn;
  34.             ?>
  35.             <tr>
  36.                 <td><?php echo $a->invoice_date;?></td>
  37.                 <td><?php echo $a->invoice_no;?></td>
  38.                 <td><?php echo $a->payment_date;?></td>
  39.                 <td><?php echo $a->reference_no;?></td>
  40.                 <td>Rp. <?php echo number_format($piutang);?></td>
  41.                 <td>Rp. <?php echo number_format($a->payment_invoice);?></td>
  42.             </tr>
  43.             <?php
  44.             }?>
  45.         </tbody>
  46.  
  47.         <?php
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment