function add()
 {
     // Code
     $ser_id = $_SESSION['SER_ID'];
     $series = new series();
     if ($_SESSION['SER_ID']) {
         $this->registry->template->ser_codigo = $series->obtenerCodigoSerie($_SESSION['SER_ID']);
         $this->registry->template->exp_codigo = "";
         $this->registry->template->exp_codigoSigla = $series->validarCodigoSerie($_SESSION['SER_ID']);
         $this->registry->template->ser_corr = $series->obtenerTipoCorrSerie($_SESSION['SER_ID']);
         $this->registry->template->uni_descripcion = $series->obtenerSeccionSerie($_SESSION['SER_ID']);
         $uni_id = $series->obtenerSeccionIdSerie($_SESSION['SER_ID']);
         $this->registry->template->series = $series->obtenerSelectSeccionDefault($_SESSION['USU_ID'], $uni_id, $_SESSION['SER_ID']);
     } else {
         $this->registry->template->ser_codigo = "";
         $this->registry->template->exp_codigo = "";
         $this->registry->template->exp_codigoSigla = "";
         $this->registry->template->ser_corr = "";
         $this->registry->template->uni_descripcion = "";
         $uni_id = 0;
         $this->registry->template->series = $series->obtenerSelectDefault($_SESSION['USU_ID'], $_SESSION['SER_ID']);
     }
     // Dynamic fields
     $expcampo = new expcampo();
     $this->registry->template->expcampo = $expcampo->obtenerSelectCampos($ser_id);
     $sopfisico = new sopfisico();
     $this->registry->template->sof_id = $sopfisico->obtenerSelect();
     $this->registry->template->exp_nrofoj = "(SIN PAG.)";
     $this->registry->template->exp_tomovol = "";
     $this->registry->template->exp_nroejem = "1";
     $this->registry->template->exp_nrocaj = "0";
     $this->registry->template->exp_sala = "";
     $expediente = new expediente();
     $this->registry->template->exp_estante = $expediente->obtenerSelectEstante();
     $this->registry->template->exp_cuerpo = "";
     $this->registry->template->exp_balda = "";
     $this->registry->template->exp_obs = "";
     $this->registry->template->exp_ori = "1";
     $this->registry->template->exp_cop = "0";
     $this->registry->template->exp_fot = "0";
     $this->registry->template->exp_lugar = "";
     $this->registry->template->exp_corr = "<OPTION>AUTO</OPTION><OPTION>MANUAL</OPTION>";
     // isadg
     $this->registry->template->exp_id = "";
     $this->registry->template->exp_titulo = "";
     $this->registry->template->exp_mesi = $expediente->obtenerSelectMes();
     $this->registry->template->exp_anioi = $expediente->obtenerSelectAnio();
     $this->registry->template->exp_fecha_exi = date("Y-m-d");
     $this->registry->template->exp_mesf = $expediente->obtenerSelectMes();
     $this->registry->template->exp_aniof = $expediente->obtenerSelectAnio();
     $this->registry->template->exp_fecha_exf = date("Y-m-d");
     //        $this->registry->template->exp_nivdes = $expediente->obtenerSelectNivelDescripcion();
     $this->registry->template->exp_volsop = "";
     $this->registry->template->exp_nomprod = "MPD.";
     $this->registry->template->exp_hisins = "";
     $this->registry->template->exp_hisarc = "";
     $this->registry->template->exp_foring = "TRANSFERENCIA";
     $this->registry->template->exp_alccon = "";
     $this->registry->template->exp_vaseel = "";
     $this->registry->template->exp_nueing = "";
     $this->registry->template->exp_org = "LOS DOCUMENTOS FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN CAJAS DE ACUERDO A CHECK LIST (SI TUVIERA) DE LA SERIE CORRESPONDIENTE .";
     $this->registry->template->exp_conacc = "EL ACCESO ESTA SUJETO A LO QUE ESTABLECE LA CONSTITUCION POLITICA DEL ESTADO Y EL ARTICULO 18 DE LA LEY 2341 SOBRE PROCESOS ADMINISTRATIVOS.";
     $this->registry->template->exp_conrep = "";
     $idioma = new idioma();
     $this->registry->template->idi_id = $idioma->obtenerSelect();
     $this->registry->template->exp_carfis = $expediente->obtenerSelectEstado();
     $this->registry->template->exp_insdes = "";
     $this->registry->template->exp_exloor = "";
     $this->registry->template->exp_exloco = "";
     $this->registry->template->exp_underel = "";
     $this->registry->template->exp_notpub = "";
     $this->registry->template->exp_notas = "";
     $this->registry->template->exp_notarc = "";
     $this->registry->template->exp_regnor = "ISAD-G, ISAAR(CPF), RCAA";
     $this->registry->template->exp_fecdes = date("Y-m-d");
     $this->registry->template->exp_descripcion = "";
     // Keywords
     //        $palclave = new palclave();
     //        $this->registry->template->pac_nombre = $palclave->listaPC('Expediente');
     $this->registry->template->pac_nombre = "";
     $this->menu = new menu();
     $this->liMenu = $this->menu->imprimirMenu(VAR1, $_SESSION['USU_ID']);
     $this->registry->template->men_titulo = $this->liMenu;
     $this->registry->template->titulo = "HOJA DE TRABAJO - Nuevo";
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_EVENT = "save";
     $this->registry->template->GRID_SW = "true";
     $this->registry->template->PATH_J = "jquery-1.4.1";
     $this->registry->template->show('headerG');
     $this->registry->template->show('expediente/tab_expediente.tpl');
     $this->registry->template->show('footer');
 }
 function view()
 {
     $exp_id = VAR3;
     $fil_id = VAR4;
     $this->archivo = new tab_archivo();
     $rows = $this->archivo->dbselectByField("fil_id", $fil_id);
     $row = $rows[0];
     // Tab_archivo
     // Tab_doccorr
     $tab_doccorr = new Tab_doccorr();
     $sql = "SELECT *\r\n                FROM tab_doccorr\r\n                WHERE fil_id='" . $row->fil_id . "'";
     $doccorr = $tab_doccorr->dbSelectBySQL($sql);
     if ($doccorr) {
         $doccorr = $doccorr[0];
         // Nur
         $hojas_ruta = new hojas_ruta();
         $this->registry->template->dco_id = $doccorr->dco_id;
         $this->registry->template->fil_cite = $hojas_ruta->obtenerSelect($doccorr->fil_cite);
         $seguimientos = new seguimientos();
         $this->registry->template->fil_nur_s = $seguimientos->obtenerSelect($doccorr->fil_nur_s);
         $this->registry->template->fil_nur = $doccorr->fil_nur;
         $this->registry->template->fil_asunto = $doccorr->fil_asunto;
         $this->registry->template->fil_sintesis = $doccorr->fil_sintesis;
         $this->registry->template->fil_nur_tipo = "";
     } else {
         // Nur
         $this->registry->template->dco_id = "";
         $this->registry->template->fil_cite = "";
         $this->registry->template->fil_nur_s = "";
         $this->registry->template->fil_nur = $_SESSION["codigo"];
         $this->registry->template->fil_asunto = "";
         $this->registry->template->fil_sintesis = "";
         $this->registry->template->fil_nur_tipo = "";
     }
     // Tab_exparchivo
     $sql = "SELECT *\r\n                FROM tab_exparchivo\r\n                WHERE fil_id='" . $row->fil_id . "'";
     $exa_rows = $this->archivo->dbSelectBySQL($sql);
     $exa_row = $exa_rows[0];
     $this->registry->template->exp_id = $exp_id;
     $this->registry->template->tra_id = $exa_row->tra_id;
     $this->registry->template->cue_id = $exa_row->cue_id;
     $this->registry->template->exa_id = $exa_row->exa_id;
     // Tab_archivo
     $this->registry->template->fil_id = $fil_id;
     $this->registry->template->fil_codigo = $row->fil_codigo;
     $expediente = new expediente();
     $this->registry->template->exp_codigo = $expediente->obtenerCodigo(VAR3);
     $this->registry->template->exp_nombre = "";
     $this->registry->template->exp_corr = $expediente->obtenerTipoCorrExpediente(VAR3);
     $this->registry->template->fil_nro = $row->fil_nro;
     $this->registry->template->fil_titulo = $row->fil_titulo;
     $this->registry->template->fil_subtitulo = $row->fil_subtitulo;
     $this->registry->template->fil_fecha = $row->fil_fecha;
     $this->registry->template->fil_mes = $expediente->obtenerSelectMes($row->fil_mes);
     $this->registry->template->fil_anio = $expediente->obtenerSelectAnio($row->fil_anio);
     $this->registry->template->fil_mesf = $expediente->obtenerSelectMes($row->fil_mesf);
     $this->registry->template->fil_aniof = $expediente->obtenerSelectAnio($row->fil_aniof);
     $idioma = new idioma();
     $this->registry->template->idi_id = $idioma->obtenerSelect($row->idi_id);
     $this->registry->template->fil_proc = $row->fil_proc;
     $this->registry->template->fil_firma = $row->fil_firma;
     $this->registry->template->fil_cargo = $row->fil_cargo;
     $this->registry->template->fil_alccon = $row->fil_alccon;
     // Find ser_id
     $texpediente = new tab_expediente();
     $tab_expediente = $texpediente->dbselectById(VAR3);
     $ser_id = $tab_expediente->getSer_id();
     // Include dynamic fields
     $expcampo = new expcampo();
     $this->registry->template->filcampo = $expcampo->obtenerSelectCampos($ser_id);
     $sopfisico = new sopfisico();
     $this->registry->template->sof_id = $sopfisico->obtenerSelect($row->sof_id);
     $this->registry->template->fil_nrofoj = $row->fil_nrofoj;
     $this->registry->template->fil_tomovol = $row->fil_tomovol;
     $this->registry->template->fil_nroejem = $row->fil_nroejem;
     $this->registry->template->fil_nrocaj = $row->fil_nrocaj;
     $this->registry->template->fil_nropaq = $row->fil_nropaq;
     $this->registry->template->fil_cantpaq = $row->fil_cantpaq;
     $this->registry->template->fil_cantcaj = $row->fil_cantcaj;
     $this->registry->template->fil_sala = $row->fil_sala;
     $archivo = new archivo();
     $this->registry->template->fil_estante = $archivo->obtenerSelectEstante($row->fil_estante);
     $this->registry->template->fil_cuerpo = $row->fil_cuerpo;
     $this->registry->template->fil_balda = $row->fil_balda;
     $this->registry->template->fil_tipoarch = $row->fil_tipoarch;
     $this->registry->template->fil_mrb = $row->fil_mrb;
     if ($row->fil_ori) {
         $this->registry->template->fil_ori = $row->fil_ori;
     } else {
         $this->registry->template->fil_ori = '0';
     }
     if ($row->fil_cop) {
         $this->registry->template->fil_cop = $row->fil_cop;
     } else {
         $this->registry->template->fil_cop = '0';
     }
     if ($row->fil_fot) {
         $this->registry->template->fil_fot = $row->fil_fot;
     } else {
         $this->registry->template->fil_fot = '0';
     }
     $this->registry->template->fil_confidencilidad = $row->fil_confidencialidad;
     $this->registry->template->fil_obs = $row->fil_obs;
     $this->registry->template->required_archivo = "";
     // Validate keywords
     $palclave = new palclave();
     $sis_palclave = $palclave->obtenerSisPalclave();
     if ($sis_palclave == "RECORDAR") {
         $this->registry->template->fil_descripcion = $palclave->listaPCFile($row->fil_id);
         $this->registry->template->pac_nombre = "";
     } else {
         $this->registry->template->fil_descripcion = "";
         $this->registry->template->pac_nombre = "";
     }
     $tab_serie = new tab_series();
     $row1 = $tab_serie->dbselectById($ser_id);
     $expisadg = new tab_expisadg();
     $row2 = $expisadg->dbselectById(VAR3);
     $expediente2 = new expediente();
     $this->registry->template->detExpediente = "";
     $this->registry->template->detExpediente = $expediente2->getDetalles(VAR3);
     $this->registry->template->ubicacion = $expediente2->getUbicacion(VAR3);
     $this->registry->template->ser_id = $row1->ser_id;
     $this->registry->template->serie = $row1->ser_categoria;
     $this->registry->template->exp_fecha_exi = $row2->exp_fecha_exi;
     $this->registry->template->exp_fecha_exf = $row2->exp_fecha_exf;
     if (VAR5) {
         if (VAR5 == 0) {
             $msm = "HUBO ERROR AL REGISTRAR EL DOCUMENTO!";
         } else {
             if (VAR5 == 1) {
                 $msm = "SE GUARDO CORRECTAMENTE EL DOCUMENTO!";
             } else {
                 $msm = "";
             }
         }
     } else {
         $msm = "";
     }
     $this->registry->template->msm = $msm;
     $exp = new expediente();
     $this->registry->template->linkTree = $exp->linkTree($exp_id, $exa_row->tra_id, $exa_row->cue_id);
     $arc = new archivo();
     $this->registry->template->confidencialidad = $arc->loadConfidencialidad('1');
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_EVENT = "update";
     $this->registry->template->controller = VAR1;
     $this->registry->template->GRID_SW = "true";
     $this->registry->template->PATH_J = "jquery-1.4.1";
     $this->registry->template->tituloEstructura = "<div class='titulo' align='center'>ESTRUCTURA DOCUMENTAL</div>";
     $this->menu = new menu();
     $liMenu = $this->menu->imprimirMenu(VAR1, $_SESSION['USU_ID']);
     $this->registry->template->men_titulo = $liMenu;
     $this->registry->template->show('headerG');
     //        $this->registry->template->show('archivo/exp_detallesView.tpl');
     $this->registry->template->show('archivo/tab_archivo.tpl');
     $this->registry->template->show('footer');
 }