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

if(isset($_POST['mon'])){
$mon= $_POST['mon'];
$yea= $_POST['yea']; 
$m=$yea."-".$mon."-01";
?>
 <?php
$year=$yea;
$month=$yea."-".$mon."-01";
?>                            <?php
                                $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $mon);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                             <?php
                             $year= date('Y', strtotime($month .'+1 months'));    
                           $months= date('m', strtotime($month .'+1 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                    
                              <?php
                                $year= date('Y', strtotime($month .'+2 months'));    
                                $months= date('m', strtotime($month .'+2 months'));
                                $year=date('Y');
                                $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                 <?php
                            $year= date('Y', strtotime($month .'+3 months'));             
                           $months= date('m', strtotime($month .'+3 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                                    
                             <?php
                            $year= date('Y', strtotime($month .'+4 months'));         
                           $months= date('m', strtotime($month .'+4 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div> 
                            
                             <?php
                            $year= date('Y', strtotime($month .'+5 months'));    
                           $months= date('m', strtotime($month .'+5 months'));
                           $totaldeal_res=$objpipeline->salespipelineemployeedealmonth($adminemailid, $year, $months);
                            ?>   
                            
                                    <div class="col-md-2" style="color:black;cursor:pointer;padding-top:15px;height:50px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                        <?php if($totaldeal_res!=""){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_total_deal_month('<?php echo $companyname;?>','<?php echo $months;?>','<?php echo $year;?>')"><center>&#8360&nbsp;<b><?php echo $totaldeal_res;?></b></center></a>
                                        <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                        <?php } ?>
                                    </div>         

<?php
}
?>

<?php
if(isset($_POST['tar_mon'])){
    $mm=$_POST['tar_mon'];
$yy=$_POST['tar_yea'];

?>

                            <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=$yy;
                                    $month=$mm;
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                            
                            <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+1 month'));
                            $months= date('m', strtotime($month.'+1 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+2 month'));
                            $months= date('m', strtotime($month.'+2 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+3 month'));
                            $months= date('m', strtotime($month.'+3 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+4 month'));
                            $months= date('m', strtotime($month.'+4 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
                            
                              <?php
                            //salespipelineemployeetarget($companyname,$email,$year,$month) $emp_emailid_a
                                    $year=date('Y', strtotime($month.'+5 month'));
                            $months= date('m', strtotime($month.'+5 month'));
                                    $traget_amount=0;
                                    for($g=0;$g<$emp_count;$g++){
                                        $email=$emp_emailid_a[$g];
                                        $totaldeal_res=$objpipeline->salespipelineemployeetarget($companyname,$email,$year,$months);
                                        $totaldealwon=0;
                                        if($totaldeal_res->rowCount()>0){
                                        foreach($totaldeal_res as $totaldeal_row){
                                                $totaldealwon=$totaldeal_row['amount'];
                                        }
                                        $traget_amount=$traget_amount+$totaldealwon;
                                        }else{
                                            $traget_amount=$traget_amount+5000;
                                        }
                                    }
                                    
                            ?>  
                            <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;border-right:1px solid #ddd;">
                                <span style="color:grey;font-size:14px;"><center>&#8360&nbsp;<b><?php echo $traget_amount;?></b></center></span>
                            </div>
<?php
}
?>

<?php
if(isset($_POST['per_mon'])){
  $per_mon=$_POST['per_mon'];
$per_year=$_POST['per_yea'];
?>  
    
    <?php //$pipe_percentage $pipe_name
for($i1=0;$i1<count($pipe_percentage);$i1++){
        $j=100-($i1*10)."%";
        $stage=$pipe_id[$i1];
        $percentage=$pipe_percentage[$i1];
        $p_name=$pipe_name[$i1];
?>
                <div style="padding:3px 0px;">
                    <div class="row" style="height:40px;">
                        <div class="col-md-3" style="background-color:#f6f6f6;">
                            <center><span id="pipeline1" style="width:<?php echo $j;?>"><span ><?php echo $percentage;?><br><span style="font-size:12px;"><?php echo $p_name;?></span></span></span></center>
                        </div>
                        <div class="col-md-9" style="height:40px;">
<?php
$mon=$per_mon;
$year=$per_year;
$month=$year."-".$mon."-01";
?>                              
                            <?php
                                    $i= $mon;
                                    $year= $year;
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                                
                             <?php
                                    $i= date('m', strtotime($month .'+1 months'));
                                    $year= date('Y', strtotime($month .'+1 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                                
                            <?php
                                    $i= date('m', strtotime($month .'+2 months'));
                                    $year= date('Y', strtotime($month .'+2 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+3 months'));
                                    $year= date('Y', strtotime($month .'+3 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+4 months'));
                                    $year= date('Y', strtotime($month .'+4 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                            
                            <?php
                                    $i= date('m', strtotime($month .'+5 months'));
                                    $year= date('Y', strtotime($month .'+5 months'));
                                    $totaldeal_res=$objpipeline->salespipelineemployeedealmonthstage($adminemailid,$year,$i,$stage);
                                    $totaldealwon=0;
                                    foreach($totaldeal_res as $totaldeal_row){
                                            $totaldealwon=$totaldealwon+($totaldeal_row['d_amount']*$percentage/100);
                                    }
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <?php if($totaldealwon!=0){ ?>
                                        <a style="color:black;font-size:14px;" data-toggle="modal" data-target="#myModal_view_pipeline_deal" onclick="show_pipeline_deal_stage_month('<?php echo $companyname;?>','<?php echo $i;?>','<?php echo $year;?>','<?php echo $stage;?>')"><center>&#8360&nbsp;<?php echo $totaldealwon;?></center></a>
                                    <?php }else{ ?>
                                        <center><span style="color: #ccc;text-decoration: none;">&#8360&nbsp;0</span></center>
                                    <?php } ?>
                                </div>
                           
                        </div>
                    </div>
                </div>
                
<?php
}
?>

<?php }
?>


<?php 
if(isset($_POST['pending_mon'])){
 $mo=$_POST['pending_mon'];
    $ye=$_POST['pending_yea'];
    $m=$ye."-".$mo."-01";
?>
<?php
$mon=$mo;
$year=$ye;
$month=$year."-".$mon."-01";
?>                               
                            <?php
                            
                                      $i= $mon;
                                      $year= $year;
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                            <?php
                            
                                      $i= date('m', strtotime($month .'+1 months'));
                                      $year= date('Y', strtotime($month .'+1 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                            <?php
                                        $i= date('m', strtotime($month .'+2 months'));
                                      $year= date('Y', strtotime($month .'+2 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                            
                             <?php
                            
                                      $i= date('m', strtotime($month .'+3 months'));
                                      $year= date('Y', strtotime($month .'+3 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                                
                            
                            <?php
                            
                                      $i= date('m', strtotime($month .'+4 months'));
                                      $year= date('Y', strtotime($month .'+4 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    foreach($totaldeal_res as $totaldeal_row){
                                        $stage1=$totaldeal_row['stage'];
                                        $stage2=explode("%",$stage1);
                                        $stage121=$stage2[0];
                                        $totaldealwon1=$totaldealwon1+($totaldeal_row['amount']*$stage121/100);
                                    }
                                    
                            ?>   
                                <div class="col-md-2" style="color:black;cursor:pointer;padding-top:10px;height:40px;background-color:#fff;<?php if($i!=6){ ?>border-right:1px solid #ddd; <?php } ?>">
                                    <center><span style="color: #db1b56;font-size:14px;text-decoration: none;">&#8360&nbsp;<b><?php echo $totaldealwon1;?></b></span></center>
                                </div>
                                
                            <?php
                            
                                      $i= date('m', strtotime($month .'+5 months'));
                                      $year= date('Y', strtotime($month .'+5 months'));
                                    $totaldeal_res=$objpipeline->salesemployeetotalpendingdealamount($adminemailid, $year, $i);
                                    $j=0;
                                    //echo $totaldeal_res->rowCount();
                                    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 }
?>
