<?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();
$mappingid  = $_REQUEST['mappingid'];
$page  = $_REQUEST['page'];
if (@$_REQUEST['action'] == 'submit')
{
	$msg = $obj->confirmFinalCostSheet();
	header('Location:./view_cost_sheet_list.php?msg='.$msg."&mappingid=".$mappingid."&page=".$page);
}
$pagename = basename($_SERVER['PHP_SELF'])."?mappingid=".$mappingid."&page=".$page;

if($page == 1){$page_link = "in_ops_at_glance.php"; $page_bar="In Ops at a glance";}else if($page == 2){$page_link = "vessel_in_post_ops.php"; $page_bar="Vessels in Post Ops";}else {$page_link = "vessel_in_history.php"; $page_bar="Vessels in History";}
?>
<!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(5); ?>
			<aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <i class="fa fa-book"></i>&nbsp;Daily Tasks&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">Daily Tasks&nbsp;&nbsp;&nbsp;>&nbsp;&nbsp;&nbsp;<?php echo $page_bar; ?></li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content invoice">
				<!--   content put here..................-->
					<div align="right"><a href="<?php echo $page_link;?>"><button class="btn btn-info btn-flat">Back</button></a></div>
					<div style="height:10px;">&nbsp;</div>
				
					<?php if(isset($_REQUEST['msg'])){
							$msg = $_REQUEST['msg'];
							if($msg == 0){?>
					<div class="alert alert-success alert-dismissable">
						<i class="fa fa-check"></i>
						<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
						<b>Congratulations!</b> Final Voyage Financials Estimated sheet confirmed.
					</div>
					<?php }?>
					<?php if($msg == 1){?>
					<div class="alert alert-danger alert-dismissable">
						<i class="fa fa-ban"></i>
						<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
						<b>Sorry!</b> there was an error while adding/updating Final Voyage Financials Estimated sheet.
					</div>
					<?php }?>
					<?php if($msg == 2){?>
					<div class="alert alert-success alert-dismissable">
						<i class="fa fa-check"></i>
						<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
						<b>Congratulations!</b> Status changed successfully.
					</div>
					<?php }}?>
				
				<div class="box box-primary">
					<h3 style=" text-align:center;">ESTIMATED COST SHEETS</h3>
					<div align="right"><a href="vfc_compare.php?mappingid=<?php echo $mappingid; ?>&page=<?php echo $page; ?>"><button class="btn btn-info btn-flat" >Compare Voyage Financials</button></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
					<form name="frm1" id="frm1" enctype="multipart/form-data" action="<?php echo $pagename;?>" method="post"/>
					 
						<div style="height:10px;">
							<input type="hidden" name="action" value="submit" />
							<input type="hidden" name="txtMappingid2" id="txtMappingid2" value="" />
						</div>
							<?php $obj->displayCostSheetList($mappingid,$page);?>
				   
					</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/dataTables.bootstrap.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(){
});
function getValidate()
{
	var arr = Array();var i=0;
	$('[id^=rdoFCA_]').each(function(index) {
		var rowid = this.id;
		//alert(rowid);
		var lasrvar1 = rowid.split('_')[1];
		if($("#rdoFCA_"+lasrvar1).is(":checked"))
		{
			arr[i] = 1;
		}
			i++;
	});
	if(arr.length > 0)
		{
			return true;
		}
		else
		{
			jAlert('Please select atleast one voyage financials.', 'Alert');
			return false;
		}	
}

function msg(){
	
	jAlert('Please confirm voyage financials sheet first.', 'Alert');
	return false;
}
</script>
		
</body>
</html>