<?php
session_start();
$companyname=$_SESSION['companyname'];//;
$adminemailid=$_SESSION['emailid'];//;
$companytype=$_SESSION['companytype'];

$employeetype=$_SESSION['employeetype'];
//if(($adminemailid !="")&&($companyname!="")){
require_once('../Control/sales.php');
$objsales=new salesctrl();
require_once('../Control/pipeline.php');
$objpipeline=new pipelinectrl();
$pipelinetype_res=$objsales->salesselectall($companyname, $adminemailid, "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");
$email_array=[];
$employeename_array=[];

$j=0;
foreach($emp_res as $emp_row){
 $emp_emailid_a[$j++]=$emp_row['emailid'];  
 $emp_employeename[$j++]=$emp_row['employeename'];
  array_push($email_array,$emp_row['emailid']);
    array_push($employeename_array,$emp_row['employeename']);
}
$emp_count= count($emp_emailid_a);

?>
<?php

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


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

?>

<!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>
    .row{
        margin:0px;
        padding:0px;
    }
::-webkit-scrollbar {
    width: .1em;
    height: .1em
}
</style>
   
<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;">
        <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" style="color:white;" href="dashboard.php">Action Stream</a>
                    </li>
                    <li>
                        <a class="page-scroll pull-left" href="dashboard_contact.php">Contact</a>
                    </li>
                    <li class="sales">
                        <a style="top:5px;" href="pipeline_view.php">Pipeline</a>
                    </li>
                    <li class="activity">
                        <a style="top:5px;"  href="activity_all.php">Activity</a>
                    </li>
                    
                    <?php if($employeetype=="admin") {?>
                    <li class="user">
                        <a style="top:5px;"  href="user_dashboard.php">User</a>
                    </li>
                    <?php } ?>
                    
                    <li>
                    <a href="logout.php">Logout</a>
                    </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(){
        var id= <?php echo json_encode($pipe_id); ?>;
        var name= <?php echo json_encode($pipe_name); ?>;
         var percentage=<?php echo json_encode($pipe_percentage); ?>;
        var id1=($('#pipe_id1').val());
        var per1=($('#pipe_stage1').val());
        var pername1=($('#pipe_name1').val());
       if((name[0]!=pername1) ||  (percentage[0]!=per1)){
           $.post("pipeline_edit_stages.php",{idno:id1,percentage:per1,name:pername1},function testing(data){
               
           });
       }  
        var id2=($('#pipe_id2').val());
        var per2=($('#pipe_stage2').val());
        var pername2=($('#pipe_name2').val());
       if((name[1]!=pername2) ||  (percentage[1]!=per2)){
           $.post("pipeline_edit_stages.php",{idno:id2,percentage:per2,name:pername2},function testing(data){
               
           });
       }
      
         var id3=($('#pipe_id3').val());
        var per3=($('#pipe_stage3').val());
        var pername3=($('#pipe_name3').val());
       if((name[2]!=pername3) ||  (percentage[2]!=per3)){
           $.post("pipeline_edit_stages.php",{idno:id3,percentage:per3,name:pername3},function testing(data){
               
           });
       }
       
        var id4=($('#pipe_id4').val());
        var per4=($('#pipe_stage4').val());
        var pername4=($('#pipe_name4').val());
       if((name[3]!=pername4) ||  (percentage[3]!=per4)){
           $.post("pipeline_edit_stages.php",{idno:id4,percentage:per4,name:pername4},function testing(data){
               
           });
       }
       
       var id5=($('#pipe_id5').val());
        var per5=($('#pipe_stage5').val());
        var pername5=($('#pipe_name5').val());
       if((name[4]!=pername5) ||  (percentage[4]!=per5)){
           $.post("pipeline_edit_stages.php",{idno:id5,percentage:per5,name:pername5},function testing(data){
               
           });
       }
       
        var id6=($('#pipe_id6').val());
        var per6=($('#pipe_stage6').val());
        var pername6=($('#pipe_name6').val());
    if(id6!=""){  
       if((name[5]!=pername6) ||  (percentage[5]!=per6)){
           $.post("pipeline_edit_stages.php",{idno:id6,percentage:per6,name:pername6},function testing(data){
               
           });
       }
       
    }
    if((id6=="") && (per6!="") && (pername6!="") ){
        $.post("pipeline_edit_stages.php",{percentage_insert:per6,name_insert:pername6},function testing(data){
               
           });
    }
    
        var id7=($('#pipe_id7').val());
        var per7=($('#pipe_stage7').val());
        var pername7=($('#pipe_name7').val());
       if(id7!=""){ 
       if((name[6]!=pername7) ||  (percentage[6]!=per7)){
           $.post("pipeline_edit_stages.php",{idno:id7,percentage:per7,name:pername7},function testing(data){
               
           });
       }
       }
        if((id7=="") && (per7!="") && (pername7!="") ){
        $.post("pipeline_edit_stages.php",{percentage_insert:per7,name_insert:pername7},function testing(data){
               
           });
    }
       
       window.location="pipeline_view.php";
    }
