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

class Parserdatabaselimpio
{

    protected $CI;

    public function __construct()
    {
        $this->CI = &get_instance();
        $this->CI->load->model("Parser_model");
        $this->CI->load->model("Xlsexport_model");
    }

    public function index($fechaInicioParser, $filename)
    {
        $tablasInsert = $this->CI->Parser_model->getMapaTablas();
        $totalInserted = array();
        if ($tablasInsert['num_rows'] > 0) {

            $this->CI->Parser_model->deleteCascadaNuevasLicitaciones();

            foreach ($tablasInsert['datos'] as $row) {

                $datosTablaToInsert = $this->CI->Parser_model->getDatosBrutos($row->tabla_sucia);

                if ($datosTablaToInsert['num_rows'] > 0) {
                    guardar_log("inToGlobal_" . $fechaInicioParser, "ARCHIVO--" . $row->tabla_maestra . "_" . $fechaInicioParser . " - " . $filename);
                    $totalInserted[$row->tabla_maestra] = insertBucle($datosTablaToInsert['datos'], $row->tabla_maestra, "inToGlobal_" . $fechaInicioParser);
                }
            }

            return $totalInserted;
        }
    }
}

/* End of file Parserdatabaselimpio.php */
/* Location: ./application/libraries/Parserdatabaselimpio.php */
