<?php
require_once("conn.php");

$idpel=$_GET['idpel'];
$tanggal=$_GET['tanggal'];
$jenis=$_GET['jenis'];
$iadmin=$_GET['admin'];

$conn=mysqli_connect("$host","$user","$pass") or die("koneksi gagal");
mysqli_select_db($conn,"$db");
$exe = mysqli_query($conn,"SELECT * FROM transaksi where kode_produk = '$jenis' and tujuan= '$idpel' and tanggal= '$tanggal' order by kode asc");

while($record = mysqli_fetch_array($exe)){
                       
    $sn = $record['sn'];   
    $para = explode('/',$sn);
    //RIZKIA ANINDITA PUTRI(PST:1)/KODECAB:/NAMACAB:/TOTALTAGIHAN:28.000/RPPREMI:25.500/JMLBLN:1BLN/RPADMIN:2.500/REFNUM:E591EB97C8B05CB4
    
    $ref=substr($para[7],7);
    $nama=$para[0];
    $tarif=$para[2];
    $daya=$para[1];
   // $bulan=substr($para[5],7);
   $bulan=substr($para[5],7);
    $meter=$para[3];
    
    //$iadmin=substr($para[5],3);
    $admin = number_format($iadmin,2,",",".");
    
    $itagihan = str_replace(".","",substr($para[3],13));
	$tagihan = number_format($itagihan-$iadmin,2,",",".");
	
    $ippn=0;
    $ppn = number_format($ippn,2,",",".");
	
    $ippj=0;
    $ppj = number_format($ippj,2,",",".");

    $irptoken=number_format($nominal-$ippn-$ippj,2,",",".");
    $irpbayartoken=number_format($nominal+$iadmin,2,",",".");
    $irpbayartagihan=number_format($itagihan,2,",",".");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cetak Struk</title>
<meta name="generator" content="WYSIWYG Web Builder 10 - http://www.wysiwygwebbuilder.com">
<link href="Untitled1.css" rel="stylesheet" type="text/css">
<link href="bpjs1.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<table style="position:absolute;left:167px;top:56px;width:527px;height:85px;z-index:0;" cellpadding="0" cellspacing="1" id="Table1">
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">TANGGAL</span></div>
</td>
<td colspan="4" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $tanggal ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">NO VA</span></div>
</td>
<td colspan="4" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $idpel ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">NAMA PESERTA</span></div>
</td>
<td colspan="4" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $nama ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">PERIODE</span></div>
</td>
<td colspan="4" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $bulan ?></span></div>
</td>
</tr>
</table>
<div id="wb_Text1" style="position:absolute;left:167px;top:4px;width:656px;height:31px;z-index:1;text-align:left;">
<span style="color:#000000;font-family:'Courier New';font-size:27px;"><strong>STRUK PEMBAYARAN IURAN BPJS KESEHATAN</strong></span></div>
<div id="wb_Text2" style="position:absolute;left:85px;top:255px;width:738px;height:51px;text-align:center;z-index:2;">
<span style="color:#000000;font-family:'Courier New';font-size:15px;">TERIMA KASIH<br>&quot;Rincian tagihan dapat dilihat di www.bpjs-kesehatan.go.id&quot;<br>INFORMASI HUB: 1500 - 400<br><br><hr></span></div>
<table style="position:absolute;left:167px;top:141px;width:331px;height:70px;z-index:3;" cellpadding="0" cellspacing="1" id="Table2">
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">RP TAGIHAN</span></div>
</td>
<td colspan="2" style="background-color:transparent;text-align:left;vertical-align:top;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: Rp</span></div>
</td>
<td style="background-color:transparent;text-align:right;vertical-align:top;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;"><?php echo $tagihan ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">ADMIN BANK</span></div>
</td>
<td colspan="2" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: Rp</span></div>
</td>
<td style="background-color:transparent;text-align:right;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;"><?php echo $admin ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:24px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">RP BAYAR</span></div>
</td>
<td colspan="2" style="background-color:transparent;text-align:left;vertical-align:top;height:24px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: Rp</span></div>
</td>
<td style="background-color:transparent;text-align:right;vertical-align:top;height:24px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;"><?php echo $irpbayartagihan ?></span></div>
</td>
</tr>
</table>
<table style="position:absolute;left:166px;top:211px;width:528px;height:22px;z-index:5;" cellpadding="0" cellspacing="1" id="Table3">
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:130px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">REF</span></div>
</td>
<td colspan="4" style="background-color:transparent;text-align:left;vertical-align:top;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $ref ?></span></div>
</td>
</tr>
</table>
</div>
</body>
</html>
<body onload="window.print()">