<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends REF_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->model('home_model', '', TRUE);
        $this->load->model('reports/daily_summary_model', '', TRUE);
        $this->load->model('general_settings_model', '', TRUE);
    }
    
    public function index() {
        $data = array();
        $data['header'] = array();
        $data['header']['page_title'] = 'Dashboard';
        
        /*
         * Get Archanai Graph
         */
        //$data['categories'] = $this->home_model->get(TBL_CATEGORY, array( 'where' => array('status' => 1) ));
        
        // Daily Report
        $date = date('d-m-Y');
        $data_type = ($this->input->post('submit') != 'Submit') ? $this->input->post('submit') : 'Get Summary Data';
        $abishegam = $this->daily_summary_model->get_abishegam_data($date,$data_type);
      /*
	  $festival = $this->daily_summary_model->get_festival_data($date,$data_type);
        $ubayam = $this->daily_summary_model->get_ubayam_data($date,$data_type);
        $mega = $this->daily_summary_model->get_mega_data($date,$data_type);
        $other = $this->daily_summary_model->get_other_service_data($date,$data_type);
        $gold_silver = $this->daily_summary_model->get_gold_silver_data($date,$data_type);
        $temple = $this->daily_summary_model->get_temple_activity_data($date,$data_type);
        $member_subscripe = $this->daily_summary_model->get_member_subscribe_data($date,$data_type);
        $building_fund  = $this->daily_summary_model->get_building_fund_data($date,$data_type);
        $outdoor = $this->daily_summary_model->get_outdoor_data($date,$data_type);
        $prasadam = $this->daily_summary_model->get_prasadam_data($date,$data_type);
        $madappalli = $this->daily_summary_model->get_madappalli_data($date,$data_type);
        $donation = $this->daily_summary_model->get_donation_data($date,$data_type);
        $hall_booking = $this->daily_summary_model->get_hall_booking_data($date,$data_type);
        $wedding_hall = $this->daily_summary_model->get_wed_hall_booking_data($date,$data_type);
        $archanai = $this->daily_summary_model->get_archanai_data($date,$data_type);
        $kattalai = $this->daily_summary_model->get_kattalai_data($date,$data_type);
        $membership = $this->daily_summary_model->get_membership_data($date,$data_type);
        $card_topup = $this->daily_summary_model->get_membership_card_topup_data($date,$data_type);
		*/
        /*
        $data['results'] = array_merge($abishegam,$archanai,$building_fund,$donation,$festival,$gold_silver,$hall_booking,$kattalai,$madappalli,$mega,$member_subscripe,$membership,$card_topup,$outdoor,$other,$prasadam,$temple,$ubayam,$wedding_hall);
		*/
		$data['results'] = array_merge(
			isset($abishegam) && is_array($abishegam) ? $abishegam : array(),
			isset($archanai) && is_array($archanai) ? $archanai : array(),
			isset($building_fund) && is_array($building_fund) ? $building_fund : array(),
			isset($donation) && is_array($donation) ? $donation : array(),
			isset($festival) && is_array($festival) ? $festival : array(),
			isset($gold_silver) && is_array($gold_silver) ? $gold_silver : array(),
			isset($hall_booking) && is_array($hall_booking) ? $hall_booking : array(),
			isset($kattalai) && is_array($kattalai) ? $kattalai : array(),
			isset($madappalli) && is_array($madappalli) ? $madappalli : array(),
			isset($mega) && is_array($mega) ? $mega : array(),
			isset($member_subscripe) && is_array($member_subscripe) ? $member_subscripe : array(),
			isset($membership) && is_array($membership) ? $membership : array(),
			isset($card_topup) && is_array($card_topup) ? $card_topup : array(),
			isset($outdoor) && is_array($outdoor) ? $outdoor : array(),
			isset($other) && is_array($other) ? $other : array(),
			isset($prasadam) && is_array($prasadam) ? $prasadam : array(),
			isset($temple) && is_array($temple) ? $temple : array(),
			isset($ubayam) && is_array($ubayam) ? $ubayam : array(),
			isset($wedding_hall) && is_array($wedding_hall) ? $wedding_hall : array()
		);
        $data['mode'] = $this->daily_summary_model->payment_type_list();
        

        $this->render($data, 'home');
    }
    
    function ajax(){
        echo json_encode( $this->home_model->ajax() );
        
    }
}
?>