<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Miboleta extends CI_Controller{
    public function __construct(){
        parent::__construct();
        $this->load->model("mgeneral");
        $this->load->library("Funciones");
    }
    public function ver(){
        $aini=2005;
        $afin=$this->mgeneral->get_data("year(now()) as anio");
        $afin=$afin[0]->anio;
        $vistas=array(
            "miboleta/vver",
        );
        $datas=array(
            array(
                "dres"=>$this->mgeneral->get_dres(),
                "aini"=>$aini,
                "afin"=>$afin,
            ),
        );
        $this->funciones->crearInterface($vistas,$datas);
    }
    public function get_boletas(){
        $tablas=$this->mgeneral->get_tablas($this->input->post("anio"));
        $misboletas=array();
        foreach($tablas as $reg){
            $tmp=$this->mgeneral->get_boleta($reg->TABLE_NAME);
            foreach ($tmp as $t) {
                $misboletas[]=$t;
            }
        }
        usort($misboletas, $this->funciones->ordenar('data_mes'));
        $data=array(
            "anio"=>$this->input->post("anio"),
            "misboletas"=>$misboletas
        );
        $this->load->view("miboleta/vmisboletas",$data);
    }
}