// Comprobar que sea un contenedor válido. // ------------------------------------------ $idConte = getValueTable("id_contenedor", "CONTENEDOR", "numero", $conte); $idNav = getValueTable("id_naviera", "CONTENEDOR", "id_contenedor", $idConte); // Contenedores que no se deben vaidar por el algoritmo. // CDHU5646058 (1119670) // CAXU6314780 ( 1120194 ) : Fec. 20130711 $algoActivo = 1; if ($idConte == 1119670 || $idConte == 1120194 || $idConte == "1124167") { $algoActivo = '0'; } if ($idNav == '35') { $algoActivo = '0'; } if (!empty($conte)) { if (!validaConte($conte) && $algoActivo == 1) { $msg[] = "<font color=red><b>ERROR : Numero de contenedor incorrecto. Favor de verificar.</b></font>"; } else { $idEq = getIdEquipo($equipo); if (empty($idConte)) { // Entonces debe agragar al catalogo. // Validar el conte. if (empty($idEq)) { $msg[] = "<font color=red><b>ERROR : Equipo, faltan datos.</b></font>"; } else { // Entonces Grabar contenedor. if ($idEq > 0) { $sql = "insert into CONTENEDOR (numero,id_equipo) values ('{$conte}','{$idEq}')"; $db->query($sql); $idConte = getValueTable("id_contenedor", "CONTENEDOR", "numero", $conte); }
$msg[] = "<font color=\"red\">[ERROR] PLACAS , NO ESPECIFICADO. "; } if (empty($salFec)) { $msg[] = "<font color=\"red\">[ERROR] FECHA DE SALIDA, NO ESPECIFICADO. "; } if (empty($concepto) || $concepto == "-") { $msg[] = "<font color=\"red\">[ERROR] CONCEPTO, NO ESPECIFICADO. "; } if (empty($facturaSN) || $facturaSN == "-") { $msg[] = "<font color=\"red\">[ERROR] FACTURA SI O NO, NO ESPECIFICADO. "; } if (empty($monto)) { $msg[] = "<font color=\"red\">[ERROR] MONTO , NO ESPECIFICADO. "; } if (!empty($conte)) { if (validaConte($conte) == 0) { $msg[] = "<font color=\"red\">[ERROR] NUMERO DE CONTENEDOR NO VALIDO.</font> "; } if ($idEquipo == 13) { $msg[] = "<font color=\"red\">[ERROR] EQUIPO o TIPO DE CONTE. NO VALIDO.</font> "; } } if (empty($metPago)) { $msg[] = "<font color=\"red\">[ERROR] METODO DE PAGO, NO ESPECIFICADO.</font> "; } if (count($msg) > 0) { showForm($arr_request, $msg); } else { $idConte = getValueTable("id_contenedor", "CONTENEDOR", "numero", $conte); if (empty($idConte) || $idConte == 0) { // Agregar a la base.
} } $t->pparse("out", "page"); } // ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff // ---------------------------------------------------------------- $modo = $_POST['modo']; $conte = $_POST['conte']; switch ($modo) { case "verificar": if (empty($conte)) { $msg[] = "<font color=red>ERROR. Debe especificar un numero de contenedor</font>"; } if (count($msg) > 0) { showForm($data, $msg); } else { $flgDigitoVal = ""; $flgDigitoVal = validaConte($conte); if ($flgDigitoVal == "0") { $msg[] = "<font color=red>ERROR. Contenedor Invalido</font>"; } elseif ($flgDigitoVal == "1") { $msg[] = "<font color=green>OK. Contenedor Valido.</font>"; } $data[conte] = $conte; showForm($data, $msg); } break; default: showForm($data); break; }
$manufactura = $_POST['manufactura']; $folioImp = $_POST['folioImp']; if (existeConte($contenedor)) { $msg[existeConte] = "El numero de contenedor ya existe."; } if ($idNav == "-") { $msg[] = "[Naviera] Faltan datos..."; } if ($idEquipo == 13) { $msg[] = "[Equipo] No ha sido especificado..."; } if (empty($contenedor)) { $msg[] = "[Contenedor] Faltan datos..."; } if ($idNav != 35) { if (validaConte($contenedor) == 0) { $msg[] = "<font color=\"red\">[Contenedor] Eror el número de contenedor no es Valido.</font> "; } } // --- Fin de la validación if (count($msg) > 0) { showForm($arr_request, 'nuevo', $msg); } else { // Comprobar que no se repita el numero de contenedor $cr = getValueTable("id_contenedor", "CONTENEDOR", "numero", $contenedor); if (empty($cr)) { $contenedor = strtoupper($contenedor); $sql = "insert into CONTENEDOR (numero,id_equipo,id_naviera,manufactura,folio_imp "; $sql .= ") values ("; $sql .= "'{$contenedor}','{$idEquipo}','{$idNav}','{$manufactura}','{$folioImp}')"; $db->query($sql);
function reporte($data) { global $db, $db2, $hoy; $sesIdUsuario = $_SESSION[sesIdUsuario]; $fec1 = $data[fec1]; $fec2 = $data[fec2]; $sepa = $data[sepa]; // Se crea el archivo $archivo = "../files/myReport.csv"; $fp = fopen("{$archivo}", "w"); // Encabezado $enc = "TRANSPORTES MALEJA, S.A. DE C.V. MEXICO\n"; fputs($fp, $enc); $enc = "REPORTE DE DE CONTENEDORES NO VALIDOS\n"; fputs($fp, $enc); $enc = "NOTA : Se comprueba segun Algoritmo Verificador Ver.1.0. \n\n"; fputs($fp, $enc); // ----------------------------------- // COLUMNAS // ----------------------------------- $enc = "Folio" . $sepa . "Contenedor" . $sepa . "Valido" . $sepa . "Naviera" . $sepa . "Capturo" . $sepa . "Fec.Cap" . $sepa . "Oficina" . "\n"; fputs($fp, $enc); // ----------------------------------- // DATOS // ----------------------------------- // ENTRADAS $sql = "select eir,id_contenedor,id_naviera,cap_id_usr,cap_fec,id_oficina from "; $sql .= "ENTRADA "; $sql .= "where cap_fec BETWEEN '{$fec1} 00:00:00' and '{$fec2} 23:59:59' and st_reg<>'B' order by id_oficina,id_naviera,cap_fec desc "; $db->query($sql); while ($db->next_record()) { $idOficina = $db->f(id_oficina); $oficina = getValueTable("oficina", "OFICINA", "id_oficina", $idOficina); $idConte = $db->f(id_contenedor); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $eir = $db->f(eir); $idNav = $db->f(id_naviera); $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav); $capIdUsr = $db->f(cap_id_usr); $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr); $capFec = $db->f(cap_fec); if (!validaConte($conte)) { $row = "E-{$eir}" . $sepa . "{$conte}" . $sepa . "NO" . $sepa . "{$naviera}" . $sepa . "{$capUsr}" . $sepa . "{$capFec}" . $sepa . "{$oficina}" . $sepa . "\n"; fputs($fp, $row); } } fputs($fp, "SALIDAS\n"); // SALIDAS $sql = "select eir,id_contenedor,id_naviera,cap_id_usr,cap_fec,id_oficina from "; $sql .= "SALIDA "; $sql .= "where cap_fec BETWEEN '{$fec1} 00:00:00' and '{$fec2} 23:59:59' and st_reg<>'B' order by id_oficina,id_naviera,cap_fec desc "; $db->query($sql); while ($db->next_record()) { $idOficina = $db->f(id_oficina); $oficina = getValueTable("oficina", "OFICINA", "id_oficina", $idOficina); $idConte = $db->f(id_contenedor); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $eir = $db->f(eir); $idNav = $db->f(id_naviera); $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav); $capIdUsr = $db->f(cap_id_usr); $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr); $capFec = $db->f(cap_fec); if (!validaConte($conte)) { $row = "S-{$eir}" . $sepa . "{$conte}" . $sepa . "NO" . $sepa . "{$naviera}" . $sepa . "{$capUsr}" . $sepa . "{$capFec}" . $sepa . "{$oficina}" . $sepa . "\n"; fputs($fp, $row); } } fclose($fp); // ----------------------------- // SALVAR COMO... O ABRIR EN AUTO. // (No modificar) // ----------------------------- if (file_exists("{$archivo}")) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($archivo)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($archivo)); ob_clean(); flush(); readfile("{$archivo}"); exit; } }