function ajax_duplicidad_expediente() { $valor = $_POST['valor']; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($valor)); foreach ($resulall as $list) { $t++; } if ($t > 0) { echo "El Título del Expediente ya existe!"; } }
function viewCajaExpediente() { $ini = $_POST['nro_inicial']; $fin = $ini; $exp_ids = $_POST['expedientes_ids']; $cantidadexp = $_POST['cantidadexp']; $cantdocs = $_POST['cantdocs']; $expedientes = explode(",", $_POST['cantexps']); $documentos = explode(",", $_POST['cantdocs']); $tiposeries = $_POST['tiposeries']; $cantidadetiqcajas = count($expedientes); $cantidadetiqcajas2 = count($documentos); $explode = explode(",", $exp_ids); $varioseries = $_POST['varioseries']; $nropiezas = $_POST['nropiezas']; if ($nropiezas != "") { $extraer_piezas = explode(",", $nropiezas); } $tab_expediente = new tab_expediente(); $tab_expisadg = new Tab_expisadg(); $cantidadtotal = $cantidadetiqcajas + $cantidadetiqcajas2; $expediente = new Tab_expediente(); $fondo2 = new Tab_fondo(); $texp = new Tab_etiquetas(); $usuario = new usuario(); $idexp = "SELECT tab_expediente.exp_id,tab_expediente.exp_codigo\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n WHERE\r\n tab_archivo.fil_estado=1 and tab_archivo.fil_id={$documentos['0']} "; $rowespdoc = $tab_expediente->dbSelectBySQL($idexp); $cant = count($explode); if ($fin == NULL) { $fin = $ini; } $where2 = ""; $where4 = ""; if ($cantidadexp != 0) { for ($t = 0; $t < $cantidadetiqcajas; $t++) { if ($expedientes[$t] != "") { $where2 .= " tab_expediente.exp_id=" . $expedientes[$t]; if ($t < $cantidadetiqcajas - 1) { $where2 .= " OR "; } } } if ($cantidadetiqcajas2 > 0) { for ($u = 0; $u < $cantidadetiqcajas2; $u++) { if ($documentos[$u] != "") { $where4 .= " tab_archivo.fil_id=" . $documentos[$u]; if ($u < $cantidadetiqcajas2 - 1) { $where4 .= " OR "; } } } } } else { for ($t = 0; $t < $cantidadetiqcajas; $t++) { $where2 .= " tab_expediente.exp_id=" . $rowespdoc[0]->exp_id; } for ($u = 0; $u < $cantidadetiqcajas2; $u++) { if ($documentos[$u] != "") { $where4 .= " tab_archivo.fil_id=" . $documentos[$u]; if ($u < $cantidadetiqcajas2 - 1) { $where4 .= " OR "; } } } } if ($cantdocs == 1) { $where4 = " tab_archivo.fil_id=0"; } $consultaexps = "SELECT\r\n min(tab_expediente.exp_codigo) as minimo,\r\n max(tab_expediente.exp_codigo) as maximo,\r\n count(tab_expediente.exp_codigo) as cantidad\r\n FROM\r\n tab_expediente\r\n WHERE\r\n tab_expediente.exp_estado = 1 AND {$where2}"; $consultadoc = "SELECT\r\n MIN(tab_expediente.exp_codigo) as minimo,\r\n MAX(tab_expediente.exp_codigo) as maximo\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n WHERE\r\n tab_archivo.fil_estado = 1 and {$where4}"; $rowsdocs = $expediente->dbSelectBySQL($consultadoc); $rowsexps = $tab_expediente->dbSelectBySQL($consultaexps); $wh = ""; if ($nropiezas == "") { $wh = " AND tab_expediente.exp_nrocaj<>''"; } // echo $tiposeries; exit(); $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n u.uni_id,\r\n u.uni_descripcion,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n tab_expediente.exp_ori,\r\n tab_expediente.exp_cop,\r\n tab_expisadg.exp_titulo,\r\n tab_series.ser_categoria,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad AS u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 {$wh} and tab_series.ser_id={$tiposeries}"; $rows = $texp->dbSelectBySQL($sql); $rows2 = $rows; $rows2 = $rows2[0]; $tabfondo = new Tab_fondo(); $cuerpo = $tabfondo->dbSelectBySQL($sql); // Include the main TCPDF library (search for installation path). //require_once('tcpdf/tcpdf_include.php'); require_once 'tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Castellon S.R.L.'); $pdf->SetTitle('Etiquetado de Cajas'); $pdf->SetSubject('Etiquetado de Cajas'); $pdf->SetKeywords('Etiquetado, Cajas, cajas, caratulas, folders'); // set default header data // $pdf->SetHeaderData('logo2.png', 25, 'ADMINISTRADORA BOLIVIANA DE CARRETERA', 'IMPRESIÓN DE CAJAS'); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, 5, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', 'B', 8); // add a page $pdf->AddPage(); $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', '', 8); $st = ""; // ----------------------------------------------------------------------------- // $id_exp = $_REQUEST['exp_id']; $minimoExps = $rowsexps[0]->minimo; $maximoExps = $rowsexps[0]->maximo; $minimoDoc = $rowsdocs[0]->minimo; $maximoDoc = $rowsdocs[0]->maximo; $numero = $rowespdoc[0]->exp_codigo; if ($minimoExps != "" && $maximoExps != "" && $minimoDoc != "" && $maximoDoc != "") { $array = array($minimoExps, $maximoExps, $minimoDoc, $maximoDoc); } else { if ($maximoExps != "" && $minimoDoc != "" && $maximoDoc != "") { $array = array($maximoExps, $minimoDoc, $maximoDoc); } else { if ($minimoDoc != "" && $maximoDoc != "") { $array = array($minimoDoc, $maximoDoc); } else { if ($minimoExps != "" && $maximoExps != "") { $array = array($minimoExps, $maximoExps); } } } } $cant3 = 0; $minimo = min($array); $maximo = max($array); $diferencia = $maximo - $minimo; $cantMin = ""; $cantMax = ""; for ($i = $ini; $i <= $fin; $i++) { $sala = ""; $estante = ""; $balda = ""; $cuerpo = ""; $wh1 = ""; if ($nropiezas == "") { $wh1 = " AND tab_expediente.exp_nrocaj='{$i}'"; } $expcodigo = ""; $sqlcodigos = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n (NULLIF(tab_expediente.exp_codigo,'')::int) as correlativo,\r\n tab_expediente.exp_ori,\r\n tab_expediente.exp_cop,\r\n tab_expediente.exp_fot,\r\n tab_expisadg.exp_titulo,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad AS u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 {$wh1} AND tab_series.ser_id={$tiposeries}\r\n ORDER BY tab_expediente.exp_id"; $resultadocod = $fondo2->dbSelectBySQL($sqlcodigos); $resultadocod = $resultadocod[0]; $expe = new Tab_expediente(); if ($cantidadexp != 0) { $sqlcaja = "SELECT\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_balda,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_codigo\r\n FROM\r\n tab_expediente\r\n WHERE\r\n exp_estado=1 AND\r\n exp_nrocaj='{$i}' AND tab_expediente.exp_id={$expedientes['0']}"; $cajaresult = $expe->dbSelectBySQL($sqlcaja); foreach ($cajaresult as $rowscaja) { $sala = $rowscaja->exp_sala; $estante = $rowscaja->exp_estante; $balda = $rowscaja->exp_balda; $cuerpo = $rowscaja->exp_cuerpo; $expcodigo = $rowscaja->exp_codigo; } } else { $sqlcaja = "SELECT\r\n tab_expediente.exp_id,\r\n tab_expediente.exp_codigo,\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_cuerpo,\r\n tab_archivo.fil_balda\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n WHERE\r\n tab_archivo.fil_id ={$documentos['0']} and tab_archivo.fil_estado=1"; $cajaresult = $expe->dbSelectBySQL($sqlcaja); foreach ($cajaresult as $rowscaja) { $sala = $rowscaja->fil_sala; $estante = $rowscaja->fil_estante; $balda = $rowscaja->fil_balda; $cuerpo = $rowscaja->fil_cuerpo; $expcodigo = $rowscaja->exp_codigo; $exp_id = $rowscaja->exp_id; } } $st .= '<br><br>'; $st .= '<table border="1" style="width: 100%">'; $st .= '<tr>'; $st .= '<td style="border-right:2px solid white;">'; $st .= '<img src="' . PATH_ROOT . '/web/img/escudo.png" width="50" height="50" border="0" />'; $st .= '</td><td align="right"><img src="' . PATH_ROOT . '/web/img/iso.png" width="50" height="50" border="0" />'; $st .= '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2">'; $st .= '<table border="1" style="width: 100%; text-align: center">'; $st .= '<tr>'; //$st.='<td colspan="11">'.$value->fon_cod . "-" . $value->uni_cod. '</td>'; $st .= '<th colspan="11" height="20" style="font-size:70px"><b>' . $resultadocod->fon_cod . DELIMITER . $resultadocod->uni_cod . DELIMITER . $resultadocod->tco_codigo . DELIMITER . $resultadocod->ser_codigo . '</b>'; if ($nropiezas != "") { $st .= "<b>." . $expcodigo . "</b>"; } else { $st .= " " . $minimo . ' - ' . $maximo; } $st .= '</th>'; $st .= '</tr>'; // echo $rows2->uni_cod; exit(); // Verificar que tipo de seccion se va a mostrar de que serie si tiene varias series $uc = explode(".", $rows2->uni_cod); $coduni = "{$uc['0']}.0"; $tab_unidad = new Tab_unidad(); $result = $tab_unidad->dbselectByField("uni_cod", $coduni); $result = $result[0]; $explodeObtCaja = explode("(", $result->uni_descripcion); if ($explodeObtCaja[1] == "") { $seccion = $result->uni_descripcion; } else { $nuevo = $explodeObtCaja[1] . "a"; $explodeObtCaja1 = explode(")", $nuevo); $seccion = $explodeObtCaja1[0]; } $where3 = ""; $longitud_cadena = explode(",", $varioseries); $longitud = count($longitud_cadena); for ($y = 0; $y < $longitud; $y++) { $where3 .= " tab_series.ser_id={$longitud_cadena[$y]} "; if ($y < $longitud - 1) { $where3 .= " OR "; } } $slverificavariaseries = "SELECT\r\n tab_series.ser_categoria\r\n FROM\r\n tab_series\r\n WHERE\r\n tab_series.ser_estado=1 AND {$where3}"; $tab_series = new Tab_series(); $unidad = new unidad(); $padre = $unidad->obtenerPadre($rows2->uni_id); $pa = 0; if ($padre == $rows2->uni_descripcion) { $pa++; } if ($seccion == "PRESIDENCIA" && $rows2->uni_descripcion == "AREA TECNICA") { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . htmlentities($rows2->uni_descripcion, ENT_IGNORE, 'utf-8') . '</b></td>'; $st .= '</tr>'; } else { if ($pa > 0) { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . htmlentities($rows2->uni_descripcion, ENT_IGNORE, 'utf-8') . '</b></td>'; $st .= '</tr>'; } else { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . $padre . " - " . htmlentities($rows2->uni_descripcion, ENT_IGNORE, 'utf-8') . '</b></td>'; $st .= '</tr>'; } } // if ($rows2->uni_par_cod) // { // $st.='<tr>'; // $st.='<td colspan="11" height="20" style="font-size:30px"><b>' . $seccion . ' - ' . $rows2->uni_descripcion . '</b></td>'; // $st.='</tr>'; // } // else // { // $st.='<tr>'; // $st.='<td colspan="11" height="20" style="font-size:30px"><b>' . $seccion . ' - ' . $result->uni_descripcion . '</b></td>'; // $st.='</tr>'; // } $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:35px"><b>'; $series_rows = $tab_series->dbSelectBySQL($slverificavariaseries); foreach ($series_rows as $row) { $st .= $row->ser_categoria; if ($longitud > 1) { $st .= ","; } } $diferencia = $diferencia + 1; $st .= '</b></td>'; $st .= '</tr>'; if ($diferencia > 1) { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:48px"><b>' . $diferencia . ' EXPEDIENTE(S)</b></td>'; $st .= '</tr>'; } else { $rowtitulo = $tab_expisadg->dbselectByField("exp_id", $exp_id); $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:48px"><b>' . $rowtitulo[0]->exp_titulo . '</b></td>'; $st .= '</tr>'; } $cant1 = 0; $pdf->SetFont('helvetica', '', 8); $st .= '<tr>'; $st .= '<td colspan="2" height="20" bgcolor="#CCCCCC" style="font-size:40px" width="232">FECHAS EXTREMAS:</td>'; $st .= '<td colspan="9" bgcolor="#CCCCCC" width="420" style="font-size:40px">CODIGOS:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2" height="20" style="font-size:45px"><b>'; if ($diferencia == 1) { $st .= $rowtitulo[0]->exp_anioi; if ($rowtitulo[0]->exp_aniof) { $st .= " - " . $rowtitulo[0]->exp_aniof; } } $st .= '</b></td>'; $st .= '<th colspan="9" rowspan="3"'; if ($cantidadtotal > 15) { if ($cantidadtotal > 30) { $st .= 'style="text-align:left;font-size:24px;padding:15px">'; } else { $st .= 'style="text-align:left;font-size:32px;padding:15px">'; } } else { $st .= 'style="text-align:left;font-size:40px;padding:15px">'; } $p = 0; if ($cantidadexp != 0) { $sqlcodigos2 = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n (NULLIF(tab_expediente.exp_codigo,'')::int) as correlativo,\r\n tab_expediente.exp_codigo,\r\n tab_expediente.exp_ori,\r\n tab_expediente.exp_cop,\r\n tab_expediente.exp_fot,\r\n tab_expediente.exp_id,\r\n tab_expisadg.exp_titulo,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad AS u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_expediente.exp_nrocaj='{$i}' AND {$where2}\r\n ORDER BY correlativo"; $idexp = $_REQUEST['exp_id']; $vector = array(); $resultadoexpw = $fondo2->dbSelectBySQL($sqlcodigos2); $r = 0; $cantidadCajasfilas = count($resultadoexpw); foreach ($resultadoexpw as $filnro) { $st44 = ""; $codigo_exp = $filnro->fon_cod . DELIMITER . $filnro->uni_cod . DELIMITER . $filnro->tco_codigo . DELIMITER . $filnro->ser_codigo . DELIMITER . $filnro->correlativo; $sumar = $filnro->exp_ori + $filnro->exp_cop + $filnro->exp_fot; $cant1 = $cant1 + $filnro->exp_ori + $filnro->exp_cop + $filnro->exp_fot; if ($sumar == 0) { $archivo = new archivo(); $nroejemp = $archivo->obtenercantejemplares($filnro->exp_id); $sumar = $nroejemp; $cant1 = $cant1 + $sumar; } $st44 .= $codigo_exp . "("; if ($nropiezas != "") { $st44 .= $extraer_piezas[$r]; $cant3 = $extraer_piezas[$r] + $cant3; } else { $st44 .= $sumar; } $st44 .= ")"; // $st.=" (".$filnro->fil_fot.")"; $vector[$p] = $st44; // $st.=" "; $r++; $p++; } } if ($cantidadetiqcajas2 > 0) { $sqlcodigos2 = "SELECT\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_unidad.uni_codigo,\r\n tab_series.ser_codigo,\r\n tab_tipocorr.tco_codigo,\r\n tab_expediente.exp_id,\r\n tab_expediente.exp_codigo,\r\n (NULLIF(tab_expediente.exp_codigo,'')::int) as correlativo,\r\n tab_archivo.fil_id,\r\n tab_archivo.fil_ori,\r\n tab_archivo.fil_cop,\r\n tab_archivo.fil_fot,\r\n tab_archivo.fil_nro,\r\n tab_archivo.fil_titulo\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_series.tco_id = tab_tipocorr.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n {$where4} ORDER BY tab_archivo.fil_nro"; $resultadoexpw = $fondo2->dbSelectBySQL($sqlcodigos2); $y = 0; $cantidadCajasfilas = count($resultadoexpw); foreach ($resultadoexpw as $filnro) { $st44 = ""; $codigo_exp = $filnro->fon_cod . DELIMITER . $filnro->uni_cod . DELIMITER . $filnro->tco_codigo . DELIMITER . $filnro->ser_codigo . DELIMITER . $filnro->correlativo . DELIMITER . $filnro->fil_nro; $sumar = $filnro->fil_ori + $filnro->fil_cop + $filnro->fil_fot; $cant1 = $cant1 + $filnro->fil_ori + $filnro->fil_cop + $filnro->fil_fot; if ($sumar == 0) { $archivo = new archivo(); $nroejemp = $archivo->obtenercantejemplares($filnro->exp_id); $sumar = $nroejemp; $cant1 = $cant1 + $sumar; } $st44 .= $codigo_exp . "("; if ($nropiezas != "") { $st44 .= $extraer_piezas[$y]; $cant3 = $extraer_piezas[$y] + $cant3; } else { $st44 .= $sumar; } $st44 .= ")"; // $st42.=" (".$filnro->fil_fot.")"; $vector[$p] = $st44; $y++; $p++; } sort($vector); foreach ($vector as $ro) { $st .= $ro; $st .= " "; } } $st .= '</th>'; $st .= '</tr>'; if ($cant3 == 0) { $cant = $cant1; } else { $cant = $cant3; } $st .= '<tr>'; $st .= '<td colspan="4" height="20" bgcolor="#CCCCCC" width="232">NRO. DE CAJA DE EXPS.</td>'; // $st.='<td colspan="7" bgcolor="#CCCCCC" >ML</td>'; $st .= '</tr>'; //width="420" $st .= '<tr>'; $st .= '<td height="20" colspan="4" rowspan="3" style="font-size:190px">' . $i . '</td>'; // $st.='<td colspan="7" height="20" style="font-size:70px" >0,32</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">NRO. DE PIEZAS</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">Nº DE TRANSFERENCIA</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" height="20" style="font-size:60px"><b>' . $cant . '</b></td>'; $st .= '<td colspan="2"></td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="4" bgcolor="#CCCCCC" height="20" width="232">UBICACIÓN TOPOGRAFICA:</td>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">FECHA DE TRANSFERENCIA DOCUMENTAL</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">ELABORADO POR:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" bgcolor="#CCCCCC">SALA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">ESTANTE</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">BALDA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">CUERPO</td>'; $st .= '<td colspan="5" rowspan="2">'; $st .= '</td>'; $st .= '<td colspan="2" rowspan="2">' . $usuario->obtenerNombre($_SESSION['USU_ID']) . '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" style="font-size:35px">' . $sala . '</td>'; $st .= '<td height="20" style="font-size:35px">' . $estante . '</td>'; $st .= '<td height="20" style="font-size:35px">' . $balda . '</td>'; $st .= '<td height="20" style="font-size:35px">' . $cuerpo . '</td>'; $st .= '</tr>'; $st .= '</table>'; $st .= '</td>'; $st .= '</tr>'; $st .= '</table>'; $st .= ''; $s = 0; $pdf->writeHTML($st, true, false, false, false, ''); $st = ""; } // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_paquetes.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ }
function linkTreeUno($exp_id) { $exp = new informe_viaje(); $tree = ""; $this->series = new series(); $this->tramite = new tab_tramite(); $this->informe_digital = new tab_informe_digital(); $this->cuerpos = new tab_cuerpos(); $row = $this->informe_digital->dbselectByField("exp_id", $exp_id); if (is_null($row)) { return $tree; } else { $row = $row[0]; $ser_id = $row->ser_id; // Expisag $tab_expisadg = new Tab_expisadg(); $row2 = $tab_expisadg->dbselectByField("exp_id", $exp_id); $row2 = $row2[0]; $pathAnterior = PATH_DOMAIN . "/" . VAR1 . "/"; $titulo = $this->series->getTitle($ser_id); $nuevoEnlace = $row2->exp_titulo; $pathActual = PATH_DOMAIN . "/" . VAR1 . "/" . VAR2 . "/" . VAR3; return array($pathAnterior, $titulo, $pathActual, $nuevoEnlace); } }
function Migrar() { $msg = ""; set_time_limit(1024); ini_set("memory_limit", "1024M"); if ($_FILES["archivo"]) { $Size = $_FILES["archivo"]['size']; $Type = $_FILES["archivo"]['type']; $File = $_FILES["archivo"]['name']; if ($File != '') { $dominio = PATH_FTPDIR_EXCEL; $Dir = $dominio . "/" . $File; if (copy($_FILES['archivo']['tmp_name'], $Dir)) { $status = "Correcto"; } else { $status = "Error"; } } else { $status = "Error"; } } $tipoformato = $_POST['tiporeporte']; require_once $dominio . '/PHPExcel/IOFactory.php'; $objPHPExcel = PHPExcel_IOFactory::load("web/" . $File); foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { $worksheetTitle = $worksheet->getTitle(); $highestRow = $worksheet->getHighestRow(); // e.g. 10 $highestColumn = $worksheet->getHighestColumn(); // e.g 'F' $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); $nrColumns = ord($highestColumn) - 64; } $id_serie = ""; $id_seccion = ""; //obtener datos de la base de datos like $fechadocAnioInicial = ""; $fechadocMesInicial = ""; if ($tipoformato == 1) { //GNT-SCT $cantidaddoc = $highestRow - 37; $fondo = $objPHPExcel->getActiveSheet()->getCell("E8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("E9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("E10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("E11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("E13")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("E14")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("O13")->getValue(); $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $objWorksheet = $objPHPExcel->getActiveSheet(); $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } if ($highestColumn != "Q") { $msg = "<font color='red'>FORMATO GNT - SCT NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; // //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells, //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} // //$msg= '</tr>' . "\n"; //} //$msg= '</table>' . "\n"; //if(trim($subseccion)=="SUBGERENCIA DE CONSERVACION VIAL"){ // $subseccion="PROYECTOS DE CONSERVACION VIAL"; //} $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND tab_series.ser_categoria LIKE '%{$serie}%'"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } if ($highestColumn == "Q") { if ($ml == "ML") { $i = 1; $ct = 18; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); // $expisadg->setExp_insdes(''); // $expisadg->setExp_exloor(''); // $expisadg->setExp_exloco(''); // $expisadg->setExp_underel(''); // $expisadg->setExp_notpub(''); // $expisadg->setExp_notas(''); // $expisadg->setExp_notarc(''); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; //insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("F" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("G" . $ct)->getValue(); $productor = $objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue(); $contrato = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("J" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("K" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("L" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("M" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("P" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("Q" . $ct)->getValue(); //todavia en trabajo if ($titledoc != "") { if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } // exit(); if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; $this->archivo->setFil_nro($max3); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo(''); $this->archivo->setFil_alccon(''); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_codigo(2); $this->archivo->setFil_nrofoj(''); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>FORMATO GNT - SCT NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>FORMATO GNT - SCT NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } } else { if ($tipoformato == 2) { //GNT-SCV // $msg= $highestColumn; exit(); $cantidaddoc = $highestRow - 18; $fondo = $objPHPExcel->getActiveSheet()->getCell("F8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("F9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("F10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("F11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("F13")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("F14")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("S13")->getValue(); $ml = $objPHPExcel->getActiveSheet()->getCell("D17")->getValue(); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $objWorksheet = $objPHPExcel->getActiveSheet(); //if(trim($subseccion)=="SUBGERENCIA DE CONSERVACION VIAL"){ // $subseccion="PROYECTOS DE CONSERVACION VIAL"; //} $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } if ($highestColumn != "U") { $msg = "<font color='red'>FORMATO GNT - SCV NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } // //$msg= $fondo."<br>"; //$msg= $subfondo."<br>"; //$msg= $seccion."<br>"; //$msg= $subseccion."<br>"; //$msg= $serie."<br>"; //$msg= $tituloexpediente."<br>"; //$msg= $fechasExtremas."<br>"; //$msg= $ml."<br>"; // //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; // //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells, //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} //$msg= '</tr>' . "\n"; //} //$msg= '</table>' . "\n"; // // exit(); $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND tab_series.ser_categoria LIKE '%{$serie}%'"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } $ml = $objPHPExcel->getActiveSheet()->getCell("D17")->getValue(); //$msg= $id_serie."<br>"; //$msg= $id_fondo."<br>"; //$msg= $id_subfondo."<br>"; //$msg= $id_seccion."<br>"; if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } if ($highestColumn == "U") { if ($ml == "ML") { $i = 1; $ct = 18; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); // $expisadg->setExp_insdes(''); // $expisadg->setExp_exloor(''); // $expisadg->setExp_exloco(''); // $expisadg->setExp_underel(''); // $expisadg->setExp_notpub(''); // $expisadg->setExp_notas(''); // $expisadg->setExp_notarc(''); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; //insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); // $productor=$objPHPExcel->getActiveSheet()->getCell("J".$ct)->getValue(); $contrato = $objPHPExcel->getActiveSheet()->getCell("K" . $ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("P" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("Q" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("R" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("S" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("T" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("U" . $ct)->getValue(); //todavia en trabajo if ($titledoc != "") { if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } // exit(); if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; $this->archivo->setFil_nro($max3); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_codigo(2); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo(''); $this->archivo->setFil_alccon(''); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_nrofoj(''); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>FORMATO GNT - SCV NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>FORMATO GNT - SCV NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); } } else { if ($tipoformato == 3) { //GNT-SSA $cantidaddoc = $highestRow - 38; $fondo = $objPHPExcel->getActiveSheet()->getCell("E8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("E9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("E10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("E11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("E13")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("E14")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("P13")->getValue(); //if(trim($subseccion)=="SUBGERENCIA DE CONSERVACION VIAL"){ // $subseccion="PROYECTOS DE CONSERVACION VIAL"; //} $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); if ($highestColumn != "Q") { $msg = "<font color='red'>FORMATO GNT - SSA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND tab_series.ser_categoria LIKE '%{$serie}%'"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } if ($highestColumn == "Q") { if ($ml == "ML") { $i = 1; $ct = 18; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; //insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("F" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("G" . $ct)->getValue(); $productor = $objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue(); $contrato = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("J" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("K" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("L" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("M" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("P" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("Q" . $ct)->getValue(); //todavia en trabajo if ($titledoc != "") { if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; $this->archivo->setFil_nro($max3); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_codigo(2); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo(''); $this->archivo->setFil_alccon(''); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_nrofoj(''); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>FORMATO GNT - SSA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>FORMATO GNT - SSA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); } //end } else { if ($tipoformato == 4) { //CONTRATACIONES $cantidaddoc = $highestRow - 38; $fondo = $objPHPExcel->getActiveSheet()->getCell("E8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("E9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("E10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("E11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("E13")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("E14")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("U13")->getValue(); $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $objWorksheet = $objPHPExcel->getActiveSheet(); $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } if ($highestColumn != "W") { $msg = "<font color='red'>FORMATO CONTRATACIONES NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } //$msg= $cantidaddoc; exit(); //$msg= $fondo."<br>"; //$msg= $subfondo."<br>"; //$msg= $seccion."<br>"; //$msg= $subseccion."<br>"; //$msg= $serie."<br>"; //$msg= $tituloexpediente."<br>"; //$msg= $fechasExtremas."<br>"; //$msg= $ml."<br>"; //$msg= $nrColumns; //exit(); //$l=0; //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; // $l++; //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells, //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} // //$msg= '</tr>' . "\n"; // //} //$msg= '</table>' . "\n"; //$msg= "la cantidad e:".$cantidaddoc; //exit(); if (trim($subseccion) == "SUBGERENCIA DE CONSERVACION VIAL") { $subseccion = "PROYECTOS DE CONSERVACION VIAL"; } $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND tab_series.ser_categoria LIKE '%{$serie}%'"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } //$ml=$objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } //$msg= $nrColumns; //exit(); if ($highestColumn == "W") { if ($ml == "ML") { $i = 1; $ct = 19; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); // $expisadg->setExp_insdes(''); // $expisadg->setExp_exloor(''); // $expisadg->setExp_exloco(''); // $expisadg->setExp_underel(''); // $expisadg->setExp_notpub(''); // $expisadg->setExp_notas(''); // $expisadg->setExp_notarc(''); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; //insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("F" . $ct)->getValue(); $subtitledoc2 = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); $unidadsolicitante = $objPHPExcel->getActiveSheet()->getCell("J" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue(); $financiamiento = $objPHPExcel->getActiveSheet()->getCell("L" . $ct)->getValue(); $contrato = $objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue(); $nrofojas = $objPHPExcel->getActiveSheet()->getCell("Q" . $ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("P" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("R" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("S" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("T" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("U" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("V" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("W" . $ct)->getValue(); //todavia en trabajo $subtitledoc = $subtitledoc . " " . $subtitledoc2; if ($titledoc != "") { //$msg= $caja."<br>"; //$msg= $filnroejem."<br>"; //$msg= $correlativo."<br>"; //$msg= $titledoc."<br>"; //$msg= $subtitledoc."<br>"; ////$msg= $productor."<br>"; //$msg= $contrato."<br>"; //$msg= $fecha."<br>"; //$msg= $tomovol."<br>"; //$msg= $sopfis."<br>"; //$msg= $sala."<br>"; //$msg= $estante."<br>"; //$msg= $cuerpo."<br>"; //$msg= $balda."<br>"; //$msg= $obs."<br>"; //exit(); if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } //exit(); if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; $this->archivo->setFil_nro($max3); $this->archivo->setFil_codigo(2); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo($unidadsolicitante); $this->archivo->setFil_alccon($financiamiento); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_nrofoj($nrofojas); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>EL FORMATO CONTRATACIONES NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>FORMATO CONTRATACIONES No ES CORRECTO</font>"; unlink($Dir); $this->index($msg); } } else { if ($tipoformato == 5) { //CORRESPONDENCIA $cantidaddoc = $highestRow - 34; $fondo = $objPHPExcel->getActiveSheet()->getCell("E8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("E9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("E10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("E11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("E13")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("E14")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("M13")->getValue(); $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $objWorksheet = $objPHPExcel->getActiveSheet(); $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } //$msg= $fondo."<br>"; //$msg= $subfondo."<br>"; //$msg= $seccion."<br>"; //$msg= $subseccion."<br>"; //$msg= $serie."<br>"; //$msg= $tituloexpediente."<br>"; //$msg= $fechasExtremas."<br>"; //$msg= $ml."<br>"; //exit(); //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells, //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} //$msg= '</tr>' . "\n"; //} //$msg= '</table>' . "\n"; if ($highestColumn != "O") { $msg = "<font color='red'>EL FORMATO DE CORRESPONDENCIA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND tab_series.ser_categoria LIKE '%{$serie}%'"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } $ml = $objPHPExcel->getActiveSheet()->getCell("D16")->getValue(); if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } //$msg= $id_seccion."<br>"; //$msg= $id_subfondo."<br>"; //$msg= $nrColumns."<br>"; //exit(); if ($highestColumn == "O") { if ($ml == "ML") { $i = 1; $ct = 18; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); // $expisadg->setExp_insdes(''); // $expisadg->setExp_exloor(''); // $expisadg->setExp_exloco(''); // $expisadg->setExp_underel(''); // $expisadg->setExp_notpub(''); // $expisadg->setExp_notas(''); // $expisadg->setExp_notarc(''); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; // insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } $y = 1; while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("F" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("G" . $ct)->getValue(); // $productor=$objPHPExcel->getActiveSheet()->getCell("H".$ct)->getValue(); // $contrato=$objPHPExcel->getActiveSheet()->getCell("I".$ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("J" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("K" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("L" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("M" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue(); //todavia en trabajo if ($titledoc != "") { $vector[$i] = $titledoc; if ($i > 1) { if ($vector[$i - 1] == $titledoc) { $y++; } else { $y = 1; } } if ($y > 1) { $titledoc = "{$titledoc} Nro" . $y; } // //$msg= $caja."<br>"; //$msg= $filnroejem."<br>"; //$msg= $correlativo."<br>"; //$msg= $titledoc."<br>"; //$msg= $subtitledoc."<br>"; // //$msg= $fecha."<br>"; //$msg= $tomovol."<br>"; //$msg= $sopfis."<br>"; //$msg= $sala."<br>"; //$msg= $estante."<br>"; //$msg= $cuerpo."<br>"; //$msg= $balda."<br>"; //$msg= $obs."<br>"; //exit(); if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } // exit(); if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; // $titledoc="$titledoc Nro ".$i; $this->archivo->setFil_nro($max3); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo(''); $this->archivo->setFil_alccon(''); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_nrofoj(''); $this->archivo->setFil_codigo(2); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>EL FORMATO CORRESPONDENCIA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>EL FORMATO CORRESPONDENCIA NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); } } else { if ($tipoformato == 6) { //CONTABILIDAD $cantidaddoc = $highestRow - 30; $fondo = $objPHPExcel->getActiveSheet()->getCell("E8")->getValue(); $subfondo = $objPHPExcel->getActiveSheet()->getCell("E9")->getValue(); $seccion = $objPHPExcel->getActiveSheet()->getCell("E10")->getValue(); $subseccion = $objPHPExcel->getActiveSheet()->getCell("E11")->getValue(); $serie = $objPHPExcel->getActiveSheet()->getCell("E12")->getValue(); $tituloexpediente = $objPHPExcel->getActiveSheet()->getCell("E13")->getValue(); $fechasExtremas = $objPHPExcel->getActiveSheet()->getCell("N12")->getValue(); $ml = $objPHPExcel->getActiveSheet()->getCell("D15")->getValue(); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $objWorksheet = $objPHPExcel->getActiveSheet(); $tituloserie = explode("\n", $serie); $cantidaserie = count($tituloserie); if ($cantidaserie > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea del Título de la Serie</font><br>"; unlink($Dir); $this->index($msg); exit; } $tituloexp = explode("\n", $tituloexpediente); $cantidaexpediente = count($tituloexp); if ($cantidaexpediente > 1) { $msg = "<font color='red'>Error, Elimine los saltos de linea en Título de Expediente </font><br>"; unlink($Dir); $this->index($msg); exit; } //$msg= $fondo."<br>"; //$msg= $subfondo."<br>"; //$msg= $seccion."<br>"; //$msg= $subseccion."<br>"; //$msg= $serie."<br>"; //$msg= $tituloexpediente."<br>"; //$msg= $fechasExtremas."<br>"; //$msg= $ml."<br>"; //exit(); //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; // //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} //$msg= '</tr>' . "\n"; //} //$msg= '</table>' . "\n"; //$msg= "la cantidad es:"; exit(); if ($highestColumn != "O") { $msg = "<font color='red'>EL FORMATO DE CONTABILIDAD NO ES CORRECTO!</font>"; unlink($Dir); $this->index($msg); exit; } //15-1-17 $tab_fondo = new Tab_fondo(); $tab_unidad = new Tab_unidad(); $tab_series = new Tab_series(); //obtener fondo y subfondo $sql = "select* from tab_fondo where fon_descripcion LIKE '%{$fondo}%'"; $sql2 = "select* from tab_fondo where fon_descripcion LIKE '%{$subfondo}%'"; $resultado = $tab_fondo->dbSelectBySQL($sql); $resultado2 = $tab_fondo->dbSelectBySQL($sql2); $id_fondo = $resultado[0]->fon_id; $id_subfondo = $resultado2[0]->fon_id; $ubicacion = $resultado2[0]->fon_codigo; switch ($ubicacion) { case "ON": $ubicacion = "LA PAZ"; break; case "LP": $ubicacion = "LA PAZ"; break; case "SC": $ubicacion = "SANTA CRUZ"; break; case "PT": $ubicacion = "POTOSI"; break; case "BN": $ubicacion = "BENI"; break; case "PN": $ubicacion = "PANDO"; break; case "CB": $ubicacion = "COCHABAMBA"; break; case "OR": $ubicacion = "ORURO"; break; case "CH": $ubicacion = "CHUQUISACA"; break; case "TJ": $ubicacion = "TARIJA"; break; } if ($seccion == "DIRECCION GENERAL TECNICA") { if ($id_subfondo == 3) { $seccion = "TECNICA-OPERATIVA"; } else { $seccion = "AREA TECNICA"; } } //obtener el fon_id $subseccion = trim($subseccion); if ($subseccion == "") { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$seccion}%'"; } else { $sql3 = "SELECT\r\ntab_unidad.uni_id,\r\nf.fon_id,\r\ntab_unidad.uni_descripcion\r\nFROM tab_fondo as f\r\nINNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\nWHERE\r\nf.fon_id = {$id_subfondo} and tab_unidad.uni_descripcion LIKE'%{$subseccion}%'"; } $resultado3 = $tab_unidad->dbSelectBySQL($sql3); foreach ($resultado3 as $rowseccion) { $id_seccion = $rowseccion->uni_id; } //obtengo la serie $sql4 = "SELECT\r\ntab_series.ser_categoria,\r\ntab_series.ser_id\r\nFROM\r\ntab_fondo\r\nINNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\nWHERE\r\ntab_fondo.fon_id = {$id_subfondo} AND (tab_series.ser_categoria LIKE '%{$serie}%' or tab_series.ser_categoria LIKE '{$serie}%' )"; $resultado4 = $tab_series->dbSelectBySQL($sql4); foreach ($resultado4 as $rowserie) { $id_serie = $rowserie->ser_id; } if ($id_serie == "") { $msg = "<font color='red'>Error, No existe la Serie Asignada</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_subfondo == "") { $msg = "<font color='red'>Error, No existe el Subfondo</font><br>"; unlink($Dir); $this->index($msg); exit; } else { if ($id_seccion == "") { $msg = "<font color='red'>Error, No existe la Sección</font><br>"; unlink($Dir); $this->index($msg); exit; } } } //$msg= $id_seccion."<br>"; //$msg= $id_subfondo."<br>"; //$msg= $id_serie."<br>"; //exit(); if ($highestColumn == "O") { if ($ml == "ML") { $i = 1; $ct = 17; $t = 0; $expsadg = new Tab_expisadg(); $resulall = $expsadg->dbselectByField("exp_titulo", strtoupper($tituloexpediente)); foreach ($resulall as $list) { $t++; } $fechafinal = ''; $fechainicial = ''; $exp_fechas = explode("-", $fechasExtremas); if (!empty($exp_fechas[1])) { $fechafinal = trim($exp_fechas[1]); } if (!empty($exp_fechas[0])) { $fechainicial = trim($exp_fechas[0]); } if ($t > 0) { $msg = "<font color='red'>Error! existe otro nombre duplicado</font>"; unlink($Dir); $this->index($msg); exit; } $expediente = new expediente(); $hoy = date("Y-m-d"); $this->expediente = new tab_expediente(); // $this->expediente->setRequest2Object($_REQUEST); $this->expediente->setExp_id(''); $this->expediente->setSer_id($id_serie); // Generation code $this->expediente->setExp_codigo($expediente->generaCodigo($id_serie)); $this->expediente->setExp_lugar($ubicacion); $this->expediente->setSof_id(1); $this->expediente->setExp_ori(0); $this->expediente->setExp_cop(0); $this->expediente->setExp_fot(0); $this->expediente->setExp_obs(''); $this->expediente->setExp_corr('AUTO'); $this->expediente->setExp_estado(1); $this->expediente->setExp_migrarexcel(1); $exp_id = $this->expediente->insert2(); // Update count // if ($_REQUEST['ser_corr'] == 'AUTO') { // // Auto // $tseries = new tab_series(); // $row2 = $tseries->dbselectByField("ser_id", $_REQUEST['ser_id']); // $row2 = $row2[0]; // $tseries->setSer_id($_REQUEST['ser_id']); // $ser_exp = $row2->ser_exp + 1; // $tseries->setSer_exp($ser_exp); // $tseries->update(); // } else { // // Manual // $tseries = new tab_series(); // $tseries->setSer_id($_REQUEST['ser_id']); // $tseries->setSer_exp($_REQUEST['exp_codigo']); // $tseries->update(); // } //$this->expisadg->setTrm_id(1); // $expisadg = new tab_expisadg(); // $expisadg->setExp_id($exp_id); // $expisadg->setExp_titulo($expediente); // $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_fecha_exi(date('Y-m-d')); // $expisadg->setExp_fecha_exf(date('Y-m-d')); // $expisadg->setExp_anioi($fechainicial); // $expisadg->setExp_aniof($fechafinal); // $expisadg->setIdi_id(1); // $expisadg->setExp_estado(1); // $eig_id = $expisadg->insert(); $fechahoy = date('Y-m-d'); $expisadg = new tab_expisadg(); $expisadg->setExp_id($exp_id); $expisadg->setExp_titulo($tituloexpediente); $expisadg->setExp_fecha_exi($fechahoy); // $expisadg->setExp_mesi(''); $expisadg->setExp_anioi($fechainicial); $expisadg->setExp_fecha_exf($fechahoy); // $expisadg->setExp_mesf(''); $expisadg->setExp_aniof($fechafinal); $expisadg->setExp_nivdes('EXPEDIENTE'); // $expisadg->setExp_volsop(''); $expisadg->setExp_nomprod($fondo); // $expisadg->setExp_hisins(''); // $expisadg->setExp_hisarc(''); $expisadg->setExp_foring('TRANSFERENCIA'); // $expisadg->setExp_alccon(''); // $expisadg->setExp_vaseel(''); // $expisadg->setExp_nueing(''); $expisadg->setExp_org('LOS DOCUMENTOS DEL PROYECTO FUERON IDENTIFICADOS, CLASIFICADOS Y ORDENADOS EN LAS CAJAS DE ACUERDO AL CHECK LIST DE LA SERIE A LA QUE CORRESPONDEN.'); $expisadg->setExp_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.'); // $expisadg->setExp_conrep(''); $expisadg->setIdi_id(1); $expisadg->setExp_carfis('BUENO'); // $expisadg->setExp_insdes(''); // $expisadg->setExp_exloor(''); // $expisadg->setExp_exloco(''); // $expisadg->setExp_underel(''); // $expisadg->setExp_notpub(''); // $expisadg->setExp_notas(''); // $expisadg->setExp_notarc(''); $expisadg->setExp_regnor('ISAD-G, ISAAR(CPF), RCAA'); $expisadg->setExp_fecdes(date('Y-m-d')); $expisadg->setExp_estado(1); $eig_id = $expisadg->insert(); // Save expfondo data $texf = new Tab_expfondo(); $texf->setExp_id($exp_id); $usuario = new usuario(); $fon_id = $usuario->getFon_id($_SESSION['USU_ID']); $nomUsuario = $usuario->obtenerNombre($_SESSION['USU_ID']); $texf->setExf_fecha_exi($fechahoy); $texf->setFon_id($fon_id); $texf->setExf_estado('1'); $texf->insert(); // Save expusuario data $this->expusuario = new expusuario(); $this->expusuario->saveExp($exp_id, $_SESSION['USU_ID']); // // Save expcontenedor data // $con = new expcontenedor(); // $con->saveExpCont($_REQUEST['con_id'], $_REQUEST['suc_id'], $exp_id); // // Save proyecto list data (tramos) // if (isset($_REQUEST['lista_tramo'])) { // $proyectos = $_REQUEST['lista_tramo']; // foreach ($proyectos as $proyecto) { // $exp = new tab_expproyecto(); // $exp->setExp_id($exp_id); // $exp->setPry_id($proyecto); // $exp->setEpp_estado(1); // $exp->insert(); // } // } // Save data dynamic $c = 0; $caj = ""; $cnt = 0; // insert usuario serie $tab_usu_serie = new Tab_usu_serie(); $sqlususerie = "select* from tab_usu_serie\r\n where usu_id='" . $_SESSION['USU_ID'] . "'\r\n and ser_id='" . $id_serie . "'\r\n and use_estado=1"; $comprobar_usu_serie = $tab_usu_serie->dbSelectBySQL($sqlususerie); $cnt = count($comprobar_usu_serie); if ($cnt == 0) { $tab_usu_serie->setUse_id(''); $tab_usu_serie->setUsu_id($_SESSION['USU_ID']); $tab_usu_serie->setSer_id($id_serie); $tab_usu_serie->setUse_estado(1); $tab_usu_serie->insert(); } $y = 1; while ($i <= $cantidaddoc) { $caja = $objPHPExcel->getActiveSheet()->getCell("A" . $ct)->getValue(); $filnroejem = $objPHPExcel->getActiveSheet()->getCell("C" . $ct)->getValue(); $correlativo = $objPHPExcel->getActiveSheet()->getCell("E" . $ct)->getValue(); $titledoc = $objPHPExcel->getActiveSheet()->getCell("F" . $ct)->getValue(); $subtitledoc = $objPHPExcel->getActiveSheet()->getCell("G" . $ct)->getValue(); // $productor=$objPHPExcel->getActiveSheet()->getCell("H".$ct)->getValue(); // $contrato=$objPHPExcel->getActiveSheet()->getCell("I".$ct)->getValue(); $fecha = trim($objPHPExcel->getActiveSheet()->getCell("H" . $ct)->getValue()); $tomovol = $objPHPExcel->getActiveSheet()->getCell("I" . $ct)->getValue(); $sopfis = $objPHPExcel->getActiveSheet()->getCell("J" . $ct)->getValue(); $sala = $objPHPExcel->getActiveSheet()->getCell("K" . $ct)->getValue(); $estante = $objPHPExcel->getActiveSheet()->getCell("L" . $ct)->getValue(); $cuerpo = $objPHPExcel->getActiveSheet()->getCell("M" . $ct)->getValue(); $balda = $objPHPExcel->getActiveSheet()->getCell("N" . $ct)->getValue(); $obs = $objPHPExcel->getActiveSheet()->getCell("O" . $ct)->getValue(); //todavia en trabajo if ($titledoc != "") { $vector[$i] = $titledoc; if ($i > 1) { if ($vector[$i - 1] == $titledoc) { $y++; } else { $y = 1; } } if ($y > 1) { $titledoc = "{$titledoc} Nro " . $y; } if ($fecha != "s/f") { $extfe = explode("\n", $fecha); $cantidadfecha = count($extfe); if ($cantidadfecha > 1) { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = $extfe[1]; } else { $fechadocAnioInicial = $extfe[0]; $fechadocMesInicial = ""; if ($fechadocAnioInicial > 30000) { $fe = date("m-y", (int) $fechadocAnioInicial); $extraer = explode("-", $fe); $fechadocAnioInicial = $extraer[1]; $fechadocMesInicial = $extraer[0]; } } } // exit(); if ($caja == "") { } else { $extraercaj = explode(" ", trim($caja)); $caj = $extraercaj[1]; } $id_exp = $exp_id; $this->archivo = new tab_archivo(); $this->archivo->setFil_id(''); // Generation code max fil_nro $maxFil = new Tab_archivo(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$id_exp} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; // $titledoc="$titledoc Nro ".$i; $this->archivo->setFil_nro($max3); $this->archivo->setFil_titulo(strtoupper($titledoc)); $this->archivo->setFil_codigo(2); $this->archivo->setFil_subtitulo(strtoupper($subtitledoc)); $this->archivo->setFil_fecha($fechahoy); $this->archivo->setIdi_id(1); $this->archivo->setFil_proc($fondo); $this->archivo->setFil_firma($nomUsuario); $this->archivo->setFil_cargo(''); $this->archivo->setFil_alccon(''); $sqlsopfis = new tab_sopfisico(); if ($sopfis != "AP" || $sopfis != "EM" || $sopfis != "LG" || $sopfis != "AN" || $sopfis != "MM" || $sopfis != "CP") { $sopfis = "LG"; } $result = $sqlsopfis->dbselectByField("sof_codigo", $sopfis); $this->archivo->setSof_id($result[0]->sof_id); $this->archivo->setFil_nrofoj(''); $this->archivo->setFil_tomovol($tomovol); $this->archivo->setFil_nroejem($filnroejem); $this->archivo->setFil_nrocaj($caj); $this->archivo->setFil_nropaq(''); $this->archivo->setFil_sala(strtoupper($sala)); $this->archivo->setFil_estante(strtoupper($estante)); $this->archivo->setFil_cuerpo(strtoupper($cuerpo)); $this->archivo->setFil_balda(strtoupper($balda)); $this->archivo->setFil_tipoarch('TEC'); $this->archivo->setFil_mrb('BUENO'); $this->archivo->setFil_mes($fechadocMesInicial); $this->archivo->setFil_anio($fechadocAnioInicial); $this->archivo->setFil_cantpaq(''); $this->archivo->setFil_cantcaj(''); $this->archivo->setFil_confidencialidad(1); $this->archivo->setFil_obs(strtoupper($obs)); $this->archivo->setFil_estado('1'); $fil_id = $this->archivo->insert(); $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $archivo_digital = new tab_archivo_digital(); $archivo_digital->setFid_id(''); $archivo_digital->setFil_id($fil_id); $archivo_digital->insert(); $seriet = new Tab_serietramite(); $this->series = new series(); $ser_codigo = $this->series->obtenerCodigoSerie($id_serie); //insert grupos documentales y tipos documentales $this->tramite = new tab_tramite(); $tramitecc = new tab_tramitecuerpos(); $sqltramite = "SELECT\r\n tab_tramite.tra_descripcion,\r\n tab_tramite.tra_id\r\n FROM\r\n tab_series\r\n INNER JOIN tab_serietramite ON tab_series.ser_id = tab_serietramite.ser_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_serietramite.tra_id\r\n WHERE\r\n tab_series.ser_id = {$id_serie}"; $rows = $seriet->dbSelectBySQL($sqltramite); $v = 0; foreach ($rows as $row) { if ($row->tra_descripcion == 'GRUPO DOCUMENTAL COMPUESTA') { $v++; $tra_id = $row->tra_id; $obtenerColumnCueId = $tramitecc->dbselectByField("tra_id", $tra_id); $cue_id = $obtenerColumnCueId[0]->cue_id; } } if ($v == 0) { $this->tramite->setTra_orden(1); $this->tramite->setTra_codigo(1); $this->tramite->setTra_descripcion("GRUPO DOCUMENTAL COMPUESTA"); $this->tramite->setTra_fecha_crea(date("Y-m-d")); $this->tramite->setTra_usuario_crea($_SESSION['USU_ID']); $this->tramite->setTra_estado(1); $tra_id = $this->tramite->insert(); $seriet->setSer_id($id_serie); $seriet->setTra_id($tra_id); $seriet->setSts_fecha_crea(date("Y-m-d")); $seriet->setSts_fecha_reg(date("Y-m-d")); $seriet->setSts_usuario_crea($_SESSION['USU_ID']); $seriet->setSts_usu_reg($_SESSION['USU_ID']); $seriet->setVer_id('0'); $seriet->setSts_estado(1); $seriet->insert(); $this->tramite = new tramite(); $tra_codigo = $this->tramite->obtenerCodigoTramite($tra_id); $tcuerpos = new tab_cuerpos(); $tcuerpos->setCue_id(''); $tcuerpos->setCue_orden(1); $tcuerpos->setCue_codigo(1); $tcuerpos->setCue_descripcion("UNIDAD DOCUMENTAL SIMPLE"); $tcuerpos->setCue_fecha_crea(date("Y-m-d")); $tcuerpos->setCue_usuario_crea($_SESSION['USU_ID']); $tcuerpos->setCue_estado(1); $cue_id = $tcuerpos->insert(); // Last code //$tramitecc = new tab_tramitecuerpos(); $tramitecc->setCue_id($cue_id); $tramitecc->setTra_id($tra_id); $tramitecc->setTrc_estado(1); $tramitecc->insert(); } //insert $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); //Fin del archivo } $i++; $ct++; } } else { $msg = "<font color='red'>EL FORMATO DE CONTABILIDAD NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); exit; } $msg .= "<b style='color:green'>SE GUARDO CORRECTAMENTE</b><br>"; $msg .= "<a href='" . PATH_DOMAIN . "/nuevoExpediente/index/'>Ver registro</a>"; unlink($Dir); $this->index($msg); exit; } else { $msg = "<font color='red'>EL FORMATO DE CONTABILIDAD NO ES CORRECTO</font>"; unlink($Dir); $this->index($msg); } } } } } } } //otro modelo //$objHoja=$objPHPExcel->getActiveSheet()->toArray(null,true,true,true); // //foreach($objHoja as $iIndice=>$objCelda) { //$msg= $objCelda['A'].$objCelda['B']; //} //$objWorksheet = $objPHPExcel->getActiveSheet(); // //$msg= '<table border="1">' . "\n"; //foreach ($objWorksheet->getRowIterator() as $row) { //$msg= '<tr>' . "\n"; // //$cellIterator = $row->getCellIterator(); //$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells, //foreach ($cellIterator as $cell) { //$msg= '<td>' . htmlentities($cell->getValue(), ENT_IGNORE, 'utf-8') . '</td>' . "\n"; //} // //$msg= '</tr>' . "\n"; //} //$msg= '</table>' . "\n"; //foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { //$worksheetTitle = $worksheet->getTitle(); //$highestRow = $worksheet->getHighestRow(); // e.g. 10 //$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' //$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); //$nrColumns = ord($highestColumn) - 64; ////$msg= "<br>The worksheet ".$worksheetTitle." has "; ////$msg= $nrColumns . ' columns (A-' . $highestColumn . ') '; ////$msg= ' and ' . $highestRow . ' row.'; //$msg= '<br><table border="1"><tr>'; //for ($row = 1; $row <= $highestRow; ++ $row) { //$msg= '<tr>'; //for ($col = 0; $col < $highestColumnIndex; ++ $col) { //$cell = $worksheet->getCellByColumnAndRow($col, $row); //$val = $cell->getValue(); //$dataType = PHPExcel_Cell_DataType::dataTypeForValue($val); //$msg= '<td>' . $val . '</td>'; //} //$msg= '</tr>'; //} //$msg= '</table>'; //} unlink($Dir); exit; // //if( !isset($_FILES['archivo']) ){ // $msg= 'Ha habido un error, tienes que elegir un archivo<br/>'; // $msg= '<a href="index.html">Subir archivo</a>'; //}else{ // // $nombre = $_FILES['archivo']['name']; // $nombre_tmp = $_FILES['archivo']['tmp_name']; // $tipo = $_FILES['archivo']['type']; // $tamano = $_FILES['archivo']['size']; // // $ext_permitidas = array('xls','jpeg','xlsx','png'); // $partes_nombre = explode('.', $nombre); // $extension = end( $partes_nombre ); // $ext_correcta = in_array($extension, $ext_permitidas); // // $tipo_correcto = preg_match('/^image\/(pjpeg|jpeg|gif|png|xls|xlsx)$/', $tipo); // // $limite = 500 * 1024; // // if( $ext_correcta && $tamano <= $limite ){ // if( $_FILES['archivo']['error'] > 0 ){ // $msg= 'Error: ' . $_FILES['archivo']['error'] . '<br/>'; // }else{ // $msg= 'Nombre: ' . $nombre . '<br/>'; // $msg= 'Tipo: ' . $tipo . '<br/>'; // $msg= 'Tamaño: ' . ($tamano / 1024) . ' Kb<br/>'; // $msg= 'Guardado en: ' . $nombre_tmp; // // $nombreDirectorio = ""; // $tsistema = new tab_sistema (); // $sql = "SELECT * // FROM tab_sistema"; // $rows2 = $tsistema->dbselectBySQL($sql); // if (count($rows2) >= 1) { // $sis_tipcarga = $rows2 [0]->sis_tipcarga; // $sis_tammax = $rows2 [0]->sis_tammax; // $nombreDirectorio = $rows2 [0]->sis_ruta; // } // // if( file_exists( 'subidas/'.$nombre) ){ // $msg= '<br/>El archivo ya existe: ' . $nombre; // }else{ // move_uploaded_file($nombre_tmp, // "subidas/" . $nombre); // // $msg= "<br/>Guardado en: " . "subidas/" . $nombre; // } // } // }else{ // $msg= 'Archivo inválido'; // } //} exit; }
function guardarExpediente() { $id_exp = $_POST['id_exp']; $tituloexp = $_POST['tituloexp']; $alconexp = $_POST['alconexp']; $notasexp = $_POST['notasexp']; $tomovolexp = $_POST['tomovolexp']; $nrocajexp = $_POST['nrocajexp']; $salaexp = $_POST['salaexp']; $estanteexp = $_POST['estanteexp']; $baldaexp = $_POST['baldaexp']; $cuerpoexp = $_POST['cuerpoexp']; $exp_anioi = $_POST['exp_anioi']; $exp_aniof = $_POST['exp_aniof']; $nrofojasexp = $_POST['nrofojasexp']; $productorexp = $_POST['productorexp']; $obsexp = $_POST['obsexp']; $extraeexp = new Tab_expisadg(); $row = $extraeexp->dbselectByField("exp_id", $id_exp); $eig_id = $row[0]->eig_id; $expediente = new Tab_expediente(); $update = "UPDATE \r\n tab_expediente\r\n set exp_tomovol='{$tomovolexp}',exp_nrocaj='{$nrocajexp}',exp_sala='{$salaexp}',exp_estante='{$estanteexp}',exp_balda='{$baldaexp}',exp_cuerpo='{$cuerpoexp}',exp_obs='{$obsexp}',exp_nrofoj='{$nrofojasexp}' where exp_id={$id_exp}"; $update2 = "UPDATE \r\n tab_expisadg \r\n set exp_titulo='{$tituloexp}',exp_alccon='{$alconexp}',exp_notas='{$notasexp}',exp_anioi='{$exp_anioi}',exp_aniof='{$exp_aniof}',exp_nomprod='{$productorexp}' where eig_id={$eig_id}"; $expediente->dbSelectBySQL($update); $extraeexp->dbSelectBySQL($update2); // echo "Se guardo correctamente"; }