<?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");
    }

    public function index()
    {
        $now = date("Y-m-d_H-i-s");
        $tablasInsert = $this->CI->Parser_model->getMapaTablas();

        if ($tablasInsert['num_rows'] > 0) {

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

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

                if ($datosTablaToInsert['num_rows'] > 0) {
                    if ($row->tabla_maestra == "maestro_datos_iniciales_licitacion") {
                        pretty_dump($datosTablaToInsert['datos']);
                    }

                    insertBucleDuplicateOnKey($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $now);
                }
            }
        }
    }

}

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