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/login_cafsindia_com/dist/highcharts/drill_back_.js
$(document).ready(function() {
    //var win_widdh = $(window).width();

	Highcharts.theme = {
		colors: ['rgba(244, 143,177, 0.5)','rgba(255, 255, 0, 0.3)','rgba(255,0,255,0.3)','rgba(0,255,0,0.3)','rgba(129, 2, 247, 1)','rgba(255, 111, 0, 0.3)','rgba(255, 111, 0, 0.3)','rgba(64, 247, 2, 1)','rgba(38, 198, 218, 0.5)' ],
		chart: {
			backgroundColor: {
				linearGradient: [255, 111, 0, 0.27],
				stops: [
					[0, 'rgb(255, 111, 0, 0.27)'],
					[1, 'rgb(255, 111, 0, 0.27)']
				]
			},
		},
		title: {
			style: {
				color: '#000',
				font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
			}
		},
		subtitle: {
			style: {
				color: '#666666',
				font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
			}
		},

		legend: {
			itemStyle: {
				font: '9pt Trebuchet MS, Verdana, sans-serif',
				color: 'black',
				width: 200
			},
			itemHoverStyle:{
				color: 'gray'
			}   
		}
	};

	// Apply the theme
	Highcharts.setOptions(Highcharts.theme);
});

// Onchange function - START
function get_team_info(date,emp_role,emp_cat,emp_id,misc){
    var frm = "get_team_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,date:date,misc:misc},
      success: function(data) {
        $('table#team_info_table tbody').html(data);
        $('#team_info_table').DataTable({        
          "paging":   false, 
                  "dom": '<"top"fi>rt<"bottom"flp><"clear">'          
        });
      },
    });
}
function get_renewal_info(date){
    var frm = "get_renewal_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date},
      success: function(data) {
        $('table#renewal_info_table tbody').html(data);
      },
    });
}
/*
function get_productivity_info(date){
    var frm = "get_productivity_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date},
      success: function(data) {
        $('#productivity_info_table').html(data);
      },
    });
}
*/

//SAT Start New MIS Dashboard

function get_cat_issuance_info(category){
	var date     = $('#mis_date').val();
	if(!date){
		date = "M";
	}
	 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);
      },
    });
}
function get_document_info(date,category){
	var frm = "get_document_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date,category:category},
      success: function(data) {
        $('#document_info_table').html(data);
		get_app_info(date);
      },
    });
}
function get_app_info(date){
	var frm = "get_app_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date},
      success: function(data) {
        $('#app_info_table').html(data);
      },
    });
}
function get_renew_life_info(date){
    var frm = "get_renew_life_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date},
      success: function(data) {
        $('table#renew_life_info_table tbody').html(data);
      },
    });
}

function get_renew_hl_info(date){
    var frm = "get_renew_hl_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date},
      success: function(data) {
        $('table#renew_hl_info_table tbody').html(data);
      },
    });
}

function get_renew_rm_info(date,ids){
    var frm = "get_renew_rm_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date,ids:ids},
      success: function(data) {
        $('table#renew_rm_info_table tbody').html(data);
      },
    });
}
// Onchange function - END

// Model Popup function - START
function get_lead_info(emp_role,emp_cat,emp_id,lead_status,date,misc){
    var frm = "get_lead_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,lead_status:lead_status,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable({
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_rm_lead_info(emp_role,emp_cat,emp_id,prospect,date,misc){
    var frm = "get_rm_lead_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,prospect:prospect,date:date,misc:misc},
      success: function(data) {
        //alert(data);
        $('#lead_model_body').html(data);
    		$('#detail_list').DataTable({
    			"paging":   false, 
                "dom": '<"top"fi>rt<"bottom"flp><"clear">'
    		});
        $('#detail_list_model').modal('show');
      },
    });
}
function rm_lead_info(emp_role,emp_cat,emp_id,prospect,date,misc){
    var frm = "rm_lead_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,prospect:prospect,date:date,misc:misc},
      success: function(data) {
        //alert(data);
        $('#lead_model_body').html(data);
    $('#detail_list').DataTable( {
      "paging":   false, 
      "dom": '<"top"fi>rt<"bottom"flp><"clear">'
    });
        $('#detail_list_model').modal('show');
      },
    });
}
function get_lead_info_type(emp_role,emp_cat,emp_id,sts,date,misc){
	var frm = "get_lead_info_type";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_rm_ocl(emp_role,emp_cat,emp_id,sts,date,misc){
	var frm = "get_rm_ocl";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_admin_ocl(emp_role,emp_cat,emp_id,sts,date,misc){
  var frm = "get_admin_ocl";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
    $('#detail_list').DataTable( {
      "paging":   false, 
      "dom": '<"top"fi>rt<"bottom"flp><"clear">'
    });
        $('#detail_list_model').modal('show');
      },
    });
}
/*
function get_mis_rmlead(emp_role,emp_cat,emp_id,sts,date,misc){
	var frm = "get_mis_rmlead";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
*/

