public $GENERO = 15;
     public $TIPO_VIVIENDA = 16;
     public $DEPENDIENTES_ECONOMICOS = 17;
     public $TIPO_IDENTIFICACION = 18;
     public $ID_IDENTIFICACION = 19;
     public $EMPRESA_TRABAJO = 20;
     public $PUESTO = 21;
     public $TRABAJO_FECHA_INGRESO = 22;
     public $NACIONALIDAD = 23;
     public $CIUDAD_NACIMIENTO = 24;
     public $INGRESOS_MENSUALES = 25;
 }
 //Cedula de Identidad
 $tmp = new cTmp();
 $xFi->setCharDelimiter("|");
 $xFi->setLimitCampos(26);
 //var_dump($_FILES["f1"]);
 if ($xFi->processFile($doc1) == true) {
     $data = $xFi->getData();
     $conteo = 1;
     foreach ($data as $rows) {
         if ($conteo > 1) {
             $xFi->setDataRow($rows);
             $xSoc = new cSocio(false);
             /*$nombre, $apellidopaterno = "", $apellidomaterno = "",
             		$rfc = "POR_REGISTRAR", $curp = "POR_REGISTRAR", $cajalocal = 99,
             		$fecha_de_nacimiento = false, $lugar_de_nacimiento = "DESCONOCIDO",
             		
             		$tipo_de_ingreso = FALLBACK_PERSONAS_TIPO_ING, $estado_civil = DEFAULT_ESTADO_CIVIL,
             		
             		$genero = DEFAULT_GENERO, $dependencia = FALLBACK_CLAVE_EMPRESA, $regimen_conyugal = DEFAULT_REGIMEN_CONYUGAL,
} else {
    //
    $doc1 = isset($_FILES["idarchivo"]) ? $_FILES["idarchivo"] : false;
    $xFi = new cFileImporter();
    $xT = new cTipos();
    $colcuenta = parametro("idcolcuenta");
    $colnombre = parametro("idcolnom");
    $colnat = parametro("idcolnat");
    $catImport = array();
    $aplicar = parametro("idaplicar", false, MQL_BOOL);
    if ($aplicar == true) {
        $action = MQL_ADD;
    }
    //Cedula de Identidad
    $xFi->setCharDelimiter("|");
    $xFi->setLimitCampos(4);
    //$xFi->setToUTF8();
    //var_dump($_FILES["f1"]);
    //$xFi->setExo($esqueleto);
    //var_dump($_FILES);
    if ($xFi->processFile($doc1) == true) {
        $data = $xFi->getData();
        $conteo = 1;
        foreach ($data as $rows) {
            if ($conteo > 1) {
                $xFi->setDataRow($rows);
                $cuenta = $xFi->getV($colcuenta, "");
                //$cuenta		= $xT->cSerial($largo)
                $xEQ = new cCuentaContableEsquema($cuenta);
                //$xCW		= new cCatalogoCompacW();
                //echo $xEQ->CUENTA_FORMATEADA . "<br/>" . $xEQ->CUENTARAW ."<br />" . $xCW->getEquivalencia( $xFi->getV($tmp->NATURALEZA, "") )  . $xEQ->NIVEL_ACTUAL . "<hr />";
$msg = "";
if ($action == SYS_CERO) {
    $xFRM->addHElem("<div class='tx4'><label for='f1'>" . $xFRM->lang("archivo") . "</label><input type='file'  name='f1' id='f1'  /></div>");
    $xFRM->addHElem($xSel->get("", "TR.tipo de importacion"));
    //$xFRM->addHElem( $xTxt2->getDeMoneda("idnumeropagina", $xFRM->lang("numero de", "pagina")) );
    $xFRM->addHElem($xTxt->get("idobservaciones", "", "Observaciones"));
    $xFRM->addSubmit();
    $xFRM->addFootElement('<input type="hidden" name="MAX_FILE_SIZE" value="1024000">');
    echo $xFRM->get();
} else {
    $doc1 = isset($_FILES["f1"]) ? $_FILES["f1"] : false;
    $observaciones = isset($DDATA["idobservaciones"]) ? $DDATA["idobservaciones"] : "";
    $tipoimportacion = isset($DDATA["idtipoimportacion"]) ? $DDATA["idtipoimportacion"] : "SDN";
    $xFil = new cFileImporter();
    $limit = $tipoimportacion == "SDN" ? 12 : 6;
    $xFil->setLimitCampos($limit);
    $xFil->setCharDelimiter("|");
    $xFil->setType("PIP");
    //var_dump($_FILES["f1"]);
    if ($xFil->processFile($doc1) == true) {
        $data = $xFil->getData();
        foreach ($data as $valores => $cont) {
            $id = $xT->cInt($cont[0]);
            switch ($tipoimportacion) {
                case "SDN":
                    $xFil->setDataRow($cont);
                    /*
                    4149|"CAVIEDES CRUZ, Leonardo"|"individual"|"SDNT"|
                    -5  - 6  - 7  - 8  -  9 - 10 - 11
                    -0- |-0- |-0- |-0- |-0- |-0- |-0-
                    -12 
 {
     public $ID_PERSONA = 1;
     public $ID_FISCAL = 2;
     public $ID_POBLACIONAL = 3;
     public $NOMBRE_PERSONA = 4;
     public $PRIMER_APELLIDO = 5;
     public $SEGUNDO_APELLIDO = 6;
     public $ID_CUENTA = 7;
     public $DEPOSITO = 8;
     public $OBSERVACIONES = 9;
     public $RETIRO = 10;
 }
 //Cedula de Identidad
 $tmp = new cTmp();
 $xFi->setCharDelimiter("|");
 $xFi->setLimitCampos(10);
 //TODO: Evaluar carga de personas desde otra entidad
 //var_dump($_FILES["f1"]);
 if ($xFi->processFile($doc1) == true) {
     $data = $xFi->getData();
     $conteo = 1;
     $msg .= "";
     foreach ($data as $rows) {
         if ($conteo > 1) {
             //Omitir primera columna
             $xFi->setDataRow($rows);
             //$xHT = new cHTabla();
             //$xHT->addTR();
             $sucess = true;
             $persona = $xFi->getV($tmp->ID_PERSONA, false, MQL_INT);
             $cuenta = $xFi->getV($tmp->ID_CUENTA, false, MQL_INT);
     public $CTA1 = 4;
     public $CTA2 = 5;
     public $CTA3 = 6;
     public $CTA4 = 7;
     public $CTA5 = 8;
     public $CTA6 = 9;
 }
 $catImport = array();
 $aplicar = parametro("idaplicar", false, MQL_BOOL);
 if ($aplicar == true) {
     $action = MQL_ADD;
 }
 //Cedula de Identidad
 $tmp = new cTmp();
 $xFi->setCharDelimiter("|");
 $xFi->setLimitCampos(9);
 $xFi->setToUTF8();
 //var_dump($_FILES["f1"]);
 if ($xFi->processFile($doc1) == true) {
     $data = $xFi->getData();
     $conteo = 1;
     foreach ($data as $rows) {
         if ($conteo > 1) {
             $xFi->setDataRow($rows);
             $cuenta = $xFi->getV($tmp->CUENTA, "");
             $xCCont = new cCuentaContable($cuenta);
             $DetNivel = $xCCont->determineNivel($cuenta);
             $sucess = true;
             $naturaleza = $xFi->getV($tmp->NATURALEZA, false);
             $nivel = $xFi->getV($tmp->NIVEL, 0, MQL_INT);
             $nombre = "";
if ($action == MQL_LOAD) {
    $doc1 = isset($_FILES["idarchivo"]) ? $_FILES["idarchivo"] : false;
    $primerosql = parametro("primerosql", false, MQL_BOOL);
    $sql = parametro("idsql", "", MQL_RAW);
    $clave = parametro("idclave", "", MQL_RAW);
    $clave2 = parametro("idclave2", "", MQL_RAW);
    $keyFile = array();
    $keySQL = array();
    $aKeyFile = explode(",", $clave2);
    $aKeySql = explode(",", $clave);
    $xFi = new cFileImporter();
    $xT = new cTipos();
    $delimiter = "|";
    //var_dump($_FILES);
    $xFi->setCharDelimiter($delimiter);
    $xFi->setLimitCampos(16);
    $xFi->setToUTF8();
    if ($primerosql == true) {
        if ($xFi->processFile($doc1) == true) {
            $data = $xFi->getData();
            $conteo = 1;
            foreach ($data as $rows) {
                $xFi->setDataRow($rows);
                $pkey = "";
                //var_dump($rows);
                foreach ($aKeyFile as $ikey) {
                    $pkey .= $xFi->getV($ikey);
                    // $rows[$ikey];
                }
                $pkey = preg_replace("/[^a-zA-Z0-9]+/", "", $pkey);
                $keyFile[$pkey] = $pkey;