public function desuscribirse(array $datos) { $fecha = isset($datos["fecha"]) ? $datos["fecha"] : date('Y-m-d H:i:s'); // guardo la desuscripcion $sql = "update acsa_tickets_suscripcion set estado='0' where ticket_id = '" . mysql_real_escape_string($datos['ticket_id']) . "' and staff_id = '" . mysql_real_escape_string($datos['staff_id']) . "'"; executeQuery($sql, $this->conn); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $datos['ticket_id'], 'staff_id' => $datos['staff_id'], 'descripcion' => 'Desuscripción al Trámite')); }
public function guardarCitacion(array $datos) { $fecha = isset($datos["fecha"]) ? $datos["fecha"] : 'now()'; // guardo la citacion $sql = "insert into acsa_citacion(id,cliente_id,citacion_tipo,citacion_plantilla,citacion_email,ticket_id,staff_id,fecha) values (\r\n '',\r\n '" . mysql_real_escape_string($datos['cliente_id']) . "',\r\n '" . mysql_real_escape_string($datos['citacion_tipo']) . "',\r\n '" . mysql_real_escape_string($datos['citacion_plantilla']) . "',\r\n '" . mysql_real_escape_string($datos['citacion_email']) . "',\r\n '" . mysql_real_escape_string($datos['ticket_id']) . "',\r\n '" . mysql_real_escape_string($datos['staff_id']) . "',\r\n '" . mysql_real_escape_string($fecha) . "'\r\n )"; executeQuery($sql, $this->conn); $var_citacion_id = mysql_insert_id($this->conn); $this->cargarCitacion($var_citacion_id); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('citacion_id' => $var_citacion_id, 'cliente_id' => $datos['cliente_id'], 'ticket_id' => $datos['ticket_id'], 'staff_id' => $datos['staff_id'], 'descripcion' => 'Se creo una nueva Citacion al ticket')); // envio el mail if ($datos['citacion_tipo'] == 2) { $this->enviarEmail(); } }
public function guardarAlarma(array $datos) { // formatear fecha y hora if ($datos["alarmaInput"] != "") { $alarmaFecha = explode('/', $datos["alarmaInput"]); $alarmaFecha = $alarmaFecha[2] . '-' . $alarmaFecha[1] . '-' . $alarmaFecha[0] . ' ' . $datos["alarmaInput_hora"] . ':' . $datos["alarmaInput_min"] . ':00'; } else { $alarmaFecha = '0000-00-00 00:00:00'; } if ($datos["alarmaInput_1"] != "") { $alarmaAviso = explode('/', $datos["alarmaInput_1"]); $alarmaAviso = $alarmaAviso[2] . '-' . $alarmaAviso[1] . '-' . $alarmaAviso[0] . ' ' . $datos["alarmaInput_1_hora"] . ':' . $datos["alarmaInput_1_min"] . ':00'; } else { $alarmaAviso = '0000-00-00 00:00:00'; } // guardo la alarma $sql = "update sptbl_tickets SET\r\n alarmaFecha = '" . mysql_real_escape_string($alarmaFecha) . "',\r\n alarmaAviso = '" . mysql_real_escape_string($alarmaAviso) . "'\r\n where nTicketId = '" . $datos["ticket_id"] . "'"; executeQuery($sql, $this->conn); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $datos['ticket_id'], 'staff_id' => $datos['staff_id'], 'descripcion' => 'Se creo una nueva Alarma al ticket', 'show_in_ticket' => $datos["var_show_ticket"])); }
if ($_GET["nota"] == 2) { cambiarEstadoTramite('insertarNota'); } if ($_GET["nota"] == 3) { cambiarEstadoTramite('eliminarNota'); } // +----------------------------------------------------------------------+ // | Eliminar Archivo | // +----------------------------------------------------------------------+ if ($_GET["delFil"] != "") { $ruta = 'uploads/' . $_GET["tk"]; try { @unlink($ruta . '/' . $_GET["delFil"]); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $_GET["tk"], 'staff_id' => $_SESSION["sess_staffid"], 'descripcion' => "Se borro el Archivo " . $_GET['delFil'], 'show_in_ticket' => 1)); // redirijo header("Location: viewticket.php?limitval=0&mt=y&tk=" . $_GET["tk"] . "&us=" . $_GET["us"] . "&stylename=" . $_GET["stylename"] . "&styleminus=" . $_GET["styleminus"] . "&styleplus=" . $_GET["styleplus"] . "&delFilS=1"); die; } catch (Exception $e) { // redirijo header("Location: viewticket.php?limitval=0&mt=y&tk=" . $_GET["tk"] . "&us=" . $_GET["us"] . "&stylename=" . $_GET["stylename"] . "&styleminus=" . $_GET["styleminus"] . "&styleplus=" . $_GET["styleplus"] . "&delFilE=1"); die; } } // +----------------------------------------------------------------------+ // | Eliminar Archivo | // +----------------------------------------------------------------------+ include "../includes/docheader.php"; ?> <!-- <title><?php
// solo una if ($citacion["citacion_cliente"] == 1) { $citacion["cliente_id"] = $var_userid; } elseif ($citacion["citacion_cliente"] == 2) { $citacion["cliente_id"] = $var_userid_dos; } else { // busco el cliente compuesto $citacion["cliente_id"] = citacionClienteCompuesto($citacion["citacion_cliente"]); } $citacionClass->guardarCitacion(array('citacion_tipo' => $citacion["citacion_tipo"], 'citacion_plantilla' => $citacion["citacion_plantilla"], 'ticket_id' => $var_insert_id, 'staff_id' => $var_staffid, 'cliente_id' => $citacion["cliente_id"])); } } // historial de derivar if ($derivar_sector != 0) { $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $var_ticketid, 'staff_id' => $var_staffid, 'descripcion' => 'El Trámite ha sido derivado', 'derivado' => $derivar_sector, 'show_in_ticket' => 1)); } insertStattics($var_ticketid); //update reference number // modified on 15-11-06 by roshith for constant length ref.no. // 'zero' added for 2 digit companyid if ($var_compid < 10) { $var_compid = "0" . $var_compid; } $dept_id = $deptid; // to send mail // 'zero' added for 2 digit departmentid if ($deptid < 10) { $deptid = "0" . $deptid; } // 'zeros' added for 4 digit userid
function cambiarEstadoTramite($val) { global $conn; $query = ""; $sql_comentario = ""; $sql = ""; $sql2 = ""; if ($val == 'cerrarT') { $accion = 'cerrarT'; $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $sector = mysql_real_escape_string($_GET["sector"]); //$Recno = mysql_real_escape_string($_GET["recno"]); $mensaje = mysql_real_escape_string($_GET["mensaje"]); $fecha = date("d-m-Y H:i:s"); if (strlen($mensaje) < 1) { $mensaje = "Cerrado el " . $fecha; } //$sql2 = "DELETE FROM sptbl_datosContratos WHERE idContrato = ".$contratoTotvs; $sql2 = "UPDATE sptbl_datosContratos SET cantidadHijos = 0, estadoContrato = 'A' WHERE idContrato = " . $contratoTotvs; $contratoTotvs = trim(sprintf("%06d", $contratoTotvs)); $sql = "Update sptbl_tickets set vStatus='closed', nClosedStaff='" . $_SESSION["sess_staffid"] . "', nLockStatus='1'\r\n Where vStatus = 'open' and seccion_id = 6 AND tipo_tramite_id = 24 and nTicketId < '" . mysql_real_escape_string($_GET["tk"]) . "'\r\n and contratoTotvs = '" . mysql_real_escape_string($_GET["ctotvs"]) . "' "; $sql_comentario = "Update sptbl_tickets set vStatus='closed', nClosedStaff='" . $_SESSION["sess_staffid"] . "', nLockStatus='1', comentario ='" . $mensaje . "' Where nTicketId= ' " . mysql_real_escape_string($_GET["tk"]) . " '"; $descripcion = $contratoTotvs . 'Se cerraron todos los tickets abiertos del contrato'; // SI ES DE JURIDICA CREA LA QUERY $query = "UPDATE Z30010 SET Z30_ESTADO = 'A', Z30_BLQIMP = 'N' WHERE Z30_CODIGO = " . $contratoTotvs . " AND Z30_ESTADO = 'J' "; $query2 = "UPDATE SE1010 SET E1_XJURIDI = '' WHERE E1_XJURIDI = 1 and E1_XCONTRA = " . $contratoTotvs . " ' "; if (mysql_real_escape_string($_GET["hijo"]) >= 0) { $descripcion = ' Se cerro el Ticket y los anteriores del contrato, Nota: ' . $mensaje; } else { $descripcion = ' Se cierra el Ticket, Nota: ' . $mensaje; } } elseif ($val == 'cerrar') { $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $sector = mysql_real_escape_string($_GET["sector"]); $Recno = mysql_real_escape_string($_GET["recno"]); $mensaje = mysql_real_escape_string($_GET["mensaje"]); $intimado = mysql_real_escape_string($_GET["intimado"]); $registroComen = mysql_real_escape_string($_GET["rComen"]); $fecha = date("d-m-Y H:i:s"); if (strlen($mensaje) < 1) { $mensaje = "Cerrado el " . $fecha; } //$sql2 = "DELETE FROM sptbl_datosContratos WHERE idContrato = ".$contratoTotvs; $contratoTotvs = trim(sprintf("%06d", $contratoTotvs)); $sql = "Update sptbl_tickets set vStatus='closed', nClosedStaff='" . $_SESSION["sess_staffid"] . "', nLockStatus='1', comentario ='" . $mensaje . "' Where nTicketId= ' " . mysql_real_escape_string($_GET["tk"]) . " '"; $descripcion = 'Se cerro el ticket'; // SI ES DE JURIDICA CREA LA QUERY if ($sector == 6) { if ($registroComen == true) { $sql2 = "UPDATE sptbl_datosContratos SET cantidadHijos = 0 , estadoContrato = 'A' WHERE idContrato = " . $contratoTotvs; } $accion = 'cerrar'; $query = "UPDATE Z30010 SET Z30_ESTADO = 'A', Z30_BLQIMP = 'N' WHERE Z30_CODIGO = " . $contratoTotvs . " AND Z30_ESTADO = 'J' "; $query2 = "UPDATE SE1010 SET E1_XJURIDI = '' WHERE R_E_C_N_O_ = " . $Recno; if ($intimado == 1) { $descripcion = 'Se cerro el ticket y se quito el Contrato de Juridica, Nota: ' . $mensaje; } else { $descripcion = 'Se cerro el ticket, Nota: ' . $mensaje; } } } elseif ($val == 'reabrir') { $dato = 0; $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $sector = mysql_real_escape_string($_GET["sector"]); $intimado = mysql_real_escape_string($_GET["intimado"]); $ticketId = mysql_real_escape_string($_GET["tk"]); if (intval(mysql_real_escape_string($_GET["dato"])) > 0) { $dato = mysql_real_escape_string($_GET["dato"]); } if ($sector == 6) { $accion = 'reabrir'; $sql = "Update sptbl_tickets set vStatus='open', nClosedStaff='0', nLockStatus='1', comentario = '' Where nTicketId between " . $dato . " and " . $ticketId . " and contratoTotvs = " . $contratoTotvs . " and seccion_id = " . $sector; if ($intimado == 1) { $descripcion = 'Se reabrió el ticket, contrato vuelve a Juridica '; $query = "UPDATE Z30010 SET Z30_ESTADO = 'J', Z30_BLQIMP = 'S' WHERE Z30_CODIGO = " . $contratoTotvs . " AND Z30_ESTADO = 'A' "; $sql4 = "UPDATE sptbl_datosContratos SET estadoContrato = 'J' WHERE idContrato = " . $contratoTotvs; } else { $descripcion = 'Se reabrió el ticket'; } $sql3 = "Update sptbl_tickets set tramite_hijo = 0 Where nTicketId = " . $ticketId . " and contratoTotvs = " . $contratoTotvs . " and seccion_id = " . $sector; $sql2 = "INSERT INTO sptbl_datosContratos(idContrato,cantidadHijos) VALUES('" . $contratoTotvs . "',\r\n (select count(nTicketId) from sptbl_tickets where contratoTotvs ='" . $contratoTotvs . "' and vStatus = 'open' and seccion_id = 6))"; // SI ESTA INTIMADO // no se esta ejecutando if ($intimado == 1) { $descripcion = 'Se reabrió el ticket, contrato vuelve a Juridica '; } else { $descripcion = 'Se reabrió el ticket'; } } else { $sql = "Update sptbl_tickets set vStatus='open', nClosedStaff='0', nLockStatus='1' Where nTicketId = " . $ticketId; } } elseif ($val == 'intimar') { $accion = 'intimar'; $fecha = date("Y-m-d H:i:s"); $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $cantidad = mysql_real_escape_string($_GET["cantidadcomen"]); $sql = "Update sptbl_tickets set intimado = 1 where contratoTotvs = " . $contratoTotvs . " and vStatus = 'open'"; if ($cantidad != 0) { $sql2 = "Update sptbl_datosContratos SET fchIntimado = '" . $fecha . "', estadoContrato = 'J' where idContrato = '" . $contratoTotvs . " ' "; } else { $sql2 = "INSERT INTO sptbl_datosContratos(fchIntimado,idContrato) VALUES('" . $fecha . "'," . $contratoTotvs . ")"; } $query = "UPDATE Z30010 SET Z30_ESTADO = 'J', Z30_BLQIMP = 'S' WHERE Z30_CODIGO = " . $contratoTotvs . " AND Z30_ESTADO = 'A' "; $descripcion = "Se Intimo el Ticket, el contrato esta en Juridica"; } elseif ($val == 'desacerIntimacion') { $accion = 'sacarIntimacion'; $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $sql = "Update sptbl_tickets set intimado = 0 where contratoTotvs = " . $contratoTotvs . " and vStatus = 'open'"; $sql2 = "Update sptbl_datosContratos SET fchIntimado = '', estadoContrato = 'A' where idContrato = '" . $contratoTotvs . " ' "; $descripcion = 'Se saco intimacion al Ticket, el contrato sale de Juridica'; $query = "UPDATE Z30010 SET Z30_ESTADO = 'A', Z30_BLQIMP = 'N' WHERE Z30_CODIGO = " . $contratoTotvs . " AND Z30_ESTADO = 'J' "; } elseif ($val == 'eliminarNota') { $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $sector = mysql_real_escape_string($_GET["sector"]); $idCliente = mysql_real_escape_string($_GET["cliente"]); if (intval($sector) == 4 && intval($idCliente) != 0) { $sql = "UPDATE sptbl_users SET comentario_atencionInquilinos = '' WHERE userIdAcsa = " . $idCliente; } else { if (intval($sector) == 6) { $sql = "UPDATE sptbl_datosContratos SET comentario = '' WHERE idContrato = " . $contratoTotvs; } } $descripcion = 'Se elimina el comentario del contrato'; } elseif ($val == 'modificarNota') { $mensaje = mysql_real_escape_string($_GET["mensaje"]); $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $orden = mysql_real_escape_string($_GET["ordenCon"]); $sector = mysql_real_escape_string($_GET["sector"]); $mensaje = str_replace("<br/>", ";", $mensaje); $idCliente = mysql_real_escape_string($_GET["cliente"]); print_r($_GET); if ($orden == 0) { $orden = 5; } if (strlen($mensaje) > 0) { if (intval($sector) == 6) { $sql = "UPDATE sptbl_datosContratos SET comentario = '" . $mensaje . "', orden = " . $orden . " WHERE idContrato = " . $contratoTotvs; } $mensaje = str_replace(";", "<br/>", $mensaje); $descripcion = 'Se cambia el comentario del contrato por:' . $mensaje; } } elseif ($val == 'insertarNota') { $mensaje = mysql_real_escape_string($_GET["mensaje"]); $contratoTotvs = mysql_real_escape_string($_GET["ctotvs"]); $orden = mysql_real_escape_string($_GET["ordenCon"]); $cantidad = mysql_real_escape_string($_GET["cantidadcomen"]); $sector = mysql_real_escape_string($_GET["sector"]); $mensaje = str_replace("<br/>", ";", $mensaje); $idCliente = mysql_real_escape_string($_GET["cliente"]); if ($orden == 0) { $orden = 5; } if (intval($sector) == 6) { if ($cantidad != 0) { $sql = "UPDATE sptbl_datosContratos SET comentario = '" . $mensaje . "', orden = " . $orden . " WHERE idContrato = " . $contratoTotvs; } else { $sql = "INSERT INTO sptbl_datosContratos(idContrato,comentario,orden) VALUES(" . $contratoTotvs . ",'" . $mensaje . "'," . $orden . ")"; } } if ($mensaje != '') { $mensaje = str_replace(";", "<br/>", $mensaje); $descripcion = 'Se inserta en el contrato el comentario: ' . $mensaje; } else { $descripcion = 'Se Modifico el orden del contrato'; } } else { return false; } // actualizar en totvs if ($query != '') { executeQueryTotvs($query); } /* // comprobar si funcionaron los update if($accion == 'intimar') { $consulta = "SELECT Z30_ESTADO FROM Z30010 WHERE Z30_CODIGO = ".$contratoTotvs." AND Z30_ESTADO = 'J' AND Z30_BLQIMP = 'S' "; $resultado = executeSelectTotvs($consulta); if(mssql_num_rows($resultado) > 0) $update_totvs = TRUE; else $update_totvs = FALSE; } if($accion == 'cerrarT' || $accion == 'cerrar') { $consulta = "SELECT TOP 1 COUNT(Z30_CODIGO) FROM Z30010 WHERE Z30_CODIGO = ".$contratoTotvs." AND Z30_ESTADO = 'A' AND Z30_BLQIMP = 'N' "; $resultado = executeSelectTotvs($consulta); if(mssql_num_rows($resultado) > 0) $update_totvs = TRUE; else $update_totvs = FALSE; } if($accion == 'reabrir') { $consulta = "SELECT count(intimado) as intimado FROM sptbl_tickets where contratoTotvs = ".$contratoTotvs." and intimado = 1 LIMIT 1 "; echo $consulta ; $result = executeSelect($consulta,$conn); while($row = mysql_fetch_array($result)){ $cantidad = $row['intimado']; } if($cantidad <= 0) $consulta = "SELECT Z30_ESTADO FROM Z30010 WHERE Z30_CODIGO = ".$contratoTotvs." AND Z30_ESTADO = 'A' AND Z30_BLQIMP = 'N' "; else $consulta = "SELECT Z30_ESTADO FROM Z30010 WHERE Z30_CODIGO = ".$contratoTotvs." AND Z30_ESTADO = 'J' AND Z30_BLQIMP = 'S' "; /* // guardo el historial $historial = new Historial(); $historial->guardarHistorial( array('ticket_id' => $_GET["tk"], 'staff_id' => $_SESSION["sess_staffid"], 'descripcion' => $cantidad, 'show_in_ticket' => 1) ); $resultado = executeSelectTotvs($consulta); if(mssql_num_rows($resultado) >0) $update_totvs = TRUE; else $update_totvs = FALSE; $update_totvs = TRUE; } if($accion == 'sacarIntimacion') { $consulta = "SELECT Z30_ESTADO FROM Z30010 WHERE Z30_CODIGO = ".$contratoTotvs." AND Z30_ESTADO = 'A' AND Z30_BLQIMP = 'N' "; $resultado = executeSelectTotvs($consulta); if(mssql_num_rows($resultado) > 0) $update_totvs = TRUE; else $update_totvs = FALSE; } */ if ($query2 != "") { // actualizar en totvs $result = executeSelectTotvs($query2); } //if($update_totvs || $query=""){ if ($sql != "") { executeQuery($sql, $conn); } if ($sql2 != "") { executeQuery($sql2, $conn); } if ($sql3 != "") { executeQuery($sql3, $conn); } if ($sql4 != "") { executeQuery($sql4, $conn); } if ($sql_comentario != "") { executeQuery($sql_comentario, $conn); } // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $_GET["tk"], 'staff_id' => $_SESSION["sess_staffid"], 'descripcion' => $descripcion, 'show_in_ticket' => 1)); // redirijo header("Location: viewticket.php?limitval=0&mt=y&tk=" . $_GET["tk"] . "&us=" . $_GET["us"] . "&stylename=" . $_GET["stylename"] . "&styleminus=" . $_GET["styleminus"] . "&styleplus=" . $_GET["styleplus"]); die; }
$lienzo = imagecreatetruecolor($miniatura_ancho, $miniatura_alto); imagecopyresampled($lienzo, $imagen, 0, 0, 0, 0, $miniatura_ancho, $miniatura_alto, $imagen_ancho, $imagen_alto); imagejpeg($lienzo, "{$uploads_dir}/thumbs_{$name}", 80); // elimino la imagen original @unlink("{$uploads_dir}/{$name}"); } } // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $var_ticketid, 'staff_id' => $var_staffid, 'descripcion' => 'Se adjunto el archivo ' . $name, 'show_in_ticket' => 1)); $result['success'][$key] = true; } else { $result['error'][$key] = true; } } } else { if ($_FILES["file"]['error'] == 0) { $tmp_name = $_FILES["file"]["tmp_name"]; $name = $_FILES["file"]["name"]; move_uploaded_file($tmp_name, "{$uploads_dir}/{$name}"); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $var_ticketid, 'staff_id' => $var_staffid, 'descripcion' => 'Se adjunto el archivo ' . $name, 'show_in_ticket' => 1)); $result['success'] = true; } else { $result['error'] = true; } } return json_decode($result); die; }
<?php require_once "./includes/applicationheader.php"; include "./includes/functions/miscfunctions.php"; $conn = getConnection(); if (isset($_POST["submit"]) and isset($_GET)) { if ($_POST["var_ticket"] != '' and $_POST["edit_user_totvs"] != '' and $_POST["edit_user_dire"] != '' and $_POST["edit_user_tele"] != '') { // staff id $var_staffid = $_SESSION["sess_staffid"]; $var_show_ticket = 0; // usuario $sql_insert_user = "******"; $sql_insert_user .= " vEmail = '" . mysql_real_escape_string($_POST["edit_user_email"]) . "' , "; $sql_insert_user .= " vTelefono = '" . mysql_real_escape_string($_POST["edit_user_tele"]) . "' , "; $sql_insert_user .= " vDireccion = '" . mysql_real_escape_string($_POST["edit_user_dire"]) . "' , "; $sql_insert_user .= " comentario_atencionInquilinos = '" . mysql_real_escape_string($_POST["edit_user_observ"]) . "' "; $sql_insert_user .= "WHERE userIdAcsa = '" . $_POST["edit_user_totvs"] . "'"; executeQuery($sql_insert_user, $conn); // guardo el historial $historial = new Historial(); $historial->guardarHistorial(array('ticket_id' => $_POST["var_ticket"], 'staff_id' => $var_staffid, 'descripcion' => 'Se editaron los datos del Usuario', 'show_in_ticket' => $var_show_ticket)); // vuelvo al ticket header("Location: viewticket.php?limitval=" . $_GET['limitval'] . "&mt=y&tk=" . $_GET['tk'] . "&us=" . $_GET['us'] . "&stylename=" . $_GET['stylename'] . "&styleminus=" . $_GET['styleminus'] . "&styleplus=" . $_GET['styleplus'] . "&editUser=1"); die; } else { // vuelvo al ticket con el error header("Location: viewticket.php?limitval=" . $_GET['limitval'] . "&mt=y&tk=" . $_GET['tk'] . "&us=" . $_GET['us'] . "&stylename=" . $_GET['stylename'] . "&styleminus=" . $_GET['styleminus'] . "&styleplus=" . $_GET['styleplus'] . "&editUser=2"); die; } }