<html>
    <style type="text/css">
        .style1 {
            font-size: 16pt;
            font-weight: bold;
        }
        .style2 {
            color: #FF0000;
            font-size: 36px;
            font-weight: bold;
        }
        .style3 {
            color: #00FF00;
            font-size: 36px;
            font-weight: bold;
        }
    </style>

    <?php
        if ($data->status == '3') {
    ?>
    <style type="text/css">
        #progress-bar {position:fixed;z-index:9999;top:0;left:0;width:0;height:2px;}
        #loading {position:fixed;z-index:999;top:0;left:0;width:100%;height:100%;opacity: 0.3;
                  background:#fff url(<?php echo base_url('assets/images/PAID.png'); ?>) center no-repeat}
    </style>
    <?php
        }else{
    ?>
    <style type="text/css">
        #progress-bar {position:fixed;z-index:9999;top:0;left:0;width:0;height:2px;}
        #loading {position:fixed;z-index:999;top:0;left:0;width:100%;height:100%;opacity: 0.3;
                  background:#fff url(<?php echo base_url('assets/images/UNPAID.png'); ?>) center no-repeat}
    </style>
    <?php
        }
    ?>

    <div id="hidden">
        <div id="progress-bar"></div><div id="loading"></div>
    </div>

    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif">
<!--<img src="<?= base_url() ?>/images/logo-01.png" style="width:200px;height:80px;" />-->
        <tr>
            <td width="25%" style="vertical-align:top">
                <img src="<?= base_url() ?>assets/images/logonya.png" style="width:300px;height:100px;" /></td>
            <td width="75%" align="right" style="vertical-align:top;padding-top: 15px">
                <img src="<?= base_url() ?>assets/images/desnet.png" style="width:200px;height:70px;" />

            </td>
        </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