</script>
<script>
            function fetch_pipeline_employee(){
                
                var mailid=$('#emp_email').val();
                if(mailid=='all'){
                    window.location.reload();
                }
                /*var mail="<?php echo $adminemailid;?>";
                if(mailid==mail){
                    window.location.reload();
                }*/
                else{
                $.post("fetch_employee_pipeline_view.php",{employee_emailid:mailid},function myemployee(data){
                   
                   $('#show_emp_filter').html(data);
                });
                }
            }
        </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="col-md-3 col-sm-3">
                
                <select class="form-control" onchange="fetch_pipeline_employee()" id="emp_email">
                    <option value="all" selected>All Team Members</option>
                     <?php 
                   foreach($email_array as $a=>$b){ ?>
                   
                   <option  value="<?php echo $email_array[$a]?>"><?php if($email_array[$a]==$adminemailid){echo "me($employeename_array[$a])"; } else { echo $employeename_array[$a];}?></option>
                   <?php
                   }
                 ?>    
                </select>
            </span>
            <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>
            $(document).ready(function(){
               
                 $('#monthly_view').show();
                $('#yearly_view').hide();
                 $('#quartely_view').hide();
                
            });
        </script>
        <script>
            function funcshowrecord1(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $('#monthly_view').show();
                $('#yearly_view').hide();
                  $('#quartely_view').hide();
                $("#btnm1").addClass("active");
                $("#btnm2").removeClass("active");
                $("#btnm3").removeClass("active");
                
            }
            
            function funcshowrecord2(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $('#monthly_view').hide();
                $('#yearly_view').hide();
                  $('#quartely_view').show();
                $("#btnm2").addClass("active");
                $("#btnm1").removeClass("active");
                $("#btnm3").removeClass("active");
                
            }
            
            function funcshowrecord3(id1, id2, id3){
                $(id1).show();
                $(id2).hide();
                $(id3).hide();
                $('#monthly_view').hide();
                $('#yearly_view').show();
                  $('#quartely_view').hide();
                $("#btnm3").addClass("active");
                $("#btnm2").removeClass("active");
                $("#btnm1").removeClass("active");
                
            }
        </script>
        <div style="background-color:#f6f6f6">
            
            <div class="summary" style="padding: 20px 100px ;" id="show_emp_filter">
                
                
                <div style="border:1px solid #D5D5D5;padding:5px;">  
                    <div class="row">
                        <div class="col-sm-3"style="padding-top:5px;">
                            <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 $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>
                            <input type="hidden" id="condition_button" value="123"/>
                        <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 con_but=$('#condition_button').val();
                                    if(con_but!="next"){
                                    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.php",{mon:"12",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{tar_mon:"12",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"12",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{pending_mon:"12",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    }
                                    else{
                                       var m1='Dec '+(Number(year)-1);
                                    var m2='Jan '+(Number(year));
                                    var m3='Feb '+(Number(year));
                                    var m4='Mar '+(Number(year));
                                    var m5='Apr '+(Number(year));
                                    var m6='May '+(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(12);
                                    $("#startmonth2").val(Number(year)-1);
                                    $.post("date_intermediate.php",{mon:"12",yea:(Number(year)-1)},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{tar_mon:"12",tar_yea:(Number(year)-1)},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"12",per_yea:(Number(year)-1)},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{pending_mon:"12",pending_yea:(Number(year)-1)},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.php",{mon:"01",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{tar_mon:"01",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"01",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"02",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"02",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"02",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"03",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"03",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"03",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"04",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"04",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"04",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"05",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"05",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"05",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.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.php",{mon:"06",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"06",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"06",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"07",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"07",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"07",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"08",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"08",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"08",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"09",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"09",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"09",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"10",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"10",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"10",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"11",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"11",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"11",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{pending_mon:"11",pending_yea:(Number(year))},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    
                                }
                                  $('#condition_button').val('previous');
                            }
                        </script>
                        <script>
                            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 con_but=$('#condition_button').val();
                                    if(con_but=="previous"){
                                        
                                    var m1='Feb '+(Number(year)+1);
                                    var m2='Mar '+(Number(year)+1);
                                    var m3='Apr '+(Number(year)+1);
                                    var m4='May '+(Number(year)+1);
                                    var m5='Jun '+(Number(year)+1);
                                    var m6='Jul '+(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(2);
                                    $("#startmonth2").val(Number(year)+1);
                                    $.post("date_intermediate.php",{mon:"02",yea:(Number(year)+1)},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"02",tar_yea:(Number(year)+1)},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"02",per_yea:(Number(year)+1)},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.php",{pending_mon:"02",pending_yea:(Number(year)+1)},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                    }
                                    else{
                                    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.php",{mon:"02",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"02",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"02",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"03",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"03",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"03",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"04",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"04",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"04",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.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.php",{mon:"05",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"05",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"05",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"06",yea:year},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"06",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                     $.post("date_intermediate.php",{per_mon:"06",per_yea:year},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"07",yea:year},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"07",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"07",per_yea:year},function test1(data){
                                      $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"08",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"08",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"08",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                    $.post("date_intermediate.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.php",{mon:"09",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"09",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"09",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate.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.php",{mon:"10",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"10",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"10",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate.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.php",{mon:"11",yea:(Number(year))},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"11",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"11",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate.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.php",{mon:"12",yea:(Number(year))},function test(data){
                                        
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"12",tar_yea:(Number(year))},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"12",per_yea:(Number(year))},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                     $.post("date_intermediate.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.php",{mon:"01",yea:(Number(year)+1)},function test(data){
                                       
                                        $('#exe_result').html(data);
                                    });
                                    
                                    $.post("date_intermediate.php",{tar_mon:"01",tar_yea:(Number(year)+1)},function test(data){
                                        
                                        $('#monthly_target_response').html(data);
                                    });
                                    $.post("date_intermediate.php",{per_mon:"01",per_yea:(Number(year)+1)},function test1(data){
                                       
                                        $('#per_result').html(data);
                                    });
                                 $.post("date_intermediate.php",{pending_mon:"01",pending_yea:(Number(year)+1)},function test2(data){
                                       
                                        $('#pending_tot').html(data);
                                    });
                                   
                                }
                                $('#condition_button').val('next');
                            }
                            
                        </script>
                        </div>
                       
                        <?php
                        $mm=date('m');
                        $yy=date('Y');
                        if($mm<=3){
                             $Q11="Q1 ".$yy;
                            $Q12="Q2 ".$yy;
                            $Q13="Q3 ".$yy;
                            $Q14="Q4 ".$yy;
                            $Q15="Q1 ".($yy+1);
                            $Q16="Q2 ".($yy+1);
                        }
                        if($mm>=4 && $mm <=6){
                            $Q11="Q2 ".$yy;
                            $Q12="Q3 ".$yy;
                            $Q13="Q4 ".$yy;
                            $Q14="Q1 ".($yy+1);
                            $Q15="Q2 ".($yy+1);
                            $Q16="Q3 ".($yy+1);
                        }if($mm>=7 && $mm <=9){
                            $Q11="Q3 ".$yy;
                            $Q12="Q4 ".$yy;
                            $Q13="Q1 ".($yy+1);
                            $Q14="Q2 ".($yy+1);
                            $Q15="Q3 ".($yy+1);
                            $Q16="Q4 ".($yy+1);
                        }if($mm>=10 && $mm <=12){
                            $Q11="Q4 ".$yy;
                            $Q12="Q1 ".($yy+1);
                            $Q13="Q2 ".($yy+1);
                            $Q14="Q3 ".($yy+1);
                            $Q15="Q4 ".($yy+1);
                            $Q16="Q1 ".($yy+2);
                        }
                        ?>
                        <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="myprevquart();" 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="mynextquart();" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-right"></i></button>
                            </div>
                        <script>
                            function myprevquart(){
                               var month=$('#mymonth1').val();
                                var year=$('#myyear1').val();
                                var month=parseInt(month)-2;
                                if((month<=3)){
                                    var q1="Q1 "+year;
                                    var q2="Q2 "+year;
                                    var q3="Q3 "+year;
                                    var q4="Q4 "+year;
                                    var q5="Q1 "+(parseInt(year)+1);
                                    var q6="Q2 "+(parseInt(year)+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>");
                                    $('#mymonth').val(12);
                                     $('#mymonth1').val(12);
                                     $('#myyear1').val(parseInt(year)-1);
                                      $('#myyear').val(parseInt(year)-1);
                                       $.post("date_intermediate.php",{total_mon:month,total_year:(Number(year))},function test1(data){
                                       $("#quartely_exe_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                                if((month>=4) && (month<=6) ){
                                    var q1="Q2 "+year;
                                    var q2="Q3 "+year;
                                    var q3="Q4 "+year;
                                    var q4="Q1 "+(parseInt(year)+1);
                                    var q5="Q2 "+(parseInt(year)+1);
                                    var q6="Q3 "+(parseInt(year)+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>");
                                    $('#mymonth').val(month);
                                     $('#mymonth1').val(month);
                                     $('#myyear1').val(parseInt(year));
                                      $.post("date_intermediate.php",{total_mon:month,total_year:(Number(year))},function test1(data){
                                       $("#quartely_exe_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                                if((month>=7) && (month<=9) ){
                                    var q1="Q3 "+year;
                                    var q2="Q4 "+year;
                                    var q3="Q1 "+(parseInt(year)+1);
                                    var q4="Q2 "+(parseInt(year)+1);
                                    var q5="Q3 "+(parseInt(year)+1);
                                    var q6="Q4 "+(parseInt(year)+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>");
                                    $('#mymonth').val(month);
                                     $('#mymonth1').val(month);
                                     $('#myyear1').val(parseInt(year));
                                      $.post("date_intermediate.php",{total_mon:month,total_year:(Number(year))},function test1(data){
                                       $("#quartely_exe_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                                if((month>=10) && (month<=12) ){
                                    var q1="Q4 "+year;
                                    var q2="Q1 "+(parseInt(year)+1);
                                    var q3="Q2 "+(parseInt(year)+1);
                                    var q4="Q3 "+(parseInt(year)+1);
                                    var q5="Q4 "+(parseInt(year)+1);
                                    var q6="Q1 "+(parseInt(year)+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>");
                                   $('#mymonth').val(month);
                                    $('#mymonth1').val(month);
                                    $('#myyear1').val(parseInt(year));
                                     $.post("date_intermediate.php",{total_mon:month,total_year:(Number(year))},function test1(data){
                                       $("#quartely_exe_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                            }
                        </script>
                         <script>
                            function mynextquart(){
                                var month=$('#mymonth').val();
                                var year=$('#myyear').val();
                                var month=parseInt(month)+3;
                                //alert(month);
                                if((month<=3)){
                                    var q1="Q1 "+year;
                                    var q2="Q2 "+year;
                                    var q3="Q3 "+year;
                                    var q4="Q4 "+year;
                                    var q5="Q1 "+(parseInt(year)+1);
                                    var q6="Q2 "+(parseInt(year)+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>");
                                    $('#mymonth').val(month);
                                      $('#mymonth1').val(month);
                                    $('#myyear').val(parseInt(year));
                                    $.post("date_intermediate.php",{total_mon:month,total_year:year},function test1(data){
                                        $("#quartely_exe_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                     $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                    
                                    
                                }
                                if((month>=4) && (month<=6) ){
                                    var q1="Q2 "+year;
                                    var q2="Q3 "+year;
                                    var q3="Q4 "+year;
                                    var q4="Q1 "+(parseInt(year)+1);
                                    var q5="Q2 "+(parseInt(year)+1);
                                    var q6="Q3 "+(parseInt(year)+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>");
                                    $('#mymonth').val(month);
                                    $('#mymonth1').val(month);
                                    $('#myyear').val(parseInt(year));
                                     $.post("date_intermediate.php",{total_mon:month,total_year:year},function test1(data){
                                        $("#quartely_exe_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                                if((month>=7) && (month<=9) ){
                                    var q1="Q3 "+year;
                                    var q2="Q4 "+year;
                                    var q3="Q1 "+(parseInt(year)+1);
                                    var q4="Q2 "+(parseInt(year)+1);
                                    var q5="Q3 "+(parseInt(year)+1);
                                    var q6="Q4 "+(parseInt(year)+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>");
                                    $('#mymonth').val(month);
                                    $('#mymonth1').val(month);
                                    $('#myyear').val(parseInt(year));
                                     $.post("date_intermediate.php",{total_mon:month,total_year:year},function test1(data){
                                        $("#quartely_exe_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                                if((month>=10) && (month<=13) ){
                                    var q1="Q4 "+year;
                                    var q2="Q1 "+(parseInt(year)+1);
                                    var q3="Q2 "+(parseInt(year)+1);
                                    var q4="Q3 "+(parseInt(year)+1);
                                    var q5="Q4 "+(parseInt(year)+1);
                                    var q6="Q1 "+(parseInt(year)+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>");
                                    $('#mymonth').val(0);
                                    $('#mymonth1').val(10);
                                     $('#myyear1').val(parseInt(year));
                                    $('#myyear').val(parseInt(year)+1);
                                     $.post("date_intermediate.php",{total_mon:month,total_year:(Number(year))},function test1(data){
                                       $("#quartely_exe_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{stage_mon:month,stage_year:(Number(year))},function test1(data){
                                       $("#per_quartely_result").html(data);
                                    });
                                    $.post("date_intermediate.php",{pen_mon:month,pen_year:(Number(year))},function test1(data){
                                       $("#pending_tot_quartely").html(data);
                                    });
                                }
                            }
                        </script>
                       
                        </div>
                        
                        <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 date('Y');?></b></button>
                                <button class="btn btn-primary pull-left" onclick="mypreviousyear()" 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 date('Y',strtotime('+1 year'));?></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 date('Y',strtotime('+2 year'));?></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 date('Y',strtotime('+3 year'));?></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 date('Y',strtotime('+4 year'));?></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 date('Y',strtotime('+5 year'));?></b></button></center>
                                <button  class="btn btn-primary pull-right" onclick="mynextyear()" style="display:inline;padding:5px;"><i class="glyphicon glyphicon-triangle-right"></i></button>
                            </div>
                            
                             <script>
                        function mynextyear(){
                            var year=$('#myyear').val();
                             var y1=parseInt(year)+1;
                            var y2=parseInt(year)+2;
                            var y3=parseInt(year)+3;
                            var y4=parseInt(year)+4;
                            var y5=parseInt(year)+5;
                            var y6=parseInt(year)+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>");
                            $('#myyear').val(y1);
                            $.post("date_intermediate.php",{expected_yea:y1},function test(data){
                                    $('#yearly_exe_result').html(data);
                                });
                             $.post("date_intermediate.php",{per_result_yearly:y1},function test1(data){
                                    $('#per_yearly_result').html(data);
                                });
                              $.post("date_intermediate.php",{pending_result_yearly:y1},function test2(data){
                                 
                                    $('#pending_tot_yearly').html(data);
                                });
                            
                        }
                        
                        function mypreviousyear(){
                            var year=$('#myyear').val();
                            var y1=parseInt(year)-1;
                            var y2=year;
                            var y3=parseInt(year)+1;
                            var y4=parseInt(year)+2;
                            var y5=parseInt(year)+3;
                            var y6=parseInt(year)+4;
                             $("#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>");
                             $('#myyear').val(y1);
                              $.post("date_intermediate.php",{expected_yea:y1},function test(data){
                                    $('#yearly_exe_result').html(data);
                                });
                            $.post("date_intermediate.php",{per_result_yearly:y1},function test1(data){
                                    $('#per_yearly_result').html(data);
                                });
                            $.post("date_intermediate.php",{pending_result_yearly:y1},function test2(data){
                               
                                    $('#pending_tot_yearly').html(data);
                                });
                                
                        }
                    </script>
                               
                        </div>
                    </div>
                   
                   <script>
                       function fetch_won(){
                           var value1=$('#m1').text().replace(/\s/g,'');  
                           var value=$.trim(value1);
                   //alert(value);
                           $.post("date_intermediate.php",{expected_won:value},function myresult(data){
                              $('#mycontent').html('Total Won');
                               $('#exe_result').html(data);
                           });
                       }
                       
                       function fetch_won_expected(){
                          var value=$('#m1').text().replace(/\s/g,'');  
                           $.post("date_intermediate.php",{expected_won_pending:value},function myresult(data1){
                              $('#mycontent').html('Won+Pending');
                               $('#exe_result').html(data1);
                           }); 
                       }
                   </script>
                    
                    
                </div>
                <!--monthly view-->
                <div class="row" id="monthly_view">
                <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 id="mycontent" 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 onclick="fetch_won()"><a>Total Won</a></li>
                                        <li onclick="fetch_won_expected()"><a>Expected(Won + Pending)</a></li>
                                    </ul>
                                </span>
                            </span></center>
                        </div>
                        <div class="col-md-9" id="exe_result" style="height:50px;">
                            <?php
                            
                             $month= $mon;
                              $year=$yea;
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$month,$year);
                                $percentage=$objpipeline->salespipelinestage_total($companyname,$month,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                $myresult=$stage_value-$myresult;                   
                           
                            ?>
                            
                             <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        <?php if($myresult!=""){ ?>
                                        <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 $month;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php  } else { ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                            $month=$year."-".$mon."-01";
                             $months= date('m', strtotime($month.'+1 month'));
                             
                              $year=date('Y', strtotime($month.'+1 month'));
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$months,$year);
                             $percentage=$objpipeline->salespipelinestage_total($companyname,$months,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                    $myresult=$stage_value-$myresult;  
                            ?>
                            
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                         <?php if($myresult!=""){ ?>
                                        <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 $myresult; ?></b></center></a>
                                        <?php  } else { ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                           
                             $months= date('m', strtotime($month.'+2 month'));
                              $year=date('Y', strtotime($month.'+2 month'));
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$months,$year);
                             $percentage=$objpipeline->salespipelinestage_total($companyname,$months,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                    $myresult=$stage_value-$myresult;  
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                         <?php if($myresult!=""){ ?>
                                        <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 $myresult; ?></b></center></a>
                                        <?php  } else { ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                           
                             $months= date('m', strtotime($month.'+3 month'));
                              $year=date('Y', strtotime($month.'+3 month'));
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$months,$year);
                             $percentage=$objpipeline->salespipelinestage_total($companyname,$months,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                    $myresult=$stage_value-$myresult;  
                            ?>
                            
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                         <?php if($myresult!=""){ ?>
                                        <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 $myresult; ?></b></center></a>
                                        <?php  } else { ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                            
                             $months= date('m', strtotime($month.'+4 month'));
                              $year=date('Y', strtotime($month.'+4 month'));
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$months,$year);
                             $percentage=$objpipeline->salespipelinestage_total($companyname,$months,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                    $myresult=$stage_value-$myresult;  
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                         <?php if($myresult!=""){ ?>
                                        <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 $myresult; ?></b></center></a>
                                        <?php  } else { ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                            
                             $months= date('m', strtotime($month.'+5 month'));
                              $year=date('Y', strtotime($month.'+5 month'));
                             $myresult=$objpipeline->salespipelineexpected_total($companyname,$months,$year);
                             $percentage=$objpipeline->salespipelinestage_total($companyname,$months,$year);
                                $stage_value=0;
                                foreach($percentage as $r){
                                    $percentage_stage=$r['d_stage'];
                                    if($percentage_stage!="won"){
                                        $percentage_value=$objpipeline->salespipeline_find_percentage($percentage_stage);
                                        $percent=explode("%",$percentage_value);
                                        $percent1=$percent[0];
                                        $amount=$r['d_amount'];    
                                        $percentage_amount_value=(($amount*$percent1)/100);
                                        $stage_value=$stage_value+$percentage_amount_value+$amount;
                                    }if($percentage_stage=="Won"){
                                        $amount=$r['d_amount'];
                                        $stage_value=$stage_value+$amount;
                                    }
                                }
                                    $myresult=$stage_value-$myresult;  
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                         <?php if($myresult!=""){ ?>
                                        <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 $myresult; ?></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');
                $month=date('m');
                ?>
                 <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>
                                </span>
                            </center>
                        </div>
                        <div class="col-md-9" style="height:40px;"  id="monthly_target_response">
                            
                            
                            <?php
                            $months=date('m');
                            $year=date('Y');
                            $month=$year."-".$months."-01";
                             $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
                            $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
                            $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
                            $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
                            $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
                            $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 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
                                $per_mon=date('m');
                                $per_year=date('Y');
                                $per_result=$objsales->sales_per_select($companyname,$stage,$per_mon,$per_year);
                                $per_result=(($per_result*$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($per_result!=""){?>
                                        <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 $per_mon;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                    <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                            
                            <?php
                                $per_mon=$per_year."-".$mon."-01";
                                $per_mons=date('m', strtotime($per_mon.'+1 month'));
                                $per_year=date('Y', strtotime($per_mon.'+1 month'));
                                $per_result=$objsales->sales_per_select($companyname,$stage,$per_mons,$per_year);
                                $per_result=(($per_result*$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($per_result!=""){?>
                                        <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 $per_mons;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                            <?php
                            $per_mons=date('m', strtotime($per_mon.'+2 month'));
                            $per_year=date('Y', strtotime($per_mon.'+2 month'));
                            $per_result=$objsales->sales_per_select($companyname,$stage,$per_mons,$per_year);
                            $per_result=(($per_result*$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($per_result!=""){?>
                                        <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 $per_mons;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                            <?php
                            $per_mons=date('m', strtotime($per_mon.'+3 month'));
                            $per_year=date('Y', strtotime($per_mon.'+3 month'));
                            $per_result=$objsales->sales_per_select($companyname,$stage,$per_mons,$per_year);
                            $per_result=(($per_result*$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($per_result!=""){?>
                                        <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 $per_mons;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                            <?php
                            $per_mons=date('m', strtotime($per_mon.'+4 month'));
                            $per_year=date('Y');
                            $per_result=$objsales->sales_per_select($companyname,$stage,$per_mons,$per_year);
                            $per_result=(($per_result*$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($per_result!=""){?>
                                        <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 $per_mons;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                            <?php
                            $per_mons=date('m', strtotime($per_mon.'+5 month'));
                            $per_year=date('Y', strtotime($per_mon.'+5 month'));
                            $per_result=$objsales->sales_per_select($companyname,$stage,$per_mons,$per_year);
                            $per_result=(($per_result*$percentage)/100);
                            ?>
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                   <?php if($per_result!=""){?>
                                        <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 $per_mons;?>','<?php echo $per_year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  <?php } else {?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   <?php } ?>
                                </div>
                               
                        </div>
                    </div>
                    <br>
                
<?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
                            
                                       $mo=date('m');
                                       $ye=date('Y');
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mo,$ye);
                                    $mo=$ye."-".$mo."-01";
                                    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
                            
                                      $mos=date('m', strtotime($mo.'+1 month'));
                                        $ye=date('Y', strtotime($mo.'+1 month'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mos,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon2=$totaldealwon2+($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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon2;?></b></span></center>
                                </div>
                                
                             <?php
                            
                                      $mos=date('m', strtotime($mo.'+2 month'));
                                        $ye=date('Y', strtotime($mo.'+2 month'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mos,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon3=$totaldealwon3+($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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon3;?></b></span></center>
                                </div>
                            
                            <?php
                            
                                      $mos=date('m', strtotime($mo.'+3 month'));
                                        $ye=date('Y', strtotime($mo.'+3 month'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mos,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon4=$totaldealwon4+($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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon4;?></b></span></center>
                                </div>
                                
                            <?php
                            
                                      $mos=date('m', strtotime($mo.'+4 month'));
                                        $ye=date('Y', strtotime($mo.'+4 month'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mos,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon5=$totaldealwon5+($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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon5;?></b></span></center>
                                </div>
                                
                             <?php
                            
                                      $mos=date('m', strtotime($mo.'+5 month'));
                                        $ye=date('Y', strtotime($mo.'+5 month'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamount($companyname,$mos,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon6=$totaldealwon6+($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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon6;?></b></span></center>
                                </div>
                        </div>
                    </div>
                </div>
                
                </div>
                
                <!--yearly view-->
                
                 <div class="row" id="yearly_view">
                <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="yearly_exe_result" style="height:50px;">
                            <?php
                              $year=date('Y');
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                          
                            ?>
                            
                             <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        <?php if($myresult!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></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('+1 years'));
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                            ?>
                            
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php if($myresult==""){ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                        <?php } ?>
                            </div> 
                            
                           <?php
                              $year=date('Y',strtotime('+2 years'));
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php if($myresult==""){ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                              $year=date('Y',strtotime('+3 years'));
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                            ?>
                            
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php if($myresult==""){ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                              $year=date('Y',strtotime('+4 years'));
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php if($myresult==""){ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                        <?php } ?>
                            </div> 
                            
                            <?php
                              $year=date('Y',strtotime('+5 years'));
                             $myresult=$objpipeline->salespipelineexpected_yearly_total($companyname,$year);
                            ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                        
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_year('<?php echo $companyname;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $myresult; ?></b></center></a>
                                        <?php if($myresult==""){ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                        <?php } ?>
                            </div> 
                                
                        </div>
                    </div>
                </div>
                
                <?php
                $year=date('Y');
                $month=date('m');
                ?>
                <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>
                                </span>
                            </center>
                        </div>
                        <div class="col-md-9" style="height:40px;">
                            
                            <?php
                            if(date('m')<7){
                                $year=date('Y');
                                for($i=1;$i<7;$i++){//salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$i);
                                        $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
                                }
                            }else{
                                $year=date('Y');
                                for($i=7;$i<13;$i++){//salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$i);
                                        $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
                                }
                                
                            }
                            ?>
                        </div>
                    </div>
                </div>
                
               
                <br>

                <div style="padding:3px 0px;" id="per_yearly_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 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
                               
                                $year=date('Y');
                                $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                               
                            ?>
                           
                                <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 } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   
                                </div>
                            
                            <?php
                               
                                 $year=date('Y',strtotime('+1 years'));
                                $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                                
                            ?>
                                <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 } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   
                                </div>
                            <?php
                            
                             $year=date('Y',strtotime('+2 years'));
                            $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                            
                            ?>
                                <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 } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   
                                </div>
                            <?php
                            $year=date('Y',strtotime('+3 years'));
                            $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                            
                            ?>    
                                <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 } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   
                                </div>
                            <?php
                             $year=date('Y',strtotime('+4 years'));
                            $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                            
                            ?>    
                                <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 } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                   
                                </div>
                            <?php
                            
                            $year=date('Y',strtotime('+5 years'));
                            $per_result=$objsales->sales_per_yearly_select($companyname,$stage,$year);
                            
                            ?>
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                   
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_year('<?php echo $companyname;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                                  
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                 
                                </div>
                               
                        </div>
                    </div>
                    <br>
                
<?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_yearly" style="height:40px;">
                            
                            <?php
                            
                                       
                                       $ye=date('Y');
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    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
                            
                                        $ye=date('Y',strtotime('+1 years'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon2=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon2;?></b></span></center>
                                </div>
                                
                             <?php
                            
                                      $ye=date('Y',strtotime('+2 years'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon3=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon3;?></b></span></center>
                                </div>
                            
                            <?php
                                     $ye=date('Y',strtotime('+3 years'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon4=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon4;?></b></span></center>
                                </div>
                                
                            <?php
                            
                                       $ye=date('Y',strtotime('+4 years'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon5=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon5;?></b></span></center>
                                </div>
                                
                             <?php
                            
                                     $ye=date('Y',strtotime('+5 years'));
                                    $totaldeal_res=$objpipeline->salestotalpendingdealamountyearly($companyname,$ye);
                                    
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                            $totaldealwon6=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon6;?></b></span></center>
                                </div>
                        </div>
                    </div>
                </div>
                
                </div>
                
                <!--quartely view-->
                
                <div class="row" id="quartely_view">
            <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="quartely_exe_result" style="height:50px;">
                        <?php
                            $m_q=date('m');
                            $y_q=date('Y');
                            if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                        ?>
                        
                         <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                        
                        <?php
                             $m_q=date('m',strtotime('+3 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+3 months'));
                             if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                        ?>
                        
                        <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo date('m',strtotime($month));?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                        
                        <?php
                             $m_q=date('m',strtotime('+6 months'));
                             $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+6 months'));
                            if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                     
                            
                        
                        ?>
                        <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo date('m',strtotime($month));?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                        
                          <?php
                             $m_q=date('m',strtotime('+9 months'));
                                $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+9 months'));
                           if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                     
                            
                        
                        ?>
                        
                        <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo date('m',strtotime($month));?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                         <?php
                             $m_q=date('m',strtotime('+12 months'));
                                $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+12 months'));
                            if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                     
                            
                        
                        ?>
                        <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo date('m',strtotime($month));?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                        
                        <?php
                             $m_q=date('m',strtotime('+15 months'));
                                $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+15 months'));
                            if($m_q<=3){
                                $id="01";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                $id="02";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                $id="03";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                $id="04";
                         $myresult=$objpipeline->salespipelineexpected_quartely_total($companyname,04,$y_q);
                            }
                     
                            
                        
                        ?>
                        <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;border-right:1px solid #ddd;">
                                    
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_quart('<?php echo $companyname;?>','<?php echo date('m',strtotime($month));?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php print_r($myresult); ?></b></center></a>
                                    <?php if($myresult==""){ ?>
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;</span></center>
                                    <?php } ?>
                        </div> 
                            
                    </div>
                </div>
            </div>
            
            <?php
            $year=date('Y');
            $month=date('m');
            ?>
            <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>
                            </span>
                        </center>
                    </div>
                    <div class="col-md-9" style="height:40px;">
                        
                        <?php
                        if(date('m')<7){
                            $year=date('Y');
                            for($i=1;$i<7;$i++){//salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                $traget_amount=0;
                                for($g=0;$g<$emp_count;$g++){
                                    $email=$emp_emailid_a[$g];
                                    $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$i);
                                    $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
                            }
                        }else{
                            $year=date('Y');
                            for($i=7;$i<13;$i++){//salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                $traget_amount=0;
                                for($g=0;$g<$emp_count;$g++){
                                    $email=$emp_emailid_a[$g];
                                    $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$i);
                                    $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
                            }
                            
                        }
                        ?>
                    </div>
                </div>
            </div>
            
           
            <br>
    
            <div style="padding:3px 0px;" id="per_quartely_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 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
                            $m_q=date('m');
                            $y_q=date('Y');
                            if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                           
                        ?>
                       
                            <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 } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php print_r( $per_result);?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                               
                            </div>
                        
                        <?php
                           
                           $m_q=date('m',strtotime('+3 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+3 months'));
                           if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                            
                            
                        ?>
                            <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 } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                               
                            </div>
                        <?php
                         $m_q=date('m',strtotime('+6 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+6 months'));
                          if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                        
                        ?>
                            <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 } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                               
                            </div>
                        <?php
                       $m_q=date('m',strtotime('+9 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+9 months'));
                           if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                        
                        ?>    
                            <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 } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                               
                            </div>
                        <?php
                         $m_q=date('m',strtotime('+12 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+12 months'));
                            if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                        
                        ?>    
                            <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 } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                               
                            </div>
                        <?php
                        
                        $m_q=date('m',strtotime('+15 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+15 months'));
                            if($m_q<=3){
                                $id="01";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                                    $id="02";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                                    $id="03";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                                    $id="04";
                         $per_result=$objpipeline->sales_per_quartely_select($companyname,$stage,04,$y_q);
                            }
                            
                        
                        ?>
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                               
                                    <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_quart('<?php echo $companyname;?>','<?php echo $id;?>','<?php echo $y_q;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $per_result;?></center></a>
                              
                                    <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                             
                            </div>
                           
                    </div>
                </div>
                <br>
            
    <?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_quartely" style="height:40px;">
                        
                        <?php
                        
                            $m_q=date('m');
                            $y_q=date('Y');
                            
                            if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                               
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar1=$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  print_r($totaldealwon_quar1);?></b></span></center>
                            </div>
                        <?php
                        
                                     $m_q=date('m',strtotime('+3 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+3 months'));
                                    
                                   if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar2=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon_quar2;?></b></span></center>
                            </div>
                            
                         <?php
                        
                                 $m_q=date('m',strtotime('+6 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+6 months'));
                                    
                                    if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar3=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon_quar3;?></b></span></center>
                            </div>
                        
                        <?php
                                
                                 $m_q=date('m',strtotime('+9 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+9 months'));
                                    
                                   if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar4=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon_quar4;?></b></span></center>
                            </div>
                            
                        <?php
                        
                                 $m_q=date('m',strtotime('+12 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+12 months'));
                                    
                                 if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar5=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon_quar5;?></b></span></center>
                            </div>
                            
                         <?php
                        
                                 $m_q=date('m',strtotime('+15 months'));
                            $y_qs=date('Y');
                            $quar_year=$y_qs."-".date('m')."-01";
                            $y_q=date('Y', strtotime($quar_year.'+15 months'));
                                    
                                 if($m_q<=3){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,01,$y_q);
                            }
                            if($m_q>=4 && $m_q <=6){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,02,$y_q);
                            }
                            if($m_q>=7 && $m_q <=9){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,03,$y_q);
                            }
                            if($m_q>=10 && $m_q <=12){
                         $totaldeal_res=$objpipeline->salestotalpendingdealamountquartely($adminemailid,04,$y_q);
                            }
                                foreach($totaldeal_res as $totaldeal_row){
                                    $stage1=$totaldeal_row['stage'];
                                    $stage2=explode("%",$stage1);
                                    $stage121=$stage2[0];
                                        $totaldealwon_quar6=$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!=12){ ?>border-right:1px solid #ddd; <?php } ?>">
                                <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360 <b>&nbsp;<?php echo $totaldealwon_quar6;?></b></span></center>
                            </div>
                    </div>
                </div>
            </div>
            
            </div>
                
                 <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'));?>">
                    
                    <input type="hidden" id="myyear" value="<?php echo date('Y')?>" />
                    <input type="hidden" id="myyear1" value="<?php echo date('Y')?>" />
                    <input type="hidden" id="mymonth" value="<?php echo date('m')?>" />
                     <input type="hidden" id="mymonth1" value="<?php echo date('m')?>" />
            </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);
                   }
                });
            }
            function show_pipeline_deal_stage_quart(companyname, month, year, stage){
                //alert(month);
                $.ajax({
                   url:"pipeline_total_month_stage_data.php",
                   data:{cp:companyname, mn:month, yar:year, sge:stage},
                   type:"post",
                   success:function(respond){
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
             function show_pipeline_deal_stage_year(companyname,year, stage){
                //alert(month);
                $.ajax({
                   url:"pipeline_total_month_stage_data.php",
                   data:{cmp:companyname, yr:year, stg:stage},
                   type:"post",
                   success:function(respond){
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
        </script>
        
        <script>
            function show_pipeline_total_deal_month(companyname, month, year){
                
                $.ajax({
                   url:"pipeline_total_month_data.php",
                   data:{companyname:companyname, month:month, year:year},
                   type:"post",
                   success:function(respond){
                      
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
            function show_pipeline_total_deal_quart(companyname, month, year){
                
                $.ajax({
                   url:"pipeline_total_month_data.php",
                   data:{cp:companyname, mn:month, yar:year},
                   type:"post",
                   success:function(respond){
                      
                       $("#show_pipe_deal").html(respond);
                   }
                });
            }
            
             function show_pipeline_total_deal_year(companyname,year){
               
                $.ajax({
                   url:"pipeline_total_month_data.php",
                   data:{cmp:companyname,yr: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>";
//}?>