<?php
session_start();
$companyname=$_SESSION['companyname'];//;
$adminemailid=$_SESSION['emailid'];//;
$companymailid=$_SESSION['companymailid'];
if(($adminemailid !="")&&($companyname!="")){
require_once('../Control/sales.php');
$objsales=new salesctrl();
require_once('../Control/pipeline.php');
$objpipeline=new pipelinectrl();
$pipelinetype_res=$objsales->salesselectall($companyname, $companymailid, "sales_pipe_type", "no");
$i=0;
$pipe_name=array();
$pipe_percentage=array();
foreach($pipelinetype_res as $pipelinetype_row){
    $pipe_id[$i]=$pipelinetype_row['id'];
    $pipe_name[$i]=$pipelinetype_row['pipe_name'];
    $pipe_percentage[$i]=$pipelinetype_row['pipe_percentage'];
    //echo $pipelinetype_row['pipe_percentage'];
    $i++;
}
//print_r($pipe_name);

/*$pipelinetype_res=$objpipeline->salespipelinedeal($companyname,"");
$emp_res=$objsales->salesselectall($companyname, $adminemailid, "signupdetails", "no");
//print_r($emp_res);
$j=0;*/
/*foreach($emp_res as $emp_row){
 $emp_emailid_a[$j++]=$emp_row['emailid'];   
}*/
$emp_emailid_a[0]=$adminemailid;
$emp_count= count($emp_emailid_a);
//print_r($emp_emailid_a);
?>

<!doctype html>
<html>
    <head>
    
        <link rel="icon" href="../../Images/cloud-icon-27.png">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="../../Bootstrap/css/bootstrap.min.css">
        <script src="../../Bootstrap/jquery.min.js"></script>
        <script src="../../Bootstrap/js/bootstrap.min.js"></script>
        <script src="../../Bootbox/bootbox.min.js"></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.js"></script>
        
    <!-- data Table -->
<link rel="stylesheet" type="text/css" href="http://www.fieldcloud.in/Web/DataTable/Css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://www.fieldcloud.in/Web/DataTable/Css/buttons.bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="http://www.fieldcloud.in/Web/DataTable/Css/dataTables.bootstrap.min.css"/>


<link rel="stylesheet" type="text/css" href="http://www.fieldcloud.in/Web/DataTable/hide/responsive.bootstrap.min.css"/>

<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/buttons.bootstrap.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/jszip.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/pdfmake.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/vfs_fonts.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/buttons.html5.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/buttons.print.min.js"></script>
<script type="text/javascript" src="http://www.fieldcloud.in/Web/DataTable/Js/buttons.colVis.min.js"></script>
   
<style>
    #pipeline1{
        background: #db1b56;
        height: 40px;
        display: block;
        color: #ffffff;
        font-size: 21px;
        font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
        font-weight: normal;
        line-height: 0.7;
        padding: 9px 0 0px 0;
        margin: 0 -10px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        -ms-box-sizing: border-box;
    }
    #pipeline2{
        background: #9999cc;
        height: 50px;
        display: block;
        color: #ffffff;
        font-size: 21px;
        font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
        font-weight: normal;
        line-height: 0.6;
        padding: 9px 0 0px 0;
        margin: 0 -10px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        -ms-box-sizing: border-box;
    }
    #pipeline3{
        background: #c6c3be;
        height: 40px;
        display: block;
        color: #ffffff;
        font-size: 21px;
        font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
        font-weight: normal;
        line-height: 0.6;
        padding: 9px 0 0px 0;
        margin: 0 -10px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        -ms-box-sizing: border-box;
    }
</style>    
<style>
	.modal.left .modal-dialog,
	.modal.right .modal-dialog {
		position: fixed;
		margin: auto;
		padding-top:50px;
		width: 80%;
		height: 98%;
		-webkit-transform: translate3d(0%, 0, 0);
		    -ms-transform: translate3d(0%, 0, 0);
		     -o-transform: translate3d(0%, 0, 0);
		        transform: translate3d(0%, 0, 0);
	}

	.modal.left .modal-content,
	.modal.right .modal-content {
		height: 100%;
		overflow-y: auto;
	}
	
	.modal.left .modal-body,
	.modal.right .modal-body {
		padding: 15px 15px 80px;
	}

        
/*Right*/
	.modal.right.fade .modal-dialog {
		right: -80%;
		-webkit-transition: opacity 0.3s linear, right 0.3s ease-out;
		   -moz-transition: opacity 0.3s linear, right 0.3s ease-out;
		     -o-transition: opacity 0.3s linear, right 0.3s ease-out;
		        transition: opacity 0.3s linear, right 0.3s ease-out;
	}
	
	.modal.right.fade.in .modal-dialog {
		right: 0;
	}


