<?php 


session_start();
require_once("../../includes/display_internal_user_risk.inc.php");
require_once("../../includes/functions_internal_user_riskmangement.inc.php");
$obj = new data();
$connect = $obj->funConnect();
$display = new display();
$display->logout_iu();
if (@$_REQUEST['action'] == 'submit')
 {
 	$msg = $obj->changeEntityFfaStatusRecords();
	header('Location:./entity_list.php?msg='.$msg);
 }
$pagename = basename($_SERVER['PHP_SELF']);
$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="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/buttons/2.2.2/css/buttons.dataTables.min.css" rel="stylesheet" type="text/css" />
<style>
.dataTables_scrollBody {
    transform:rotateX(180deg);
}
.dataTables_scrollBody table {
    transform:rotateX(180deg);
}
	</style>





<!-- <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(7); ?>
			<aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <i class="fa fa-folder-open"></i>&nbsp;Reports&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">Reports &nbsp;&nbsp;&nbsp;> RM Specs&nbsp;&nbsp;</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
				<!--   content put here..................-->
				<?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> GST added/updated successfully.
				</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 GST.
				</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;">RM Specs</h3>
				<!-- <div align="right"><a href="addgst.php" title="Add New"><button class="btn btn-info btn-flat">Add New</button></a>&nbsp;&nbsp;&nbsp;&nbsp;</div> -->
				<form name="frm1" id="frm1" enctype="multipart/form-data" action="<?php echo $pagename;?>"/>


				<div class="row invoice-info" style="margin-left:10px;">
                        <div class="col-sm-2 invoice-col">
						<span style="font-size:10px; font-style:italic;"> &nbsp;TRADE MONTH FROM:  MONTH & YEAR</span>
							<address>
								<input type="month" name="txtFrom_Date" id="txtFrom_Date" class="form-control" value="" placeholder="dd-mm-yyyy">
							 </address>
						</div>
						
						<div class="col-sm-2 invoice-col">
						<span style="font-size:10px; font-style:italic;">  &nbsp;TRADE MONTH To:  MONTH & YEAR</span>
							<address>
								<input type="month" name="txtTo_Date" id="txtTo_Date" class="form-control" value="" placeholder="dd-mm-yyyy">
							 </address>
						</div>

						<div class="col-sm-2 invoice-col">
						PIC /<span style="font-size:10px; font-style:italic;">  &nbsp;(Executed for)</span>
						<select  name="selCreatedFor" class="form-control" id="selCreatedFor" onChange=""  >
					
					<?php 
					$obj->getLoginDetailsForFFA();
					?>
					</select> 	
						</div>
                    
						
                        <div class="col-sm-2 invoice-col">
						&nbsp;
                            <address>
                              <button type="button" class="btn btn-primary btn-flat" onClick="getData();" >Search</button>
                            </address>
                        </div><!-- /.col -->

					</div>

					<!-- <div align="right">
                        <a href="#" title="Pdf" onClick="getExcel();"><button class="btn btn-default" style="margin-right: 5px;" type="button"><i class="fa fa-download"></i>Download</button></a>
					</div> -->
				<div style="height:10px;">
				<input name="txttblid" id="txttblid" class="input" size="5" type="hidden" value="" />
				<input name="txttblstatus" id="txttblstatus" type="hidden" value="" />
				<input type="hidden" name="action" value="submit" />
				</div>				
				<?php //$obj->displayGstFfa();?>


				<div id="DivOwner" class="box-body table-responsive" style="overflow:auto;">
						<table id="sf_list" class="table table-bordered table-striped dataTable">
							<thead>
							<tr>
								<th  align="left" valign="top" width="10%">Sr.No.</th>
								<th  align="left" valign="top" width="10%">DATE</th>
					
								<th  align="left" valign="top" width="10%">CONTRACT</th>
								<th  align="left" valign="top" width="10%">PERIOD</th>
								<th  align="left" valign="top" width="10%">SIZE TOTAL</th>
								<th  align="left" valign="top" width="10%">SIZE DPM</th>
								
							
								<th  align="left" valign="top" width="10%">GROSS PL</th>
								<th  align="left" valign="top" width="10%">NET PL</th>
								<th  align="left" valign="top" width="10%">PROFIT/LOSS</th>
								
                              
							</tr>
                            
							</thead>
							<tbody>
								
							</tbody>
							
						</table>
					</div>


				</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="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js" type="text/javascript"></script>
	
	<!-- new scripts -->
	<script src="https://cdn.datatables.net/buttons/2.2.2/js/dataTables.buttons.min.js" type="text/javascript"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" type="text/javascript"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" type="text/javascript"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" type="text/javascript"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" type="text/javascript"></script>
	<script src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.html5.min.js" type="text/javascript"></script>
	<script src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.print.min.js" type="text/javascript"></script>