//RM Chart
	$('#get_rm_val_chart').on("change", function(e){
		e.preventDefault();
		var type = $('#get_rm_val_chart').val();
		get_rm_val_chart(type);
	});
	
/*
function get_document_info(mode,cat,sts){
	var frm = "get_document_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,mode:mode,cat:cat,sts:sts},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
*/
function get_renewal_info_list(date,cat,emp_ids,sts){
	var frm = "get_renewal_info_list";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date,cat:cat,emp_ids:emp_ids,sts:sts},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
// Model Popup function - END
//Chart function - START
function mis_hl_chart() {
    var options = {
        chart: {
            renderTo: 'mis_hl_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Health chart'
        },
        tooltip: {
            formatter: function() {
                percentage = this.percentage.toFixed(2);
                return '<b>' + this.point.name + '</b>: ' + this.y + '</b>: ' + percentage+'%';
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
				center: [150, 75],
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        percentage = this.percentage.toFixed(2);
                        return '<b>' + this.point.name + '</b>: ' + this.y + '</b>: ' + percentage+'%';
                    }
                },
               showInLegend: true
            }
        },
		legend: {
			enabled: true,
			floating: true,
			verticalAlign: 'top',
			align:'right',
			width: 200,
			x:-30,
			y:30,
			useHTML: true,
			labelFormatter: function() {
				//return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
				percentage = this.percentage.toFixed(2);
				return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
			}
		},
        series: []
    };
    $.getJSON("index.php/home/mis_hl_chart", function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}

function crm_chart(emp_id,emp_role,emp_cat){
	var options = {
        chart: {
			type: 'pie',
			name:'Lead Status',
            renderTo: 'crm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Over all performance'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
     data: {emp_id_all:emp_id,emp_cat:emp_cat,role:emp_role},
		url: './index.php/home/crm_chart',
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
	
}

// MET chart for team leader from crm 04aug2018 @GS 

function tl_crm_met_chart(emp_id_all,role,emp_cat){

  var options = {
        chart: {
      type: 'pie',
      name:'Lead Status',
            renderTo: 'tl_crm_met_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'CRM MET Performance'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
     data: {emp_id_all:emp_id_all,emp_cat:emp_cat,role:role},
    url: './index.php/home/tl_crm_met_chart',
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      chart = new Highcharts.Chart(options);
    },
  });
  
}
// MET chart for team leader from RM 04aug2018 @GS 
function tl_rm_met_chart(emp_id_all,role,emp_cat){
  var options = {
        chart: {
      type: 'pie',
      name:'Lead Status',
            renderTo: 'tl_rm_met_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'RM MET Performance'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    data: {emp_id_all:emp_id_all,emp_cat:emp_cat,role:role},
    url: './index.php/home/tl_rm_met_chart',
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      chart = new Highcharts.Chart(options);
    },
  });
  
}


// @GS Health performance dashboard

function healthteamperformance(emp_id_all,role,emp_cat){
  var options = {
        chart: {
          size:'100%',
      type: 'pie',
      name:'performance',
            renderTo: 'healthteamperformance',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'This Month Performance'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    data: {emp_id_all:emp_id_all,emp_cat:emp_cat,role:role},
    url: './index.php/home/healthteamperformance',
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      chart = new Highcharts.Chart(options);
    },
  });
  
}


