MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/crm_cafsindia_com/application/views/CrmPortfolioDashboard.php
    <?php
                 
    if($emp_portfolio_onchange==="1")
    {
        $emp_id    = $emp_portfolio_empid;
        $emp_cat      = $emp_portfolio_cat;
        $emp_role     = $emp_portfolio_role;

        $today         = new DateTime();
        $lastDay       = new DateTime('last day of this month');
        $DaysRemaining =  $lastDay->diff($today)->format('%a days');

        $first_day = date("Y-m-01");
        $last_day = date("t");
        $today     = date("Y-m-d"); 
        $yesterday = date("Y-m-d",strtotime("-1 days"));
        $tmrw = new DateTime('tomorrow');
        $tmrw = $tmrw->format('Y-m-d');  
        $cur_month = date("Y-m");
        $cur_year = date("Y");
        $datestring= "$today first day of last month";
        $dt=date_create($datestring);
        $last_month = $dt->format('Y-m');
         $april_month = date("Y-04");
    //Get Financial Year
        $year = date('Y');
        $year1 = date('Y')-1;
        $year2 = date('Y')+1;
    if (date('m') > 03){
        $fin_start_month = $year."-"."04"."-"."01";
        $fin_end_month   = $year2."-"."03"."-"."31"; 
        $m = date("m");
        $mth = $m - 1 ;
        $lst_mth = $mth - 3; 
    }else{    
        $fin_start_month = $year1."-"."04"."-"."01";
        $fin_end_month   = $year."-"."03"."-"."31";
        $m = date("m");
        $lst_mth = $m + 9 ;
    }

    //Last 30 days
        $thirty_days = date('Y-m-d', strtotime('today - 30 days'));
    //Last Month End Date
        $dd = $endLastMonth = mktime(0, 0, 0, date("m"), 0, date("Y"));
        $last_month_endDate = date("Y-m-d", $dd);
    }

                 
                 /* Head box - START */ 
                $zeroqry      = $this->db->query("SELECT count(met_id) as count,ospos_met_log.met_date FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' and first_met='1' group by log_lead_id order by ospos_met_log.met_date desc limit 0,1");
                $zeroqry_result = $zeroqry->result_array();
                $met_date = $zeroqry_result[0]['met_date'];
                if($met_date === ""){
                    $met_date=date('Y-m-01');
                }

                $now       = time();
                $your_date = strtotime($met_date);
                $datediff  = $now - $your_date;
                $Zero_days = floor($datediff / (60 * 60 * 24));

                //SELECT count(DISTINCT(met_date)) as met_date FROM `ospos_lead_type_info` where lead_status='9' and ospos_lead_type_info.created_by = '$emp_id' and met_date BETWEEN '$first_day' and '$yesterday'

                //Zero Days in a month- crmbox - 1		
      	
                $zero_in_month = $this->db->query("SELECT count(met_id) as count FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' and first_met='1' AND ospos_met_log.met_date BETWEEN '$first_day' and '$yesterday'"); //$first_day , $yesterday
                $zero_in_month_result = $zero_in_month->result_array();
                $month = (int)$zero_in_month_result[0]['met_date'];
                $days  = explode("-", $yesterday);            
                $days  = (int)$days[2];
                $month = $days - $month;
                $zeroresult =  $Zero_days. "-".$month;            
              
                //Self Met crmbox - 2
    			
    			
               // $self_qry=$this->db->query("SELECT count(*) as count FROM `ospos_lead_type_info` where lead_status='9' and ospos_lead_type_info.created_by = '$emp_id' and met_date like '$cur_month%'");
    		  // echo "SELECT count(distinct ospos_met_log.met_date) as count, MIN( ospos_met_log.met_date ) FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' AND ospos_met_log.met_date like '$cur_month%'";
    		  // $self_qry=$this->db->query("SELECT count(distinct ospos_met_log.met_date) as count, MIN( ospos_met_log.met_date ) FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' AND ospos_met_log.met_date like '$cur_month%'");
    		    $self_qry=$this->db->query("SELECT count(met_id) as count FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' and first_met='1' AND ospos_met_log.met_date like '$cur_month%'");
                $self_result = $self_qry->result_array();
                $self_count  = $self_result[0]['count'];
    			//Target
                $crm_target_qry     = $this->db->query("SELECT IFNULL(met,0) as met FROM `ospos_target` where role = '$emp_role' and emp_id = '$emp_id' and category = '$emp_cat' and from_date like '$cur_month%' and to_date like '$cur_month%' ");
                $crm_target_result  = $crm_target_qry->result_array();
                $crm_target = $crm_target_result[0]['met'];
                if(!$crm_target){
                    $crm_target = 0;
                }
    			
                //Con/Nop & value crmbox - 4  
                $crm_log_qry     = $this->db->query("SELECT count(*) as count FROM `ospos_lead_type_info` left join ospos_leads_product on ospos_leads_product.lead_info_id = ospos_lead_type_info.lead_type_id where prospect_level='4' and ospos_lead_type_info.created_by ='$emp_id' and ospos_leads_product.status =  '1' and login_date like '$cur_month%'");
                $crm_log_result  = $crm_log_qry->result_array();
                $crm_log = $crm_log_result[0]['count'];
                $crm_con_ratio = round(((int)$crm_log / (int)$self_count) * 100);

    			
                $crm_nop_qry     = $this->db->query("SELECT count(*) as count,IFNULL(sum(overall_net_premium),0) as value FROM `ospos_lead_type_info` inner join ospos_leads_product on ospos_leads_product.lead_info_id = ospos_lead_type_info.lead_type_id where ospos_lead_type_info.created_by = '$emp_id' and ospos_leads_product.status =  '1' and ncd like '$cur_month%'");
                $crm_nop_result  = $crm_nop_qry->result_array();
                $crm_nop = $crm_nop_result[0]['count'];
                $crm_value = $crm_nop_result[0]['value'];

                 /* Head box - END */ 

                 /*Leads - START */
                 // Today Count
                 $today_lead = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and ospos_lead_type_info.lead_mode='1'  and ncd like '$today%' GROUP by lead_status");
                 $today_lead_rslt = $today_lead->result_array();
                 $today_app   = 0;
                 $today_follw = 0;
                 $today_drop  = 0;
                 foreach ($today_lead_rslt as $key => $value) {
                    $count      = $value['count'];
                    $statusname = $value['statusname'];
                    if($statusname === "Appointment"){
                        $today_app  = $count;
                    }else
                    if($statusname === "Follow Up"){
                        $today_follw = $count;
                    }else
                    if($statusname === "Dropped"){
                        $today_drop = $count;
                    }
                 }
    			 
                 $today_lead_cr = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and ospos_lead_type_info.lead_mode='1'  and created_date like '$today%' GROUP by lead_status");
                 $today_lead_rslt_cr = $today_lead_cr->result_array();
                 $today_app_cr   = 0;
                 $today_follw_cr = 0;
                 $today_drop_cr  = 0;
                 foreach ($today_lead_rslt_cr as $key => $value) {
                    $count      = $value['count'];
                    $statusname = $value['statusname'];
                    if($statusname === "Appointment"){
                        $today_app_cr  = $count;
                    }else
                    if($statusname === "Follow Up"){
                        $today_follw_cr = $count;
                    }else
                    if($statusname === "Dropped"){
                        $today_drop_cr = $count;
                    }
                 }
                 // Tomorrow count 
                 $tmrw_lead = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and ospos_lead_type_info.lead_mode='1'  and ncd like '$tmrw%' GROUP by lead_status");
                 $tmrw_lead_rslt = $tmrw_lead->result_array();
                 $tmrw_app   = 0;
                 $tmrw_follw = 0;
                 $tmrw_drop  = 0;
                 foreach ($tmrw_lead_rslt as $key => $value) {
                    $count      = $value['count'];
                    $statusname = $value['statusname'];
                    if($statusname === "Appointment"){
                        $tmrw_app  = $count;
                    }else
                    if($statusname === "Follow Up"){
                        $tmrw_follw = $count;
                    }
                 }
                 // Month count
                 $month_lead = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and ospos_lead_type_info.lead_mode='1' and ncd like '$cur_month%' GROUP by lead_status");
                 $month_lead_rslt = $month_lead->result_array();
                 $month_app   = 0;
                 $month_follw = 0;
                 $month_drop  = 0;
                foreach ($month_lead_rslt as $key => $value) {
                    $count      = $value['count'];
                    $statusname = $value['statusname'];
                    if($statusname === "Appointment"){
                        $month_app  = $count;
                    }else
                    if($statusname === "Follow Up"){
                        $month_follw = $count;
                    }else
                    if($statusname === "Dropped"){
                        $month_drop = $count;
                    }
                 }
                 $month_lead_cr = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and created_date like '$cur_month%' GROUP by lead_status");
                 $month_lead_rslt_cr = $month_lead_cr->result_array();
                 $month_app_cr   = 0;
                 $month_follw_cr = 0;
                 $month_drop_cr  = 0;
                foreach ($month_lead_rslt_cr as $key => $value) {
                    $count      = $value['count'];
                    $statusname = $value['statusname'];
                    if($statusname === "Appointment"){
                        $month_app_cr  = $count;
                    }else
                    if($statusname === "Follow Up"){
                        $month_follw_cr = $count;
                    }else
                    if($statusname === "Dropped"){
                        $month_drop_cr = $count;
                    }
                 }

              $last_month_lead_cr = $this->db->query("SELECT count(*) as count,lead_status,statusname FROM `ospos_lead_type_info` left join ospos_lead_status on status_id = lead_status where ospos_lead_type_info.created_by = '$emp_id' and ospos_lead_type_info.category in (2) and created_date like '$last_month%' GROUP by lead_status");
             $last_month_lead_rslt_cr = $last_month_lead_cr->result_array();
             $last_month_app_cr   = 0;
             $last_month_follw_cr = 0;
             $last_month_drop_cr  = 0;
            foreach ($last_month_lead_rslt_cr as $key => $value) {
                $count      = $value['count'];
                $statusname = $value['statusname'];
                if($statusname === "Appointment"){
                    $last_month_app_cr  = $count;
                }else
                if($statusname === "Follow Up"){
                    $last_month_follw_cr = $count;
                }else
                if($statusname === "Dropped"){
                    $last_month_drop_cr = $count;
                }
             }
                 /* Lead - END*/        
                /*RM Status - START */            
                // Created date  
    			
    			
    			
    			
    			          
                //$rm_crdate = $this->db->query("SELECT IFNULL(count(*),0) as count,prospect_name FROM `ospos_lead_type_info` left JOIN ospos_prospect_level on prospect_id = prospect_level where ospos_lead_type_info.created_by = '$emp_id' and lead_status = '9' and met_date like '$cur_month%' GROUP by prospect_name");
    					
    			$rm_crdate = $this->db->query("SELECT IFNULL(count(met_id),0) as count,prospect_name FROM ospos_met_log INNER JOIN ospos_lead_type_info ON ospos_met_log.log_lead_id = ospos_lead_type_info.lead_id inner JOIN ospos_prospect_level on ospos_lead_type_info.prospect_level = ospos_prospect_level.prospect_id  WHERE lead_status =  '9' AND ospos_lead_type_info.created_by =  '$emp_id' AND first_met='1' AND ospos_met_log.met_date like '$cur_month%' and  ospos_lead_type_info.status='1' GROUP by prospect_name");
    			
                $rm_crdate_rslt = $rm_crdate->result_array();
                $crdate_hot   = 0;
                $crdate_warm  = 0;
                $crdate_drop  = 0;
                $crdate_log   = 0;
                foreach ($rm_crdate_rslt as $key => $value) {
                    $count         = $value['count'];
                    $prospect_name = $value['prospect_name'];
                    if($prospect_name === "Hot"){
                        $crdate_hot = $count;
                    }else
                    if($prospect_name === "Warm"){
                        $crdate_warm = $count;
                    }else
                    if($prospect_name === "Dropped"){
                        $crdate_drop = $count;
                    }else
                    if($prospect_name === "Login"){
                        $crdate_log = $count;
                    }
                }

                // NCD
                $rm_ncd = $this->db->query("SELECT IFNULL(count(*),0) as count,prospect_level,prospect_name FROM `ospos_lead_type_info` inner JOIN ospos_prospect_level on prospect_id = prospect_level where ospos_lead_type_info.created_by = '$emp_id' and lead_status = '9' and ncd like '$cur_month%' and ospos_lead_type_info.met_date not like '$cur_month%' and  ospos_lead_type_info.status='1' GROUP by prospect_level");
                $rm_ncd_rslt = $rm_ncd->result_array();
                $ncd_hot   = 0;
                $ncd_warm  = 0;
                $ncd_drop  = 0;
                $ncd_log   = 0;
                foreach ($rm_ncd_rslt as $key => $value) {
                    $count         = $value['count'];
                    $prospect_name = $value['prospect_name'];
                    if($prospect_name === "Hot"){
                        $ncd_hot = $count;
                    }else
                    if($prospect_name === "Warm"){
                        $ncd_warm = $count;
                    }else
                    if($prospect_name === "Dropped"){
                        $ncd_drop = $count;
                    }else
                    if($prospect_name === "Login"){
                        $ncd_log = $count;
                    }
                }
                // C-Ratio		
                $rm_crdate_nop = $this->db->query("SELECT IFNULL(count(*),0) as count FROM `ospos_lead_type_info` inner join ospos_met_log on ospos_lead_type_info.lead_id=ospos_met_log.log_lead_id  where ospos_lead_type_info.created_by = '$emp_id' and lead_status = '9' and  ospos_lead_type_info.status='1' and ospos_met_log.met_date like '$cur_month%' and ospos_met_log.first_met='1'");
                $rm_crdate_nop_rslt = $rm_crdate_nop->result_array();
                $crdate_nop   = $rm_crdate_nop_rslt[0]['count'];

                $rm_crdate_log = $this->db->query("SELECT IFNULL(count(*),0) as count FROM `ospos_lead_type_info` INNER join ospos_leads_product on lead_type_id = lead_info_id inner join ospos_met_log on ospos_lead_type_info.lead_id=ospos_met_log.log_lead_id where ospos_lead_type_info.created_by = '$emp_id' and ospos_leads_product.status =  '1' and ospos_leads_product.login_date like '%$cur_month%' and ospos_met_log.met_date like '$cur_month%' and ospos_met_log.first_met='1' and  ospos_lead_type_info.status='1' and ospos_lead_type_info.lead_status = '8' and prospect_level='4'");
                $rm_crdate_log_rslt = $rm_crdate_log->result_array();
                $rm_crdate_log = $rm_crdate_log_rslt[0]['count'];

                $crdate_cratio = round(((int)$rm_crdate_log / (int)$crdate_nop) * 100); 

                $rm_ncd_nop = $this->db->query("SELECT IFNULL(count(*),0) as count FROM `ospos_lead_type_info` where ospos_lead_type_info.created_by = '$emp_id' and lead_status = '9' and ncd like '$cur_month%' and met_date not like '$cur_month%'");
                $rm_ncd_nop_rslt = $rm_ncd_nop->result_array();
                $ncd_nop   = $rm_ncd_nop_rslt[0]['count'];

                $rm_ncd_log = $this->db->query("SELECT IFNULL(count(*),0) as count FROM `ospos_lead_type_info` INNER join ospos_leads_product on lead_type_id = lead_info_id where ospos_lead_type_info.created_by = '$emp_id' and ospos_leads_product.login_date like '%$cur_month%' and met_date not like '$cur_month%' and ospos_leads_product.status =  '1' and prospect_level='4'");
                $rm_ncd_log_rslt = $rm_ncd_log->result_array();
                $rm_ncd_log = $rm_ncd_log_rslt[0]['count'];

                $ncd_cratio = round(((int)$rm_ncd_log / (int)$ncd_nop) * 100); 
                //
                /*RM Status -END */

                /*Goal Sheet - START */   
    			
                $goal_sheet = $this->db->query("SELECT met,conversion_ratio FROM `ospos_goal_sheet` where emp_id = '$emp_id' AND role = '$emp_role' AND category = '$emp_cat' AND (YEAR(from_date) = '$fin_start_month' or YEAR(to_date) = '$fin_end_month')");
                $goal_sheet_rslt  = $goal_sheet->result_array();
                $req_met              = $goal_sheet_rslt[0]['met'];
                $conversion_ratio = $goal_sheet_rslt[0]['conversion_ratio'];
                $actual_month     = $req_met / 12;

                //Pending
                $met_qry=$this->db->query("SELECT count(DISTINCT(lead_id)) as count FROM `ospos_lead_type_info` where lead_status='9' and ospos_lead_type_info.created_by = '$emp_id' and (ncd BETWEEN '$fin_start_month' and '$fin_end_month') and ncd not like '$cur_month%'");
                $met_result    = $met_qry->result_array();
                $met_count     = $met_result[0]['count']; 
                $fnl_met_count = $req_met - $met_count;
                $required_met  = $actual_month + $fnl_met_count;
    			
                //No of LOP            
                $login_qry=$this->db->query("SELECT count(DISTINCT(lead_id)) as count FROM `ospos_lead_type_info` where prospect_level='4' and ospos_lead_type_info.created_by = '$emp_id' and (ncd BETWEEN '$fin_start_month' and '$fin_end_month')");
                $login_result    = $login_qry->result_array();
                $login_count     = $login_result[0]['count'];    

    			//Total login value
                $login_value_qry = $this->db->query("SELECT IFNULL(sum(overall_net_premium),0) as net_premium FROM `ospos_lead_type_info` INNER JOIN ospos_leads_product on ospos_leads_product.lead_info_id = ospos_lead_type_info.lead_type_id where ospos_lead_type_info.created_by = '$emp_id' and ospos_leads_product.status =  '1'");
                $login_value_result  = $login_value_qry->row();
    			
                $tot_log_val         = $login_value_result->net_premium; 

                /*Goal Sheet - END */

                echo "<div class='col-md-12 pd0 dash_header'>
    					<h3 class='text-center headtxt'>CRM Portfolio</h3>
    					<div class='row mg0 mgb15'>
    						<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='Zero Days / Zero in a Month'>
    							<div class='dashbox orange'>
    								<table>
    									<tr>
    										<td class='pd10'><i class='fa fa-heartbeat fa-2x' aria-hidden='true'></i></td>
    										<td class='white'><h5>Zero</h5> <span class='bold'>$zeroresult</span></td>
    									</tr>
    								</table>
    							</div>
    						</div>
    						<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='Self Met / Target Met'>
    							<div class='dashbox red'>
    								<table>
    									<tr>
    										<td class='pd10'><i class='fa fa-users fa-2x' aria-hidden='true'></i></td>
    										<td class='white'><h5>Met</h5> <span class='bold'> $self_count - $crm_target</span></td>
    									</tr>
    								</table>
    							</div>
    						</div>
    						<div class='col-md-2 pdl0' data-toggle='tooltip' data-toggle='tooltip' data-placement='right' title='Last Month Earned Incentive'>
    							<div class='dashbox blue'>
    								<table>
    									<tr>
    										<td class='pd10'><i class='fa fa-ticket fa-2x' aria-hidden='true'></i></td>
    										<td class='white'><h5>Incentive</h5> <span class='bold'> Under Processing...</span></td>
    									</tr>
    								</table>
    							</div>
    						</div>
    						<div class='col-md-2 pdl0' data-placement='right' title='Conversion / NOP & Value'>
    							<div class='dashbox violet'>
    								<table>
    									<tr>
    										<td class='pd10'><i class='fa fa-thermometer-half fa-2x' aria-hidden='true'></i></td>
    										<td class='white'><h5>Value - NOP.</h5> <span class='bold'>  $crm_value -  $crm_nop </span>
                                            <div style='position: absolute; top: 5px; right: 25px; font-weight: bold;font-size: 11px;'>$crm_con_ratio%</div>
                                            </td>
    									</tr>
    								</table>
    							</div>
    						</div>
    						<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='Days to go'>
    							<div class='dashbox teal'>
    								<table>
    									<tr>
    										<td class='pd10'><i class='fa fa-hourglass-half fa-2x' aria-hidden='true'></i></td>
    										<td class='white'><h5>Days</h5> <span class='bold'> $DaysRemaining</span></td>
    									</tr>
    								</table>
    							</div>
    						</div>
    					</div>
    				</div>
    				<div class='col-md-12 pd0 divider'></div>
                        <div class='row mg0'>
                            <div class='col-md-6'>
                                <div class='row mg0'>
                                    <div class='col-md-12 pdl0'>
                                        <table class='table table-bordered table-hover col-style'>
                                            <thead>
                                                <tr>
                                                    <th>Leads</th>
                                                    <th>Appointment</th>
                                                    <th>Follow up</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td >Today</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'T','');>$today_app</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'T','');>$today_follw</td>
                                                </tr>
                                                <tr>
                                                    <td >Tomorrow</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'TW','');>$tmrw_app</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'TW','');>$tmrw_follw</td>
                                                </tr>
                                                <tr>
                                                    <td >Month</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'M','');>$month_app</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'M','');>$month_follw</td>
                                                </tr>
                                            </tbody>                                        
                                        </table>
                                    </div>
                                     <div class='col-md-12 pdl0'>
                                        <table class='table table-bordered table-hover col-style'>
                                            <thead>
                                                <tr>
                                                    <th>Generated</th>
                                                    <th>Appointment</th>
                                                    <th>Follow up</th>
                                                    <th>Dropped</th>
                                                </tr>
                                            </thead>
                                             <tbody>
                                                <tr>
                                                    <td >Today</td>
                                                    <td  class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'T','created_date');>$today_app_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'T','created_date');>$today_follw_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,3,'M','created_date');>$today_drop_cr</td>
                                                </tr>
                                                <tr>
                                                    <td >Month</td>
                                                    <td  class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'M','created_date');>$month_app_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'M','created_date');>$month_follw_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,3,'M','created_date');>$month_drop_cr</td>
                                                </tr>
                                                <tr>
                                                    <td >Last Month</td>
                                                    <td  class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,1,'LM','created_date');>$last_month_app_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,2,'LM','created_date');>$last_month_follw_cr</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,3,'LM','created_date');>$last_month_drop_cr</td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
    								<div class='col-md-12 pdl0'>
                                        <table class='table table-bordered table-hover col-style'>
                                            <thead>
                                                <tr>
                                                    <th>RM Status</th>
                                                    <th>MET</th>
                                                    <th>Login</th>
                                                    <th>Hot</th>
                                                    <th>Warm</th>
                                                    <th>Dropped</th>
                                                    <th>Conversion</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td >Current Month</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,9,'M','PMET');>$crdate_nop</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,4,'CRMMET','');>$crdate_log</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,1,'CRMMET','');>$crdate_hot</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,2,'CRMMET','');>$crdate_warm</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,3,'CRMMET','');>$crdate_drop</td>
                                                    <td>$crdate_cratio%</td>
                                                </tr>
                                                <tr>
                                                    <td >NCD</td>
                                                    <td class='cursor' onclick=get_lead_info($emp_role,$emp_cat,$emp_id,9,'M','METNCD');>$ncd_nop</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,4,'NCD','');>$ncd_log</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,1,'NCD','');>$ncd_hot</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,2,'NCD','');>$ncd_warm</td>
                                                    <td class='cursor' onclick=get_rm_lead_info($emp_role,$emp_cat,$emp_id,3,'NCD','');>$ncd_drop</td>
                                                    <td>$ncd_cratio%</td>
                                                </tr>
                                            </tbody>
                                        </table>

                                         <table class='table table-bordered table-hover col-style'>

                                       			 <thead>
                                                <tr>
                                                    <th>Goal Sheet - Under Processing...</th>
                                                    
                                                </tr>
                                             </thead>
                                            
                                        </table>
                                    </div>

                                   
                                </div>
                            </div>
                            <div class='col-md-6 pdl0'>							
    							<div class='col-md-12 col-style'>
    								<div id='ribbon'>Login $tot_log_val</div>
    								<div id='crm_chart' style='height:315px;'></div>
    							</div>
    						</div>
                            <div class='col-md-12'>
                                 <div class='row mg0'>                               
                                    
                                </div>
                            </div>
                            <div class='col-md-12'>
                 <div class='row mg0'>   
                    <div class='col-md-6 pdl0' style='overflow: auto;height: 336px;'>
                        <div class='form-group' style='margin-bottom:4px;float:right;'>
                            <select class='form-control input-sm' onchange=get_team_info(this.value,$emp_role,$emp_cat,'$map_crm',''); >
                                <option value='T'>Today</option>
                                <option value='Y'>Yesterday</option>
                                <option value='TW'>Tomorrow</option>
                                <option value='M'>Month</option>
                            </select>
                        </div>
                        <div id='divhightcontroll'>
                        <table class='table table-bordered table-hover col-style tbl' id='team_info_table'>
                            <thead>
                                <tr>                                                
                                    <th>Team CRM</th>
                                    <th>Manager</th>
                                    <th>Zero Days</th>
                                    <th>Met</th>
                                    <th>Appointment</th>
                                    <th>Follow up</th>
                                    <th>C- Ratio</th>
                                </tr>
                            </thead>
                            <tbody>
                                   
                            </tbody>
                        </table>
                        </div>
                    </div>
                <div class='col-md-6 pd0'>
                    <div class='col-md-12 col-style'>
                        <div id='ribbon'>MET $team_met</div>
                        <div id='tl_crm_met_chart' style='height:315px;'></div>
                    </div>
                </div>
            </div>
                </div>
                        </div>";
    ?>