function retorno_automatico($VendedorEmail, $TransacaoID, $Referencia, $TipoFrete, $ValorFrete, $Anotacao, $DataTransacao, $TipoPagamento, $StatusTransacao, $CliNome, $CliEmail, $CliEndereco, $CliNumero, $CliComplemento, $CliBairro, $CliCidade, $CliEstado, $CliCEP, $CliTelefone, $produtos, $NumItens) { global $db, $log; $order = $db->query('SELECT * FROM `' . DB_PREFIX . 'order` WHERE order_id = ' . $Referencia); $StatusTransacao = normaliza($StatusTransacao); switch ($StatusTransacao) { case 'Aguardando Pagto': $order_status_id = 10200; break; case 'Em Analise': $order_status_id = 10201; break; case 'Aprovado': $order_status_id = 10202; break; case 'Cancelado': $order_status_id = 10203; break; case 'Completo': $order_status_id = 10204; break; case 'Devolvido': $order_status_id = 10205; break; default: $order_status_id = 10206; } $log->setLog('order_status_id : ' . $order_status_id . "\n"); $db->query('UPDATE `' . DB_PREFIX . 'order` SET `comment` = ' . $TipoPagamento . ', `order_status_id` = ' . $order_status_id . ' WHERE `order_id` = ' . $Referencia); $db->query("INSERT INTO `" . DB_PREFIX . "order_history` VALUES (NULL , '" . $Referencia . "', '" . $order_status_id . "', '0', '', NOW());"); }
function convert_to_username($nom, $ap, $am) { $conn = dbConnect(); $nom = normaliza($nom); $ap = normaliza($ap); $am = normaliza($am); //$passno_strip = substr($passno, 0, 2); $preuname = substr($nom, 0, 1); if ($ap !== '' && $am !== '') { $preuname .= $ap; $preuname .= substr($am, 0, 1); } elseif ($ap == '' && $am !== '') { $preuname .= $am; } elseif ($ap !== '' && $am == '') { $preuname .= $ap; } //check if this username already exist (this is using my library, you have to change this with whatever mysql query u need. this is to check whether the name exists) //$check = $sql->selectSQL("COUNT(*) as how_many","admin_login","WHERE uname LIKE '$uname'"); $check = 1; while ($check > 0) { try { $stmt = $conn->prepare("SELECT COUNT( * ) FROM usuarios WHERE id_usuario =:preuname"); $stmt->bindParam(':preuname', $preuname, PDO::PARAM_INT); $isQueryOk = $stmt->execute(); if ($isQueryOk) { $check = $stmt->fetchColumn(); //echo $count . ' users are older than ' . $maxAge . ' years old'; } else { trigger_error('Error executing statement.', E_USER_ERROR); } } catch (PDOException $e) { trigger_error('Error occured while trying to select users in DB:' . $e->getMessage(), E_USER_ERROR); } if ($check > 0) { $aleatorio = rand(1, 9); $preuname .= $aleatorio; } } $conn = NULL; $uname = strtolower($preuname); return $uname; }
if ($selectVideo || isset($_FILES["fileVideo"]['tmp_name']) && $_FILES["fileVideo"]['tmp_name'] != "") { if ($selectVideo) { // on associe une vidéo existante $modifParag->numvideo = $selectVideo; $newVideo = new Video(); $newVideo->numvideo = $selectVideo; $newVideo->infosVideo(); $nom_video = $newVideo->nomVideo; $modifParag->ordreVideo = $selectOrdreVideo; $modifParag->legVideo = $textLegVi; $modifParag->modifierVideo(); } else { if (isset($_FILES["fileVideo"]['tmp_name']) && $_FILES["fileVideo"]['tmp_name'] != "") { // on crée une vidéo $newVideo = new Video(); $nom_video = normaliza(basename($_FILES["fileVideo"]['name'])); $newVideo->nomVideo = $nom_video; $newVideo->tmp_name = $_FILES["fileVideo"]['tmp_name']; $newVideo->modif = 1; // utile pour changer la valeur $chem="../" $numvideo = $newVideo->creerVideo(); // On modifie ensuite la vidéo du paragraphe $modifParag->numvideo = $numvideo; $modifParag->ordreVideo = $selectOrdreVideo; $modifParag->legVideo = $textLegVi; $modifParag->modifierVideo(); } } } //fin if ($selectPhoto || ...) $mes = "La vidéo est modifiée!";
// si existe, entonces lo eliminamos $res = $mysqli->query("DELETE FROM atributo_propiedad WHERE id_atributo = " . seguridad($pos) . " AND id_propiedad = '{$id_propiedad}'"); } } } } //insertar en fotografia //si $_FILES["myfile"]["error"] en su primera posicion (primer archivo) tiene error 4, es que no se agrego ningun archivo if (isset($_FILES["myfile"]) && $_FILES["myfile"]["error"][0] != 4) { $output_dir = "../uploads/"; $agregado = true; $error = $_FILES["myfile"]["error"]; //agregar archivos $fileCount = count($_FILES["myfile"]["name"]); for ($i = 0; $i < $fileCount; $i++) { $fileName = normaliza($_FILES["myfile"]["name"][$i]); move_uploaded_file($_FILES["myfile"]["tmp_name"][$i], $output_dir . $fileName); // insertar a la base de datos $res = $mysqli->query("INSERT INTO fotografia (Ruta, id_Propiedad) VALUES ('" . $fileName . "', '{$id_propiedad}')") or die("Error en:" . $mysqli->error); if (!$res) { $agregado = false; break; } } if (!$agregado) { echo "error_1"; } } //insertar en propiedad_operacion $query2 = $mysqli->query("UPDATE propiedad_operacion SET Precio = '{$precio}', Precio_metro = '{$precio_m2}', operacion = '{$tipo}' WHERE Id_propiedad = '{$id_propiedad}'"); if ($mysqli->affected_rows < 0) {
</tr> </thead> <tbody> <?php include_once '../connections/guayana_s.php'; $conexion = new Conexion(); $db = $conexion->getDbConn(); $db->debug = false; $db->SetFetchMode(ADODB_FETCH_ASSOC); $query_sucesos = $db->Prepare("SELECT suceso_id, fecha_suceso, delito_id, delito_detalle_id, titulo, nombre_victima, fuente\n\t\t\t\t\t\tFROM sucesos ORDER BY fecha_suceso DESC"); $rs_sucesos = $db->Execute($query_sucesos); while (!$rs_sucesos->EOF) { echo '<tr>'; echo '<td><a class="btn ampliar" href="suceso.php?suceso_id=' . $rs_sucesos->Fields('suceso_id') . '" class="btn btn-primary btn-lg">' . $rs_sucesos->Fields('suceso_id') . '</a></td>'; echo '<td>' . normaliza($rs_sucesos->Fields('fecha_suceso')) . '</td>'; echo '<td>' . $rs_sucesos->Fields('titulo') . '</td>'; echo '<td>' . $rs_sucesos->Fields('nombre_victima') . '</td>'; echo '<td><a class="btn" href="' . $rs_sucesos->Fields('fuente') . '" target="_blank">Fuente</a></td>'; echo '</td>'; echo '</tr>'; $rs_sucesos->MoveNext(); } $rs_sucesos->MoveFirst(); ?> </tbody> </table> </div> </div> </div> <!-- /container --> <div class="ajaxcont"></div>
').raty({ space: false, path: "<?php echo base_url('js/raty/img'); ?> ", width: false, <?php if ($actividad['evaluacion'] == 1) { ?> readOnly: true, <?php } ?> scoreName: '<?php echo normaliza($eval['idMetaKey']); ?> ', score: <?php echo $evalNota; ?> , /*click: function(score) { $.post('<?php echo base_url('mipanel/guardaCalificacion'); ?> ', { idActividad: <?php echo $actividad['idActividad']; ?>
<?php include_once '../connections/guayana_s.php'; $conexion = new Conexion(); $db = $conexion->getDbConn(); $db->debug = true; $suceso_id = $_GET['suceso_id']; //$suceso_id = 32; $query_suceso = $db->Prepare("SELECT fecha_suceso, delito_id, delito_detalle_id, titulo, fuente, otra_fuente1, otra_fuente2, nombre_victima, sexo, edad, tipo_arma, estado, \n\tmunicipio_id, parroquia_id,\tlatitud, longitud, sector, usuario, fecha_creado\n\tFROM sucesos WHERE suceso_id = {$suceso_id}"); $db->SetFetchMode(ADODB_FETCH_ASSOC); $rs_suceso = $db->Execute($query_suceso); $fecha_suceso = normaliza($rs_suceso->Fields('fecha_suceso')); //$fecha_suceso = $rs_suceso->Fields('fecha_suceso'); $delito_id = $rs_suceso->Fields('delito_id'); $delito_detalle_id = $rs_suceso->Fields('delito_detalle_id'); $titulo = $rs_suceso->Fields('titulo'); $fuente = $rs_suceso->Fields('fuente'); $otra_fuente1 = $rs_suceso->Fields('otra_fuente1'); $otra_fuente2 = $rs_suceso->Fields('otra_fuente2'); $nombre_victima = $rs_suceso->Fields('nombre_victima'); $sexo = $rs_suceso->Fields('sexo'); $edad = $rs_suceso->Fields('edad'); $tipo_arma = $rs_suceso->Fields('tipo_arma'); $estado = $rs_suceso->Fields('estado'); $municipio_id = $rs_suceso->Fields('municipio_id'); $parroquia_id = $rs_suceso->Fields('parroquia_id'); $sector = $rs_suceso->Fields('sector'); $usuario = $rs_suceso->Fields('usuario'); $query_delitos = $db->Prepare("SELECT delito_id, descripcion\n\t\t\t\t\tFROM delitos"); $query_delitos_deta = $db->Prepare("SELECT delito_detalle_id, delito_id, descripcion\n\t\t\t\t\tFROM delitos_detalles"); $query_municipios = $db->Prepare("SELECT municipio_id, descripcion, estado_id\n\t\t\t\t\tFROM municipios\n\t\t\t\t\tWHERE estado_id = 7");
</tr> </thead> <tbody> <?php include_once '../connections/guayana_s.php'; $conexion = new Conexion(); $db = $conexion->getDbConn(); $db->debug = false; $db->SetFetchMode(ADODB_FETCH_ASSOC); $query_sucesos = $db->Prepare("SELECT suceso_id, fecha_suceso As fecha_suceso, delito_id, delito_detalle_id, titulo, nombre_victima, fuente, \n\t\t\t\t\t\t\t\t\t\t\t\t\tm.descripcion AS municipio, p.descripcion AS parroquia\n\t\t\t\t\t\t\t\t\t\t\t\tFROM sucesos As s\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN municipios AS m ON s.municipio_id = m.municipio_id\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN parroquias AS p ON s.parroquia_id = p.parroquia_id"); $rs_sucesos = $db->Execute($query_sucesos); while (!$rs_sucesos->EOF) { echo '<tr>'; echo '<td><a class="btn ampliar" href="suceso.php?suceso_id=' . $rs_sucesos->Fields('suceso_id') . '" class="btn btn-primary btn-lg">' . $rs_sucesos->Fields('suceso_id') . '</a></td>'; echo '<td><span style="display: none;">' . $rs_sucesos->Fields('fecha_suceso') . "</span>" . normaliza($rs_sucesos->Fields('fecha_suceso')) . '</td>'; echo '<td>' . $rs_sucesos->Fields('titulo') . '</td>'; echo '<td>' . $rs_sucesos->Fields('nombre_victima') . '</td>'; echo '<td>' . $rs_sucesos->Fields('municipio') . '</td>'; echo '<td>' . $rs_sucesos->Fields('parroquia') . '</td>'; echo '<td><a class="btn" href="' . $rs_sucesos->Fields('fuente') . '" target="_blank">Fuente</a></td>'; echo '<td width=250>'; echo '<a class="btn update btn-success" href="frm_modi_suceso.php?suceso_id=' . $rs_sucesos->Fields('suceso_id') . '" class="btn btn-primary btn-lg">Modifi</a>'; echo ' '; echo '<a class="btn btn-danger" id="delete" href="trata_borra_suceso.php?suceso_id=' . $rs_sucesos->Fields('suceso_id') . '">Delete</a>'; echo ' '; echo '</td>'; echo '</tr>'; $rs_sucesos->MoveNext(); } $rs_sucesos->MoveFirst();
} $valor = number_format($valor, 2, ".", ""); $dim = extenso($valor); $dim = ereg_replace(" E "," e ",ucwords($dim)); // função para retirar acentos e passar a frase para minuscula function normaliza($string){ $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; $string = utf8_decode($string); $string = strtr($string, utf8_decode($a), $b); return utf8_encode($string); } $dim = normaliza($dim); $dim = strtoupper($dim); // DIVIDE OS VALORES if ($vencimento2 != "--") { $valor1 = $valor / 2; $valor1 = number_format($valor1, 2, ".", ""); $valor2 = $valor - $valor1; } else { $valor1 = $valor; } //DATA DO CADASTRO $data_cadastro = date("Y-m-d"); //GRAVA DADOS NA TABELA dados_nf_unica
function reporte($vessel, $voyage, $pol = '', $pod = '') { global $linkSrv, $linkDB, $linkUsr, $linkPass; // ------------------------------------------------------------------------------- // ODBC // El sistema se trata de conectar mediante ODBC nativo a la base de datos MscLink // ------------------------------------------------------------------------------- $dsn = "Driver={SQL Server};Server={$linkSrv};Database={$linkDB};Integrated Security=SSPI;Persist Security Info=False;"; // Se realiza la conexón con los datos especificados anteriormente $conn = odbc_connect($dsn, $linkUsr, $linkPass); $conn2 = odbc_connect($dsn, $linkUsr, $linkPass); // Incluir la libreria PHPExcel require '../include/PHPExcel/PHPExcel.php'; // Reservar memoria en servidor PHP // Si el archivo final tiene 5Mb, reservar 500Mb // Por cada operación, phpExcel mapea en memoria la imagen del archivo y esto satura la mamoria ini_set("memory_limit", "512M"); // Estilos Arreglo $styleEnc = array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => 'FFA0A0A0'), 'endcolor' => array('argb' => 'FFFFFFFF'))); $styleSombra = array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => '80E9E07A'), 'endcolor' => array('argb' => 'FFFFFFFF'))); $styleTitulo = array('font' => array('bold' => true, 'size' => 14), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT)); $styleSubtitulo = array('font' => array('bold' => true, 'size' => 10), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT)); // ---------------------------- // Hoja 1 // Nota : No usar acentos!!! $objPHPExcel = new PHPExcel(); $objPHPExcel->getActiveSheet()->setTitle('Hoja1'); $objPHPExcel->getDefaultStyle()->getFont()->setName('Arial'); $objPHPExcel->getDefaultStyle()->getFont()->setSize(8); // HOJA 2 $workSheet2 = new PHPExcel_Worksheet($objPHPExcel, 'Hoja2'); $objPHPExcel->addSheet($workSheet2, 1); $workSheet2->getDefaultStyle()->getFont()->setSize(8); $workSheet2->getDefaultStyle()->getFont()->setName('Arial'); // ----------------------------------------------- // ENCABEZADOS // ----------------------------------------------- // Se crea el arreglo de hojas. Esto es como llevan el mismo encabezado en todas las hojas, solo es recorrer el index = hojas. $arrHojas[] = 0; //$arrHojas[]=1; foreach ($arrHojas as $hoja) { $objPHPExcel->setActiveSheetIndex($hoja); // Se aplica estilo al encabezado $objPHPExcel->getActiveSheet()->getStyle('A7:M7')->applyFromArray($styleEnc); // Encabezados $headings = array('BL', 'Vessel', 'Voyage', 'Date', 'Amount', 'CheckNumber', 'PayerName', 'Tracking_Number', 'Received_Via', 'Remarks', 'POL', 'POD', 'Comments'); // Escribe los encabezados $rowNumber = 7; // Freeze pane so that the heading line won't scroll $objPHPExcel->getActiveSheet()->freezePane('A8'); $col = 'A'; foreach ($headings as $heading) { $objPHPExcel->getActiveSheet()->setCellValue($col . $rowNumber, $heading); $col++; } // AutoFiltro $objPHPExcel->getActiveSheet()->setAutoFilter('A7:M7'); // Auto Ajuste de Ancho en Columna $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(10); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(100); // Titulo $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Mediterranean Shipping Company Mexico, S.A. de C.V.')->getStyle('A1')->applyFromArray($styleTitulo); // SUBTitulo $objPHPExcel->getActiveSheet()->setCellValue('A2', 'X-Tractor Version 1.0.'); $objPHPExcel->getActiveSheet()->getStyle('A2')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Reporte de cobranza por Barco'); $objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A4', ""); $objPHPExcel->getActiveSheet()->getStyle('A4')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A5', ''); $objPHPExcel->getActiveSheet()->getStyle('A5')->applyFromArray($styleSubtitulo); } /* // ------------------------- // Encabezado de la hoja 2 // ------------------------- $objPHPExcel->setActiveSheetIndex(1); // Se aplica estilo al encabezado $objPHPExcel->getActiveSheet()->getStyle('A7:S7')->applyFromArray($styleEnc); // Encabezados $headings = array('Bl', 'Contenedor', 'Concepto', 'Evento', 'Ev.Tiempo', 'EventoFin', 'EventoFin.Tiempo','POD','TMSCodeShp','Shipper','Inv.Company','DiasLibres','Invoice','Doc.Date','Amount','InvNum','TotInv','PaidInv','OustInv'); // Escribe los encabezados $rowNumber = 7; // Freeze pane so that the heading line won't scroll $objPHPExcel->getActiveSheet()->freezePane('A8'); $col = 'A'; foreach ($headings as $heading) { $objPHPExcel->getActiveSheet()->setCellValue($col . $rowNumber, $heading); $col++; } // AutoFiltro $objPHPExcel->getActiveSheet()->setAutoFilter('A7:S7'); // Auto Ajuste de Ancho en Columna $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('P')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('R')->setWidth(25); $objPHPExcel->getActiveSheet()->getColumnDimension('S')->setWidth(25); // Titulo $objPHPExcel->getActiveSheet()->setCellValue('A1', 'MEDITERRANEAN SHIPPING COMPANY MEXICO, S.A. DE C.V.') ->getStyle('A1')->applyFromArray($styleTitulo); // SUBTitulo $objPHPExcel->getActiveSheet()->setCellValue('A2', '.'); $objPHPExcel->getActiveSheet()->getStyle('A2')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A3', '.'); $objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A4', "."); $objPHPExcel->getActiveSheet()->getStyle('A4')->applyFromArray($styleSubtitulo); $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Depositos en Garantia MscLink'); $objPHPExcel->getActiveSheet()->getStyle('A5')->applyFromArray($styleSubtitulo); // ---------------------------------------------------------------------------- */ // ----------------------------------- // HOJA 1 // ----------------------------------- $vessel = trim($vessel); $voyage = trim($voyage); $objPHPExcel->setActiveSheetIndex(0); // Simple query $sql = "\n SELECT\n\tBL.Bill_Of_Lading_Number as bl,\n\tBL2.Vessel_Name as vessel,\n\tBL2.Voyage as voyage,\n\tM.DATE as fecha,\n\tM.Amount as amount,\n\tM.Check_Number as checkNum,\n\tM.Payer_Name as payer,\n\tM.Tracking_Number as tnumber,\n\tM.Received_Via as received_via,\n\tM.Remarks as remarks,\n\tBL2.POLUN as polun,\n\tBL2.PODUN as podun\n\n FROM\n Interlink_DFeed90.dfeed.FNTB_Bill_Of_Lading_to_Booking () BL\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_Bill_Of_Lading (NULL, NULL) BL2 ON BL.Bill_Of_Lading_id = BL2.Bill_Of_Lading_id\n LEFT JOIN Interlink_Main90.dbo.BL_Money_Received M (NOLOCK) ON BL.Bill_Of_Lading_id = M.Bill_Of_Lading_id\n -- LEFT JOIN Interlink_Main90.dbo.BL_Comment C (NOLOCK) ON BL.Bill_Of_Lading_id = C.Bill_Of_Lading_id\n WHERE\n BL2.Vessel_Name='{$vessel}'\n AND BL2.Voyage='{$voyage}' "; if (!empty($pod)) { $sql .= "AND BL2.PODUN='{$pod}' "; } if (!empty($pol)) { $sql .= "AND BL2.POLUN='{$pol}' "; } $rs = odbc_exec($conn, $sql); $rowNumber = 8; // donde inicia los datos while (odbc_fetch_row($rs)) { $c1 = odbc_result($rs, "bl"); $c2 = odbc_result($rs, "vessel"); $c3 = odbc_result($rs, "voyage"); $c4 = odbc_result($rs, "fecha"); $c5 = odbc_result($rs, "amount"); $c6 = odbc_result($rs, "checkNum"); $c7 = odbc_result($rs, "payer"); $c8 = odbc_result($rs, "tnumber"); $c9 = odbc_result($rs, "received_via"); $c10 = odbc_result($rs, "remarks"); $pol = odbc_result($rs, "polun"); $pod = odbc_result($rs, "podun"); // Buscar y concatenar los comentarios del BL. $nota = ""; $sql2 = "\n SELECT\n C.Comment as nota\n --,C.CreatedTime\n FROM\n Interlink_DFeed90.dfeed.FNTB_Bill_Of_Lading_to_Booking () BL\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_Bill_Of_Lading (NULL, NULL) BL2 ON BL.Bill_Of_Lading_id = BL2.Bill_Of_Lading_id\n -- LEFT JOIN Interlink_Main90.dbo.BL_Money_Received M (NOLOCK) ON BL.Bill_Of_Lading_id = M.Bill_Of_Lading_id\n LEFT JOIN Interlink_Main90.dbo.BL_Comment C (NOLOCK) ON BL.Bill_Of_Lading_id = C.Bill_Of_Lading_id\n WHERE\n BL.Bill_Of_Lading_Number = '{$c1}';\n "; $rs2 = odbc_exec($conn2, $sql2); while (odbc_fetch_row($rs2)) { $nota .= odbc_result($rs2, "nota"); } $nota = addslashes($nota); $nota = normaliza($nota); $c7 = normaliza($c7); // Quitar acentos // Por manejo de memoria se deben de meter los datos con las menos operaciones posibles. $objPHPExcel->getActiveSheet()->setCellValue('A' . $rowNumber, $c1)->setCellValue('B' . $rowNumber, $c2)->setCellValue('C' . $rowNumber, $c3)->setCellValue('D' . $rowNumber, $c4)->setCellValue('E' . $rowNumber, $c5)->setCellValue('F' . $rowNumber, $c6)->setCellValue('G' . $rowNumber, $c7)->setCellValue('H' . $rowNumber, $c8)->setCellValue('I' . $rowNumber, $c9)->setCellValue('J' . $rowNumber, $c10)->setCellValue('K' . $rowNumber, $pol)->setCellValue('L' . $rowNumber, $pod)->setCellValue('M' . $rowNumber, $nota); $rowNumber++; } /* // ------------------------------ // Hoja 2 - DEMORAS // ------------------------------ $sqlBL=""; foreach( $arrBls as $bl ) { if (!empty($bl)) { $bl = str_replace("\n", "", $bl); $bl = str_replace("\r", "", $bl); $bl = trim($bl); $sqlBL.="'$bl',"; } } $blsInTxt = substr($sqlBL,0,-1); $objPHPExcel->setActiveSheetIndex(1); // Simple query $sql = " SELECT CH.Show_as AS CONCEPTO, CH.Start_Event AS EVENTO, CH.start_event_datetime AS EVENTOTIEMPO, CH.End_Event AS ENVENTOFIN, CH.end_event_datetime AS EVENTOFINTIEMPO, CH.POD_name AS PODNAME, CH.Bill_Of_Lading_Number AS BL, CH.Equipment_Number AS CONTE, ADCSH.MSCCode AS TMSCODESHI, ADCCN.Company AS SHIPPER, ADCIC.Company AS INVCOMPANY, CH.Charge_Level_0_Days AS DIASLIBRES, CH.invoice_number AS INVOICE, I.Doc_Date AS DOCDATE, CH.Charge_Amount AS AMOUNTX, (select I.Invoice_Number from Interlink_Accounting90. Accounting .InvoiceState I (NOLOCK ) left JOIN Interlink_Accounting90 .dbo . ACC_Invoice AI ( NOLOCK) ON AI.ACC_Invoice_id = I.ACC_Invoice_id where i.InvoiceState_id=(select MAX(InvoiceState_id) from Interlink_Accounting90.Accounting.InvoiceState (NOLOCK) where Invoice_Number=CH.invoice_number)) as InvNum, (select (AI . Inv_Total_Inv_Currency + AI. Inv_Total_VAT_Inv_Currency) Total from Interlink_Accounting90. Accounting .InvoiceState I (NOLOCK ) left JOIN Interlink_Accounting90 .dbo . ACC_Invoice AI ( NOLOCK) ON AI.ACC_Invoice_id = I.ACC_Invoice_id where i.InvoiceState_id=(select MAX(InvoiceState_id) from Interlink_Accounting90.Accounting.InvoiceState (NOLOCK) where Invoice_Number=CH.invoice_number)) as TotInv, (select I.Paid from Interlink_Accounting90. Accounting .InvoiceState I (NOLOCK ) left JOIN Interlink_Accounting90 .dbo . ACC_Invoice AI ( NOLOCK) ON AI.ACC_Invoice_id = I.ACC_Invoice_id where i.InvoiceState_id=(select MAX(InvoiceState_id) from Interlink_Accounting90.Accounting.InvoiceState (NOLOCK) where Invoice_Number=CH.invoice_number)) as PaidInv, (select ( AI .Inv_Total_Inv_Currency + AI. Inv_Total_VAT_Inv_Currency - I .Paid ) from Interlink_Accounting90. Accounting .InvoiceState I (NOLOCK ) left JOIN Interlink_Accounting90 .dbo . ACC_Invoice AI ( NOLOCK) ON AI.ACC_Invoice_id = I.ACC_Invoice_id where i.InvoiceState_id=(select MAX(InvoiceState_id) from Interlink_Accounting90.Accounting.InvoiceState (NOLOCK) where Invoice_Number=CH.invoice_number )) as OustInv FROM Interlink_DFeed90.dfeed.ILIM_FNTB_Charges () CH INNER JOIN Interlink_Main90.dbo.Invoice I (NOLOCK) ON I.Invoice_id = CH.Invoice_id LEFT JOIN Interlink_Dfeed90.dfeed.FNTB_AssocDocCompany ('CONSIGN') ADCCN ON ADCCN.Bill_Of_Lading_id = CH.bill_of_lading_id LEFT JOIN Interlink_Dfeed90.dfeed.FNTB_AssocDocCompany ('SHIPPER') ADCSH ON ADCSH.Bill_Of_Lading_id = CH.bill_of_lading_id LEFT JOIN Interlink_Dfeed90.dfeed.FNTB_AssocDocCompany ('INVCMPBL') ADCIC ON ADCIC.Bill_Of_Lading_id = CH.bill_of_lading_id WHERE Show_as = 'DEMURRAGE' AND CH.Bill_Of_Lading_Number in ($blsInTxt) AND Charge_Status IN ('INVOICED') "; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error en la consulta SQL"); } $rowNumber = 8; // donde inicia los datos while ( odbc_fetch_row($rs) ) { $c1 = odbc_result($rs, "BL"); $c2 = odbc_result($rs, "CONTE"); $c3 = odbc_result($rs, "CONCEPTO"); $c4 = odbc_result($rs, "EVENTO"); $c5 = odbc_result($rs, "EVENTOTIEMPO"); $c6 = odbc_result($rs, "ENVENTOFIN"); $c7 = odbc_result($rs, "EVENTOFINTIEMPO"); $c8 = odbc_result($rs, "PODNAME"); $c9 = odbc_result($rs, "TMSCODESHI"); $c10 = odbc_result($rs, "SHIPPER"); $c11 = odbc_result($rs, "INVCOMPANY"); $c12 = odbc_result($rs, "DIASLIBRES"); $c13 = odbc_result($rs, "INVOICE"); $c14 = odbc_result($rs, "DOCDATE"); $c15 = odbc_result($rs, "AMOUNTX"); $c16 = odbc_result($rs, "InvNum"); $c17 = odbc_result($rs, "TotInv"); $c18 = odbc_result($rs, "PaidInv"); $c19 = odbc_result($rs, "OustInv"); // Por manejo de memoria se deben de meter los datos con las menos operaciones posibles. $objPHPExcel->getActiveSheet() ->setCellValue('A'.$rowNumber,$c1) ->setCellValue('B'.$rowNumber,$c2) ->setCellValue('C'.$rowNumber,$c3) ->setCellValue('D'.$rowNumber,$c4) ->setCellValue('E'.$rowNumber,$c5) ->setCellValue('F'.$rowNumber,$c6) ->setCellValue('G'.$rowNumber,$c7) ->setCellValue('H'.$rowNumber,$c8) ->setCellValue('I'.$rowNumber,$c9) ->setCellValue('J'.$rowNumber,$c10) ->setCellValue('K'.$rowNumber,$c11) ->setCellValue('L'.$rowNumber,$c12) ->setCellValue('M'.$rowNumber,$c13) ->setCellValue('N'.$rowNumber,$c14) ->setCellValue('O'.$rowNumber,$c15) ->setCellValue('P'.$rowNumber,$c16) ->setCellValue('Q'.$rowNumber,$c17) ->setCellValue('R'.$rowNumber,$c18) ->setCellValue('S'.$rowNumber,$c19) ; $rowNumber++; } // Loregreso a la hoja 1. $objPHPExcel->setActiveSheetIndex(0); */ // Se modifican los encabezados del HTTP para indicar que se envia un archivo de Excel2007. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition:attachment;filename="x-tractor.xlsx"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; }
if (mysql_numrows($execChkOco[$i]) > 0) { $achou[] = normaliza($palavrasA[$i]); //$achou[] = noHtml($palavrasA[$i]); $achou = array_unique($achou); } $qryChkAss[$i] = "SELECT * FROM assentamentos WHERE ocorrencia = " . $row['numero'] . " AND " . "\n (lower(assentamento) like lower('%" . $palavrasA[$i] . "%') " . "\n OR lower(assentamento) like lower('%" . noHtml($palavrasA[$i]) . "%') )"; $execChkAss[$i] = mysql_query($qryChkAss[$i]) or die(TRANS('MSG_ERR_CONSUL') . '<br>' . $qryChkAss); if (mysql_numrows($execChkAss[$i]) > 0) { $achou[] = normaliza($palavrasA[$i]); //$achou[] = noHtml($palavrasA[$i]); $achou = array_unique($achou); } $qryChkSol[$i] = "SELECT * FROM solucoes WHERE numero = " . $row['numero'] . " AND (" . "\n lower(solucao) like lower('%" . $palavrasA[$i] . "%') OR " . "\n lower(problema) like lower('%" . $palavrasA[$i] . "%') OR " . "\n lower(solucao) like lower('%" . noHtml($palavrasA[$i]) . "%') OR " . "\n lower(problema) like('%" . noHtml($palavrasA[$i]) . "%') )"; $execChkSol[$i] = mysql_query($qryChkSol[$i]) or die(TRANS('MSG_ERR_CONSUL') . '<br>' . $qryChkSol); if (mysql_numrows($execChkSol[$i]) > 0) { $achou[] = normaliza($palavrasA[$i]); //$achou[] = noHtml($palavrasA[$i]); $achou = array_unique($achou); } } reIndexArray($achou); //if ((!isset($_POST['anyword']) && count($achou) >= count($termos)) || (isset($_POST['anyword']))) { if (isset($_POST['anyword']) || !isset($_POST['anyword']) && (count($achou) >= count($termos) && count($termos) == 1) || !isset($_POST['anyword']) && (count($achou) == count($termos) && count($termos) > 1)) { print "<TABLE border='1' style=\"{border-collapse:collapse;}\" align='center' width='100%'>"; print "<tr>"; print "<TD align='left' bgcolor='" . TD_COLOR . "'>" . TRANS('OCO_FIELD_NUMBER') . ":</TD>"; print "<TD align='left'><a onClick= \"javascript: popup_alerta('mostra_consulta.php?popup=true&numero=" . $row['numero'] . "&destaca=" . $destacaProb . "')\">" . "<font color='blue'>" . $row['numero'] . "</font></a></TD>"; print "<TD align='left'>" . TRANS('OCO_DATE') . ":</TD>"; print "<TD align='left'>" . datab($row['data']) . "</TD>"; print "<TD align='left'>" . TRANS('OCO_FIELD_OPERATOR') . ":</TD>"; print "<TD align='left'>" . $row['nome'] . "</TD>";
<div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <div class="panel panel-primary"> <div class="panel-heading">Informacion del Sucesoss: <?php echo $suceso_id; ?> <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> </div> <div class="panel-body"> <h4>Fecha Suceso:<?php echo normaliza($rs_sucesos->Fields('fecha_suceso')); ?> </h4> <h4>Detalle: <?php echo $detalle_delito; ?> </h4> <h4>Titulo: <?php echo $titulo; ?> </h4> <div class="row"> <div class="col-xs-6 col-md-4"> <label class="control-label col-sm-4" for="fecha">Fuente:</label> <a href="<?php echo $fuente;
if (!file_exists($upload_folder . '/' . $idEmisor . '/')) { mkdir($upload_folder . '/' . $idEmisor . '/', 0777, true); } // MÉTODO PARA QUITAR ACENTOS Y CARACTERES RAROS function normaliza($cadena) { $originales = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ'; $modificadas = 'aaaaaaaceeeeiiiidnoooooouuuuy bsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; $cadena = utf8_decode($cadena); $cadena = strtr($cadena, utf8_decode($originales), $modificadas); $cadena = strtolower($cadena); return utf8_encode($cadena); } $url_filtrada = normaliza($nombreRecortado); $archivador = $upload_folder . '/' . $idEmisor . '/' . $url_filtrada; $sql = "UPDATE `emisor` " . "SET " . "`nombre` = :nombre ," . "`rfc` = :rfc ," . "`calle` = :calle ," . "`numero_exterior` = :numero_exterior ," . "`num_interior` = :num_interior ," . "`colonia` = :colonia ," . "`cp` = :cp ," . "`telefono` = :telefono ," . "`fax` = :fax ," . "`correo_electronico` = :correo_electronico ," . "`foto` = :foto ," . "`razon_social` = :razon_social ," . "`idMunicipio` = :idMunicipio " . "WHERE `idEmisor` = :idEmisor"; try { $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("nombre", $nombreEmpresa); $stmt->bindParam("rfc", $RFC); $stmt->bindParam("calle", $calle); $stmt->bindParam("numero_exterior", $numExt); $stmt->bindParam("num_interior", $numInt); $stmt->bindParam("colonia", $colonia); $stmt->bindParam("cp", $CP); $stmt->bindParam("telefono", $telefono); $stmt->bindParam("fax", $fax); $stmt->bindParam("correo_electronico", $email);
$newLien->urlLien = $textUrlLien; $newLien->fenLien = $radioFen; $newLien->creerLien(); } // La vignette if ($selectPhoto || isset($_FILES["filePhoto"]['tmp_name']) && $_FILES["filePhoto"]['tmp_name'] != "") { if ($selectPhoto) { // on associe une photo existante $newActu->numphoto = $selectPhoto; $newActu->legPhoto = $textLegPh; $newActu->associerPhoto(); } else { if (isset($_FILES["filePhoto"]['tmp_name']) && $_FILES["filePhoto"]['tmp_name'] != "") { // on cr�e une photo $newPhoto = new Photo(); $newPhoto->nomPhoto = normaliza(basename($_FILES["filePhoto"]['name'])); $newPhoto->tmp_name = $_FILES["filePhoto"]['tmp_name']; // Quelle taille pour la vignette ? $newPhoto->taille=$$valTaille; $numphoto = $newPhoto->creerPhoto(); // On associe ensuite la vignette à l'actualité $newActu->numphoto = $numphoto; $newActu->legPhoto = $textLegPh; $newActu->associerPhoto(); } } } //fin if ($selectPhoto || (isset($_FILES["filePhoto"]['tmp_name']) && $_FILES["filePhoto"]['tmp_name']!="")) if ($cree) { $mes = "La brève d\\'actualité est créée"; } else { $mes = "La brève d\\'actualité est modifiée!";
function reporteNewExcel($idNav = "") { global $db; $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav); // Incluir la libreria PHPExcel require '../include/PHPExcel/PHPExcel.php'; // Reservar memoria en servidor PHP // Si el archivo final tiene 5Mb, reservar 500Mb // Por cada operación, phpExcel mapea en memoria la imagen del archivo y esto satura la mamoria ini_set("memory_limit", "512M"); // Create a new PHPExcel object $objPHPExcel = new PHPExcel(); $objPHPExcel->getActiveSheet()->setTitle('Hoja 1'); $objPHPExcel->getDefaultStyle()->getFont()->setName('Arial'); $objPHPExcel->getDefaultStyle()->getFont()->setSize(8); // Estilos Arreglo $styleEnc = array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => 'FFA0A0A0'), 'endcolor' => array('argb' => 'FFFFFFFF'))); $styleSombra = array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => '80E9E07A'), 'endcolor' => array('argb' => 'FFFFFFFF'))); $styleTitulo = array('font' => array('bold' => true, 'size' => 14), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT)); $styleSubtitulo = array('font' => array('bold' => true, 'size' => 10), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT)); // ---------------------------- // Se aplica estilo al encabezado $objPHPExcel->getActiveSheet()->getStyle('A5:G5')->applyFromArray($styleEnc); // Encabezados $headings = array('Naviera', 'Contenedor', 'Tipo', 'Fecha', 'Clase', 'Status', 'Observaciones'); // Escribe los encabezados $row = 5; $col = 'A'; foreach ($headings as $heading) { $objPHPExcel->getActiveSheet()->setCellValue($col . $row, $heading); $col++; } // AutoFiltro $objPHPExcel->getActiveSheet()->setAutoFilter('A5:G5'); // Auto Ajuste de Ancho en Columna $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(13); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(60); // Freeze pane so that the heading line won't scroll $objPHPExcel->getActiveSheet()->freezePane('A6'); // Titulo $objPHPExcel->getActiveSheet()->setCellValue('A1', 'MOPSA S.A. DE C.V.')->getStyle('A1')->applyFromArray($styleTitulo); // SUBTitulo if ($naviera != '') { $naviera = "[ {$naviera} ]"; } $objPHPExcel->getActiveSheet()->setCellValue('A2', "Reporte de Inventario {$naviera} "); $objPHPExcel->getActiveSheet()->getStyle('A2')->applyFromArray($styleSubtitulo); // Simple query $sql = "SELECT * from INVENTARIO_PLUS "; if ($idNav > 0) { $sql .= "WHERE id_naviera='{$idNav}' "; } $sql .= " order by id_naviera,cap_fec desc"; $db->query($sql); // Escribe los Registros $row = 6; while ($db->next_record()) { $idConte = $db->f(id_contenedor); $idEquipo = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEquipo); $idNavDB = $db->f('id_naviera'); $navieraDB = getValueTable("naviera", "NAVIERA", "id_naviera", $idNavDB); $c1 = $navieraDB; $c2 = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $c3 = $equipo; $c4 = $db->f('cap_fec'); $c5 = $db->f('clase'); $statusDM = $db->f('damage'); if ($statusDM == "DM") { $c6 = "DAMAGE"; } else { $c6 = "OK"; } $c7 = $db->f('nota'); $c7 = normaliza($c7); // Por manejo de memoria se deben de meter los datos con las menos operaciones posibles. $objPHPExcel->getActiveSheet()->setCellValue('A' . $row, $c1)->setCellValue('B' . $row, $c2)->setCellValue('C' . $row, $c3)->setCellValue('D' . $row, $c4)->setCellValue('E' . $row, $c5)->setCellValue('F' . $row, $c6)->setCellValue('G' . $row, $c7); $row++; } // Se modifican los encabezados del HTTP para indicar que se envia un archivo de Excel2007. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition:attachment;filename="reporteInventario.xlsx"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; }
fputs($fp2, $lin); $tlSegmentos++; } $lin = "DTM+7:{$regFecha}{$regHora}:203'\r\n"; fputs($fp2, $lin); $tlSegmentos++; // LOC ( Pendiente) // EJ. LOC+165+MXATM:139:6+CTA:TER' $lin = "SEL+{$sello}+CA'\r\n"; fputs($fp2, $lin); $tlSegmentos++; $placas = str_replace(".", "", $placas); if (empty($placas)) { $placas = ""; } $operador = normaliza($operador); $operador = substr($operador, 0, 35); $placas = str_replace("-", "", $placas); $placas = str_replace(".", "", $placas); $placas = str_replace(" ", "", $placas); $lin = "TDT+1++3+++++{$placas}'\r\n"; fputs($fp2, $lin); $tlSegmentos++; // Marcarlos como transmitidos. $sql2 = "\n UPDATE SALIDA\n SET flg_edicodeco='1'\n WHERE id_salida='{$idSal}' "; $db2->query($sql2); echo "[ HS_GATE_OUT ] {$conte} <br>"; // EDICODECO LOG // $hoyX = date("Y-m-d H:i:s"); // $sql2 = "insert into EDICODECO_LOG (id_conte,eir,e_s,fec_trans,id_nav) values ('$idConte','$eir','S','$hoyX','$idNav')"; // $db2->query($sql2);
function ajouterPara() { $newParag = new Paragraphe(); $newParag->titrePara = $_POST['textTitrePara']; $newParag->contenuPara = $_POST['textCont']; $numpara = $newParag->creerParagraphe(); $laPage = new Page(); $laPage->numpage = $_GET['numpage']; $laPage->id_m = $_GET['id']; $laPage->numpara = $numpara; $laPage->ordre = $_POST['selectOrdre']; $laPage->colonne = $_POST['selectType']; $laPage->liste = $_POST['radioListe']; $laPage->typeTitre = $_POST['radioTypeTitre']; $laPage->ajouterParagraphe(); // On l'ajoute à la page for ($i = 1; $i <= $_POST['nbLiens']; $i++) { // On traite l'ajout de liens $valUrl = "textUrlLien" . $i . "_"; $valPage = "selectPage" . $i . "_"; if (${$valUrl} || ${$valPage}) { $valLib = "textLibLien" . $i . "_"; $valTexte = "textTexteLien" . $i . "_"; $valOrdre = "selectOrdreLien" . $i . "_"; $valFen = "radioFen" . $i . "_"; $newLien = new Lien(); $newLien->numpara = $numpara; $newLien->libLien = ${$valLib}; $newLien->texteLien = ${$valTexte}; if (${$valPage}) { $pageLien = new Page(); $pageLien->numpage = ${$valPage}; $pageLien->infosPage(); $newLien->numpage = ${$valPage}; $newLien->urlLien = $pageLien->aliasPage; } else { $newLien->urlLien = ${$valUrl}; } $newLien->fenLien = ${$valFen}; $newLien->ordreLien = ${$valOrdre}; $newLien->creerLien(); } //fin if ($$valUrl) } //fin du for for ($i = 1; $i <= $nbPhotos; $i++) { // On traite l'association de photos $valSelect = "selectPhoto" . $i . "_"; $valFile = "filePhoto" . $i . "_"; if (${$valSelect} || isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") { $valLeg = "textLegPh" . $i . "_"; $valOrdre = "selectOrdrePhoto" . $i . "_"; $valTaille = "radioTaille" . $i . "_"; if (${$valSelect}) { // on associe une photo existante $newParag->numphoto = ${$valSelect}; $newParag->ordrePhoto = ${$valOrdre}; $newParag->legPhoto = ${$valLeg}; $newParag->associerPhoto(); } else { if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") { // on cr�e une photo $newPhoto = new Photo(); $newPhoto->nomPhoto = normaliza(basename($_FILES[$valFile]['name'])); $newPhoto->tmp_name = $_FILES[$valFile]['tmp_name']; $newPhoto->taille = ${$valTaille}; $numphoto = $newPhoto->creerPhoto(); // On associe ensuite la photo au paragraphe $newParag->numphoto = $numphoto; $newParag->ordrePhoto = ${$valOrdre}; $newParag->legPhoto = ${$valLeg}; $newParag->associerPhoto(); } } } //fin if ($$valSelect || $$valFile) } //fin du for for ($i = 1; $i <= $nbVideos; $i++) { // On traite l'association de vidéos $valSelect = "selectVideo" . $i . "_"; $valFile = "fileVideo" . $i . "_"; if (${$valSelect} || isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") { $valLeg = "textLegVi" . $i . "_"; $valOrdre = "selectOrdreVideo" . $i . "_"; if (${$valSelect}) { // on associe une vidéo existante $newParag->numvideo = ${$valSelect}; $newParag->ordreVideo = ${$valOrdre}; $newParag->legVideo = ${$valLeg}; $newParag->associerVideo(); } else { if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") { // on cree une video $newVideo = new Video(); $newVideo->nomVideo = normaliza(basename($_FILES[$valFile]['name'])); $newVideo->tmp_name = $_FILES[$valFile]['tmp_name']; $numvideo = $newVideo->creerVideo(); // On associe ensuite la vidéo au paragraphe $newParag->numvideo = $numvideo; $newParag->ordreVideo = ${$valOrdre}; $newParag->legVideo = ${$valLeg}; $newParag->associerVideo(); } } } //fin if ($$valSelect || $$valFile) } //fin du for for ($i = 1; $i <= $nbFichiers; $i++) { // On traite l'association de fichiers //$valSelect="selectFich".$i."_"; $valFile = "fileFich" . $i . "_"; if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") { $valOrdre = "selectOrdreFich" . $i . "_"; $valLib = "textLibFich" . $i . "_"; $newFichier = new Fichier(); $newFichier->nomFichier = normaliza(basename($_FILES[$valFile]['name'])); $newFichier->tmp_name = $_FILES[$valFile]['tmp_name']; $numfichier = $newFichier->creerFichier(); // On associe ensuite le fichier au paragraphe $newParag->numfichier = $numfichier; $newParag->ordreFichier = ${$valOrdre}; $newParag->libFichier = ${$valLib}; $newParag->associerFichier(); } //fin if ($$valSelect || $$valFile) } //fin du for if (!$action) { //on est en création de page if (!$paragraphe) { $pg_admin = "lister-page"; } else { $creer_page = 1; } } else { //on est en modification de page if (!$paragraphe) { $onglet = "mod_para"; } else { $onglet = "aj_para"; } } }
function cargarHI($fechaA = "", $fechaA2 = "", $arrBlsMscu = "") { global $conn, $dbf; if (is_array($arrBlsMscu)) { $bls = implode(",", $arrBlsMscu); } if ($conn) { $idPrvS = ""; $costoONC = 0; unset($arrHI); $sql = "\n SELECT\n PT.Intermodal_Leg_id ,\n PT.Purchase_Order_Number as PO ,\n GC.Global_Name as Global_Name ,\n GC.Tax_Id as Tax_Id ,\n IC.Transport_Mode as Transport_Mode ,\n IC.IL_Estimated_Cost ,\n IC.ISC_Customer_Appointment_Date as ISC_Customer_Appointment_Date ,\n IC.Booking_Number as Booking_Number ,\n IC.Bill_Of_Lading_Number as BL ,\n IC.Vessel_Name as Vessel_Name ,\n IC.Voyage as Voyage ,\n IC.POL as POL ,\n IC.POD as POD ,\n IC.Container_Number as Container_Number ,\n IC.Req_Assign_Container as Req_Assign_Container ,\n IC.IC_Req_Assign_Container as IC_Req_Assign_Container ,\n IC.EQ_Type as EQ_Type ,\n -- IC.Tot_Container_Packages_Weight as Tot_Container_Packages_Weight,\n IC.CSC_Cargo_Weight_Kgs as CSC_Cargo_Weight_Kgs ,\n IC.LocalLogisticLocation as LocalLogisticLocation ,\n IC.Cust_Company as Cust_Company ,\n IC.DStart_Depot as DStart_Depot ,\n IC.DEnd_Depot as DEnd_Depot ,\n IC.Booking_Type_Desc as Booking_Type_Desc ,\n IC.Ex_Short_Description as Ex_Short_Description ,\n IC.Shipment_Method as Shipment_Method ,\n IC.Origin as Origin ,\n IC.FDest as FDest ,\n IC.I_E as I_E ,\n CH.Charge as ChargePreOn ,\n CH.Result_Std as Result_Std ,\n CH.Currency as Currency ,\n CH.Cargo_Shipment_id as Cargo_Shipment_id ,\n ACS.Company AS Cargo_Supplier ,\n ACS.Contact_Name as CS_Contact_Name ,\n ACS.Phone_Number AS CS_PHONE_NAME ,\n CF.Company AS AAF ,\n CF.Contact_Name AS AAF_CONTACT_NAME ,\n CF.Phone_Number AS AAF_PHONE_NAME ,\n CF.Email as AAF_Email ,\n CB.Company AS AAB ,\n CB.Contact_Name AS AAB_CONTACT_NAME ,\n CB.Phone_Number AS AAB_PHONE_NAME ,\n CB.Email as AAB_Email,\n CTX.Free_Text as Maniobras\n FROM\n Interlink_DFeed90. dfeed .FNTB_Intermodal_Customer (NULL, NULL) IC\n left join Interlink_Main90.dbo.Clause_Tx CTX (nolock) ON CTX.Clause_PK_id = IC.Intermodal_Leg_id\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_AssocDocCompany ( 'CGSUP' ) ACS ON IC.Intermodal_Step_Cargo_id = ACS.Intermodal_Step_Cargo_id\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_AssocDocCompany ( 'CUSTFWD') CF ON CF.Intermodal_Step_Cargo_id = ACS.Intermodal_Step_Cargo_id\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_AssocDocCompany ( 'CUBKR') CB ON CB.Intermodal_Step_Cargo_id = ACS.Intermodal_Step_Cargo_id\n LEFT JOIN Interlink_Main90.dbo.Assoc_Doc_Company DC ( nolock) ON DC.Intermodal_Leg_id = IC.Intermodal_Leg_id\n LEFT JOIN Interlink_Main90.dbo.GISCompany_Address GA ( nolock) ON GA.Company_Address_id = DC.Company_Address_id\n LEFT JOIN Interlink_Main90.dbo.GISCompany GC ( nolock) ON GC .company_id = GA.Company_id\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_Intermodal_EDI_Request_Truck (NULL, NULL) PT ON IC.Intermodal_Leg_id = PT.Intermodal_Leg_id\n LEFT JOIN Interlink_DFeed90.dfeed.FNTB_Charge (1 , NULL) CH ON CH.Cargo_Shipment_Container_id = IC.Cargo_Shipment_Container_id\n AND CH . Charge_DTX_Code = (\n CASE\n WHEN CH .I_E = 'E' THEN\n 'PRE'\n ELSE\n 'ONC'\n END\n )\n WHERE\n "; if (!empty($bls)) { $sql .= " IC.Bill_Of_Lading_Number in ({$bls}) "; // IC .Booking_number = '190MR0000056' // AND IC.Booking_number = '190MC0000151' // AND ( IC.Bill_Of_Lading_Number='MSCUMA667627' OR IC.Booking_number = '190MR0000143' ) } elseif (!empty($fechaA)) { // $sql.=" IC.ISC_Customer_Appointment_Date >= '$fechaA' "; $sql .= " IC.ISC_Customer_Appointment_Date between '{$fechaA}' and '{$fechaA2}' "; } $sql .= "\n ORDER BY\n Intermodal_Leg_id\n "; //echo $sql; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error en la consulta SQL"); } // Extraer campos while (odbc_fetch_row($rs)) { $rfc = odbc_result($rs, "Tax_Id"); $idPrvS = ""; // Detectar el id_prv del sion if (!empty($rfc)) { unset($result); $sqlF = "select id_proveedor from IM_PROVEEDOR where rfc='{$rfc}' "; $dbf->query($sqlF); while ($dbf->next_record()) { $idPrvS = $dbf->f('id_proveedor'); } } $pesoKgs = odbc_result($rs, "CSC_Cargo_Weight_Kgs"); $tipoMerca = odbc_result($rs, "Ex_Short_Description"); $tipoMerca = addslashes($tipoMerca); $tipoMerca = normaliza($tipoMerca); $po = odbc_result($rs, "PO"); $prv = odbc_result($rs, "Global_Name"); $prv = addslashes($prv); $bkg = odbc_result($rs, "Booking_Number"); $impoExpo = odbc_result($rs, "I_E"); $chargePreOn = odbc_result($rs, "ChargePreOn"); $bl = odbc_result($rs, "BL"); $bl = str_replace("MSCU", "", $bl); $conte = odbc_result($rs, "Container_Number"); $conteTipo = odbc_result($rs, "EQ_Type"); $transMode = odbc_result($rs, "Transport_Mode"); $IL_Estimated_Cost = odbc_result($rs, "IL_Estimated_Cost"); $ISC_Customer_Appointment_Date = odbc_result($rs, "ISC_Customer_Appointment_Date"); $Booking_Number = odbc_result($rs, "Booking_Number"); // $ml_bl= odbc_result($rs, "ml_bl"); $Vessel_Name = odbc_result($rs, "Vessel_Name"); $Voyage = odbc_result($rs, "Voyage"); $POL = odbc_result($rs, "POL"); $POD = odbc_result($rs, "POD"); $LocalLogisticLocation = odbc_result($rs, "LocalLogisticLocation"); $LocalLogisticLocation = addslashes($LocalLogisticLocation); $Cust_Company = odbc_result($rs, "Cust_Company"); $Cust_Company = addslashes($Cust_Company); $DStart_Depot = odbc_result($rs, "DStart_Depot"); $DStart_Depot = addslashes($DStart_Depot); $DEnd_Depot = odbc_result($rs, "DEnd_Depot"); $DEnd_Depot = addslashes($DEnd_Depot); $Shipment_Method = odbc_result($rs, "Shipment_Method"); $Origin = odbc_result($rs, "Origin"); $Origin = addslashes($Origin); $FDest = odbc_result($rs, "FDest"); $FDest = addslashes($FDest); $Charge = odbc_result($rs, "ChargePreOn"); $Charge_Cost = odbc_result($rs, "Result_Std"); $Currency = odbc_result($rs, "Currency"); if ($Currency == "USD") { $idMoneda = 1; } if ($Currency == "MXP") { $idMoneda = 2; } if ($Currency == "MXN") { $idMoneda = 2; } // Cargo Suplier y AA. $Cargo_Supplier = odbc_result($rs, "Cargo_Supplier"); $CS_Contact_Name = addslashes(odbc_result($rs, "CS_Contact_Name")); $CS_PHONE_NAME = odbc_result($rs, "CS_PHONE_NAME"); $AAF = odbc_result($rs, "AAF"); $AAF_CONTACT_NAME = odbc_result($rs, "AAF_CONTACT_NAME"); $AAF_CONTACT_NAME = addslashes($AAF_CONTACT_NAME); $AAF_PHONE_NAME = odbc_result($rs, "AAF_PHONE_NAME"); $AAF_Email = odbc_result($rs, "AAF_Email"); $AAB = addslashes(odbc_result($rs, "AAB")); $AAB_CONTACT_NAME = addslashes(odbc_result($rs, "AAB_CONTACT_NAME")); $AAB_CONTACT_NAME = addslashes($AAB_CONTACT_NAME); $AAB_PHONE_NAME = odbc_result($rs, "AAB_PHONE_NAME"); $AAB_Email = odbc_result($rs, "AAB_Email"); if ($impoExpo == "E") { $aaIns = $AAB; $aaContact = $AAB_CONTACT_NAME; $aaTel = $AAB_PHONE_NAME; $aaEmail = $AAB_Email; } else { $aaIns = $AAF; $aaContact = $AAF_CONTACT_NAME; $aaTel = $AAF_PHONE_NAME; $aaEmail = $AAF_Email; } $maniobras = odbc_result($rs, "Maniobras"); // ---------------------------- // Fecha del posicionamiento // ---------------------------- if (preg_match("/(\\d{4}-\\d{2}-\\d{2}) (.+)/", $ISC_Customer_Appointment_Date, $partsFP)) { $fecPos = $partsFP[1]; $horPos = $partsFP[2]; } // --------------------------------------------- // Comprobar en SION que no exista el registro. // Si existe, debe actualizar algunos datos. // No existe, entonces crear HI. $sqlS = "select id_instruccion from IM_INSTRUCCION where "; if ($impoExpo == "E") { $sqlS .= "ex_booking='{$bkg}' "; } else { $sqlS .= "bl='{$bl}' "; } $sqlS .= "and ml_proveedor='{$prv}' "; $dbf->query($sqlS); $nr = $dbf->num_rows(); // ---------------------------- // AGREGAR HOJA DE INSTRUCCION // ---------------------------- if ($nr == 0 || empty($nr)) { // ---------------------------------------- // Detectar si tiene cargo Pre/On Carrier. // Si no tiene cargos entonces es el servicio es Fuera. // Generar folio de HI if ($chargePreOn == 0 || empty($chargePreOn)) { // Servicio Fuera de BL $arrDataFolio = generaFolio('F', $impoExpo); $folioHI = $arrDataFolio['folio']; $idServ = $arrDataFolio['idServicio']; } else { // Servicio Dentro de BL $arrDataFolio = generaFolio('D', $impoExpo); $folioHI = $arrDataFolio['folio']; $idServ = $arrDataFolio['idServicio']; } echo "Folio HI: {$folioHI} <br>"; if (!empty($folioHI)) { // ---------------------------- // BL // Buscar el Id_expo en SION // ---------------------------- $idBl = 0; $sqlF = "select Id_expo from EXPO where Bl='{$bl}' "; $dbf->query($sqlF); while ($dbf->next_record()) { $idBl = $dbf->f('Id_expo'); } // Costo del PRE/ON Carrier if ($impoExpo == "E") { $costoONC = 0; $costoPRE = $Charge_Cost; $destino = $POL; $intermedio = $Origin; $id_moneda_tari_prv = 2; // Siempre es en pesos el costo unitario } else { $costoONC = $Charge_Cost; $costoPRE = 0; $destino = $POD; $intermedio = $FDest; $id_moneda_tari_prv = 2; // Siempre es en pesos el costo unitario } // --------------------------------------------- // GRABA LA INFO A SION // --------------------------------------------- if ($impoExpo == "I") { $POL = $POD; } $POL = str_replace("'", "", $POL); $POD = str_replace("'", "", $POD); $POD = str_replace("\n", "", $POD); $POD = str_replace("\r", "", $POD); $POD = addslashes($POD); $POD = normaliza($POD); //echo "<hr>$bl</hr>"; $sqlS = "\n insert into IM_INSTRUCCION (\n flg_msclink,\n origen_ins,\n tari_prv,id_moneda_tari_prv,\n fecha_pos,hora_pos,\n puerto_desc,\n tipo_merca,\n destino_ins,intermedio_ins,\n id_prv,folio_servicio,\n ml_proveedor,\n ml_proveedor_tax_id,\n ex_booking,\n bl,\n id_servicio,\n id_bl,\n ml_transport_mode,\n ex_barco,\n ex_viaje,\n ex_cliente,\n pre_carrier,\n on_carrier,\n id_moneda_on_carrier,\n id_moneda_pre_carrier,\n\n cli_nombre,cli_contacto,cli_telefono,\n aa_ins,aa_contacto,aa_tel,aa_email,\n\n IL_Estimated_Cost,\n ISC_Customer_Appointment_Date,\n Vessel_Name,\n Voyage,\n POL,\n POD,\n LocalLogisticLocation,\n Cust_Company,\n DStart_Depot,\n DEnd_Depot,\n Shipment_Method,\n Origin,\n FDest,\n Charge,\n Charge_Cost,\n Charge_Cost_Cur,\n ml_maniobras\n )\n values\n (\n '1',\n '{$POL}',\n '{$IL_Estimated_Cost}','{$id_moneda_tari_prv}',\n '{$fecPos}','{$horPos}',\n '{$POD}',\n '{$tipoMerca}',\n '{$destino}','{$intermedio}',\n '{$idPrvS}','{$folioHI}',\n '{$prv}','{$rfc}',\n '{$bkg}','{$bl}','{$idServ}',\n '{$idBl}','{$transMode}',\n '{$Vessel_Name}','{$Voyage}','{$Cust_Company}',\n '{$costoPRE}','{$costoONC}','{$idMoneda}','{$idMoneda}',\n '{$Cust_Company}','{$CS_Contact_Name}','{$CS_PHONE_NAME}',\n '{$aaIns}','{$aaContact}','{$aaTel}','{$aaEmail}',\n '{$IL_Estimated_Cost}',\n '{$ISC_Customer_Appointment_Date}',\n '{$Vessel_Name}',\n '{$Voyage}',\n '{$POL}',\n '{$POD}',\n '{$LocalLogisticLocation}',\n '{$Cust_Company}',\n '{$DStart_Depot}',\n '{$DEnd_Depot}',\n '{$Shipment_Method}',\n '{$Origin}',\n '{$FDest}',\n '{$Charge}',\n '{$Charge_Cost}',\n '{$Currency}',\n '{$maniobras}'\n )\n "; if ($dbf->query($sqlS)) { echo "[ Hoja de Instrucción ][ <font color=green><b>Cargado</b></font> ] {$folioHI}<br>"; } } } else { // Actualizar ... PENDIENTE. // echo "[<font color=blue><b>Hoja de Instr. en SION Existente</b></font>] $bl $bkg <br>"; } if (!empty($folioHI)) { // ------------------------------ // AGREGAR PO X CONTENEDOR // ------------------------------ // Id_contenedor de SION // Si no existe entonces agregar // ------------------------------ if (empty($conte)) { // Si no existe el contenedor, entonces asignar contenedor ficticio. $conte = "ZZZZ0000000"; } $sqlF = "select id_instruccion FROM IM_INSTRUCCION where folio_servicio='{$folioHI}' "; $dbf->query($sqlF); while ($dbf->next_record()) { $idHI = $dbf->f('id_instruccion'); if (isset($arrHI) && is_array($arrHI)) { if (!in_array($idHI, $arrHI)) { $arrHI[] = $idHI; } } else { $arrHI[] = $idHI; } } unset($idConte); $sqlF = "select id_contenedor FROM CONTENEDOR where numero='{$conte}' "; $dbf->query($sqlF); while ($dbf->next_record()) { $idConte = $dbf->f('id_contenedor'); } if (empty($idConte) || $idConte == 0) { // Tipo de contenedor $sqlF2 = "select id_equipo from EQUIPO where equipo='{$conteTipo}'"; $dbf->query($sqlF2); while ($dbf->next_record()) { $idEq = $dbf->f('id_equipo'); } // Agregar contenedor $sqlF2 = "insert into CONTENEDOR (numero,id_equipo) values ('{$conte}','{$idEq}')"; $dbf->query($sqlF2); // Consultar el id_contenedor $sqlF2 = "select id_contenedor FROM CONTENEDOR where numero='{$conte}' "; $dbf->query($sqlF2); while ($dbf->next_record()) { $idConte = $dbf->f('id_contenedor'); } } // Comprobar que no duplique la info. if (isset($idHI) && $idHI > 0) { $sqlF = "select id_rel_inst_cont\n from IM_REL_INST_CONT\n where id_contenedor='{$idConte}' and id_instruccion='{$idHI}' and po_num='{$po}'\n "; $dbf->query($sqlF); $nrX = $dbf->num_rows(); if ((empty($nrX) || $nrX == 0) && $idHI > 0) { $sqlF = "\n insert into IM_REL_INST_CONT (\n id_contenedor,id_instruccion,po_num,peso_kgs,pickup_at,deliver_at\n ) values (\n '{$idConte}','{$idHI}','{$po}','{$pesoKgs}','{$DStart_Depot}','{$DEnd_Depot}'\n )\n "; $dbf->query($sqlF); } // ----------------------------------------------------- } // ------------------------------------- // AGREGAR "TOMA DE CONTENEDOR" // ------------------------------------- } } } // Sumar el PESO de cada Hoja de instruccion. if (isset($arrHI) && is_array($arrHI)) { foreach ($arrHI as $idHojaIns) { $sql = "select sum(peso_kgs) as totalPeso from IM_REL_INST_CONT where id_instruccion='{$idHojaIns}' "; $dbf->query($sql); while ($dbf->next_record()) { $totalPeso = $dbf->f('totalPeso'); } // Actualizar el campo. $totalPeso = $totalPeso . " Kgs."; $sql = "update IM_INSTRUCCION set peso='{$totalPeso}' where id_instruccion='{$idHojaIns}' "; $dbf->query($sql); } } echo "[ Fin ] del proceso de Intermodal : Cargar hojas de instrucción <p>"; }