<?php 
	error_reporting(0);
	include "config/session.php"?>
<?php 
	ob_start();
	include"config/config-url.php";
	include"config/function.php";
?>
        <link href="<?php echo $base?>css/AdminLTE.css" rel="stylesheet" type="text/css" />
     <style type="text/css">
		@media print {
			 body {
			  -webkit-print-color-adjust: exact;
			}
			#warna{
			  -webkit-print-color-adjust: exact;
			}
			@page {
				size: 300px 442px; 
				margin:0px;
			  }
		}
#table1 {
  border-collapse: collapse;
  margin-left:5%;
  margin-right:5%;
}
#table1 td, table th {
  border: 1px solid black;
}
#table1 tr:first-child th {
  border-top: 0;
}
     </style>
<body style="background-color:#FFF; min-height:0px; margin:0px; font-family:'Times New Roman', Times, serif" onLoad="doPrint()">
           <?php
		$id_master = $_GET['id'];
		include("config/session.php");
		include("config/connection.php");
		
		$sqlx ="select * from tb_tiket where id_master = '".$id_master."'";
		$hasilx = mysql_query($sqlx) or die("Kesalahan Pada SQLii");
		mysql_close($test);
		
		while($rowx = mysql_fetch_object($hasilx)){
			$notiket = $rowx->no_tiket;
					include("config/connection.php");
              		$sql ="	select tb_tiket.*, tb_angkutan.nama as angkutan, tb_operator.nama as operator from tb_tiket inner join 
							tb_angkutan on tb_angkutan.id_angkutan = tb_tiket.id_angkutan inner join 
							tb_operator on tb_tiket.id_operator = tb_operator.id_operator
							where tb_tiket.no_tiket = '".$notiket."' ";
					$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
					mysql_close($test);
					
					$row = mysql_fetch_object($hasil);
					    
						$idtiket = $row->id;
						$id_jadwal = $row->id_jadwal;
						$harga = $row->harga;
						$namapenumpang = $row->nama;
						$no_identitas = $row->no_identitas;
						$tanggal = $row->tanggal;
						$no_tiket = $row->no_tiket;
						$id_angkutan = $row->id_angkutan;
						$angkutan = $row->angkutan;
						$operator = $row->operator;
						
						if($id_angkutan == 1 or $id_angkutan == 2){
							$jenisangkutan = 'Penumpang';	
						}else{
							$jenisangkutan = 'Kendaraan';	
						}
						
						$nice_date = date('d-M-y', strtotime( $tanggal ));
						
						
					include("config/connection.php");
              		$sql2 ="select Waktu from tb_jadwal where Id_Jadwal = '".$id_jadwal."'";
					$hasil2 = mysql_query($sql2) or die("Kesalahan Pada SQL");
					mysql_close($test);
					
					$row2 = mysql_fetch_object($hasil2);
					    $Waktu = $row2->Waktu;
						if($Waktu == '10.30'){
							$wk = 'PAGI';
						}else{
							$wk = 'SORE';
						}
	
?>
<table width="100%" border="0" >
  <tr>
    <td style="padding:5px; font-size:14px; border:1px solid black"><div align="center"><strong>ELEKTRONIK TIKET</strong></div></td>
  </tr>
  <tr>
    <td style="padding-top:3px; font-size:10px;"><div align="center">TIKET TERPADU</div></td>
  </tr>
  <tr>
    <td style="font-size:10px;"><div align="center">PELABUHAN PENYEBERANGAN </div></td>
  </tr>
  <tr>
    <td style="padding:2px; font-size:14px;"><div align="center">LINTAS NUSA PENIDA - PADANG BAI</div></td>
  </tr>
</table>
<table id="table1" width="90%">   
  <tr>
    <td style="font-size:16px;  border-collapse:collapse; padding-top:5px; padding-bottom:5px;">
    <p align="center" style="margin:0;"><strong>KELAS EKONOMI</strong></p>
    <p align="center" style="margin:0;"><strong><?php echo $angkutan?></strong></p></td>
  </tr>
</table>
<table id="table1" width="90%">  
  <tr>
    <td style="padding:3px; font-size:16px; border-collapse:collapse; border-top:none"><div align="center"><strong>Rp. <?php echo number_format($harga); ?>,-</strong></div></td>
  </tr>
</table>
<table width="100%" border="0">
  <tr>
    <td style="padding-top:5px; font-size:10px;"><div align="center">*Harga sudah termasuk tiket masuk,  Jasa Dermaga, Pemeliharaan Pelabuhan dan Asuransi</div></td>
  </tr>
  <tr>
    <td style="padding-top:5px; font-size:10px;"><div align="center">Berlaku sekali jalan</div></td>
  </tr>
  <tr>
    <td><div align="center" style="font-size:10px;">Peraturan Daerah No. 5 Tahun 2013</div></td>
  </tr>
  <tr>
    <td><div align="center" style="font-size:12px;">Peraturan Gubernur Bali No. 10 Tahun 2014</div></td>
  </tr>
  <tr>
	<td style="font-size:14px; border:1px solid black">
    	<div align="center">
            <p class="text-muted well well-sm no-shadow" style="margin-top: 5px;">
                <img alt="TESTING" src="plugins/barcode.php?codetype=Code128&size=15&text=<?php echo $notiket + $tbh?>&print=true" />
            </p>
		</div>
        <div align="center" style="font-size:12px; margin-top:-25px; padding-bottom:5px;"><?PHP echo $wk?>/<?php echo $nice_date?>/OP:<?php echo $operator?></div>
    </td>
  </tr>
  <tr>
    <td style="border-bottom:#000 dashed 1px; padding-top:15px;"></td>
  </tr>
  <tr>
    <td style="padding-top:15px;"></td>
  </tr>
</table>
<?php 					
	} 
?>
<script>
function doPrint() {
    window.print();            
    document.location.href = "order-tiket/<?php echo $id_jadwal?>"; 
}
</script>
