<?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)){
        
    //SUMADI/PTAG:092018/JBLN:1/TD:R1-000000450/SM:00017198-00017341/TAG:68096/ADM:1600/TTAG:69696/Ref:3464367547 
        
	$sn = $record['sn'];   
    $para = explode('/',$sn);
    
   if (strpos(strtoupper($sn),"REF:")==0)
    {
        $ref=idate("U");
    }
    else
    {
         $ref=substr($para[9],4);
    }
    
    $nama=substr($para[0],5);
    $tarif=substr($para[3],3);
    $daya=$para[4];
    $bulan=substr($para[1],5);
   //$bulan=$para[2];
    $meter=substr($para[5],3);
    
    //$iadmin=substr($para[3],3);
    $admin = number_format($iadmin,2,",",".");
    
    $itagihan = substr($para[6],4);
	$tagihan = number_format($itagihan,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+$iadmin,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="pasca1.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<table style="position:absolute;left:80px;top:39px;width:793px;height:129px;z-index:0;" cellpadding="0" cellspacing="1" id="Table1">
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">TANGGAL</span></div>
</td>
<td colspan="3" 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>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:126px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">BLN/TH</span></div>
</td>
<td 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>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">ID PEL</span></div>
</td>
<td colspan="3" 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>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:126px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">STAND METER</span></div>
</td>
<td 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 $meter ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">NAMA</span></div>
</td>
<td colspan="3" 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>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:126px;height:20px;">&nbsp;</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;height:20px;">&nbsp;</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">TARIF/DAYA</span></div>
</td>
<td colspan="3" 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 $tarif ?>/<?php echo $daya ?></span></div>
</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:126px;height:20px;">&nbsp;</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;height:20px;">&nbsp;</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">RP TAG PLN</span></div>
</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:60px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: Rp&nbsp;&nbsp; </span></div>
</td>
<td style="background-color:transparent;text-align:right;vertical-align:top;width:148px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;"><?php echo $tagihan ?></span></div>
</td>
<td style="background-color:transparent;text-align:right;vertical-align:top;width:64px;height:20px;">&nbsp;</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:126px;height:20px;">&nbsp;</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;height:20px;">&nbsp;</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:140px;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">REF</span></div>
</td>
<td colspan="5" style="background-color:transparent;text-align:left;vertical-align:top;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">: <?php echo $ref ?></span></div>
</td>
</tr>
</table>
<div id="wb_Text1" style="position:absolute;left:80px;top:0px;width:656px;height:31px;z-index:1;text-align:left;">
<span style="color:#000000;font-family:'Courier New';font-size:27px;"><strong>STRUK BUKTI PEMBAYARAN
TAGIHAN LISTRIK</strong></span></div>
<div id="wb_Text2" style="position:absolute;left:85px;top:253px;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.pln.co.id atau PLN terdekat&quot;<br>INFORMASI HUB: 123<br><br><hr></span></div>
<div id="wb_Text3" style="position:absolute;left:94px;top:175px;width:720px;height:17px;text-align:center;z-index:3;">
<span style="color:#000000;font-family:'Courier New';font-size:15px;"><strong>PLN menyatakan struk ini sebagai bukti pembayaran yang sah, mohon disimpan</strong></span></div>

<table style="position:absolute;left:85px;top:201px;width:347px;height:45px;z-index:5;" cellpadding="0" cellspacing="1" id="Table2">
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:138px;height:22px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">ADMIN BANK</span></div>
</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:62px;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 $admin ?></span></div>
</td>
</tr>
<tr>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:138px;height:20px;"><div><span style="color:#000000;font-family:'Courier New';font-size:16px;">RP BAYAR</span></div>
</td>
<td style="background-color:transparent;text-align:left;vertical-align:top;width:62px;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 $irpbayartagihan ?></span></div>
</td>
</tr>
</table>
</div>
</body>
</html>
<body onload="window.print()">