function rmm_team_chart(date,emp_id,admin) {
    var options = {
        chart: {
            renderTo: 'rmm_team_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			  options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			  }
        },
        title: {
            text: 'RM chart'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
				center: [150, 75],
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
               showInLegend: true
            }
        },
    legend: {
		enabled: true,
		floating: true,
		verticalAlign: 'top',
		align:'right',
		width: 200,
		x:-30,
		y:30,
		useHTML: true,
		labelFormatter: function() {
		  //return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
			percentage = this.percentage.toFixed(2);
			return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
		}
    },
        series: []
    };
    $.getJSON("index.php/home/rmm_team_chart?date="+date+"&emp_id="+emp_id+"&admin="+admin, function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}

function am_crm_chart(emp_id,emp_cat,emp_role){
	var options = {
        chart: {
			type: 'pie',
			name:'Lead Status',
            renderTo: 'crm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Over all performance'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
		url: "./index.php/home/am_crm_chart?emp_id="+emp_id+"&emp_cat="+emp_cat+"&emp_role="+emp_role,
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
	
}
function rm_ni_chart() {
    var options = {
        chart: {
            renderTo: 'rm_ni_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Not Interested chart'
        },
        tooltip: {
            formatter: function() {
                return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
               showInLegend: true
            }
        },
    legend: {
		enabled: true,
		floating: true,
		verticalAlign: 'top',
		align:'right',
		width: 200,
		y:30,
		useHTML: true,
		labelFormatter: function() {
		  return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
		}
    },
        series: []
    };
    $.getJSON("index.php/home/rm_ni_chart", function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}
function rmm_ni_chart() {
    var options = {
        chart: {
            renderTo: 'rmm_ni_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Not Interested chart'
        },
        tooltip: {
            formatter: function() {
                return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
               showInLegend: true
            }
        },
    legend: {
		enabled: true,
		floating: true,
		verticalAlign: 'top',
		align:'right',
		width: 200,
		y:30,
		useHTML: true,
		labelFormatter: function() {
			return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
		}
    },
        series: []
    };
    $.getJSON("index.php/home/rmm_ni_chart", function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}
function bar_report(role,category,start_date,end_date,status){

    var options = {
            chart: {
        renderTo: 'bar_report',
        type: 'column'
        },
        title: {
            text: 'Report'
        },
        xAxis: {
            categories: [],
            crosshair: true,
            title: {
                text: 'Names'
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Value'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
           column: {
            pointPadding: 0.2,
            borderWidth: 0
			}
        },
        series: []
    };
    $.getJSON("index.php/Report/role_wise_bar?role="+role+"&category="+category+"&status="+status+"&start="+start_date+"&end="+end_date, function(json) {

        options.xAxis.categories = json[0]['data'];
        options.series[0] = json[1];        
        chart = new Highcharts.Chart(options);
    });
}
function get_rm_val_chart(type){
	var options = {
        chart: {
			type: 'pie',
			name:'Lead Status',
            renderTo: 'rm_val_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Over all performance'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
			 
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
					//format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                    formatter: function() {
                        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
		url: './index.php/home/get_rm_val_chart?type='+type,
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
}
function get_rm_chart(type,emp_id,emp_role,emp_cat,admin){

	var options = {
        chart: {
			type: 'pie',
			name:'Lead Status',
            renderTo: 'rm_val_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Over all performance'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
			 
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
					//format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                    formatter: function() {
                        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
		url: './index.php/home/get_rm_chart?type='+type+'&emp_id='+emp_id+'&emp_role='+emp_role+'&emp_cat='+emp_cat,
     data: {type:type,emp_id:emp_id,emp_role:emp_role,emp_cat:emp_cat,admin:admin},
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
}
//MIS SAT 09aug2018 START
function get_issued_info(mode,cat,sts){
	var frm = "get_issued_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,mode:mode,cat:cat,sts:sts},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_client_status(category,start_date,end_date){
	var frm = "get_client_status";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,start_date:start_date,end_date:end_date,category:category},
      success: function(data) {
        $('#client_status_table').html(data);
      },
    });
}
function get_issuance_list(date,category,sts,type){
	 var frm = "get_issuance_list";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,date:date,category:category,sts:sts,type:type},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_lead_info_issued(emp_role,emp_cat,emp_id,sts,date,misc){
	var frm = "get_lead_info_issued";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_mis_rmlead(emp_role,emp_cat,emp_id,sts,start_date,end_date,misc){
	var frm = "get_mis_rmlead";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,start_date:start_date,end_date:end_date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_mis_hllead(emp_role,emp_cat,emp_id,sts,start_date,end_date,misc){
	var frm = "get_mis_hllead";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,start_date:start_date,end_date:end_date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_mis_lead_info(emp_role,emp_cat,emp_id,sts,date,misc){
	var frm = "get_mis_lead_info";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function get_mis_renewal(type,category,start_date,end_date,sts){
	var frm = "get_mis_renewal_list";
    $.ajax({
      type: "POST",
      url: "./dashboard/call_back.php",
      data: {frm:frm,type:type,category:category,start_date:start_date,end_date:end_date,sts:sts},
      success: function(data) {
        $('#lead_model_body').html(data);
		$('#detail_list').DataTable( {
			"paging":   false, 
            "dom": '<"top"fi>rt<"bottom"flp><"clear">'
		});
        $('#detail_list_model').modal('show');
      },
    });
}
function mis_health_chart(category,start_date,end_date) {
    var options = {
        chart: {
            renderTo: 'mis_rm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			  options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			  }
        },
        title: {
            text: 'Health Business'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
				center: [150, 75],
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
               showInLegend: true
            }
        },
    legend: {
		enabled: true,
		floating: true,
		verticalAlign: 'top',
		align:'right',
		width: 200,
		x:-30,
		y:30,
		useHTML: true,
		labelFormatter: function() {
		  //return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
			percentage = this.percentage.toFixed(2);
			return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
		}
    },
        series: []
    };
    $.getJSON("index.php/home/mis_health_chart?category="+category+"&start_date="+start_date+"&end_date="+end_date, function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}
function mis_rm_chart(category,start_date,end_date) {
    var options = {
        chart: {
            renderTo: 'mis_rm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			  options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			  }
        },
        title: {
            text: 'Portfolio Business'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 35,
				center: [150, 75],
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
               showInLegend: true
            }
        },
    legend: {
		enabled: true,
		floating: true,
		verticalAlign: 'top',
		align:'right',
		width: 200,
		x:-30,
		y:30,
		useHTML: true,
		labelFormatter: function() {
		  //return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
			percentage = this.percentage.toFixed(2);
			return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;text-transform:Capitalize;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
		}
    },
        series: []
    };
    $.getJSON("index.php/home/mis_rm_chart?category="+category+"&start_date="+start_date+"&end_date="+end_date, function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
}
function mis_renew_chart(category,start_date,end_date){
	
	var options = {
        chart: {
			type: 'pie',
			name:'Renew Status',
            renderTo: 'renew_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Renewal Status'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
				size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'</b>';			
                    },
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
		url: './index.php/Home/renew_chart?category='+category+'&start_date='+start_date+'&end_date='+end_date,
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
}
function issuance_chart(category,date){
	
	var options = {
        chart: {
			type: 'pie',
			name:'Lead Status',
            renderTo: 'issuance_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
			options3d: {
				enabled: true,
				alpha: 45,
				beta: 0
			}
        },
        title: {
            text: 'Issuance Status'
        },
        tooltip: {
            formatter: function() {
				return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
				size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
				depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
						return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'</b>';			
                    },
                },
                showInLegend: false
            }
        },
        series: [],
		drilldown: {
			series: []
		}
    };	
	$.ajax({
		type: "POST",
		url: './index.php/Home/issuance_chart?date='+date+'&category='+category,
		success: function(data) {
			var rslt = JSON.parse(data);			
			options.series = rslt.series; 
			options.drilldown.series = rslt.drill_list;
			chart = new Highcharts.Chart(options);
		},
	});
}
function mis_life_chart(category,type) {
    var options = {
        chart: {
        renderTo: 'mis_life_chart',
        type: 'column'
        },
        title: {
			text: 'Business'
							
        },
        xAxis: {
            categories: [],
            crosshair: true,
            title: {
                text: 'Company'
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Value'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
           column: {
            pointPadding: 0.2,
            borderWidth: 0
			}
        },
        series: []
    };
    $.getJSON("index.php/Home/mis_life_chart?category="+category+"&type="+type, function(json) {
        options.xAxis.categories = json[0]['data'];
        options.series[0] = json[1];        
        chart = new Highcharts.Chart(options);
    });
}
//MIS SAT 09aug2018 END
//Chart function - END
// gm lead chart start
function gm_lead_portfolio_chart(start_date,end_date,emp_cat)
{
  
  var options = {
        chart: {
      type: 'pie',
      name:'Lead Status',
            renderTo: 'gm_lead_portfolio_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Over all lead performance'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
     data: {start_date:start_date,end_date:end_date,emp_cat:emp_cat},
    url: './index.php/home/gm_lead_portfolio_chart',
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
  
}

function gm_lead_portfolio_rm_chart(start_date,end_date,emp_cat) { 
    var options = {
        chart: {
            renderTo: 'gm_lead_portfolio_rm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,            
        options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
        } 
        },
        title: {
            text: 'RM Performance chart'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },       
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
        center: [110, 95],
                dataLabels: {
                    enabled: false,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                    }
                },
               showInLegend: true
            },            
        },      
    legend: {
          enabled: true,
          floating: true,
          verticalAlign: 'top',
          align:'right',
          width: 140,
          x:-33,
          y:20,
          useHTML: true,
          labelFormatter: function() {
            //return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
            percentage = this.percentage.toFixed(2);
            return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:60px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:45px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:40px;'>"+percentage+"%</div></div>";
        }
    },
        series: []
    };

    $.getJSON("index.php/home/gm_lead_portfolio_rm_chart?start_date="+start_date+"&end_date="+end_date+"&emp_cat="+emp_cat, function(json) {
        options.series = json;
        chart = new Highcharts.Chart(options);
    });
    
}


function gm_health_crm_chart(start_date,end_date,emp_cat){
 var options = {
        chart: {
      type: 'pie',
      name:'Lead Status',
            renderTo: 'gm_health_crm_chart',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Health CRM Performance'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                //return '<b>' + this.point.name + '</b>: ' + this.y;
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 35,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
                        //return '<b>' + this.point.name + '</b>: ' + this.y;
                    }
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
     data: {start_date:start_date,end_date:end_date,emp_cat:emp_cat},
    url: './index.php/home/gm_health_crm_chart',
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
  
}

//SK Start GM Dashboard
function gm_rm_avg_business_chart(start_date,end_date,category){
  
  var options = {
      chart: {
      type: 'pie',
      name:'Lead Status',
      renderTo: 'gm_rm_avg_business_chart',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Life RM Average Contribution'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+   Math.round(this.y)+'</b>';
            }
        },
        plotOptions: {
            pie: {
        size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+   Math.round(this.y)+'</b>';     
                    },
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    url: './index.php/Home/gm_rm_avg_business_chart?start_date='+start_date+'&end_date='+end_date+'&category='+category,
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
}
function gm_month_wise_chart(start_date,end_date,category)
{
     var options = {
        chart: {
            renderTo: 'gm_month_wise_chart',
            type: 'line'
        },
        title: {
            text: 'Life Month wise Growth',
            x: -20 //center
        },
        subtitle: {
            text: 'Business',
            x: -20
        },
        xAxis: {
            categories: [],
            title: {
                text: 'Month'
            }
        },
        yAxis: {
            title: {
                text: 'Value'
            },
            plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#d84f57'
                }]
        },
        tooltip: {
            valueSuffix: ''
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: []
    };
    $.getJSON("./index.php/Home/gm_month_wise_chart?start_date="+start_date+"&end_date="+end_date+"&category="+category, function(json) {
       //alert(data);
        options.xAxis.categories = json[0]['data']; //xAxis: {categories: []}
        options.series[0] = json[1];
        chart = new Highcharts.Chart(options);
    });
}
//Health Avg Business Chart
function gm_health_avg_business_chart(start_date,end_date,category){
  var options = {
      chart: {
      type: 'pie',
      name:'Lead Status',
      renderTo: 'gm_health_avg_business_chart',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Health Manager Average Contribution'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+   Math.round(this.y)+'</b>';
            }
        },
        plotOptions: {
            pie: {
        size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+   Math.round(this.y)+'</b>';     
                    },
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    url: './index.php/Home/gm_health_avg_business_chart?start_date='+start_date+'&end_date='+end_date+'&category='+category,
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
}
function gm_health_month_wise_chart(start_date,end_date,category)
{
     var options = {
        chart: {
            renderTo: 'gm_health_month_wise_chart',
            type: 'line'
        },
        title: {
            text: 'Health Month wise Growth',
            x: -20 //center
        },
        subtitle: {
            text: 'Business',
            x: -20
        },
        xAxis: {
            categories: [],
            title: {
                text: 'Month'
            }
        },
        yAxis: {
            title: {
                text: 'Value'
            },
            plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#d84f57'
                }]
        },
        tooltip: {
            valueSuffix: ''
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: []
    };
    $.getJSON("./index.php/Home/gm_health_month_wise_chart?start_date="+start_date+"&end_date="+end_date+"&category="+category, function(json) {
       //alert(data);
        options.xAxis.categories = json[0]['data']; //xAxis: {categories: []}
        options.series[0] = json[1];
        chart = new Highcharts.Chart(options);
    });
}

function gm_health_business_chart(start_date,end_date,category){
  
  var options = {
      chart: {
      type: 'pie',
      name:'Lead Status',
      renderTo: 'gm_health_business_chart',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'Health Manager Business'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
        size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';     
                    },
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    url: './index.php/Home/gm_health_business_chart?start_date='+start_date+'&end_date='+end_date+'&category='+category,
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
}
function gm_mf_chart(start_date,end_date,category){
  
  var options = {
      chart: {
      type: 'pie',
      name:'Mutual Fund',
      renderTo: 'gm_mf_chart',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      options3d: {
        enabled: true,
        alpha: 45,
        beta: 0
      }
        },
        title: {
            text: 'RM SIP Business'
        },
        tooltip: {
            formatter: function() {
        return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';
            }
        },
        plotOptions: {
            pie: {
        size:'100%',
                allowPointSelect: true,
                cursor: 'pointer',
        depth: 50,
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
            return  '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+  this.y+'</b>';     
                    },
                },
                showInLegend: false
            }
        },
        series: [],
    drilldown: {
      series: []
    }
    };  
  $.ajax({
    type: "POST",
    url: './index.php/Home/gm_mf_chart?start_date='+start_date+'&end_date='+end_date+'&category='+category,
    success: function(data) {
      var rslt = JSON.parse(data);      
      options.series = rslt.series; 
      options.drilldown.series = rslt.drill_list;
      chart = new Highcharts.Chart(options);
    },
  });
}

function gm_mf_month_wise_chart(start_date,end_date,category)
{
     var options = {
        chart: {
            renderTo: 'gm_mf_month_wise_chart',
            type: 'line'
        },
        title: {
            text: 'MF Month wise Growth',
            x: -20 //center
        },
        subtitle: {
            text: 'Business',
            x: -20
        },
        xAxis: {
            categories: [],
            title: {
                text: 'Month'
            }
        },
        yAxis: {
            title: {
                text: 'Value'
            },
            plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#d84f57'
                }]
        },
        tooltip: {
            valueSuffix: ''
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: []
    };
    $.getJSON("./index.php/Home/gm_mf_month_wise_chart?start_date="+start_date+"&end_date="+end_date+"&category="+category, function(json) {
       //alert(data);
        options.xAxis.categories = json[0]['data']; //xAxis: {categories: []}
        options.series[0] = json[1];
        chart = new Highcharts.Chart(options);
    });
}