File: /home/cafsindia/crm_cafsindia_com/application/views/mf_dashboard.php
<?php
//MF
//Box 1
$sip_qry = $this->db->query("SELECT IFNULL(sum(ospos_mf_investment.amount),0) as amount from ospos_mutual_fund inner join ospos_mf_investment on ospos_mf_investment.inves_mf_id = ospos_mutual_fund.mf_id INNER JOIN ospos_lead_type_info ON ospos_mf_investment.lead_id = ospos_lead_type_info.lead_id where entry_date like '$cur_month%' and investment_type = 'SIP' and fund_class = 'Equity' and lead_status = '8' AND ospos_lead_type_info.created_by in ($emp_id) and ospos_lead_type_info.status = '1'");
$sip_result = $sip_qry->result_array();
$sip_achieved = $sip_result[0]['amount'];
$sip_target_qry = $this->db->query("SELECT IFNULL(sum(sip),0) as sip_target from ospos_target where emp_id in ($emp_id) and category = '$emp_cat' and from_date like '$cur_month%' and to_date like '$cur_month%'");
$sip_target_result = $sip_target_qry->result_array();
$sip_target = $sip_target_result[0]['sip_target'];
//Box 2
$lumpsum_qry = $this->db->query("SELECT IFNULL(sum(ospos_mf_investment.amount),0) as amount from ospos_mutual_fund inner join ospos_mf_investment on ospos_mf_investment.inves_mf_id = ospos_mutual_fund.mf_id INNER JOIN ospos_lead_type_info ON ospos_mf_investment.lead_id = ospos_lead_type_info.lead_id where entry_date like '$cur_month%' and investment_type = 'Lumpsum' and lead_status = '8' AND ospos_lead_type_info.created_by in ($emp_id) and ospos_lead_type_info.status = '1'");
$lumpsum_result = $lumpsum_qry->result_array();
$lumpsum = $lumpsum_result[0]['amount'];
//Box 3
$doc_status_qry = $this->db->query("SELECT count(*) as count from ospos_mutual_fund inner join ospos_mf_ewealth on ospos_mf_ewealth.inves_mf_id = ospos_mutual_fund.mf_id inner join ospos_mf_investment on ospos_mf_investment.inves_mf_id = ospos_mutual_fund.mf_id where entry_date like '$cur_month%' and doc_sts = 'Activated' and ospos_mf_ewealth.status = '1'");
$doc_result = $doc_status_qry->result_array();
$doc_count = $doc_result[0]['count'];
//Box 4
$life_login_qry = $this->db->query("SELECT IFNULL(sum(overall_net_premium),0) as value FROM `ospos_lead_type_info` INNER JOIN ospos_leads_product on lead_type_id = lead_info_id inner join ospos_leads on ospos_leads.lead_id = ospos_lead_type_info.lead_id where product_category = '2' and prospect_level='4' and (ospos_lead_type_info.created_by in ($emp_id) or rm_name in ($emp_id)) and login_date like '$cur_month%' and ospos_leads_product.status = '1'");
$life_login_result = $life_login_qry->result_array();
$life_login = $life_login_result[0]['value'];
//Box 5
$mf_renewal_qry = $this->db->query("SELECT DISTINCT(count(cust_id)) as count from ospos_mutual_fund inner join ospos_mf_investment on ospos_mf_investment.inves_mf_id = ospos_mutual_fund.mf_id where entry_date like '$cur_month%' and purpose = 'Renewal' and ospos_mf_investment.status = '1'");
$mf_renewal_result = $mf_renewal_qry->result_array();
$mf_renewal = $mf_renewal_result[0]['count'];
echo "<div class='col-md-12 pd0 dash_header'>
<h3 class='text-center headtxt'>MF Dashboard</h3>
<div class='row mg0 mgb15'>
<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='SIP Achieved & Target'>
<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>SIP</h5> <span class='bold'>$sip_achieved</span> <div style='position: absolute; top: 5px; right: 25px; font-weight: bold;font-size: 11px;'>$sip_target</div></td>
</tr>
</table>
</div>
</div>
<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='Lumpsum'>
<div class='dashbox red'>
<table>
<tr>
<td class='pd10'><i class='fa fa-sign-in fa-2x' aria-hidden='true'></i></td>
<td class='white'><h5>Lumpsum</h5> <span class='bold'>$lumpsum</span></td>
</tr>
</table>
</div>
</div>
<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='SIP'>
<div class='dashbox blue'>
<table>
<tr>
<td class='pd10'><i class='fa fa-bookmark-o fa-2x' aria-hidden='true'></i></td>
<td class='white'><h5>Ewealth Activated</h5> <span class='bold'>$doc_count</span></td>
</tr>
</table>
</div>
</div>
<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='Life'>
<div class='dashbox brown'>
<table>
<tr>
<td class='pd10'><i class='fa fa-history fa-2x' aria-hidden='true'></i></td>
<td class='white'><h5>Life</h5> <span class='bold'>$life_login</span></td>
</tr>
</table>
</div>
</div>
<div class='col-md-2 pdl0' data-toggle='tooltip' data-placement='right' title='MF Renewal Purpose'>
<div class='dashbox redish'>
<table>
<tr>
<td class='pd10'><i class='fa fa-user-md fa-2x' aria-hidden='true'></i></td>
<td class='white'><h5>Renewal</h5> <span class='bold'> $mf_renewal</span></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='col-md-12'>
<div class='col-md-6 pdl0'>
<div class='col-md-12 col-style'>
<div id='investment_chart' style='height:315px;'></div>
</div>
</div>
<div class='col-md-6 pdl0'>
<div class='col-md-12 col-style'>
<div id='ewealth_chart' style='height:315px;'></div>
</div>
</div>
</div>
<div class='col-md-12'>
<div class='col-md-6 pdl0'>
<div class='col-md-12 col-style'>
<div id='get_login_table' ></div>
</div>
</div>
<div class='col-md-6 pdl0'>
<div class='col-md-12 col-style'>
<div id='invest_login_chart' style='height:284px;'> </div>
</div>
</div>
</div>";
?>