<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class reports extends MX_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->model("reports_model");
        $this->load->model("clients_model");
    }
    function index() {
        $client_id = $this->input->get("client_id") ?: null;
        $data["months"]      = $this->reports_model->get_earning_by_month();
        $data["weeks"]       = $this->reports_model->get_earning_by_week();
        $data["years"]       = $this->reports_model->get_earning_by_year();
        $data["clients"]     = $this->reports_model->get_earning_by_client();
        $data["fin_months"]  = $this->reports_model->get_financeiro_by_month($client_id);
        $data["fin_clients"] = $this->reports_model->get_financeiro_by_client();
        $data["all_clients"] = $this->clients_model->get_all_clients();
        $data["client_id"]   = $client_id;
        $data["page_title"]  = lang("reports");
        $data["body"]        = "reports/reports";
        $this->load->view("template/main", $data);
    }
}