File: /home/cafsindia/crm_cafsindia_com/application/views/home_bk20aug2018.php
<?php $this->load->view("partial/header"); ?>
<script type="text/javascript" src="dist/datatables.js"></script>
<script type="text/javascript" src="dist/highcharts.js"></script>
<script type="text/javascript" src="dist/highcharts-3d.js"></script>
<script type="text/javascript" src="dist/data.js"></script>
<script type="text/javascript" src="dist/drilldown.js"></script>
<script type="text/javascript" src="dist/dashboard.js"></script>
<script type="text/javascript" src="dist/mf_dashboard.js"></script>
<style type="text/css">
.col-style{background-color:#FFFFFF;box-shadow:0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); border-radius: 3px; padding: 8px;margin-bottom: 10px;border:0px !important;}
.mg0{margin:0px !important;}
.pd0{padding:0px !important;}
.pd10{padding:10px !important;}
.pdl0{padding-left:0px !important;}
.pd4{padding: 4px !important;}
.pd04{padding: 0px 4px !important;}
th{background-color:#007ac3; color:#FFFFFF; text-align: center;white-space: nowrap;text-overflow: ellipsis; overflow: hidden;vertical-align: inherit !important;padding:6px 8px !important;border: 1px solid #c5cacc !important;font-weight: 500;background: linear-gradient(45deg, #00AEFF -182%, #3369E6 100%) !important;border-right: 0px !important;border-left: 0px !important;}
.tx-center{text-align: center !important;}
body{color:#000000;text-shadow: none !important;background-color:#f5f2f0;font-family: verdana;font-weight: 500;}
table{margin:0px;text-align: center !important;font-size: inherit;text-transform:capitalize;}
h5{white-space: nowrap; margin:0px;padding:5px;font-weight: bold;text-overflow: ellipsis; overflow: hidden;}
.dataspan{color: #c7254e; font-size: 15px; font-weight: bold;font-size: inherit;font-size: inherit;}
.mgleft10{margin-left: 10px;}
.bold{font-weight: bold !important;font-size: 11px !important;}
td:first-child{text-align:left !important;border-left:0px !important;white-space: nowrap !important;}
td:last-child{border-right:0px !important;}
th:first-child{border-left:0px !important;}
th:last-child{border-right:0px !important;}
.cursor{cursor: pointer;}
td{padding:4px 8px!important;border-right: 0px !important;border-left: 0px !important;}
.thheadpd{padding:3px !important;}
.dash_header{padding: 8px 16px!important; background-color: #FFFFFF;}
.headtxt{margin: 8px; font-size: 18px; font-weight: bold; margin-bottom: 15px;color:#044ef9 !important;}
.mgb15{margin-bottom:15px !important;}
.ulalign{display: inline-block;}
.lipd{padding: 15px 15px;}
.dashbox{border-radius: 3px; color: #FFFFFF; margin-bottom: 10px;text-overflow: ellipsis; overflow: hidden;}
.violet{background: linear-gradient(45deg, #9C27B0 0%, #BA68C8 100%); box-shadow: 0 6px 20px 0 #E1BEE7;}
.orange{background: linear-gradient(45deg, #ff6f00 0%, #ffca28 100%);box-shadow: 0 6px 20px 0 rgba(255, 111, 0, 0.3);}
.red{background: linear-gradient(45deg, #FF5252 0%, #f48fb1 100%); box-shadow: 0 6px 20px 0 rgba(244, 143, 177, 0.5);}
.blue{background: linear-gradient(45deg, #0288d1 0%, #26c6da 100%);box-shadow: 0 6px 20px 0 rgba(38, 198, 218, 0.5);}
.teal{background: linear-gradient(45deg, #009688 0%, #4DB6AC 100%);box-shadow: 0 6px 20px 0 #B2DFDB;}
.yellow{background: linear-gradient(45deg, #FFC107 0%, #FFD54F 100%);box-shadow: 0 6px 20px 0 #FFECB3;}
.redish{background: linear-gradient(45deg, #f10000 0%, #b9383e 100%);box-shadow: 0 6px 20px 0 #FFECB3;}
.dorange{background: linear-gradient(45deg, #FF5722 0%, #FF8A65 100%); box-shadow: 0 6px 20px 0 #FFCCBC;}
.brown{background: linear-gradient(45deg, #795548 0%, #A1887F 100%); box-shadow: 0 6px 20px 0 #D7CCC8;}
.blue_gray{background: linear-gradient(45deg, #607D8B 0%, #78909C 100%); box-shadow: 0 6px 20px 0 #CFD8DC;}
.lime{background: linear-gradient(45deg, #CDDC39 0%, #C0CA33 100%);
box-shadow: 0 6px 20px 0 #E6EE9C;}
.divider{background: url(images/divider.png) -5px 0 repeat-x;height: 12px;background-color:#f5f2f0;margin-bottom:15px;}
.white{white-space: nowrap !important;text-overflow: ellipsis; overflow: hidden;}
h5, .h5 {
font-size: inherit;
}
select.form-control.input-sm {
padding: 1px !important;
height: 22px !important;
}
.dataTables_filter {
float: right !important;
}
</style>
<?php
//Session Info
$emp_role = $this->session->userdata('emp_role');
$emp_id = $this->session->userdata('emp_id');
$emp_cat = $this->session->userdata('emp_category');
$emp_name = $this->session->userdata('emp_name');
$teamleader = $this->session->userdata('teamleader');
$emp_grade = $this->session->userdata('emp_grade');
$today = new DateTime();
$lastDay = new DateTime('last day of this month');
$DaysRemaining = $lastDay->diff($today)->format('%a days');
$first = date('01-m-Y');
$last = date('t-m-Y');
$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";
$fin_start_date = "01"."-"."04"."-".$year;
$fin_end_date = "31"."-"."03"."-".$year2;
$m = date("m");
$mth = $m - 1 ;
$lst_mth_count = $mth - 3;
}else{
$fin_start_month = $year1."-"."04"."-"."01";
$fin_end_month = $year."-"."03"."-"."31";
$fin_start_date = "01"."-"."04"."-".$year;
$fin_end_date = "31"."-"."03"."-".$year2;
$m = date("m");
$lst_mth_count = $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);
if($emp_role === "4"){
//Portfolio Team Leaders
$tl_port = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '2' and role = '6' and deleted = '0'");
$tl_port_info = $tl_port->result_array();
//Health Team Leaders
$tl_health = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '3' and role = '6' and deleted = '0'");
$tl_health_info = $tl_health->result_array();
$pf_tl_info_qry = $this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as tl_list FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '2' and role = '6' and deleted = '0'");
$pf_tl_info = $pf_tl_info_qry->result_array();
$pf_tl = $pf_tl_info[0]['tl_list'];
$hl_tl_info_qry = $this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as tl_list FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '3' and role = '6' and deleted = '0'");
$hl_tl_info = $hl_tl_info_qry->result_array();
$hl_tl = $hl_tl_info[0]['tl_list'];
?>
<div class='col-md-12 pd0 dash_header'>
<h3 class='text-center headtxt'>Area Manager Dashboard</h3>
<div class='col-md-12'>
<div class='row mg0'>
<div class='col-md-6 pdl0'>
<div class='form-group' style='margin-bottom:4px;'>
<label style="color:#ff6f00;">Portfolio</label>
<select class='form-control input-sm'); style="text-transform: capitalize;" onchange=get_tl_info(this.value,'2','6','<?php echo $pf_tl; ?>');>
<option value=''>-- Select Portfolio --</option>
<option value='ALL'>ALL</option>
<?php foreach ($tl_port_info as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
$grade = $value['grade'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
<div class='form-group' style='margin-bottom:4px;text-transform: capitalize;'>
<label style="color:#9C27B0;">Health</label>
<select class='form-control input-sm'); onchange=get_tl_info(this.value,'3','6','<?php echo $hl_tl; ?>');>
<option value=''>-- Select Health --</option>
<option value='ALL'>ALL</option>
<?php foreach ($tl_health_info as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<div id = "tl_data" class='col-md-12'>
</div>
</div>
<?php
}
?>
<?php
if($emp_role === "1"){ ?>
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active" role="presentation">
<a data-toggle="tab" href="#business" title="<?php echo $this->lang->line('config_info_configuration'); ?>">Business</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#rm_manager" title="<?php echo $this->lang->line('config_general_configuration'); ?>">RM Manager</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#area_manager" title="<?php echo $this->lang->line('config_info_configuration'); ?>">Area Manager</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#mis_renewals" title="<?php echo $this->lang->line('config_general_configuration'); ?>">MIS & Renewals</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#m_fund" title="<?php echo $this->lang->line('config_general_configuration'); ?>">Mutual Fund</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="business">
<?php include('gmdashboard.php'); ?>
</div>
<div class="tab-pane fade" id="rm_manager">
<?php
$rm_admin_info = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where ospos_employees.role = '9' and deleted = '0'");
$rm_admin_info_id = $rm_admin_info->result_array();
$rm_manager_info=$this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as ids FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where ospos_employees.role = '9' and deleted = '0'");
$rm_manager_info_id = $rm_manager_info->result_array();
$rm_manager_info_ids = $rm_manager_info_id[0]['ids'];
//echo "sss".$rmteamids;
?>
<div class='col-md-12'>
<div class='row mg0'>
<div class='col-md-6 pdl0'>
<div class='form-group' style='margin-bottom:4px;'>
<select class='form-control input-sm'); style="text-transform: capitalize;color: #044ef9; border-color: #0852fd;" onchange=get_rm_admin_info(this.value,2,9,'<?php echo $rm_manager_info_ids; ?>');>
<option value='ALL'>-- Select RM --</option>
<option value='ALL'>ALL</option>
<?php foreach ($rm_admin_info_id as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<div id = "rm_data" class='col-md-12'>
</div>
</div>
<div class="tab-pane fade" id="area_manager">
<?php
//Portfolio Team Leaders
$tl_port = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '2' and role = '6' and deleted = '0'");
$tl_port_info = $tl_port->result_array();
//Health Team Leaders
$tl_health = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '3' and role = '6' and deleted = '0'");
$tl_health_info = $tl_health->result_array();
$pf_tl_info_qry = $this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as tl_list FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '2' and role = '6' and deleted = '0'");
$pf_tl_info = $pf_tl_info_qry->result_array();
$pf_tl = $pf_tl_info[0]['tl_list'];
$hl_tl_info_qry = $this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as tl_list FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where category = '3' and role = '6' and deleted = '0'");
$hl_tl_info = $hl_tl_info_qry->result_array();
$hl_tl = $hl_tl_info[0]['tl_list'];
?>
<div class='col-md-12 pd0 dash_header'>
<h3 class='text-center headtxt'>Area Manager Dashboard</h3>
<div class='col-md-12'>
<div class='row mg0'>
<div class='col-md-6 pdl0'>
<div class='form-group' style='margin-bottom:4px;'>
<label style="color:#ff6f00;">Portfolio</label>
<select class='form-control input-sm'); style="text-transform: capitalize;" onchange=get_tl_info(this.value,'2','6','<?php echo $pf_tl; ?>');>
<option value=''>-- Select Portfolio --</option>
<option value='ALL'>ALL</option>
<?php foreach ($tl_port_info as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
$grade = $value['grade'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
<div class='form-group' style='margin-bottom:4px;text-transform: capitalize;'>
<label style="color:#9C27B0;">Health</label>
<select class='form-control input-sm'); onchange=get_tl_info(this.value,'3','6','<?php echo $hl_tl; ?>');>
<option value=''>-- Select Health --</option>
<option value='ALL'>ALL</option>
<?php foreach ($tl_health_info as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<div id = "tl_data" class='col-md-12'>
</div>
</div>
</div>
<div class="tab-pane fade" id="mis_renewals">
<?php include('mis_dashboard.php') ?>
</div>
<div class="tab-pane fade" id="m_fund">
<?php include('mf_dashboard.php') ?>
</div>
</div>
<?php
}else
if($emp_role === "2"){
//Managerd
}else
if($emp_role === "3"){
// CRM Portfolio
if($emp_cat === "2"){
include('CrmPortfolioDashboard.php');
}
// CRM Health
if($emp_cat === "3"){
/* Head box - START */
include('CrmHealthDashboard.php');
}
}else
if($emp_role === "5"){
if($emp_cat === "2"){
include('rmdashboard.php');
}else
if($emp_cat === "4"){
include('mf_dashboard.php');
}
}else
if($emp_role === "6"){
$team = $this->db->query("SELECT GROUP_CONCAT(teammembers SEPARATOR ',') as teammembers FROM `ospos_team` where teamleader in ($emp_id) and deleted = '0'");
$team_info = $team->result_array();
$map_crm = $team_info[0]['teammembers'];
$team_ids = explode(",",$map_crm);
$map_count = substr_count($team_ids, ",") +1;
$team_ids[] = $emp_id;
$team_ids = implode(",",$team_ids);
$team_count = substr_count($team_ids, ",") +1;
$crm_portfolio_list_info = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where ospos_employees.id in ($team_ids) and deleted = '0'");
$crmportfolioteamid = $crm_portfolio_list_info->result_array();
?>
<div class='col-md-12'>
<div class='row mg0'>
<div class='col-md-6 pdl0'>
<div class='form-group' style='margin-bottom:4px;'>
<select class='form-control input-sm'); style='text-transform: capitalize;color: #044ef9; border-color: #0852fd;'' onchange=get_crm_teamleader_info(this.value);>
<option value='ALL'>ALL</option>
<?php foreach ($crmportfolioteamid as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<?php
echo ' <div id=crm_data_hide>';
//include('TeamleaderDashboard.php');
echo '</div>';
}else
if($emp_role === "7"){
//MIS
include('mis_dashboard.php');
}else
if($emp_role === "8"){
//Executive
}else
if($emp_role === "9"){
//RM Manager
//Rm's
$rm_tm_info = $this->db->query("SELECT GROUP_CONCAT(id SEPARATOR ',') as ids FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where reporting = '$emp_id' and deleted = '0'");
$rm_tm_ids = $rm_tm_info->result_array();
$rmteamids = $rm_tm_ids[0]['ids'];
$rm_info = $this->db->query("SELECT id,first_name FROM `ospos_employees` inner join ospos_people on ospos_people.person_id = ospos_employees.person_id where reporting = '$emp_id' and deleted = '0'");
$rmteamid = $rm_info->result_array();
?>
<div class='col-md-12 pd0 dash_header'>
<h3 class='text-center headtxt'>Manager Dashboard</h3>
<div class='col-md-12'>
<div class='row mg0'>
<div class='col-md-6 pdl0'>
<div class='form-group' style='margin-bottom:4px;'>
<select class='form-control input-sm'); style="text-transform: capitalize;color: #044ef9; border-color: #0852fd;" onchange=get_rm_info(this.value,2,5,'$rmteamids');>
<option value=''>-- Select RM --</option>
<option value='ALL'>ALL</option>
<?php foreach ($rmteamid as $key => $value) {
$id = $value['id'];
$first_name = $value['first_name'];
?>
<option value=<?php echo $id; ?>><?php echo $first_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<div id = "rm_data" class='col-md-12'>
</div>
</div>
<?php
}else
if($emp_role === "10"){
//RE Manager
}
?>
<div class="modal fade" id="detail_list_model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-lg" style="width: 90%;" role="document">
<div class="modal-content">
<div class="modal-header" style='padding: 5px 15px;'>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Detailed List</h4>
</div>
<div class="modal-body" id="lead_model_body" style="height:260px;">
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$.fn.dataTableExt.sErrMode = 'throw';
var emp_id = '<?php echo $emp_id ?>';
var emp_role = '<?php echo $emp_role ?>';
var emp_cat = '<?php echo $emp_cat ?>';
var ids = '<?php echo $rm_team_ids ?>';
var rm_ids = '<?php echo $rmteamids ?>';
var manager = '<?php echo $manager ?>';
var first = '<?php echo $first ?>';
var last = '<?php echo $last ?>';
var fin_start_date = '<?php echo $fin_start_date ?>';
var fin_end_date = '<?php echo $fin_end_date ?>';
$('.tbl').DataTable({
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
if(emp_role === "1"){
get_rm_admin_info("ALL",2,5,rm_ids);
get_renew_life_info("M");
get_renew_hl_info("M");
//mis call start
mis_category(2,"M");
issuance_chart(2,"M");
mis_search(2,first,last);
mis_life_chart(2,"M");
mis_rm_chart(2,first,last);
renewal_search(2,first,last);
mis_renew_chart(2,first,last);
//mis call end
//@BSK Start GM Dash 18 Aug 2018
gm_lead_portfolio_chart(fin_start_date,fin_end_date,"2");
gm_lead_portfolio_rm_chart(fin_start_date,fin_end_date,"2");
gm_health_crm_chart(fin_start_date,fin_end_date,"3");
gm_health_business_chart(fin_start_date,fin_end_date,"3");
gm_rm_avg_business_chart(fin_start_date,fin_end_date,"2");
gm_month_wise_chart(fin_start_date,fin_end_date,"2");
gm_health_avg_business_chart(fin_start_date,fin_end_date,"3");
gm_health_month_wise_chart(fin_start_date,fin_end_date,"3");
gm_mf_chart(fin_start_date,fin_end_date,"4");
gm_mf_month_wise_chart(fin_start_date,fin_end_date,"4");
//mf function call
get_ewealth_chart();
invest_login_chart();
get_login_table();
investment_chart();
//@BSK END GM Dash 18 Aug 2018
}else
if((emp_role === "3") && (emp_cat === "2")){
crm_chart(emp_id,emp_role,emp_cat);
}else
if((emp_role === "3") && (emp_cat === "3")){
crm_chart(emp_id,emp_role,emp_cat);
healthteamperformance(emp_id,emp_role,emp_cat);
}else
if((emp_role === "6") && (emp_cat === "2")){
get_crm_teamleader_info("ALL");
}else
if((emp_role === "6") && (emp_cat === "3")){
//crm_chart();
//tl_rm_met_chart();
get_crm_teamleader_info("ALL");
}else
if(emp_role === "5"){
if(emp_cat === "2"){
get_rm_val_chart("LTD");
//rm_ni_chart();
rmm_team_chart("M",manager);
get_renew_rm_info("M",emp_id);
}else
if(emp_cat === "4"){
get_ewealth_chart();
invest_login_chart();
get_login_table();
investment_chart();
}
}else
if(emp_role === "7"){
mis_category(2,"M");
issuance_chart(2,"M");
mis_search(2,first,last);
mis_life_chart(2,"M");
mis_rm_chart(2,first,last);
renewal_search(2,first,last);
mis_renew_chart(2,first,last);
}else
if(emp_role === "9"){
//rmm_ni_chart();
get_rm_info("ALL",2,5,rm_ids);
get_renew_rm_info("M",emp_id);
}
});
$(function () {
$(".datepicker").datetimepicker({
format: 'DD-MM-YYYY',
});
});
//Area Manager Function - START
function get_tl_info(emp_id,emp_cat,emp_role,tl){
if(emp_id === "ALL"){
emp_id = tl;
}
$.ajax({
type: "POST",
url: "index.php/Home/get_tl_info",
data: {emp_id:emp_id,emp_cat:emp_cat,emp_role:emp_role},
success: function(data) {
$('#tl_data').html(data);
get_map_crm_info(emp_id,emp_role,emp_cat);
crm_chart(emp_id,emp_role,emp_cat);
tl_crm_met_chart(emp_id,emp_role,emp_cat);
tl_rm_met_chart(emp_id,emp_role,emp_cat);
healthteamperformance(emp_id,emp_role,emp_cat);
$('#tbl_health').DataTable({
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
},
});
}
function get_map_crm_info(emp_id,emp_role,emp_cat){
if((emp_role === "6") && (emp_cat === "2")){
$.ajax({
type: "POST",
url: "index.php/Home/get_map_crm_info",
data: {emp_id:emp_id},
success: function(map_crm) {
get_team_info("M",emp_role,emp_cat,map_crm,'');
},
});
am_crm_chart(emp_id,emp_cat,emp_role);
/*
$('#team_info_table').DataTable({
"paging" : false,
"filter" : false,
"ordering": true,
});
*/
}else
if((emp_role === "6") && (emp_cat === "3")){
am_crm_chart(emp_id,emp_cat,emp_role);
}
}
//Area Manager Function - END
//RM Manager Function - START
function get_rm_info(emp_id,emp_cat,emp_role,rm_ids){
$.ajax({
type: "POST",
url: "index.php/Home/get_rm_info",
data: {emp_id:emp_id,emp_cat:emp_cat,emp_role:emp_role},
success: function(data) {
$('#rm_data').html(data);
manager_id = '<?php echo $this->session->userdata('emp_id') ?>';
admin=0;
get_rm_chart("LTD",emp_id,emp_role,emp_cat,admin);
rmm_team_chart("M",manager_id,admin);
if(emp_id === "ALL"){
rmm_team_chart("M",manager_id,admin);
}
//get_map_crm_info(emp_id,emp_role,emp_cat);
},
});
}
//RM Manager Function - END
//RM Chart
$('#get_rm_val_chart').on("change", function(e){
e.preventDefault();
var type = $('#get_rm_val_chart').val();
get_rm_val_chart(type);
});
// @GS 06aug2018 teamleader and crm dashboard start
function get_crm_teamleader_info(emp_id)
{
var ajaxurl="";
var emp_cat = '<?php echo $emp_cat ?>';
var emp_id_all = '<?php echo $this->session->userdata('emp_id') ?>';
var emp_role = '<?php echo $emp_role ?>';
var map_crm = '<?php echo $map_crm ?>';
if(emp_id=="ALL")
{
ajaxurl="index.php/Home/teamleaderdashboard";
}
else
{
if(emp_cat=="2")
ajaxurl="index.php/Home/crmportfoliodashboard/"+emp_id;
if(emp_cat=="3")
ajaxurl="index.php/Home/crmhealthdashboard/"+emp_id;
}
$.ajax({
type: "POST",
url: ajaxurl,
success: function(data) {
$('#crm_data_hide').html(data);
if(emp_id=="ALL")
{
crm_chart(emp_id_all,"6",emp_cat);
tl_crm_met_chart(emp_id_all,"6",emp_cat);
tl_rm_met_chart(emp_id_all,"6",emp_cat);
get_team_info("T",emp_role,emp_cat,map_crm,'');
healthteamperformance(emp_id_all,"6",emp_cat);
}
else
{
crm_chart(emp_id,"3",emp_cat);
if(emp_cat==="3")
healthteamperformance(emp_id,"3",emp_cat);
}
},
});
}
// @GS 06aug2018 teamleader and crm dashboard END
//MIS SAT 09 Aug 2018 MIS and Renewal START
//$('#mis_category').on("change", function(e)
function get_mis_category()
{
var category = $('#mis_category').val();
var date = $('#mis_date').val();
if(date === ""){
return false;
}
mis_category(category,date);
}
function get_mis_data()
{
//$('#mis_date').on("change", function(e){
var category = $('#mis_category').val();
var date = $('#mis_date').val();
if(category === ""){
alert('Please Select the Category');
return false;
}
mis_date(category,date);
//});
}
function mis_category(category,date){
var frm = "get_issuance_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date,category:category},
success: function(data) {
$('#issuance_info_table').html(data);
get_document_info(date,category);
mis_life_chart(category,date);
},
});
}
function mis_date(category,date){
var frm = "get_issuance_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date,category:category},
success: function(data) {
$('#issuance_info_table').html(data);
get_document_info(date,category);
mis_life_chart(category,date);
issuance_chart(category,date);
},
});
}
//MIS RM Business
$('#search').on("click", function(e){
var category = $('#mis_rm_category').val();
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();
if(category === ""){
alert('Please Select the Category');
return false;
}
mis_search(category,start_date,end_date);
});
function mis_search(category,start_date,end_date){
var frm = "get_business_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,category:category,start_date:start_date,end_date:end_date},
success: function(data) {
$('#business_info_table').html(data);
$('#rm_table').DataTable({
"paging": false,
});
if(category === "2"){
mis_rm_chart(category,start_date,end_date);
}else
if(category === "3"){
mis_health_chart(category,start_date,end_date);
}
},
});
}
//Renewal
$('#renew_search').on("click", function(e){
var category = $('#renew_category').val();
var start_date = $('#renew_start_date').val();
var end_date = $('#renew_end_date').val();
if(category === ""){
alert('Please Select the Category');
return false;
}
renewal_search(category,start_date,end_date);
});
function renewal_search(category,start_date,end_date){
var frm = "get_renewal_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,category:category,start_date:start_date,end_date:end_date},
success: function(data) {
$('#renew_info_table').html(data);
get_client_status(category,start_date,end_date);
mis_renew_chart(category,start_date,end_date);
},
});
}
//MIS SAT 09 Aug 2018 MIS and Renewal END
//Admin Start
// function admin_call_mis(){
// $.ajax({
// type: "POST",
// url: "index.php/Home/admin_call_mis",
// success: function(data) {
// $('#mis_renewals').html(data);
// var first = '<?php echo $first ?>';
// var last = '<?php echo $last ?>';
// mis_category(2,"M");
// issuance_chart(2,"M");
// mis_search(2,first,last);
// mis_life_chart(2,"M");
// mis_rm_chart(2,first,last);
// renewal_search(2,first,last);
// mis_renew_chart(2,first,last);
// },
// });
// }
// admin dashboad start @gs 10 aug2018
function admin_call_rm(){
$.ajax({
type: "POST",
url: "index.php/Home/admin_call_mis",
success: function(data) {
$('#mis_renewals').html(data);
var first = '<?php echo $first ?>';
var last = '<?php echo $last ?>';
mis_category(2,"M");
issuance_chart(2,"M");
mis_search(2,first,last);
mis_life_chart(2,"M");
mis_rm_chart(2,first,last);
renewal_search(2,first,last);
mis_renew_chart(2,first,last);
},
});
}
function get_rm_admin_info(emp_id,emp_cat,emp_role,rm_ids){
var admin=0;
$.ajax({
type: "POST",
url: "index.php/Home/get_rm_admin_info",
data: {emp_id:emp_id,emp_cat:emp_cat,emp_role:emp_role,rm_ids:rm_ids,admin:1},
success: function(data) {
$('#rm_data').html(data);
manager_id = rm_ids;
if(emp_id === "ALL"){
admin=1;
get_rm_chart("LTD",manager_id,emp_role,emp_cat,admin);
rmm_team_chart("M",manager_id,admin);
}
else{
get_rm_chart("LTD",emp_id,emp_role,emp_cat,'1');
rmm_team_chart("M",emp_id,admin);
}
//get_map_crm_info(emp_id,emp_role,emp_cat);
},
});
}
function gm_search()
{
var start_date=$('#gm_start_date').val();
var end_date=$('#gm_end_date').val();
gm_lead_portfolio_chart(start_date,end_date,"2");
gm_lead_portfolio_rm_chart(start_date,end_date,"2");
gm_health_crm_chart(start_date,end_date,"3");
//BSK Start GM Dashboard 16aug2018
gm_health_business_chart(start_date,end_date,"3");
gm_rm_avg_business_chart(start_date,end_date,"2");
gm_month_wise_chart(start_date,end_date,"2");
gm_health_avg_business_chart(start_date,end_date,"3");
gm_health_month_wise_chart(start_date,end_date,"3");
gm_mf_chart(start_date,end_date,"4");
gm_mf_month_wise_chart(start_date,end_date,"4");
//BSK END GM Dashboard 16aug2018
}
</script>
<?php $this->load->view('partial/footer'); ?>