<?
session_start();
if ($_SESSION[grup]=='cabusr'){$sesusr=$_SESSION[user];$sesarea=$_SESSION[area];$sescab=$_SESSION[cab];}
else{header("location:../area.php");}
date_default_timezone_set("Asia/Jakarta");
include"../plg/kon.php";

$bulan = $_GET[bulan];
$tahun = $_GET[tahun];

$thnbln = $tahun."-".$bulan;

$blnthn = $bulan."-".$tahun;


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../plg/w3.css">
<link rel="icon" href="../plg/logoadp.png">
<title></title>
</head>
<style type="text/css">

    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #FAFAFA;
        font: 12pt "Tahoma";
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 297mm;
        min-height: 210mm;
        padding: 10mm;
        margin: 10mm auto;
        border: 1px gray solid;
        border-radius: 5px;
        background: white;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);

    }
    .subpage {
        padding: 1cm;
        border: 1px silver solid;
        height: 257mm;
        outline: 2cm white solid;
    }
    td{

		padding: 2px;
	}
	th{
		padding: 2px;

	}
    @page {
			size: landscape;
        margin: 0;
    }
    @media print {
        html, body {
            width: 297mm;
            height: 210mm;
        }
        .page {
		size :
            margin: 0;
			size: landscape;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
        }
    }