<script src="../../js/timer.js" type="text/javascript"></script>

<link href="../../css/datepicker/datepicker.css" rel="stylesheet" type="text/css" />
	<script src="../../js/bootstrap-datepicker.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(){

$("#sf_list").dataTable();
	// $('#txtFrom_Date,#txtTo_Date').datepicker({
	// 	format: 'dd-mm-yyyy',
	// 	autoclose: true
	// });


 var i=1;
 $("[id^=myonoffswitch_]").each(function () {
        document.getElementById("myonoffswitch_"+i).setAttribute("type", "checkbox");
		i++;
    });
 
});
$(function() {
	$("#terminal_list").dataTable();

});
function getChangeStatus(var1,var2,rowid)
{

	$("#txttblid").val(var1);
		$("#txttblstatus").val(var2);

		
	jConfirm('Do you want to change status?', 'Confirmation', function(r) {



	if(r){ 
	
		document.frm1.submit();
	}
	else{
			if(var2 == 1)
			{
				$("#myonoffswitch_"+rowid).attr("checked","checked");
			}
			else
			{
				$("#myonoffswitch_"+rowid).attr("checked","");
			}
		return false;
		}
	});
}




function getData()
{
		if($("#txtFrom_Date").val() != "" && $("#txtTo_Date").val() != "")
	{
		$('#DivOwner').html("");
		$('#DivOwner').html('<span style="text-align:center;display:block;"><img src="../../img/loading.gif" /></span>');
		$.post("options.php?id=132",{txtFrom_Date:""+$("#txtFrom_Date").val()+"",txtTo_Date:""+$("#txtTo_Date").val()+"",selCreatedFor:""+$("#selCreatedFor").val()+"", selCOASpot:""+$("#selCOASpot").val()+""}, function(html) {
			$('#DivOwner').html("");
			$('#DivOwner').html(html);


			// 	var new_row = $("<tr class='search-header'/>");
			// 	// <-----------------DPk------------------------>
			// 	$('#sf_list thead th').each(function(i) {
			// 	var title = $(this).text();

			
			// 	var new_th = $('<th style="' + $(this).attr('style') + '" />');


			//    $(new_th).append('<input type="text" style="width:150px;" placeholder="' + title + '" data-index="'+i+'"/>');
			
			
			
			
			
			
			

				
			// $(new_row).append(new_th);
			
			// // <--------------------DPk------------------------>
			// 	});
			// 	$('#sf_list thead').prepend(new_row);


			var table = $('#sf_list').DataTable({
							// "scrollX": true,
							"searching": true,

							
							paging: true, 
       
						dom: 'Bfrtip',
					buttons: [
						{
							extend: 'excel',
							messageTop: "Date From:  "+$('#txtFrom_Date').val()+"         Date To: "+$('#txtTo_Date').val(),			
							title:"RM Specs",
							sFileName: "RM-contract("+$('#txtFrom_Date').val()+"-"+$('#txtTo_Date').val()+")"


						},
						
							]

							
						});
			// $("#sf_list").dataTable();

			// Filter event handler

			$(table.table().container()).each(function (i) {
         
        });
		
$( table.table().container() ).on( 'keyup', 'thead input', function () {



  table
    .column( $(this).data('index') )
    .search( this.value )
    .draw();
});


		});
	}else{
		jAlert('Please select Date From & Date To', 'Alert Dialog');
	}
}




function getExcel()
	{
		if($("#txtFrom_Date").val().length==0 || $("#txtTo_Date").val().length==0){
			jAlert('Please select Date From & Date To', 'Alert Dialog');
			return false;
		}else{
			location.href='allExcel.php?id=37&txtFrom_Date='+$("#txtFrom_Date").val()+'&txtTo_Date='+$("#txtTo_Date").val();
		}
	}



</script>
		
</body>
</html>