<?php 
session_start();
require_once("../../includes/display_internal_user_dryout.inc.php");
require_once("../../includes/functions_internal_user_dryout.inc.php");
$obj = new data();
$connect = $obj->funConnect();
$display = new display();
$display->logout_iu();
$vesselimono = $_REQUEST['vesselimono'];
$page  		 = $_REQUEST['page'];
$type  		 = $_REQUEST['type'];
$comid       = $_REQUEST['comid'];

if($type == 'TC')
{
if($page == 1){$page_link = "in_ops_tc.php";}else if($page == 2){$page_link = "vessel_in_post_tc.php";}else {$page_link = "vessel_in_history_tc.php";}
$voyageyear = date('Y',strtotime($obj->getCharteringEstimateTCData($comid,"TC_DATE")));
$nav=19;
}else
{
    $voyageyear = date('Y',strtotime($obj->getCompareEstimateData($comid,"ADD_ON_DATE")));
	if($page == 1){$page_link = "in_ops_at_glance.php"; $page_bar="In Ops at a glance";$nav=5;$subtitle = 'VC';}else if($page == 2){$page_link = "vessel_in_post_ops.php"; $page_bar="Vessels in Post Ops";$nav=5;$subtitle = 'VC';}else if($page == 3){$page_link = "vessel_in_history.php"; $page_bar="Vessels in History";$nav=5;$subtitle = 'VC';}else if($page == 4){$page_link = "coa_in_ops_at_glance.php"; $page_bar="In Ops at a glance - COA";$nav=20;$subtitle = 'COA';}else if($page == 5){$page_link = "coa_in_post_ops.php"; $page_bar="In Post Ops at a glance - COA";$nav=20;$subtitle = 'COA';}else{$page_link = "coa_in_history.php"; $page_bar="Vessels in History - COA";$nav=20;$subtitle = 'COA';}
}

$cost_sheet_id = $obj->getLatestCostSheetID($comid);
$obj->viewFreightCostEstimationTempleteRecordsNew($cost_sheet_id);

$pagename = basename($_SERVER['PHP_SELF'])."?vesselimono=".$vesselimono."&page=".$page;
$msg = NULL;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php $display->title(); ?></title>
<?php $display->favicon(); ?>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<?php $display->css(); ?>
<link href="../../css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="../js/html5shiv.js"></script>
  <script src="../js/respond.min.js"></script>
<![endif]-->
</head>
    <body class="skin-blue fixed">
        <!-- header logo: style can be found in header.less -->
        <?php $display->header_tag(); ?>
		<div class="wrapper row-offcanvas row-offcanvas-left">
            <?php $display->leftmenu($nav); ?>
			<aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <i class="fa fa-folder-open"></i>&nbsp;Ops TC&nbsp;&nbsp;&nbsp;&nbsp;<small><div class="headline text-center" id="time" style="color:#000; font-weight:bold; font-size:12px;"></div></small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="../"><i class="fa fa-home"></i> Home</a></li>
                        <li class="active">Ops TC&nbsp;&nbsp;&nbsp;>&nbsp;&nbsp;&nbsp;In Ops at a glance TC>&nbsp;&nbsp;&nbsp;Voyage Report</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
				
				<div class="box box-primary">
				<h3 style=" text-align:center;">VOYAGE REPORT</h3>
                <form name="frm1" id="frm1" enctype="multipart/form-data" method="post" action="<?php echo $pagename;?>"/>
                	<div class="col-xs-4">
								                          
                    </div><!-- /.col -->
                    <div class="col-xs-6">
                                         
                    </div><!-- /.col -->
                    
                    <div class="col-xs-2">
                          <div align="right"><a href="<?php echo $page_link;?>?selYear=<?=$voyageyear;?>"><button type="button" class="btn btn-info btn-flat">Back</button></a>&nbsp;&nbsp;&nbsp;&nbsp;</div>                   
                    </div><!-- /.col -->
				    <div style="clear:both;"></div>
				    <?php $obj->displayVoyageReports($vesselimono,$obj->getFun8());?>
				</form>
				</div>
				<!--   content ends here..................-->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
			
        </div><!-- ./wrapper -->
<?php $display->footer(); ?>
<?php $display->js(); ?>
<script src="../../js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
<script src="../../js/plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="../../js/timer.js" type="text/javascript"></script>
<link href="../../css/jquery.alerts.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../../js/jquery.alerts.js"></script>
<script type="text/javascript">

	
$(document).ready(function(){
 
 $(".sidebar-toggle").click();
 $("#frm1").validate({
		
		submitHandler: function(form)  {
			jAlert('<b style="font-size:25px;">Please wait . . .</b><br><br><img src="../../img/loading.gif"  />', 'Alert');
			$("#popup_container").css({"background": "rgba(255,255,255,0.1)","border": "10px solid rgba(255,255,255,0.1)","width": "100%"});
			$("#popup_content").css({"background":"none","text-align":"center"});
			$("#popup_ok,#popup_title").hide();  
			form.submit();
		}
	});
	
	
	(function () {
	var customDateDDMMMYYYYToOrd = function (date) {
		"use strict"; 
		
		var dateParts = date.split(/-/);
		return (dateParts[2] * 10000) + ($.inArray(dateParts[1].toUpperCase(), ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]) * 100) + (dateParts[0]*1);
	};
	
	jQuery.fn.dataTableExt.aTypes.unshift(
		function (sData) {
			"use strict"; 
			if (/^([0-2]?\d|3[0-1])-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)-\d{4}/i.test(sData)) {
				return 'date-dd-mmm-yyyy';
			}
			return null;
		}
	);
	jQuery.fn.dataTableExt.oSort['date-dd-mmm-yyyy-asc'] = function (a, b) {
		"use strict"; 
		var ordA = customDateDDMMMYYYYToOrd(a),
			ordB = customDateDDMMMYYYYToOrd(b);
		return (ordA < ordB) ? -1 : ((ordA > ordB) ? 1 : 0);
	};
	jQuery.fn.dataTableExt.oSort['date-dd-mmm-yyyy-desc'] = function (a, b) {
		"use strict"; 
		var ordA = customDateDDMMMYYYYToOrd(a),
			ordB = customDateDDMMMYYYYToOrd(b);
		return (ordA < ordB) ? 1 : ((ordA > ordB) ? -1 : 0);
	};
	})();
	
	
	$('#voyagereports').dataTable(
	            {
				"order": [[7, "desc" ]],
				'iDisplayLength': 100
				});
	
});

function getSubmit()
{ 
	document.frm1.submit();
}
</script>
		
</body>
</html>