File: /home/cafsindia/crm_cafsindia_com/application/controllers/Home - Copy.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Secure_Controller.php");
class Home extends Secure_Controller {
public function __construct(){
parent::__construct();
$this->load->model("Homemodel");
}
public function index(){
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
$data="";
$this->load->view('home',$data);
}
public function mis_life_chart(){
$result = $this->Homemodel->mis_life_chart();
$rows['type'] = 'pie';
$rows['name'] = 'Company';
foreach ($result as $key => $value) {
$rows['data'][] = array($value['vendorcompanyname'], $value['tot_count']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
}
public function mis_hl_chart(){
$result = $this->Homemodel->mis_hl_chart();
$rows['type'] = 'pie';
$rows['name'] = 'Company';
foreach ($result as $key => $value) {
$rows['data'][] = array($value['vendorcompanyname'], $value['tot_count']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
}
public function crm_chart(){
$result = $this->Homemodel->crm_chart();
$drill_list = array();
foreach ($result as $key => $value) {
$lead_status = $value['lead_status'];
$statusname = $value['statusname'];
$lead_count = $value['lead_count'];
$rows['data'][] = array("name"=>$statusname,"y"=>$lead_count,"drilldown"=>$statusname);
$drill_result = $this->Homemodel->crm_chart_drill($lead_status);
$drill = array();
$drill['name'] = $statusname;
$drill['id'] = $statusname;
foreach ($drill_result as $key => $value) {
$prospect_name = $value['prospect_name'];
$lead_count = $value['lead_count'];
$drill['data'][] = array($prospect_name,$lead_count);
array_push($drill_list,$drill);
}
}
$rslt = array();
array_push($rslt,$rows);
echo json_encode(array('series' => $rslt, 'drill_list' => $drill_list),JSON_NUMERIC_CHECK);
}
//
// public function salebyitem(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebyitem();
// $rows['type'] = 'pie';
// $rows['name'] = 'Revenue';
// //$rows['innerSize'] = '50%';
//
// foreach ($result as $key => $value) {
// $rows['data'][] = array($value['name'], $value['total']);
// }
// $rslt = array();
// array_push($rslt,$rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salesbyitemline(){
//
// $result = $this->Homemodel->salesbyitemline();
// $bln = array();
// $bln['name'] = 'Products';
// $rows['name'] = 'Sales By Product';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
// public function salesbyitembar(){
// $result = $this->Homemodel->salesbyitemline();
// $bln = array();
// $bln['name'] = 'Products';
// $rows['name'] = 'Sales By Product';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
// public function salebycategory(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebycategory();
// $rows['type'] = 'pie';
// $rows['name'] = 'Revenue';
// //$rows['innerSize'] = '50%';
//
// foreach ($result as $key => $value) {
// $rows['data'][] = array($value['name'], $value['total']);
// }
// $rslt = array();
// array_push($rslt,$rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
// public function salesbycatline(){
//
// $result = $this->Homemodel->salesbycatline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Category';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
// public function salesbycatbar(){
//
// $result = $this->Homemodel->salesbycatline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Category';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
//
// public function salebyemployee(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebyemployee();
// $rows['type'] = 'pie';
// $rows['name'] = 'Revenue';
// //$rows['innerSize'] = '50%';
//
// foreach ($result as $key => $value) {
// $rows['data'][] = array($value['name'], $value['total']);
// }
// $rslt = array();
// array_push($rslt,$rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
// public function salebyemployeeline(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebyemployeeline();
// //$result = $this->Homemodel->salesbycatline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Employee';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
// public function salebyemployeebar(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebyemployeeline();
// //$result = $this->Homemodel->salesbycatline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Employee';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
// public function salebypaymenttype(){
// //echo "ss"; die;
// $result = $this->Homemodel->salebypaymenttype();
// $rows['type'] = 'pie';
// $rows['name'] = 'Revenue';
// //$rows['innerSize'] = '50%';
//
// foreach ($result as $key => $value) {
// $rows['data'][] = array($value['name'], $value['total']);
// }
// $rslt = array();
// array_push($rslt,$rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salebypaymenttypeline(){
// $result = $this->Homemodel->salebypaymenttypeline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Payment';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salebypaymenttypebar(){
// $result = $this->Homemodel->salebypaymenttypeline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Payment';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['name'];
// $rows['data'][] = $value['total'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salebydate(){
// $result = $this->Homemodel->salebydate();
// $rows['type'] = 'pie';
// $rows['name'] = 'Revenue';
// //$rows['innerSize'] = '50%';
//
// foreach ($result as $key => $value) {
// $rows['data'][] = array($value['saledate'], $value['payment']);
// }
// $rslt = array();
// array_push($rslt,$rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salebydateline(){
// $result = $this->Homemodel->salebydateline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Date';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['saledate'];
// $rows['data'][] = $value['payment'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
//
// }
// public function salebydatebar(){
// $result = $this->Homemodel->salebydateline();
// $bln = array();
// $bln['name'] = 'Items';
// $rows['name'] = 'Sales By Date';
// foreach ($result as $key => $value) {
// $bln['data'][] = $value['saledate'];
// $rows['data'][] = $value['payment'];
// }
// $rslt = array();
// array_push($rslt, $bln);
// array_push($rslt, $rows);
// print json_encode($rslt, JSON_NUMERIC_CHECK);
// }
//
public function logout(){
$this->Employee->logout();
}
}
?>