 
<?php //window.print();loaded();
 foreach($kontak as $data) : endforeach; ?> 
<?php 
 foreach($transaksi as $tampil) : endforeach; ?> 
<?php 
 foreach($barang as $rows) : endforeach; ?> 
<?php 
 foreach($metode as $metode) : endforeach; ?> 
<?php
 foreach($member as $user) : endforeach; ?> 
 <?php
 foreach($t_item as $item) : endforeach; ?> 
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Cetak Laporan</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="<?php echo base_url();?>assets/cetak/css/bootstrap.min.css">
  <script src="<?php echo base_url();?>assets/cetak/js/jquery.min.js"></script>
  <script src="<?php echo base_url();?>assets/cetak/js/bootstrap.min.js"></script>
  <link href="<?php echo base_url();?>assets/cetak/font-awesome/css/font-awesome.css" rel="stylesheet" />
  <link rel="stylesheet" href="<?php echo base_url();?>assets/cetak/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<script defer src="<?php echo base_url();?>assets/cetak/js/all.js" integrity="sha384-xymdQtn1n3lH2wcu0qhcdaOpQwyoarkgLVxC/wZ5q7h9gHtxICrpcaSUfygqZGOe" crossorigin="anonymous"></script>
<style>
.cetak {
    padding-left: 40px;
 
  width:500px;
}
 
@media print {
input.noPrint { display: none; }
}
@page
        {
            size: auto;   /* auto is the initial value */
            margin: 0mm;  /* this affects the margin in the printer settings onload="window.print();loaded();"   */
        }
span{
  font-size: 20px;
}
</style>
</head>
<body <?php $auto_print = $data->auto_print; if($auto_print == "iya"){ ?> onload="window.print();loaded();" <?php }else { ?>    <?php } ?>  >
 
<!-- <script type="text/javascript"> 
function loaded()
{

 
    window.close();
    if (window.opener && !window.opener.closed) {
    window.opener.location.reload();
    }
}
 

function CloseMe()
{
window.close();
}
</script> -->
<script>
  document.onkeydown = function (e) {
    switch (e.keyCode) {
                    
                    // Esc
                    case 27:
                     window.close();
                      if (window.opener && !window.opener.closed) {
                      window.opener.location.reload();
                      }
                    break;
                    
                    // F5
                    case 116:
                    location.reload(); 
                    break;
                }
                //menghilangkan fungsi default tombol
                
            };