</style>

        <style>
            body {
                min-width: 1030px;
                height: 97%;
                width: 100%;
            }
            
            html, body {
                margin: 0;
                padding: 0;
                width: 100%;
                height: 95%;
                font-family: "Open Sans", Arial, Helvetica, sans-serif;
                font-size: 14px;
                line-height: 130%;
                color: #333;
                background-color: #fff;
                -webkit-user-select: auto;
            }
             .menu>li.sales a:hover:before{
                background-position: -40px 0;
            }
            .menu>li.sales a.active:before {
                background-position: -40px 0;
            }
             .menu>li.sales a:before {
                width: 13px;
                height: 11px;
                background-position: -20px 0;
                top: 5px;
                left: 27px;
            }
             .menu>li.sales a:after {
                width: 13px;
                height: 11px;
                background-position: -20px 0;
                top: 5px;
                left: 27px;
            }
             .menu>li.activity a:hover:before{
                background-position: -80px 0;
            }
            .menu>li.activity a.active:before {
                background-position: -80px 0;
            }
             .menu>li.activity a:before {
                width: 13px;
                height: 11px;
                background-position: -20px 0;
                top: 3px;
                left: 23px;
            }
            .menu>li.sales a:before {
                background: url(Image/pipelinemenu.png) no-repeat 0 0 transparent;
                width: 18px;
                height: 18px;
                display: block;
                position: absolute;
                content: "";
                background-position: -20px 0;
            }
            .menu>li.activity a:before {
                background: url(Image/pipelinemenu.png) no-repeat 0 0 transparent;
                width: 18px;
                height: 18px;
                display: block;
                position: absolute;
                content: "";
                background-position: -60px 0px;
            }
            .left-link {
                width: 183px;
                padding: 7px 0px 7px 0px;
                width: 135px;
                display: block;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .left-link:hover{
                background: #ecf6fd;
                cursor:pointer;
            }
            .my_team{
                max-height:100%;
                background-color: #F5F5F5;
            }
             iframe
            {
                border:none;
                overflow-x: hidden;
            }
            @media only screen and (max-width: 1000px)  {
                body {
                    overflow-x: visible;
                }
            }
        </style>        
    </head>
    
    <body style="padding-top:50px;background-color:#f6f6f6">
       
        <nav id="mainNav" class="navbar navbar-inverse  navbar-fixed-top">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header page-scroll">
                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
                <a href="#page-top"><img alt="Cloud" src="http://fieldcloud.in/Web/Images/cloud-icon-27.png" width="50px" height="50px"> <span style="font-size:2em;color: White;"> Field</span><span style="font-size:2em;color: orange;">Cloud</span></a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                
                 <ul class="nav navbar-nav navbar-right menu">
                    <li>
                        <a class="page-scroll pull-left" href="employee_dashboard.php">Action Stream</a>
                    </li>
                    <li>
                        <a class="page-scroll pull-left" href="employee_dashboard_contact.php">Contact</a>
                    </li>
                    <li class="sales">
                        <a style="top:5px;color:white;">Pipeline</a>
                    </li>
                    <li class="activity">
                        <a style="top:5px;" href="employee_activity_all.php" >Activity</a>
                    </li>
                    
                    
                    <li>
                    <a href="logout.php">Logout</a>
                    </li>
                    
                    <li>
                    <?php if((strpos($companytype,'Project') !== false) || (strpos($companytype,'Service') !== false)){ ?>
                    <li>
                    <a  href="../../../home.php">Switch to Home</a>
                    </li>
                    <?php } ?>
                    </ul>
                    
                    </li>
                    </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
<!-- Modal -->
<div id="modalpipeline" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-body">
          <div class="row">
            <div class="col-md-7">
                <span style="font-size:20px;font-family: 'Times New Roman', Times, serif;"><b><center>Add/Edit funnel stages</center></b></span>
            </div>
            <div class="col-md-5">
             <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
         </div>
        <div id="addpipelineeditpage" ></div>
        <br><br>
        <center>
            <input type="submit" class="btn btn-primary" onclick="submitpipelineedit()" value="Save">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </center>
      </div>
    </div>

  </div>
</div>

<script>
    function submitpipelineedit(){
        /*pipe_id4 pipe_stage4 pipe_name4
        if()*/
    }
</script>

        <script>
            function modelboxpipeline(){
                $("#addpipelineeditpage").load('pipeline_edit.php');
            }
        </script>
        <!--<div class="row" style="padding-top: 30px;height: 72px;padding-left:100px;padding-right:100px;border-bottom:2px solid grey">
            <span class="pull-right" >
                <span onclick="modelboxpipeline()"  data-toggle="modal" data-target="#modalpipeline" style="color:#999;"><i class="glyphicon glyphicon-pencil"></i> &nbsp;Edit</span>
            </span>
        </div>-->
        
        <script>
            function funcshowrecord1(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $("#btnm1").addClass("active");
                $("#btnm2").removeClass("active");
                $("#btnm3").removeClass("active");
                
            }
            
            function funcshowrecord2(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $("#btnm2").addClass("active");
                $("#btnm1").removeClass("active");
                $("#btnm3").removeClass("active");
                
            }
            
            function funcshowrecord3(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $("#btnm3").addClass("active");
                $("#btnm2").removeClass("active");
                $("#btnm1").removeClass("active");
                
            }
        </script>
<?php

$mon=date('m');
$yea=date('Y');


$month=date('M');
$year=date('Y');
$months=$year."-".$month."-01";

?>
        <div style="background-color:#f6f6f6">
            
            <div class="summary" style="padding: 0px 100px ;">
                
                
                <div style="border:1px solid #D5D5D5;padding:5px;">  
                    <div class="row">
                        <div class="col-sm-3"style="padding-top:5px;font-size:25px;">
                           <center> Months </center>
                            <!--<button onclick="funcshowrecord1('#monthlyshow','#quarterlyshow','#yearlyshow')" id="btnm1" class="btn btn-default active" style="margin-left:0px">Month</button>
                            <button onclick="funcshowrecord2('#quarterlyshow','#monthlyshow','#yearlyshow')" id="btnm2" class="btn btn-default" style="margin-left:-6px">Quarter</button>
                            <button onclick="funcshowrecord3('#yearlyshow','#quarterlyshow','#monthlyshow')" id="btnm3" class="btn btn-default" style="margin-left:-6px">Year</button>-->
                        </div>
                        <div class="col-sm-9" id="monthlyshow">
                              <div id="my-month">
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <button id="m1" class="btn btn-default pull-right" next_month="<?php echo date('M',strtotime($month)); ?>" my_year="<?php echo $year;?>"  style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M',strtotime($month)); ?>&nbsp;&nbsp;<?php echo $year;?></b></button>
                                <button class="btn btn-primary pull-left" onclick="previewsrecordmonth()" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-left"></i></button>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="m2" class="btn btn-default"  style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M', strtotime($month .'+1 month')); ?>&nbsp;&nbsp;<?php echo date('Y', strtotime($months .'+1 month')); ?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="m3" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M', strtotime($month .'+2 month')); ?>&nbsp;&nbsp;<?php echo date('Y', strtotime($months .'+2 month')); ?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="m4" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M', strtotime($month .'+3 month')); ?>&nbsp;&nbsp;<?php echo date('Y', strtotime($months .'+3 month')); ?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="m5" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M', strtotime($month .'+4 month')); ?>&nbsp;&nbsp;<?php echo date('Y', strtotime($months .'+4 month')); ?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;">
                                <center><button id="m6" class="btn btn-default pull-left" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo date('M', strtotime($month .'+5 month')); ?>&nbsp;&nbsp;<?php echo date('Y', strtotime($months .'+5 month')); ?></b></button></center>
                                <button  class="btn btn-primary pull-right" onclick="nextrecordmonth()" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-right"></i></button>
                            </div>
                            </div>
                        </div>
                        <script>
                             function previewsrecordmonth(){
                                var month=$("#startmonth").val();//['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
                                //var year=$("#startmonth1").val();
                                var year=$("#startmonth2").val();
                                
                                if(month==1){
                                    var m1='Dec '+(Number(year));
                                    var m2='Jan '+(Number(year)+1);
                                    var m3='Feb '+(Number(year)+1);
                                    var m4='Mar '+(Number(year)+1);
                                    var m5='Apr '+(Number(year)+1);
                                    var m6='May '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(12);
                                    $.post("date_intermediate_employee.php",{mon:"12",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{tar_mon:"12",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"12",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"12",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                     
                                }
                                if(month==2){
                                    var m1='Jan '+(Number(year));
                                    var m2='Feb '+(Number(year));
                                    var m3='Mar '+(Number(year));
                                    var m4='Apr '+(Number(year));
                                    var m5='May '+(Number(year));
                                    var m6='Jun '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(1);
                                    $.post("date_intermediate_employee.php",{mon:"01",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{tar_mon:"01",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"01",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"01",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                     $("#startmonth1").val(Number(year));
                                    $("#startmonth2").val(Number(year)-1);
                                }
                                if(month==3){
                                    var m1='Feb '+(Number(year));
                                    var m2='Mar '+(Number(year));
                                    var m3='Apr '+(Number(year));
                                    var m4='May '+(Number(year));
                                    var m5='Jun '+(Number(year));
                                    var m6='Jul '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(2);
                                    $.post("date_intermediate_employee.php",{mon:"02",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"02",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"02",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"02",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==4){
                                    var m1='Mar '+(Number(year));
                                    var m2='Apr '+(Number(year));
                                    var m3='May '+(Number(year));
                                    var m4='Jun '+(Number(year));
                                    var m5='Jul '+(Number(year));
                                    var m6='Aug '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(3);
                                    $.post("date_intermediate_employee.php",{mon:"03",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"03",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"03",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"03",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==5){
                                    var m1='Apr '+(Number(year));
                                    var m2='May '+(Number(year));
                                    var m3='Jun '+(Number(year));
                                    var m4='Jul '+(Number(year));
                                    var m5='Aug '+(Number(year));
                                    var m6='Sep '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(4);
                                    $.post("date_intermediate_employee.php",{mon:"04",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"04",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"04",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"04",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==6){
                                    var m1='May '+(Number(year));
                                    var m2='Jun '+(Number(year));
                                    var m3='Jul '+(Number(year));
                                    var m4='Aug '+(Number(year));
                                    var m5='Sep '+(Number(year));
                                    var m6='Oct '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(5);
                                    $.post("date_intermediate_employee.php",{mon:"05",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"05",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"05",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{pending_mon:"05",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                   
                                }
                                 if(month==7){
                                    var m1='Jun '+(Number(year));
                                    var m2='Jul '+(Number(year));
                                    var m3='Aug '+(Number(year));
                                    var m4='Sep '+(Number(year));
                                    var m5='Oct '+(Number(year));
                                    var m6='Nov '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(6);
                                    $.post("date_intermediate_employee.php",{mon:"06",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"06",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"06",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"06",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    
                                }
                                if(month==8){
                                    var m1='Jul '+(Number(year));
                                    var m2='Aug '+(Number(year));
                                    var m3='Sep '+(Number(year));
                                    var m4='Oct '+(Number(year));
                                    var m5='Nov '+(Number(year));
                                    var m6='Dec '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(7);
                                    $.post("date_intermediate_employee.php",{mon:"07",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"07",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"07",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"07",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    
                                }
                               if(month==9){
                                    var m1='Aug '+(Number(year));
                                    var m2='Sep '+(Number(year));
                                    var m3='Oct '+(Number(year));
                                    var m4='Nov '+(Number(year));
                                    var m5='Dec '+(Number(year));
                                    var m6='Jan '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(8);
                                    $.post("date_intermediate_employee.php",{mon:"08",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"08",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"08",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"08",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                     
                                }
                                if(month==10){
                                    var m1='Sep '+(Number(year));
                                    var m2='Oct '+(Number(year));
                                    var m3='Nov '+(Number(year));
                                    var m4='Dec '+(Number(year));
                                    var m5='Jan '+(Number(year)+1);
                                    var m6='Feb '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(9);
                                    $.post("date_intermediate_employee.php",{mon:"09",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"09",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"09",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"09",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                   
                                }
                                if(month==11){
                                    var m1='Oct '+(Number(year));
                                    var m2='Nov '+(Number(year));
                                    var m3='Dec '+(Number(year));
                                    var m4='Jan '+(Number(year)+1);
                                    var m5='Feb '+(Number(year)+1);
                                    var m6='Mar '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(10);
                                    $.post("date_intermediate_employee.php",{mon:"10",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"10",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"10",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"10",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==12){
                                    var m1='Nov '+(Number(year));
                                    var m2='Dec '+(Number(year));
                                    var m3='Jan '+(Number(year)+1);
                                    var m4='Feb '+(Number(year)+1);
                                    var m5='Mar '+(Number(year)+1);
                                    var m6='Apr '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(11);
                                    $.post("date_intermediate_employee.php",{mon:"11",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"11",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"11",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"11",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    
                                }
                                
                            }
                            function nextrecordmonth(){
                                var month=$("#startmonth").val();//['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
                                var year=$("#startmonth2").val();
                                //var year1=$("#startmonth2").val();
                               
                                if(month==1){
                                    var m1='Feb '+(Number(year));
                                    var m2='Mar '+(Number(year));
                                    var m3='Apr '+(Number(year));
                                    var m4='May '+(Number(year));
                                    var m5='Jun '+(Number(year));
                                    var m6='Jul '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(2);
                                    $.post("date_intermediate_employee.php",{mon:"02",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"02",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"02",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"02",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==2){
                                    var m1='Mar '+(Number(year));
                                    var m2='Apr '+(Number(year));
                                    var m3='May '+(Number(year));
                                    var m4='Jun '+(Number(year));
                                    var m5='Jul '+(Number(year));
                                    var m6='Aug '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(3);
                                    $.post("date_intermediate_employee.php",{mon:"03",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"03",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"03",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"03",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==3){
                                    var m1='Apr '+(Number(year));
                                    var m2='May '+(Number(year));
                                    var m3='Jun '+(Number(year));
                                    var m4='Jul '+(Number(year));
                                    var m5='Aug '+(Number(year));
                                    var m6='Sep '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(4);
                                    $.post("date_intermediate_employee.php",{mon:"04",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"04",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"04",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{pending_mon:"04",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==4){
                                    var m1='May '+(Number(year));
                                    var m2='Jun '+(Number(year));
                                    var m3='Jul '+(Number(year));
                                    var m4='Aug '+(Number(year));
                                    var m5='Sep '+(Number(year));
                                    var m6='Oct '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(5);
                                    $.post("date_intermediate_employee.php",{mon:"05",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"05",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"05",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"05",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==5){
                                    var m1='Jun '+(Number(year));
                                    var m2='Jul '+(Number(year));
                                    var m3='Aug '+(Number(year));
                                    var m4='Sep '+(Number(year));
                                    var m5='Oct '+(Number(year));
                                    var m6='Nov '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(6);
                                    $.post("date_intermediate_employee.php",{mon:"06",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"06",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{per_mon:"06",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"06",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==6){
                                    var m1='Jul '+(Number(year));
                                    var m2='Aug '+(Number(year));
                                    var m3='Sep '+(Number(year));
                                    var m4='Oct '+(Number(year));
                                    var m5='Nov '+(Number(year));
                                    var m6='Dec '+(Number(year));
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(7);
                                    $.post("date_intermediate_employee.php",{mon:"07",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"07",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"07",per_yea:year},function test1(data){
                                      $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"07",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    
                                    
                                    
                                }
                                  if(month==7){
                                    var m1='Aug '+(Number(year));
                                    var m2='Sep '+(Number(year));
                                    var m3='Oct '+(Number(year));
                                    var m4='Nov '+(Number(year));
                                    var m5='Dec '+(Number(year));
                                    var m6='Jan '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(8);
                                    $.post("date_intermediate_employee.php",{mon:"08",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"08",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"08",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{pending_mon:"08",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==8){
                                    var m1='Sep '+(Number(year));
                                    var m2='Oct '+(Number(year));
                                    var m3='Nov '+(Number(year));
                                    var m4='Dec '+(Number(year));
                                    var m5='Jan '+(Number(year)+1);
                                    var m6='Feb '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(9);
                                   $.post("date_intermediate_employee.php",{mon:"09",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"09",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"09",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{pending_mon:"09",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                               if(month==9){
                                    var m1='Oct '+(Number(year));
                                    var m2='Nov '+(Number(year));
                                    var m3='Dec '+(Number(year));
                                    var m4='Jan '+(Number(year)+1);
                                    var m5='Feb '+(Number(year)+1);
                                    var m6='Mar '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(10);
                                    $.post("date_intermediate_employee.php",{mon:"10",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"10",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"10",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{pending_mon:"10",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==10){
                                    var m1='Nov '+(Number(year));
                                    var m2='Dec '+(Number(year));
                                    var m3='Jan '+(Number(year)+1);
                                    var m4='Feb '+(Number(year)+1);
                                    var m5='Mar '+(Number(year)+1);
                                    var m6='Apr '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(11);
                                    $.post("date_intermediate_employee.php",{mon:"11",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"11",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"11",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{pending_mon:"11",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==11){
                                    var m1='Dec '+(Number(year));
                                    var m2='Jan '+(Number(year)+1);
                                    var m3='Feb '+(Number(year)+1);
                                    var m4='Mar '+(Number(year)+1);
                                    var m5='Apr '+(Number(year)+1);
                                    var m6='May '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(12);
                                    $.post("date_intermediate_employee.php",{mon:"12",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"12",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"12",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate_employee.php",{pending_mon:"12",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                }
                                if(month==12){
                                    var m1='Jan '+(Number(year)+1);
                                    var m2='Feb '+(Number(year)+1);
                                    var m3='Mar '+(Number(year)+1);
                                    var m4='Apr '+(Number(year)+1);
                                    var m5='May '+(Number(year)+1);
                                    var m6='Jun '+(Number(year)+1);
                                    $("#m1").html('<b>'+m1+'</b>');
                                    $("#m2").html('<b>'+m2+'</b>');
                                    $("#m3").html('<b>'+m3+'</b>');
                                    $("#m4").html('<b>'+m4+'</b>');
                                    $("#m5").html('<b>'+m5+'</b>');
                                    $("#m6").html('<b>'+m6+'</b>');
                                    $("#startmonth").val(1);
                                    $("#startmonth2").val(Number(year)+1);
                                  $.post("date_intermediate_employee.php",{mon:"01",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate_employee.php",{tar_mon:"01",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate_employee.php",{per_mon:"01",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                 $.post("date_intermediate_employee.php",{pending_mon:"01",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                   
                                }
                                
                            }
                        </script>
                        <?php
                        $mm=date('m');
                        $yy=date('Y');
                        if($mm<7){
                            $Q11="Q1 ".$yy;
                            $Q12="Q2 ".$yy;
                            $Q13="Q3 ".$yy;
                            $Q14="Q4 ".$yy;
                            $Q15="Q1 ".($yy+1);
                            $Q16="Q2 ".($yy+1);
                        }else{
                            $Q11="Q3 ".$yy;
                            $Q12="Q4 ".$yy;
                            $Q13="Q1 ".($yy+1);
                            $Q14="Q2 ".($yy+1);
                            $Q15="Q3 ".($yy+1);
                            $Q16="Q4 ".($yy+1);
                        }
                        ?>
                        <div class="col-sm-9" id="quarterlyshow" style="display:none;">
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <button id="q1" class="btn btn-default pull-right" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q11;?></b></button>
                                <button class="btn btn-primary pull-left" onclick="perviewsqrecord();" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-left"></i></button>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="q2" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q12?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="q3" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q13;?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="q4" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q14;?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="q5" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q15;?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;">
                                <center><button id="q6" class="btn btn-default pull-left" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $Q16;?></b></button></center>
                                <button  class="btn btn-primary pull-right" onclick="nextqrecord();" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-right"></i></button>
                            </div>
                        </div>
                        <script>
                            function perviewsqrecord(){
                                var mm=$("#startQmonth").val();
                                var yy=$("#startQyear").val();
                                if(mm==1){
                                    var q1="Q3 "+Number(yy-2);
                                    var q2="Q4 "+Number(yy-2);
                                    var q3="Q1 "+Number(yy-1);
                                    var q4="Q2 "+Number(yy-1);
                                    var q5="Q3 "+Number(yy-1);
                                    var q6="Q4 "+Number(yy-1);
                                    $("#q1").html("<b>"+q1+"</b>");
                                    $("#q2").html("<b>"+q2+"</b>");
                                    $("#q3").html("<b>"+q3+"</b>");
                                    $("#q4").html("<b>"+q4+"</b>");
                                    $("#q5").html("<b>"+q5+"</b>");
                                    $("#q6").html("<b>"+q6+"</b>");
                                    $("#startQmonth").val(2);
                                    $("#startQyear").val(Number(yy-2));
                                    $("#endQmonth").val(1);
                                    $("#endQyear").val(Number(yy-1));
                                }else{
                                    var q1="Q1 "+Number(yy-1);
                                    var q2="Q2 "+Number(yy-1);
                                    var q3="Q3 "+Number(yy-1);
                                    var q4="Q4 "+Number(yy-1);
                                    var q5="Q1 "+(Number(yy));
                                    var q6="Q2 "+(Number(yy));
                                    $("#q1").html("<b>"+q1+"</b>");
                                    $("#q2").html("<b>"+q2+"</b>");
                                    $("#q3").html("<b>"+q3+"</b>");
                                    $("#q4").html("<b>"+q4+"</b>");
                                    $("#q5").html("<b>"+q5+"</b>");
                                    $("#q6").html("<b>"+q6+"</b>");
                                    $("#startQmonth").val(1);
                                    $("#startQyear").val(Number(yy-1));
                                    $("#endQmonth").val(2);
                                    $("#endQyear").val(Number(yy));
                                }
                            }
                            
                            function nextqrecord(){
                                var mm=$("#endQmonth").val();
                                var yy=$("#endQyear").val();
                                if(mm==2){
                                    var q1="Q3 "+(Number(yy));
                                    var q2="Q4 "+(Number(yy));
                                    var q3="Q1 "+(Number(yy)+Number(1));
                                    var q4="Q2 "+(Number(yy)+Number(1));
                                    var q5="Q3 "+(Number(yy)+Number(1));
                                    var q6="Q4 "+(Number(yy)+Number(1));
                                    $("#q1").html("<b>"+q1+"</b>");
                                    $("#q2").html("<b>"+q2+"</b>");
                                    $("#q3").html("<b>"+q3+"</b>");
                                    $("#q4").html("<b>"+q4+"</b>");
                                    $("#q5").html("<b>"+q5+"</b>");
                                    $("#q6").html("<b>"+q6+"</b>");
                                    $("#startQmonth").val(2);
                                    $("#startQyear").val(Number(yy));
                                    $("#endQmonth").val(1);
                                    $("#endQyear").val((Number(yy)+Number(1)));
                                }else{
                                    var q1="Q1 "+(Number(yy)+Number(1));
                                    var q2="Q2 "+(Number(yy)+Number(1));
                                    var q3="Q3 "+(Number(yy)+Number(1));
                                    var q4="Q4 "+(Number(yy)+Number(1));
                                    var q5="Q1 "+(Number(yy)+Number(2));
                                    var q6="Q2 "+(Number(yy)+Number(2));
                                    $("#q1").html("<b>"+q1+"</b>");
                                    $("#q2").html("<b>"+q2+"</b>");
                                    $("#q3").html("<b>"+q3+"</b>");
                                    $("#q4").html("<b>"+q4+"</b>");
                                    $("#q5").html("<b>"+q5+"</b>");
                                    $("#q6").html("<b>"+q6+"</b>");
                                    $("#startQmonth").val(1);
                                    $("#startQyear").val((Number(yy)+Number(1)));
                                    $("#endQmonth").val(2);
                                    $("#endQyear").val((Number(yy)+Number(2)));
                                }
                            }
                        </script>
                        <div class="col-sm-9" id="yearlyshow" style="display:none;" >
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <button id="y1" class="btn btn-default pull-right" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y', strtotime('-1 years'));?></b></button>
                                <button class="btn btn-primary pull-left" onclick="perviewsrecordyear()" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-left"></i></button>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="y2" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y');?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="y3" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y', strtotime('1 years'));?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="y4" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y', strtotime('2 years'));?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;border-right:1px solid #D5D5D5;">
                                <center><button id="y5" class="btn btn-default" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y', strtotime('3 years'));?></b></button></center>
                            </div>
                            <div class="col-sm-2" style="padding:5px 0px;">
                                <center><button id="y6" class="btn btn-default pull-left" style="display:inline;padding:5px;border:none;background-color:#f6f6f6;"><b><?php echo $prevmonth = date('Y', strtotime('4 years'));?></b></button></center>
                                <button  class="btn btn-primary pull-right" onclick="nextrecordyear()" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-right"></i></button>
                            </div>
                        </div>
                    </div>
                    <script>
                        function perviewsrecordyear(){
                            var year=$("#startyear").val();
                            //alert(year);
                            var y1=Number(year-6);
                            var y2=Number(year-5);
                            var y3=Number(year-4);
                            var y4=Number(year-3);
                            var y5=Number(year-2);
                            var y6=Number(year-1);
                            $("#y1").html("<b>"+y1+"</b>");
                            $("#y2").html("<b>"+y2+"</b>");
                            $("#y3").html("<b>"+y3+"</b>");
                            $("#y4").html("<b>"+y4+"</b>");
                            $("#y5").html("<b>"+y5+"</b>");
                            $("#y6").html("<b>"+y6+"</b>");
                            $("#startyear").val(Number(year-6));
                            $("#endyear").val(Number(year-1));
                        }
                        function nextrecordyear(){
                            var year=Number($("#endyear").val());
                            //alert(year);
                            var y1=Number(year)+Number(1);
                            var y2=Number(year)+Number(2);
                            var y3=Number(year)+Number(3);
                            var y4=Number(year)+Number(4);
                            var y5=Number(year)+Number(5);
                            var y6=Number(year)+Number(6);
                            $("#y1").html("<b>"+y1+"</b>");
                            $("#y2").html("<b>"+y2+"</b>");
                            $("#y3").html("<b>"+y3+"</b>");
                            $("#y4").html("<b>"+y4+"</b>");
                            $("#y5").html("<b>"+y5+"</b>");
                            $("#y6").html("<b>"+y6+"</b>");
                            $("#startyear").val(Number(year+1));
                            $("#endyear").val(Number(year+6));
                        }
                    </script>
                    <input type="hidden" id="startmonth" name="startmonth" value="<?php echo date('m');?>">
                    <input type="hidden" id="startmonth1" name="startmonth1" value="<?php echo date('Y');?>">
                    <input type="hidden" id="startmonth2" name="startmonth2" value="<?php echo date('Y');?>">
                    
                    <input type="hidden" id="startQmonth" name="startQmonth" value="<?php if(date('m')<7){ echo 1; }else{ echo 2;} ?>">
                    <input type="hidden" id="startQyear" name="startQyear" value="<?php echo date('Y');?>">
                    
                    <input type="hidden" id="endQmonth" name="endQmonth" value="<?php if(date('m')<7){ echo 2; }else{ echo 1;} ?>">
                    <input type="hidden" id="endQyear" name="endQyear" value="<?php echo date('Y', strtotime('1 years'));?>">
                    
                    <input type="hidden" id="startyear" name="startyear" value="<?php echo $prevmonth = date('Y', strtotime('-1 years'));?>">
                    <input type="hidden" id="endyear" name="endyear" value="<?php echo $prevmonth = date('Y', strtotime('4 years'));?>">
                    
                </div>
                
                <br>
                
                <div style="padding:3px 0px;">
                    <div class="row" style="height:50px;">
                        <div class="col-md-3" style="background-color:#f6f6f6;">
                            <center><span id="pipeline2">
                                <span class="dropdown">
                                    <span class="dropdown-toggle" data-toggle="dropdown">
                                    <span class="col-xs-10"><b><span style="font-size:16px;"><center>Expected Total</center></span> </b><br><span style="font-size:12px;">Won + Pending</span></span>
                                    <span class="col-xs-2" style="padding-top:10px;"> <span class="caret"></span></span></span> 
                                    <ul class="dropdown-menu">
                                        <li><a>Total Won</a></li>
                                        <li><a>Expected(Won + Pending)</a></li>
                                    </ul>
                                </span>
                            </span></center>
                        </div>
                        <div class="col-md-9" id="exe_result" style="height:50px;">
 <?php
$mon=date('m');
$year=date('Y');
$month=$year."-".$mon."-01";
?>                            <?php
                                $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $mon);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                             <?php
                             $year= date('Y', strtotime($month .'+1 months'));    
                           $months= date('m', strtotime($month .'+1 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                    
                              <?php
                                $year= date('Y', strtotime($month .'+2 months'));    
                                $months= date('m', strtotime($month .'+2 months'));
                                $year=date('Y');
                                $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                 <?php
                            $year= date('Y', strtotime($month .'+3 months'));             
                           $months= date('m', strtotime($month .'+3 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                    
                             <?php
                            $year= date('Y', strtotime($month .'+4 months'));         
                           $months= date('m', strtotime($month .'+4 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                            
                             <?php
                            $year= date('Y', strtotime($month .'+5 months'));    
                           $months= date('m', strtotime($month .'+5 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div>         
                        </div>
                    </div>
                </div>
                
                <?php
                $year=date('Y');
                $months=date('m');
                $month=$year."-".$months."-01";
                ?>
                <div style="padding:3px 0px;">
                    <div class="row" style="height:40px;">
                        <div class="col-md-3" style="background-color:#f6f6f6;">
                            <center>
                                <span id="pipeline3">
                                    <!--<span class="col-xs-6"><b>Target</b></span>
                                    <span class="col-xs-6">
                                        <span class="pull-right" data-toggle="modal" data-target="#myModal_view_set_target" onclick="show_pipeline_set_target('<?php echo $companyname;?>','<?php echo $month;?>','<?php echo $year;?>')" style="font-size:12px;padding-top:5px;cursor:pointer;">Edit</span>
                                    </span>-->
                                    <b>Target</b>
                                </span>
                            </center>
                        </div>
                        <div class="col-md-9" style="height:40px;"  id="monthly_target_response">
                            
                            <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y');
                                    $month=date('m');
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                            
                            <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+1 month'));
                            $months= date('m', strtotime($month.'+1 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+2 month'));
                            $months= date('m', strtotime($month.'+2 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+3 month'));
                            $months= date('m', strtotime($month.'+3 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+4 month'));
                            $months= date('m', strtotime($month.'+4 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+5 month'));
                            $months= date('m', strtotime($month.'+5 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                        </div>
                    </div>
                </div>
                
               
                <br>

<div style="padding:3px 0px;" id="per_result">
<?php //$pipe_percentage $pipe_name
for($i1=0;$i1<count($pipe_percentage);$i1++){
        $j=100-($i1*10)."%";
        $stage=$pipe_id[$i1];
        $percentage=$pipe_percentage[$i1];
        $p_name=$pipe_name[$i1];
?>
                <div style="padding:3px 0px;">
                    <div class="row" style="height:40px;">
                        <div class="col-md-3" style="background-color:#f6f6f6;">
                            <center><span id="pipeline1" style="width:<?php echo $j;?>"><span ><?php echo $percentage;?><br><span style="font-size:12px;"><?php echo $p_name;?></span></span></span></center>
                        </div>
                        <div class="col-md-9" style="height:40px;">
<?php
$mon=date('m');
$year=date('Y');
$month=$year."-".$mon."-01";
?>                              
                            <?php
                                    $i= date('m');
                                    $year= date('Y');
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                                
                             <?php
                                    $i= date('m', strtotime($month .'+1 months'));
                                    $year= date('Y', strtotime($month .'+1 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                                
                            <?php
                                    $i= date('m', strtotime($month .'+2 months'));
                                    $year= date('Y', strtotime($month .'+2 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+3 months'));
                                    $year= date('Y', strtotime($month .'+3 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+4 months'));
                                    $year= date('Y', strtotime($month .'+4 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+5 months'));
                                    $year= date('Y', strtotime($month .'+5 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                           
                        </div>
                    </div>
                </div>
                
<?php
}
?>
</div>
                <br>
                
                
                <div style="padding:3px 0px;">
                    <div class="row" style="height:40px;">
                        <div class="col-md-3" style="background-color:#db1b56;border-radius:5px;">
                            <center><span id="pipeline1"><b>Total pending</b></span></center>
                        </div>
                        <div class="col-md-9" id="pending_tot" style="height:40px;">
<?php
$mon=date('m');
$year=date('Y');
$month=$year."-".$mon."-01";
?>                               
                            <?php
                            
                                      $i= date('m');
                                      $year= date('Y');
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                            <?php
                            
                                      $i= date('m', strtotime($month .'+1 months'));
                                      $year= date('Y', strtotime($month .'+1 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                            <?php
                                        $i= date('m', strtotime($month .'+2 months'));
                                      $year= date('Y', strtotime($month .'+2 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                             <?php
                            
                                      $i= date('m', strtotime($month .'+3 months'));
                                      $year= date('Y', strtotime($month .'+3 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                                
                            
                            <?php
                            
                                      $i= date('m', strtotime($month .'+4 months'));
                                      $year= date('Y', strtotime($month .'+4 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                                
                            <?php
                            
                                      $i= date('m', strtotime($month .'+5 months'));
                                      $year= date('Y', strtotime($month .'+5 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    $totaldealwon1=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                           
                        </div>
                    </div>
                </div>
                
                
            </div>
            
        </div>
        
        <script>
            function show_pipeline_deal_stage_month(companyname, month, year, stage){
                //alert(month);
                $.ajax({
                   url:"pipeline_total_month_stage_data.php",
                   data:{companyname:companyname, month:month, year:year, stage:stage},
                   type:"post",
                   success:function(respond){
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
        </script>
        
        <script>
            function show_pipeline_total_deal_month(companyname, month, year){
                //alert(month);
                $.ajax({
                   url:"pipeline_total_month_data.php",
                   data:{companyname:companyname, month:month, year:year},
                   type:"post",
                   success:function(respond){
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
        </script>
	<!-- Modal -->
	<div class="modal right fade" id="myModal_view_pipeline_deal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2">
		<div class="modal-dialog" role="document">
			<div class="modal-content">


				<div class="modal-body">
					<button type="button" class="close pull-left" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel2"><center>Deal</center></h4>
					<span id="show_pipe_deal"></span>
				</div>

			</div><!-- modal-content -->
		</div><!-- modal-dialog -->
	</div><!-- modal -->
	<!-- Modal -->
	
                
                <script>
                    function show_pipeline_set_target(companyname, year, month){
                        //alert("companyname:"+companyname);
                        var empid=new Array();
                        empid=<?php echo json_encode($emp_emailid_a);?>;
                        /*alert("empid:"+empid.length);
                        alert("year:"+year);
                        alert("month:"+month);*/
                        $.ajax({
                           url:"pipeline_employee_traget_data.php",
                           data:{companyname:companyname, empid:empid, month:month, year:year},
                           type:"post",
                           success:function(respond){
                               $("#show_target_view").html(respond);
                           }
                        });
                    }
                </script>
	<div class="modal right fade" id="myModal_view_set_target" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2">
		<div class="modal-dialog" role="document">
			<div class="modal-content">


				<div class="modal-body">
					<button type="button" class="close pull-left" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel2"><center>Edit Employee Target</center></h4>
					<span id="show_target_view"></span>
				</div>

			</div><!-- modal-content -->
		</div><!-- modal-dialog -->
	</div><!-- modal -->
        
        <script>
            $(document).ready(function(){
                var s="";
                $.ajax({
                   url:"pipeline_data.php",
                   data:{s:s},
                   type:"post",
                   success:function(respond){
                       $("#pipelinedeallistview").html(respond);
                   }
                });
               
            });
        </script>
        <div style="background-color:#ffffff;padding:10px 100px">
            
            <div style="background-color:#f6f6f6;">
                <br>
                <span style="padding:0px 5px;font-size:20px;"><b>DEAL LIST</b></span><br>
                <div id="pipelinedeallistview"></div> 
                
            </div>
            
            
        </div>
    </body>
    
</html>
<?php
}else{
echo "<script> location.replace('http://fieldcloud.in/Login.php') </script>";
}?>