<?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['mode'] = $this->daily_summary_model->payment_type_list();
        

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