</script>

		<div class="cetak">

			<?php $tampil_logo_struk = $data->tampil_logo_struk; if($tampil_logo_struk == "tampilkan"){ ?>
			 <table align="center"  width="500px" >
				<tr>
					<td width="90" align="center"rowspan="3"><img style="padding-top:  5px;" src="<?php echo base_url();?>images/kontak/<?php echo $data->logo ;?>" width="80px"></td>
					<td align="left"><strong><span style="font-size: 25px;"><?php echo $data->nama_toko; ?></span></strong></td>
				 
				</tr>
				<tr>
					 
					 
					<td align="left"><strong><span style="font-size: 20px;"><?php echo $data->alamat; ?></span ></strong></td>
				</tr>
				<tr>
					 
					 
					<td align="left"><strong><span style="font-size: 20px;">Tlp. <?php echo $data->nomor; ?></span ></strong></td>
				</tr>
				 
			</table>
			<?php }else{ ?>
			<!--
			<table align="center"  width="500px" >
				<tr>
					<td width="90" align="center"rowspan="3"><img style="padding-top:  5px;" src="<?php echo base_url();?>images/kontak/<?php echo $data->logo ;?>" width="80px"></td>
					<td align="left"><strong><span style="font-size: 25px;"><?php echo $data->nama_toko; ?></span></strong></td>
				 
				</tr>
				<tr>
					 
					 
					<td align="left"><strong><span style="font-size: 20px;"><?php echo $data->alamat; ?></span ></strong></td>
				</tr>
				<tr>
					 
					 
					<td align="left"><strong><span style="font-size: 15px;">Tlp.<?php echo $data->nomor; ?></span ></strong></td>
				</tr>
				 
			</table>
			-->
			<table align="center"  width="500px" >
				<tr>
					<td align="left"><strong><span style="font-size: 20px;"><?php echo $data->nama_toko; ?></span ></strong></td>
				</tr> 
				<tr>
					<td align="left"><strong><span style="font-size: 17px;">Alamat. <?php echo $data->alamat; ?></span ></strong></td>
				</tr>
				<tr>
					<td align="left"><strong><span style="font-size: 17px;">Telp. <?php echo $data->nomor; ?></span ></strong></td>
				</tr>
				 
				 
			</table>
			<?php } ?>
			====================================================== 
			<table height="40"  width="100%">
				<tr>
					<td> ID Struk  </td><td>:</td><td> <span><?php echo $tampil->id_transaksi; ?></span> </td><td><span style="font-size: 15px;">Date : <?php echo $tampil->date; ?></span> </td> 
				</tr>
					
				<tr>
					<td>Costumer </td>
					<td>:</td>
						<td colspan="2"> 
							<span style="font-size: 16px;"><?php echo $user->nama_member.' / No.Hp '.$user->hp;?> </span> 
						</td>
					</td>
					
				</tr>


			</table>
   		 ====================================================== 
   		 <table   width="330px" border=0   >

		   		 	<tr>
		   		 		<td  align="center"> <span><strong>No</strong> </span></td>
		   		 		<td colspan="4" > <span><strong>Item Pembelian</strong> </span></td>
		   		 		<td colspan="3" align="right"> <span><strong>Total</strong></span> </td>
		   		 	</tr>
		   		 	<?php
		   		 	$no = 1;
		   		 	foreach($data_pembelian as $dataq) : ?>


		   		 		<tr>
		   		 			<td align="center" width="35"><span><?php echo $no; ?></span></td> 

		   		 			<td colspan="5" ><span><?php

		   		 			$ID = $dataq->id_barang;  
		   		 			$sql_menu = "SELECT tb_barang.nama_barang,tb_satuan.nama_satuan  FROM tb_barang INNER JOIN tb_satuan ON tb_barang.id_satuan_jual = tb_satuan.id_satuan  WHERE  id = '$ID' ";
		   		 			$main_menu = $this->db->query($sql_menu)->result();
		   		 			foreach ($main_menu as $main) { ?>
		   		 				<?php echo $main->nama_barang ; 

		   		 			} ?>
		   		 				 
		   		 		</span></td>



		   		 	</tr>
		   		 	<tr>
		   		 		<td align="left"> </td>
		   		 		<td align="center" colspan="3" width="50"><span><?php echo  $dataq->jumlah." ". $main->nama_satuan; ?>    </span></td>
		   		 		<td align="center" width="85"  >x <span ></td>
		   		 		<td align="center" width="50"><span><?php   echo nominal($HARGA=$dataq->harga_jual); ?></span> </td>

		   		 		<td align="right" colspan="3" width="50"><span><?php   echo nominal($dataq->harga_total); ?></span></td>
		   		 	</tr>

				   		 	<?php
				   		 	$no++;
				   		 endforeach;
				   		 ?>


		   		 <tr>
		   		 	<td colspan="7"  >-------------------------------------------------------------------------------------------</td> 


		   		 </tr> 
		   		 <tr>
		   		 	<td colspan="2"><span> </span></td>
		   		 <td align="left" ><span><strong><?php echo  $item->total_belanja; ?> item</strong></span></td>
		   		 	<td align="left" width="85" colspan="2" > </td>
		   		 	<td align="right" width="170"  > <span>Sub Total

		   		 	</span> 
		   		 </td>
		   		 <td align="right" colspan="3" width="50"><span><?php echo  nominal($tampil->sub_total); ?></span></td>
		   		</tr>

		   	 
		   		<tr>  
		   			<td align="right" colspan="6"><span>Potongan Point </span></td> 

		   			<td align="right"><span><?php echo  nominal($tampil->potongan); ?></span></td>
		   		</tr> 

		   		<tr>

		   		 
		   			<td colspan="5">   </td>
		   			<td align="right" width="100" colspan="1" ><strong><span>Total Bayar</span></strong></td>
		   			<td align="right"><span><strong><?php echo   nominal($tampil->total); ?></strong></span></td>
		   		</tr>
		   		<tr>

		   			<td colspan="5" rowspan=""><!-- <?php if($METODE_BAYAR!='Tunai'){ echo $METODE_BAYAR." - ".$tampil->keterangan; } else{ echo $METODE_BAYAR; }?> --></td>
		   			<td align="right" colspan="1"><span>Bayar</span></td> 

		   			<td align="right" width="100"><span><?php echo  nominal($tampil->bayar); ?></span></td>
		   		</tr>
		   		<tr>


		   			<td align="right" colspan="6"><span><strong>Kembali</strong></span></td> 

		   			<td align="right"><span><strong><?php echo  nominal($tampil->kembali); ?></strong></span></td>
		   		</tr>


		   	</table>  

   --------------------------------------------------------------------------------------------

 
		<?php 
 foreach($admin as $admin) : endforeach; ?> 
<table align="center">
	<tr >
		<td align="center"><span><strong> MATOR SAKALANGKONG </strong></span></td>
	</tr>
	<tr >
		<td align="center"><span style="font-size: 15px;"><strong>SAMOGHE TEROS SEHAT TOR SALAMET</strong></span></td>
	</tr>
	<tr >
		<td align="center"><span style="font-size: 15px;">* BELANJA PUAS HARGA BERSAHABAT *</span></td>
	</tr>
	<tr >
		<td align="center"><span style="font-size: 15px;">ANDA HEMAT SEBESAR Rp. <?php echo  nominal($sub_total_hemat); ?></span></td>
	</tr>
	<tr >
		<td align="center"><span style="font-size: 15px;">*** Point Anda <?php echo nominal(ceil($tampil->point)); ?> ***</span></td>
	</tr> 
	<tr>
		<td align="center"><span style="font-size: 15px;">Kasir : <?php echo  $admin->nama_admin; ?></span></td>
	</tr>
</table>
			 
			 
		</div>  	
</body>
</html>