<!--<img src="<?= base_url() ?>/images/logo-01.png" style="width:200px;height:80px;" />-->
        <tr>
            <td align="right" style="vertical-align:top;">
                <strong>PT DES Teknologi Informasi</strong><br>
                Raffless Hills Square 8A, Jl. Bukitsari Raya, Semarang 50264<br>
                024-74-66-DES (337)/ Fax 024-74-66-DES (337)<br>
                Hotline Support  : 0811-2999-DES (337)<br>
                billing@ptdes.net
            </td>
        </tr>
    </table>
    <br>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;background-color:#CCCCCC">
        <tr>
          <td style="padding: 5px 10px" colspan="2">
              <span class="style1">Proforma Invoice #<?= $data->id_invoice ?></span></td>
        </tr>
        <tr>
          <td width="25%" style="padding-left: 10px;">Proforma Invoice Date </td><td>: <?= $this->fungsi->konversi_date_slash($data->tgl_invoice) ?></td>
        </tr>
        <tr>
          <td style="padding-left: 10px;">Due Date </td><td>: <?= $this->fungsi->konversi_date_slash($data->tgl_jatuh_tempo) ?></td>
        </tr>
    </table>
    <br>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;">
        <tr>
            <td style="padding: 5px 10px" width="70%">
                <span class="style1">To :</span><br>
                <b><?= $data->nama_company ?></b><br>
                <b><?= $data->nama_customer ?></b><br>
                <?= $data->alamat ?><br>
                <?= $data->telp ?><br>
               <!--  <?php
                    if(isset($npwp)) {
                        echo $npwp."<br>";
                    }
                ?> -->
            </td>
            <td align="center" style="vertical-align:middle" width="30%">
                <?php
                    if ($data->status == '3') {
                ?>
                <span class="style3">[ PAID ]</span>
                <?php
                    }else{
                ?>
                <span class="style2">[ UNPAID ]</span>
                <?php
                    }
                ?>
            </td>
        </tr>
    </table>
    <br>
    <table width="100%" border="1" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;border-color:#CCCCCC; font-size:14px;">
        <tr>
          <td align="center" width="45%" style="background:#CCCCCC;padding:5px"><strong>Deskripsi</strong></td>
          <td align="center" width="10%" style="background:#CCCCCC;padding:5px"><strong>Unit</strong></td>
          <td align="center" width="10%" style="background:#CCCCCC;padding:5px"><strong>Satuan</strong></td>
          <td align="center" width="15%" style="background:#CCCCCC;padding:5px"><strong>Harga Satuan</strong></td>
          <td align="center" width="20%" style="background:#CCCCCC;padding:5px"><strong>Jumlah (Rp)</strong></td>
        </tr>
        <tr>
        <?php if($data->keterangan == '') { ?>
          <td width="45%" style="padding:5px"><?= $data->nama_paket ?><br>(<?= $this->fungsi->format_date($data->tanggal_aktif) ?> s.d. <?= $this->fungsi->format_date($data->tgl_berakhir) ?>)</td>
        <?php } else { ?>
            <td width="45%" style="padding:5px"><b><?= nl2br($data->keterangan); ?></b></td>
        <?php }?>
        <?php
            $date1 = $data->tanggal_aktif;
            $date2 = $data->tgl_berakhir;

            $ts1 = strtotime($date1);
            $ts2 = strtotime($date2);

            $year1 = date('Y', $ts1);
            $year2 = date('Y', $ts2);

            $month1 = date('m', $ts1);
            $month2 = date('m', $ts2);

            $masa = (($year2 - $year1) * 12) + ($month2 - $month1);
        ?>
          <td width="10%" style="padding:5px" align="center"><?= $masa ?></td>
          <td width="10%" style="padding:5px" align="center">bulan</td>
          <td width="15%" style="padding:5px" align="center"><?= number_format($data->harga_satuan,0,",",".") ?></td>
          <td width="20%" style="padding:5px" align="right"><?= number_format($data->sub_total,0,",",".") ?></td>
        </tr>
        <tr>
          <td width="45%" style="padding:5px;text-align:right">Diskon/Potongan</td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="15%" style="padding:5px" align="center"></td>
          <td width="20%" style="padding:5px" align="right"><?= $data->diskon." %" ?></td>
        </tr>
        <tr>
          <td width="45%" style="padding:5px;text-align:right">Jumlah</td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="15%" style="padding:5px" align="center"></td>
          <td width="20%" style="padding:5px" align="right"><?php

           if ($data->diskon == "0") {
                $jumlah = $data->sub_total;
            }else{
                $diskon = $data->diskon / 100;
                $jumlah = $data->sub_total * $diskon;
            } 

            echo number_format($jumlah,0,",",".");
           ?></td>
        </tr>
        <tr>
          <td width="45%" style="padding:5px;text-align:right">PPN 10%</td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="15%" style="padding:5px" align="center"></td>
          <td width="20%" style="padding:5px" align="right"><?= number_format($data->ppn,0,",",".") ?></td>
        </tr>
        <!-- <?php if($data->dp != 0 or $data->hutang_piutang != 0) { ?>
            <tr>
                <td width="45%" style="padding:5px;text-align:right">Sub Total</td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="15%" style="padding:5px" align="center"></td>
                <td width="20%" style="padding:5px" align="right"><?= $data->tagihan ?></td>
            </tr>
        <?php }?> -->
        <?php if($data->dp != 0) { ?>
            <tr>
                <td width="45%" style="padding:5px;text-align:right">Deposit Pembayaran</td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="15%" style="padding:5px" align="center"></td>
                <td width="20%" style="padding:5px" align="right">(-) <?= number_format($data->dp,0,",",".") ?></td>
            </tr>
        <?php } ?>
        <?php if($data->hutang_piutang != 0) { ?>
            <tr>
                <td width="45%" style="padding:5px;text-align:right">Hutang/Piutang Bulan Lalu</td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="10%" style="padding:5px" align="center"></td>
                <td width="15%" style="padding:5px" align="center"></td>
                <td width="20%" style="padding:5px" align="right"><?= $data->jenis_hutang_piutang; ?> <?= number_format($data->hutang_piutang,0,",","."); ?></td>
            </tr>
        <?php } ?>
		<?php if($data->sub_total > 5000000) { ?>
		<tr>
            <td width="45%" style="padding:5px;text-align:right">Biaya Materai</td>
            <td width="10%" style="padding:5px" align="center"></td>
            <td width="10%" style="padding:5px" align="center"></td>
            <td width="15%" style="padding:5px" align="center"></td>
            <td width="20%" style="padding:5px" align="right"><?= number_format($data->materai,0,",",".") ?></td>
        </tr>
		<?php } ?>
        <tr>
          <td width="45%" style="padding:5px;text-align:right"><b>Total</b></td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="10%" style="padding:5px" align="center"></td>
          <td width="15%" style="padding:5px" align="center"></td>
          <td width="20%" style="padding:5px" align="right"><b><?= number_format($data->tagihan,0,",",".") ?></b></td>
        </tr>
    </table>
    <br>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif; font-size:14px;">
        <?php
            if ($data->status != '3') {
        ?>
        <tr>
            <td colspan="2">
                Note :
                <br><br>
                Silahkan dapat melakukan pembayaran sesuai total tagihan yang tertera pada invoice ini melalui rekening berikut :
                <br><br>
            </td>
        </tr>
        <tr>
            <td width="10%">Bank </td>
            <td>: MANDIRI</td>
        </tr>
        <tr>
            <td width="10%">Nama </td>
            <td>: PT DES TEKNOLOGI INFORMASI</td>
        </tr>
        <tr>
            <td width="10%">No Rek </td>
            <td>: 1350005937352</td>
        </tr>
        <tr>
            <td width="10%">KCP </td>
            <td>: SEMARANG SRONDOL</td>
        </tr>
        <tr>
            <td colspan="2">
                <br>
                Konfirmasi pembayaran dan lampirkan bukti transfer ke email billing@ptdes.net
                <br>
            </td>
        </tr>
        <?php
            }
        ?>
        <tr>
            <td colspan="2" align="center">
                <br>
                <strong>Terima kasih telah menggunakan layanan Absenku Profesional</strong><br>
            </td>
        </tr>
    </table>
</html>