</style>
<body onload="window.print()">

	<div class="page">
	   <table cellpadding='0' cellspacing='0' width='100%'>
       <tr>
          <td width="15"><img src='../plg/logoadp.png'/></td>
  				<td align="center">
  					<h6>PT ADHI GUNA PUTERA <?=strtoupper($sesarea)?> BRANCH</h6>
  					<div class="w3-small">REPORT LINEUP PLTU <?=strtoupper($sesarea)?> </div>
            <div class="w3-small">PER TANGGAL <?=strtoupper(date('d, M Y'))?> PUKUL <?=date('H:i')?></div>
  				</td>
  				<td width="20">
  					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>
  					<img src="../plg/ohsas.jpg" width="170"/>
  				</td>
       </tr>
       <tr>
					<td colspan="3" style="border-bottom:1px solid silver;margin-bottom:4px;"></td>
			 </tr>
     </table>

     <br />

     <table class="w3-small w3-border" cellpadding="0" cellspacing="0" width="100%" >
       <thead>
         <tr>
           <th class="w3-center w3-tiny w3-border" colspan="17">SHIFTING OUT AT JETTY <?=strtoupper($sesarea)?></th>
         </tr>
       </thead>
       <thead>
         <tr>
           <th class="w3-tiny w3-center w3-border">NO</th>
           <th class="w3-tiny w3-center w3-border">SHIPMENT SHIP</th>
           <th class="w3-tiny w3-center w3-border">SHIPPER</th>
           <th class="w3-tiny w3-center w3-border">AGEN</th>
           <th class="w3-tiny w3-center w3-border">B/L NUMBER</th>
           <th class="w3-tiny w3-center w3-border">CARGO<br/>WEIGHT</th>
           <th class="w3-tiny w3-center w3-border">PORT OF<br/>LOADING</th>
           <th class="w3-tiny w3-center w3-border">TIME<br/>ARRIVAL</th>
           <th class="w3-tiny w3-center w3-border">TIME<br/>BERTHING</th>
           <th class="w3-tiny w3-center w3-border">TIME<br/>SHIFTING OUT</th>
           <th class="w3-tiny w3-center w3-border">REMARKS</th>
         </tr>
       </thead>
       <?
          $i4 = 1;
          $sqlso = "select * from shipment where sesarea='$sesarea' and tan='10' and del='0'";
          $resso = $conn->query($sqlso);
          while($a = $resso->fetch_assoc()){
          $grs = $a[tb];
          if($grs==''){
            $g = "";
          }else{
            $g = "<b> - </b>";
          }
       ?>
         <tr>
      	    <td class="w3-tiny w3-center w3-border"><b><?=$i4++?></b></td>
            <td class="w3-tiny w3-center w3-border" style="width:200px;"><?=strtoupper($a[tb])?><?=$g?><?=strtoupper($a[kpl])?></td>
            <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[shp])?></td>
            <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[agn])?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[bl])?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=number_format($a[wgt],3)?> M/T</td>
        	  <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[ori])?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=$a[ta]?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=$a[tbrt]?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=$a[so]?></td>
        	  <td class="w3-tiny w3-center w3-border"><?=$a[rsout]?></td>
          </tr>
      <?}?>
     </table>

     <br />

     <table class="w3-border w3-small" cellpadding="0" cellspacing="0" width="100%" >
      <thead>
      	<tr>
    		    <th class="w3-border w3-center w3-tiny" colspan="20">BERTHED AT JETTY <?=strtoupper($sesarea)?></th>
    	  </tr>
    	</thead>
      <thead>
        <tr>
    	  	  <th class="w3-tiny w3-center w3-border">NO</th>
            <th class="w3-tiny w3-center w3-border" style="">SHIPMENT SHIP</th>
            <th class="w3-tiny w3-center w3-border" style="">SHIPPER</th>
            <th class="w3-tiny w3-center w3-border">AGEN</th>
        		<th class="w3-tiny w3-center w3-border">B/L NUMBER</th>
        		<th class="w3-tiny w3-center w3-border">CARGO<br/>WEIGHT</th>
        		<th class="w3-tiny w3-center w3-border">PORT OF<br/>LOADING</th>
        		<th class="w3-tiny w3-center w3-border" style="">TIME<br/>ARRIVAL</th>
            <!--<th class="w3-tiny w3-center w3-border" style="">START FROM<br/>ANCHORAGE</th>-->
        		<th class="w3-tiny w3-center w3-border" style="">TIME<br/>BERTHED</th>
            <th class="w3-tiny w3-center w3-border">BALANCE CARGO</th>
            <!--<th class="w3-tiny w3-center w3-border" style="">APPROACH<br/>TIME</th>-->
        		<th class="w3-tiny w3-center w3-border"style="">EST<br/>CAST OF JETTY</th>
        		<th class="w3-tiny w3-center w3-border">REMARKS</th>
        </tr>
      </thead>
      <?
         $iii = 1;
         $sql3 = "select * from shipment where sesarea='$sesarea' and tan='3' and del='0' order by tbrt asc";
         $res3 = $conn->query($sql3);
         while($a = $res3->fetch_assoc()){
         $grs = $a[tb];
         if($grs==''){
           $g = "";
         }else{
           $g = "<b> - </b>";
         }
      ?>
      <tr>
    	    <td class="w3-tiny w3-border w3-center"><b><?=$iii++?></b></td>
          <td class="w3-tiny w3-center w3-border" style="width:200px;"><?=strtoupper($a[tb])?><?=$g?><?=strtoupper($a[kpl])?></td>
          <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[shp])?></td>
          <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[agn])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[bl])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=number_format($a[wgt],3)?> M/T</td>
      	  <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[ori])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=$a[ta]?></td>
          <!--<td class="w3-tiny w3-border w3-center"><?=$a[sanc]?></td>-->
      	  <td class="w3-tiny w3-border w3-center"><?=$a[tbrt]?><br/><div style="color:red"><?=$a[si]?></div></td>
          <td class="w3-tiny w3-border w3-center"><?=number_format($a[bal],3)?></td>
          <!--<td class="w3-tiny w3-border w3-center"><?=$a[apt]?></td>-->
      	  <td class="w3-tiny w3-border w3-center"><?=$a[ecj]?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=$a[rberth]?></td>
      </tr>
      <?}?>
    </table>

    <br/>

    <table class="w3-border w3-small" cellpadding="0" cellspacing="0" width="100%" >
      <thead>
      	<tr>
    		    <th class="w3-border w3-center w3-tiny" colspan="12">ANCHORAGE AT OUTBAR <?=strtoupper($sesarea)?>, WAIT INSTRUCTION FOR BERTHING</th>
    	  </tr>
    	</thead>
      <thead>
        <tr>
    	  	<th class="w3-tiny w3-center w3-border">NO</th>
          <th class="w3-tiny w3-center w3-border">SHIPMENT SHIP</th>
          <th class="w3-tiny w3-center w3-border">SHIPPER</th>
          <th class="w3-tiny w3-center w3-border">AGEN</th>
      		<th class="w3-tiny w3-center w3-border">B/L NUMBER</th>
      		<th class="w3-tiny w3-center w3-border">CARGO<br/>WEIGHT</th>
      		<th class="w3-tiny w3-center w3-border">PORT OF<br/>LOADING</th>
      		<th class="w3-tiny w3-center w3-border">TIME<br/>ARRIVAL(TA)</th>
      		<th class="w3-tiny w3-center w3-border">EST<br/>BERTHED</th>
      		<th class="w3-tiny w3-center w3-border">REMARKS</th>
        </tr>
      </thead>
      <?
        $ii = 1;
        $sql2 = "select * from shipment where sesarea='$sesarea' and tan='2' and del='0' order by ta asc";
        $res2 = $conn->query($sql2);
        while($a = $res2->fetch_assoc()){
        $grs = $a[tb];
        if($grs==''){
        	$g = "";
        }else{
        	$g = "<b> - </b>";
        }
      ?>
      <tr>
    	    <td class="w3-tiny w3-center w3-border"><b><?=$ii++?></b></td>
          <td class="w3-tiny w3-center w3-border" style="width:200px;"><?=strtoupper($a[tb])?><?=$g?><?=strtoupper($a[kpl])?></td>
          <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[shp])?></td>
          <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[agn])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[bl])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=number_format($a[wgt],3)?> M/T</td>
      	  <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[ori])?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=$a[ta]?></td>
      	  <td class="w3-tiny w3-border w3-center"><?=$a[etb]?></td>
      	  <td class="w3-tiny w3-center w3-border"><?=strtoupper($a[ranc])?></td>
      </tr>
      <?}?>
    </table>

    <br/>

    <table class="w3-border w3-small" cellpadding="0" cellspacing="0" width="100%" >
     <thead>
       <tr>
           <th class="w3-border w3-center w3-tiny" colspan="12">ON THE WAY <?=strtoupper($sesarea)?></th>
        </tr>
     </thead>
     <thead>
       <tr>
         <th class="w3-tiny w3-center w3-border">NO</th>
         <th class="w3-tiny w3-center w3-border">SHIPMENT SHIP</th>
         <th class="w3-tiny w3-center w3-border">SHIPPER</th>
         <th class="w3-tiny w3-center w3-border">AGEN</th>
         <th class="w3-tiny w3-center w3-border">B/L NUMBER</th>
         <th class="w3-tiny w3-center w3-border">CARGO<br/>WEIGHT</th>
         <th class="w3-tiny w3-center w3-border">PORT OF<br/>LOADING</th>
         <th class="w3-tiny w3-center w3-border">TIME DEPARTURE<br/>PELABUHAN MUAT</th>
         <th class="w3-tiny w3-center w3-border">E T A</th>
         <th class="w3-tiny w3-center w3-border">NOTE - OTW</th>
       </tr>
     </thead>
     <?
       $i = 1;
       $sql1 = "select * from shipment where sesarea='$sesarea' and tan='1' and del='0' order by eta asc";
       $res1 = $conn->query($sql1);
       while($a = $res1->fetch_assoc()){
       $grs = $a[tb];
       if($grs==''){
         $g = "";
       }else{
         $g = "<b> - </b>";
       }
     ?>
     <tr>
       <td class="w3-tiny w3-center w3-border"><b><?=$i++?></b></td>
       <td class="w3-tiny w3-center w3-border" style="width:200px;"><?=strtoupper($a[tb])?><?=$g?><?=strtoupper($a[kpl])?></td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[shp])?></td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[agn])?></td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[bl])?></td>
       <td class="w3-tiny w3-border w3-center"><?=number_format($a[wgt],3)?> M/T</td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[ori])?></td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[csn])?></td>
       <td class="w3-tiny w3-border w3-center"><?=$a[eta]?></td>
       <td class="w3-tiny w3-border w3-center"><?=strtoupper($a[rotw])?></td>
     </tr>
     <?}?>
   </table>

	</div>

</body>
</html>
