Пример #1
0
def modconfirm(req,
               sd="",
               clase="",
               estado="",
               tipo="",
               descripcion="",
               accion="",
               sale=""):

    busca = int(sd)

    executa_sql(
        """UPDATE ticket SET clase='%s', estado='%s', tipo='%s', descripcion='%s', accion='%s', sale=(STR_TO_DATE(REPLACE('%s','/','.'), GET_FORMAT(date, 'EUR'))) WHERE id = %s"""
        % (clase, estado, tipo, descripcion, accion, sale, busca))

    pag = """

	<html>
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
			<link rel="stylesheet" href="/sdirectory/estilo.css">
			<meta http-equiv="refresh" content="2;/sdirectory/index.py">
			<title>SDirectory - Control de tickets SD</title>
		</head>
        <body>
			<h1>SDirectory</h1>
			<p>Se ha modificado el ticket SD%s, volviendo a la ventana principal... Si no funciona pulsar</p>
			<a href="/sdirectory/index.py">Aquí</a>

		</body>
	</html>
	"""

    return pag % sd
Пример #2
0
def borrarconfirm(req, sd="0"):

    busca = int(sd)

    executa_sql("""DELETE FROM ticket WHERE id = %s""" % (busca, ))

    pag = """

	<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
                <link rel="stylesheet" href="/sdirectory/estilo.css">
                <meta http-equiv="refresh" content="2;/sdirectory/index.py">
                <title>SDirectory - Control de tickets SD</title>
        </head>
        <body>
		<h1>SDirectory</h1>
                <p>Se ha eliminado el ticket SD%s, volviendo a la ventana principal... Si no funciona pulsar</p>
                <a href="/sdirectory/index.py">Aquí</a>
        </body>
	</html>
	"""

    return pag % sd
Пример #3
0
def index(req, sd="0"):

    busca = int(sd)

    tickets = executa_sql(
        """SELECT id, DATE_FORMAT(entra, %s), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale, %s) FROM ticket WHERE id = %s"""
        % (
            fechaselect,
            fechaselect,
            busca,
        ))

    pag = """
		<html>
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
				<title>SDirectory - Control de tickets SD</title>
				<link rel="stylesheet" type="text/css" href="/sdirectory/estilo.css" media="screen"/>
				<link rel="shortcut icon" href="favicon.ico">
			</head>
			<body>
				<h1>SDirectory</h1>
                        
				<ul style="list-style-type:none;">
					<li class="opcion"><a class="opcion" href="/sdirectory/index.py">Volver</a></li>
				</ul>
				<h2 class="bar">
					<span class="version" style="text-align:right">%s</span>
				</h2>
			
				<p><table>
					<col width="100">
					<col width="100">
					<col width="90">
					<col width="100">
					<col width="90">
					<col width="90">
					<col width="400">
					<col width="400">
					<col width="100">
					<thead>
						<tr>
							<th># Ticket</th>
							<th>Recibido</th>
							<th>Clase</th>
							<th>Procedencia</th>
							<th>Estado</th>
							<th>Tipo</th>
							<th>Descripción</th>
							<th>Acción</th>
							<th>Fecha Acción</th>
						</tr>
					</thead>
					<tbody>
						%s
					</tbody>

					<p>¿Estás seguro de querer borrar el ticket seleccionado?<br>
					<a href="/sdirectory/borrar.py/borrarconfirm?sd=%s">Sí</a> - <a href="/sdirectory/index.py">No</a></p>

					</table>
			</body>
		</html>
	"""

    filas = ""
    contador = 0

    for ticket in tickets:
        filas += """
			<tr>
				<td class="par">SD%s</td>
				<td class="par">%s</td>
		""" % (ticket[0], ticket[1])

    if ticket[2] == 0:
        filas += """<td class="par"> - </td>"""
    if ticket[2] == 1:
        filas += """<td class="par">Incidencia</td>"""
    if ticket[2] == 2:
        filas += """<td class="par">Petición</td>"""
    if ticket[2] == 3:
        filas += """<td class="par">Nota</td>"""

    if ticket[3] == 0:
        filas += """<td class="par"> - </td>"""
    if ticket[3] == 1:
        filas += """<td class="par">CAU</td>"""
    if ticket[3] == 2:
        filas += """<td class="par">Cliente</td>"""
    if ticket[3] == 3:
        filas += """<td class="par">CGP</td>"""

    if ticket[4] == 0:
        filas += """<td class="par"> - </td>"""
    if ticket[4] == 1:
        filas += """<td class="par">En Proceso</td>"""
    if ticket[4] == 2:
        filas += """<td class="par">Devuelta</td>"""
    if ticket[4] == 3:
        filas += """<td class="par">Resuelto</td>"""
    if ticket[4] == 4:
        filas += """<td class="par">Escalado</td>"""
    if ticket[4] == 5:
        filas += """<td class="par">Pendiente Autorización</td>"""
    if ticket[4] == 6:
        filas += """<td class="par">Caducidad</td>"""

    if ticket[5] == 0:
        filas += """<td class="par"> - </td>"""
    if ticket[5] == 1:
        filas += """<td class="par">Misc.</td>"""
    if ticket[5] == 2:
        filas += """<td class="par">Datos</td>"""
    if ticket[5] == 3:
        filas += """<td class="par">VoIP</td>"""
    if ticket[5] == 4:
        filas += """<td class="par">WiFI</td>"""
    if ticket[5] == 5:
        filas += """<td class="par">Seguridad</td>"""

    filas += """
			<td class="par">%s</td>
			<td class="par">%s</td>
			<td class="par">%s</td>
		</tr>
	""" % (ticket[6], ticket[7], ticket[8])

    return pag % (version, filas, ticket[0])
Пример #4
0
def index(req, ):

    pag = """
	
		<html>
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
				<title>SDirectory - Control de tickets SD</title>
				<link rel="stylesheet" type="text/css" href="estilo.css" media="screen"/>
				<link rel="shortcut icon" href="favicon.ico">
		</head>
		<body>
			<h1>SDirectory</h1>
			<ul style="list-style-type:none;">
				<li class="opcion"><a class="opcion" href="index.py">Volver</a></li>
			</ul>
			<h2 class="bar">
				<span class="version" style="text-align:right">%s</span>
			</h2>
			<h2>Estadísticas</h2>

			<p><table>
				<col width="200">
				<col width="100">
			<thead>
				<tr>	
					<th>Tipo</th>
					<th>Total</th>
				</tr>
				<tbody>
					<tr>
						<td class="par">Todos los Tickets</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">Tickets Activos</td>
						<td class="impar">%s</td>
					</tr>				
					<tr>
						<td class="par">Incidencias</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">Peticiones</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">Notas</td>
						<td class="par">%s</td>
					</tr>				
					<tr>
						<td class="impar">Resueltos</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">Devueltos al CAU</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">Escalados</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">Pendientes de Autorización</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">A la espera de caducar</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">Datos</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">VoIP</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">WiFI</td>
						<td class="par">%s</td>
					</tr>
					<tr>
						<td class="impar">Seguridad</td>
						<td class="impar">%s</td>
					</tr>
					<tr>
						<td class="par">Misc</td>
						<td class="par">%s</td>
					</tr>
				</tbody>				
			</table>
			
		</body>
		</html>
	"""

    contodos = 0
    todos = executa_sql("SELECT id FROM ticket  ORDER BY entra, id")

    for todo in todos:
        contodos = contodos + 1

    conactivos = 0
    activos = executa_sql("SELECT id FROM ticket WHERE estado = 1")

    for activo in activos:
        conactivos = conactivos + 1

    conincident = 0
    incidents = executa_sql("SELECT id FROM ticket WHERE clase = 1")

    for incident in incidents:
        conincident = conincident + 1

    conpeticion = 0
    peticiones = executa_sql("SELECT id FROM ticket WHERE clase = 2")

    for peticion in peticiones:
        conpeticion = conpeticion + 1

    connota = 0
    notas = executa_sql("SELECT id FROM ticket WHERE clase = 3")

    for nota in notas:
        connota = connota + 1

    concgp = 0
    cgps = executa_sql("SELECT id FROM ticket WHERE estado = 3")

    for cgp in cgps:
        concgp = concgp + 1

    concau = 0
    caus = executa_sql("SELECT id FROM ticket WHERE estado = 2")

    for cau in caus:
        concau = concau + 1

    consoc = 0
    socs = executa_sql("SELECT id FROM ticket WHERE estado = 4")

    for soc in socs:
        consoc = consoc + 1

    conauth = 0
    auths = executa_sql("SELECT id FROM ticket WHERE estado = 5")

    for auth in auths:
        conauth = conauth + 1

    concad = 0
    cads = executa_sql("SELECT id FROM ticket WHERE estado = 6")

    for cad in cads:
        concad = concad + 1

    condatos = 0
    datos = executa_sql("SELECT id FROM ticket WHERE tipo = 2")

    for dato in datos:
        condatos = condatos + 1

    convoip = 0
    voips = executa_sql("SELECT id FROM ticket WHERE tipo = 3")

    for voip in voips:
        convoip = convoip + 1

    conwifi = 0
    wifis = executa_sql("SELECT id FROM ticket WHERE tipo = 4")

    for wifi in wifis:
        conwifi = conwifi + 1

    consec = 0
    secs = executa_sql("SELECT id FROM ticket WHERE tipo = 5")

    for sec in secs:
        consec = consec + 1

    conmisc = 0
    miscs = executa_sql("SELECT id FROM ticket  WHERE tipo = 1")

    for misc in miscs:
        conmisc = conmisc + 1

    return pag % (version, contodos, conactivos, conincident, conpeticion,
                  connota, concgp, concau, consoc, conauth, concad, condatos,
                  convoip, conwifi, consec, conmisc)
Пример #5
0
def insertar(req,
             sd="",
             entra="",
             clase="",
             procedencia="",
             tipo="",
             descripcion=""):

    busca = int(sd)

    tickets = executa_sql(
        """SELECT id, DATE_FORMAT(entra, %s), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale, %s) FROM ticket WHERE id = %s"""
        % (
            fechaselect,
            fechaselect,
            busca,
        ))

    if tickets:

        pag = """
			<html>
				<head>
					<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
					<title>SDirectory - Control de tickets SD</title>
					<link rel="stylesheet" type="text/css" href="/sdirectory/estilo.css" media="screen"/>
					<link rel="shortcut icon" href="favicon.ico">
				</head>
				<body>
					<h1>SDirectory</h1>

					<ul style="list-style-type:none;">
						<li class="opcion"><a class="opcion" href="/sdirectory/index.py">Volver</a></li>
					</ul>
					<h2 class="bar">
						<span class="version" style="text-align:right">%s</span>
					</h2>

					<h2>ERROR: TICKET DUPLICADO</h2>
					<p>El ticket SD%s ya existe.</p>
					<p><table>
						<col width="75">
						<col width="100">
						<col width="100">
						<col width="90">
						<col width="100">
						<col width="90">
						<col width="90">
						<col width="400">
						<col width="400">
						<col width="100">
						<thead>
							<tr>
								<th>Acción</th>
									<th># Ticket</th>
									<th>Recibido</th>
									<th>Clase</th>
									<th>Procedencia</th>
									<th>Estado</th>
									<th>Tipo</th>
									<th>Descripción</th>
									<th>Acción</th>
									<th>Fecha Acción</th>
							</tr>
						</thead>
						<tbody>
							%s
						</tbody>
					</table>

				</body>
				</html>
		"""

        filas = ""
    contador = 0

    for ticket in tickets:
        filas += """
				<tr>
					<td class="par"><a href="/sdirectory/modificar.py/index?sd=%s">Modificar</a><br><a href="/sdirectory/borrar.py/index?sd=%s">Borrar</a></td>
					<td class="par">SD%s</td>
					<td class="par">%s</td>
			""" % (ticket[0], ticket[0], ticket[0], ticket[1])

        if ticket[2] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[2] == 1:
            filas += """<td class="par">Incidencia</td>"""
        if ticket[2] == 2:
            filas += """<td class="par">Petición</td>"""
        if ticket[2] == 3:
            filas += """<td class="par">Nota</td>"""

        if ticket[3] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[3] == 1:
            filas += """<td class="par">CAU</td>"""
        if ticket[3] == 2:
            filas += """<td class="par">Cliente</td>"""
        if ticket[3] == 3:
            filas += """<td class="par">CGP</td>"""

        if ticket[4] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[4] == 1:
            filas += """<td class="par">En Proceso</td>"""
        if ticket[4] == 2:
            filas += """<td class="par">Devuelta</td>"""
        if ticket[4] == 3:
            filas += """<td class="par">Resuelto</td>"""
        if ticket[4] == 4:
            filas += """<td class="par">Escalado</td>"""
        if ticket[4] == 5:
            filas += """<td class="par">Pendiente Autorización</td>"""
        if ticket[4] == 6:
            filas += """<td class="par">Caducidad</td>"""

        if ticket[5] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[5] == 1:
            filas += """<td class="par">Misc.</td>"""
        if ticket[5] == 2:
            filas += """<td class="par">Datos</td>"""
        if ticket[5] == 3:
            filas += """<td class="par">VoIP</td>"""
        if ticket[5] == 4:
            filas += """<td class="par">WiFI</td>"""
        if ticket[5] == 5:
            filas += """<td class="par">Seguridad</td>"""

        filas += """
				<td class="par">%s</td>
				<td class="par">%s</td>
				<td class="par">%s</td>
				</tr>
			""" % (ticket[6], ticket[7], ticket[8])

        return pag % (version, sd, filas)

    else:

        pag = """
			<html>
				<head>
					<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
					<title>SDirectory - Control de tickets SD</title>
					<link rel="stylesheet" type="text/css" href="/sdirectory/estilo.css" media="screen"/>
					<meta http-equiv="refresh" content="1;/sdirectory/index.py">
					<link rel="shortcut icon" href="favicon.ico">
				</head>
				<body>
					<h1>SDirectory</h1>
					<p>Se ha creado el ticket SD%s.</p>
					<p>Se redirigirá a la página principal, si no funciona pulsar <a href="/sdirectory/index.py">aquí</a></p>

				</body>
				</html>
		""" % (sd, )

        descripcion.replace("'", "\'")

        executa_sql(
            """INSERT INTO ticket (id, entra, clase, procedencia, tipo, descripcion, estado) VALUES ('%s', (STR_TO_DATE(REPLACE('%s','/','.'), GET_FORMAT(date, 'EUR'))), '%s', '%s', '%s', '%s', '1');"""
            % (sd, entra, clase, procedencia, tipo, descripcion))

    return pag
Пример #6
0
def index(req, sd="0"):

    busca = int(sd)

    tickets = executa_sql(
        """SELECT id, DATE_FORMAT(entra, %s), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale, %s) FROM ticket WHERE id = %s"""
        % (
            fechaselect,
            fechaselect,
            busca,
        ))

    pag = """
		<html>
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
				<title>SDirectory - Control de tickets SD</title>
				<link rel="stylesheet" type="text/css" href="/sdirectory/estilo.css" media="screen"/>
				<link rel="shortcut icon" href="favicon.ico">
			</head>
			<body>
				<h1>SDirectory</h1>
                        
				<ul style="list-style-type:none;">
					<li class="opcion"><a class="opcion" href="/sdirectory/index.py">Volver</a></li>
				</ul>
				<h2 class="bar">
					<span class="version" style="text-align:right">%s</span>
				</h2>
			
				<p><table>
					<col width="100">
					<col width="100">
					<col width="90">
					<col width="100">
					<col width="90">
					<col width="90">
					<col width="400">
					<col width="400">
					<col width="100">
					<thead>
						<tr>
							<th># Ticket</th>
							<th>Recibido</th>
							<th>Clase</th>
							<th>Procedencia</th>
							<th>Estado</th>
							<th>Tipo</th>
							<th>Descripción</th>
							<th>Acción</th>
							<th>Fecha Acción</th>
						</tr>
					</thead>
						<tbody>
							%s
						</tbody>
				</table>
			
				%s
			
			</body>
		</html>
	"""

    filas = ""
    contador = 0

    for ticket in tickets:
        filas += """
			<tr>
				<td class="par">SD%s</td>
				<td class="par">%s</td>
		""" % (ticket[0], ticket[1])

        if ticket[2] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[2] == 1:
            filas += """<td class="par">Incidencia</td>"""
        if ticket[2] == 2:
            filas += """<td class="par">Petición</td>"""
        if ticket[2] == 3:
            filas += """<td class="par">Nota</td>"""

        if ticket[3] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[3] == 1:
            filas += """<td class="par">CAU</td>"""
        if ticket[3] == 2:
            filas += """<td class="par">Cliente</td>"""
        if ticket[3] == 3:
            filas += """<td class="par">CGP</td>"""

        if ticket[4] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[4] == 1:
            filas += """<td class="par">En Proceso</td>"""
        if ticket[4] == 2:
            filas += """<td class="par">Devuelta</td>"""
        if ticket[4] == 3:
            filas += """<td class="par">Resuelto</td>"""
        if ticket[4] == 4:
            filas += """<td class="par">Escalado</td>"""
        if ticket[4] == 5:
            filas += """<td class="par">Pendiente Autorización</td>"""
        if ticket[4] == 6:
            filas += """<td class="par">Caducidad</td>"""

        if ticket[5] == 0:
            filas += """<td class="par"> - </td>"""
        if ticket[5] == 1:
            filas += """<td class="par">Misc.</td>"""
        if ticket[5] == 2:
            filas += """<td class="par">Datos</td>"""
        if ticket[5] == 3:
            filas += """<td class="par">VoIP</td>"""
        if ticket[5] == 4:
            filas += """<td class="par">WiFI</td>"""
        if ticket[5] == 5:
            filas += """<td class="par">Seguridad</td>"""

        filas += """
				<td class="par">%s</td>
				<td class="par">%s</td>
				<td class="par">%s</td>
			</tr>
		""" % (ticket[6], ticket[7], ticket[8])

    formulario = """
		<form action=/sdirectory/modificar.py/modconfirm>
			<input type="hidden" name ="sd" value="%s">
				Estado del ticket:
				<select name="clase">

	""" % (ticket[0], )

    if ticket[2] == 1:
        formulario += """
			<option selected value="1">Incidencia</option>
			<option value="2">Petición</option>
			<option value="3">Nota</option>
		"""

    if ticket[2] == 2:
        formulario += """
			<option value="1">Incidencia</option>
			<option selected value="2">Petición</option>
			<option value="3">Nota</option>
		"""

    if ticket[2] == 3:
        formulario += """
			<option value="1">Incidencia</option>
			<option value="2">Petición</option>
			<option selected value="3">Nota</option>
		"""

    elif ticket[2] == 0:
        formulario += """
			<option value="1">Incidencia</option>
			<option value="2">Petición</option>
			<option value="3">Nota</option>
		"""

    formulario += """
		</select>

			Tipo:
		<select name="estado">
	"""

    if ticket[4] == 1:
        formulario += """
			<option selected value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    if ticket[4] == 2:
        formulario += """
			<option value="1">En Proceso</option>
			<option selected value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    if ticket[4] == 3:
        formulario += """
			<option value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option selected value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    if ticket[4] == 4:
        formulario += """
			<option value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option selected value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    if ticket[4] == 5:
        formulario += """
			<option value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option selected value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    if ticket[4] == 6:
        formulario += """
			<option value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option selected value="6">Caducidad</option>
		"""

    elif ticket[4] == 0:
        formulario += """
			<option value="1">En Proceso</option>
			<option value="2">Devuelto</option>
			<option value="3">Resuelto</option>
			<option value="4">Escalado</option>
			<option value="5">Pendiente Autorización</option>
			<option value="6">Caducidad</option>
		"""

    formulario += """
		</select>

			Tipo:
		<select name="tipo">
	"""

    if ticket[5] == 1:
        formulario += """
			<option selected value="1">Misc.</option>
			<option value="2">Datos</option>
			<option value="3">VoIP</option>
			<option value="4">WiFI</option>
			<option value="5">Seguridad</option>
		"""

    if ticket[5] == 2:
        formulario += """
			<option value="1">Misc.</option>
			<option selected value="2">Datos</option>
			<option value="3">VoIP</option>
			<option value="4">WiFI</option>
			<option value="5">Seguridad</option>
		"""

    if ticket[5] == 3:
        formulario += """
			<option value="1">Misc.</option>
			<option value="2">Datos</option>
			<option selected value="3">VoIP</option>
			<option value="4">WiFI</option>
			<option value="5">Seguridad</option>
		"""

    if ticket[5] == 4:
        formulario += """
			<option value="1">Misc.</option>
			<option value="2">Datos</option>
			<option value="3">VoIP</option>
			<option selected value="4">WiFI</option>
			<option value="5">Seguridad</option>
		"""

    if ticket[5] == 5:
        formulario += """
			<option value="1">Misc.</option>
			<option value="2">Datos</option>
			<option value="3">VoIP</option>
			<option value="4">WiFI</option>
			<option selected value="5">Seguridad</option>
		"""

    elif ticket[5] == 0:
        formulario += """
			<option value="1">Misc.</option>
			<option value="2">Datos</option>
			<option value="3">VoIP</option>
			<option value="4">WiFI</option>
			<option value="5">Seguridad</option>
		"""

    formulario += """
			</select>
			<br>
			Descripción:<br><textarea name="descripcion" cols="65" rows="10" textmode="multiLine">%s</textarea><br>
			Notas o Solución aportada:<br><textarea name="accion" cols="65" rows="10" textmode="multiLine">%s</textarea><br>            
			Fecha de solución: <input type="text" size="10" name="sale" value="%s"/><br>
			<input type="submit" value="Modificar"/>
		</form> 
	""" % (ticket[6], ticket[7], ticket[8])

    return pag % (version, filas, formulario)
Пример #7
0
def index(req, ):

    tickets = executa_sql(
        "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 1 OR estado = 4 OR estado = 5 OR estado = 6 ORDER BY entra, id"
    )

    pag = """
	
	<html>
	<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
        	<title>SDirectory - Control de tickets SD</title>
        	<link rel="stylesheet" type="text/css" href="estilo.css" media="screen"/>
        	<link rel="shortcut icon" href="favicon.ico">
			<meta http-equiv="refresh" content="300;/sdirectory/index.py">			
	</head>
	<body>
		<h1>SDirectory</h1>
		<ul style="list-style-type:none;">
			<li class="opcion"><a class="opcion" href="nuevo.py">Nuevo ticket</a></li>
			<li class="opcion"><a class="opcion" href="historico.py/index?select=0">Histórico de Tickets</a></li>
			<li class="opcion"><a class="opcion" href="index.py/busca?sd=0">Buscar Ticket</a></li>
			<li class="opcion"><a class="opcion" href="stats.py">Estadísticas</a></li>
		</ul>
		<h2 class="bar">
		<span class="version" style="text-align:right">%s</span>
		</h2>

		<h2>Tickets Pendientes</h2>
		<p><table>
			<col width="75">
			<col width="100">
			<col width="100">
			<col width="90">
			<col width="100">
			<col width="90">
			<col width="90">
			<col width="400">
			<col width="400">
			<col width="100">
			<thead>
				<tr>	
					<th>Acción</th>
					<th># Ticket</th>
					<th>Recibido</th>
					<th>Clase</th>
					<th>Procedencia</th>
					<th>Estado</th>
					<th>Tipo</th>
					<th>Descripción</th>
					<th>Notas/Solución</th>
					<th>Fecha Acción</th>
				</tr>
				<tbody>
					%s
				</tbody>				
		</table>
	</body>
	</html>	
	
	"""
    filas = ""
    contador = 0

    for ticket in tickets:
        contador = contador + 1

        if contador % 2:
            filas += """
				<tr>
					<td class="par"><a href="modificar/index?sd=%s">Modificar</a><br><a href="borrar/index?sd=%s">Borrar</a></td>
					<td class="par">SD%s</td>
					<td class="par">%s</td>
				""" % (ticket[0], ticket[0], ticket[0], ticket[1])

            if ticket[2] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[2] == 1:
                filas += """<td class="par">Incidencia</td>"""
            if ticket[2] == 2:
                filas += """<td class="par">Petición</td>"""
            if ticket[2] == 3:
                filas += """<td class="par">Nota</td>"""

            if ticket[3] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[3] == 1:
                filas += """<td class="par">CAU</td>"""
            if ticket[3] == 2:
                filas += """<td class="par">Cliente</td>"""
            if ticket[3] == 3:
                filas += """<td class="par">CGP</td>"""

            if ticket[4] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[4] == 1:
                filas += """<td class="par">En Proceso</td>"""
            if ticket[4] == 2:
                filas += """<td class="par">Devuelta</td>"""
            if ticket[4] == 3:
                filas += """<td class="par">Resuelto</td>"""
            if ticket[4] == 4:
                filas += """<td class="par">Escalado</td>"""
            if ticket[4] == 5:
                filas += """<td class="par">Pendiente Autorización</td>"""
            if ticket[4] == 6:
                filas += """<td class="par">Caducidad</td>"""

            if ticket[5] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[5] == 1:
                filas += """<td class="par">Misc.</td>"""
            if ticket[5] == 2:
                filas += """<td class="par">Datos</td>"""
            if ticket[5] == 3:
                filas += """<td class="par">VoIP</td>"""
            if ticket[5] == 4:
                filas += """<td class="par">WiFI</td>"""
            if ticket[5] == 5:
                filas += """<td class="par">Seguridad</td>"""

            filas += """
					<td class="par">%s</td>
					<td class="par">%s</td>
					<td class="par">%s</td>
				</tr>
			""" % (ticket[6], ticket[7], ticket[8])

        else:
            filas += """
				<tr>
					<td class="impar"><a href="modificar/index?sd=%s">Modificar</a><br><a href="borrar/index?sd=%s">Borrar</a></td>
					<td class="impar">SD%s</td>
					<td class="impar">%s</td>
			""" % (ticket[0], ticket[0], ticket[0], ticket[1])

            if ticket[2] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[2] == 1:
                filas += """<td class="impar">Incidencia</td>"""
            if ticket[2] == 2:
                filas += """<td class="impar">Petición</td>"""
            if ticket[2] == 3:
                filas += """<td class="impar">Nota</td>"""

            if ticket[3] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[3] == 1:
                filas += """<td class="impar">CAU</td>"""
            if ticket[3] == 2:
                filas += """<td class="impar">Cliente</td>"""
            if ticket[3] == 3:
                filas += """<td class="impar">CGP</td>"""

            if ticket[4] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[4] == 1:
                filas += """<td class="impar">En Proceso</td>"""
            if ticket[4] == 2:
                filas += """<td class="impar">Devuelta</td>"""
            if ticket[4] == 3:
                filas += """<td class="impar">Resuelto</td>"""
            if ticket[4] == 4:
                filas += """<td class="impar">Escalado</td>"""
            if ticket[4] == 5:
                filas += """<td class="impar">Pendiente Autorización</td>"""
            if ticket[4] == 6:
                filas += """<td class="impar">Caducidad</td>"""

            if ticket[5] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[5] == 1:
                filas += """<td class="impar">Misc.</td>"""
            if ticket[5] == 2:
                filas += """<td class="impar">Datos</td>"""
            if ticket[5] == 3:
                filas += """<td class="impar">VoIP</td>"""
            if ticket[5] == 4:
                filas += """<td class="impar">WiFI</td>"""
            if ticket[5] == 5:
                filas += """<td class="impar">Seguridad</td>"""

            filas += """    
					<td class="impar">%s</td>
					<td class="impar">%s</td>
					<td class="impar">%s</td>
				</tr>
			""" % (ticket[6], ticket[7], ticket[8])

    return pag % (version, filas)
Пример #8
0
def index(req, select):

    if select == "0":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket  ORDER BY entra, id"
        )
        subtitle = "Todos los Tickets"
    if select == "1":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE clase = 1 ORDER BY entra, id"
        )
        subtitle = "Incidencias"
    if select == "2":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE clase = 2 ORDER BY entra, id"
        )
        subtitle = "Peticiones"
    if select == "3":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE clase = 3 ORDER BY entra, id"
        )
        subtitle = "Notas"
    if select == "4":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 1 ORDER BY entra, id"
        )
        subtitle = "Tickets Pendientes"
    if select == "5":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 3 ORDER BY entra, id"
        )
        subtitle = "Resueltos"
    if select == "6":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 4 ORDER BY entra, id"
        )
        subtitle = "Escalados a otros grupos"
    if select == "7":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 2 ORDER BY entra, id"
        )
        subtitle = "Devueltos al CAU"
    if select == "8":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket  WHERE estado = 5 ORDER BY entra, id"
        )
        subtitle = "Pendientes de Autorización"
    if select == "9":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE estado = 6 ORDER BY entra, id"
        )
        subtitle = "Pendientes de caducar"
    if select == "10":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket  WHERE tipo = 1 ORDER BY entra, id"
        )
        subtitle = "Tickets Misceláneos"
    if select == "11":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE tipo = 2 ORDER BY entra, id"
        )
        subtitle = "Tickets de Datos"
    if select == "12":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE tipo = 3 ORDER BY entra, id"
        )
        subtitle = "Tickets de VoIP"
    if select == "13":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE tipo = 4 ORDER BY entra, id"
        )
        subtitle = "Tickets de WiFI"
    if select == "14":
        tickets = executa_sql(
            "SELECT id, DATE_FORMAT(entra,'%d/%m/%Y'), clase, procedencia, estado, tipo, descripcion, accion, DATE_FORMAT(sale,'%d/%m/%Y') FROM ticket WHERE tipo = 5 ORDER BY entra, id"
        )
        subtitle = "Tickets de Seguridad"

    pag = """
		<html>
			<head>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
                <title>SDirectory - Control de tickets SD</title>
                <link rel="stylesheet" type="text/css" href="/sdirectory/estilo.css" media="screen"/>
                <link rel="shortcut icon" href="favicon.ico">
			</head>
			<body>
                <h1>SDirectory</h1>
                
				<ul style="list-style-type:none;">
					<li class="opcion"><a class="opcion" href="index?select=0">Todos los Tickets</a></li>
					<li class="opcion"><a class="opcion" href="index?select=1">Incidencias</a></li>
					<li class="opcion"><a class="opcion" href="index?select=2">Peticiones</a></li>
					<li class="opcion"><a class="opcion" href="index?select=3">Notas</a></li>
					<li class="opcion"><a class="opcion" href="index?select=4">Tickets Pendientes</a></li>
					<li class="opcion"><a class="opcion" href="index?select=5">Resueltos</a></li>
					<li class="opcion"><a class="opcion" href="index?select=6">Escalados</a></li>
					<li class="opcion"><a class="opcion" href="index?select=7">Devueltos al CAU</a></li>
					<li class="opcion"><a class="opcion" href="index?select=8">Pendientes de Autorización</a></li>
					<li class="opcion"><a class="opcion" href="index?select=9">Pendiente de caducar</a></li>
					<li class="opcion"><a class="opcion" href="index?select=10">Misc.</a></li>
					<li class="opcion"><a class="opcion" href="index?select=11">Datos</a></li>
					<li class="opcion"><a class="opcion" href="index?select=12">VoIP</a></li>
					<li class="opcion"><a class="opcion" href="index?select=13">WiFI</a></li>
					<li class="opcion"><a class="opcion" href="index?select=14">Seguridad</a></li>
					<li class="opcion"><a class="opcion" href="/sdirectory/index.py">Volver</a></li>
                </ul>
                <h2 class="bar">
					<span class="version" style="text-align:right">%s</span>
                </h2>
				
				<h2>Tickets Pendientes</h2>
		
				<h2>%s</h2>
                <p><table>
					<col width="75">
					<col width="100">
					<col width="100">
					<col width="90">
					<col width="100">
					<col width="90">
					<col width="90">
					<col width="375">
					<col width="375">
					<col width="100">
					<thead>
						<tr>
							<th>Acción</th>
							<th># Ticket</th>
							<th>Recibido</th>
							<th>Clase</th>
							<th>Procedencia</th>
							<th>Estado</th>
							<th>Tipo</th>
							<th>Descripción</th>
							<th>Acción</th>
							<th>Fecha Acción</th>
						</tr>
						<tbody>
							%s
						</tbody>
				</table>
				<ul style="list-style-type:none;">
					<li class="opcion"><a class="opcion" href="#top">Subir</a></li>
					<li class="opcion"><a class="opcion" href="/sdirectory/index.py">Volver</a></li>
				</ul>
				<h2 class="bar"> 
					<span class="version" style="text-align:right">.</span>
				<h2>
			</body>
        </html>

	"""
    filas = ""
    contador = 0

    for ticket in tickets:
        contador = contador + 1

        if contador % 2:
            filas += """
				<tr>
					<td class="par"><a href="/sdirectory/modificar.py/index?sd=%s">Modificar</a><br><a href="/sdirectory/borrar.py/index?sd=%s">Borrar</a></td>
					<td class="par">SD%s</td>
					<td class="par">%s</td>
			""" % (ticket[0], ticket[0], ticket[0], ticket[1])

            if ticket[2] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[2] == 1:
                filas += """<td class="par">Incidencia</td>"""
            if ticket[2] == 2:
                filas += """<td class="par">Petición</td>"""
            if ticket[2] == 3:
                filas += """<td class="par">Nota</td>"""

            if ticket[3] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[3] == 1:
                filas += """<td class="par">CAU</td>"""
            if ticket[3] == 2:
                filas += """<td class="par">Cliente</td>"""
            if ticket[3] == 3:
                filas += """<td class="par">CGP</td>"""

            if ticket[4] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[4] == 1:
                filas += """<td class="par">En Proceso</td>"""
            if ticket[4] == 2:
                filas += """<td class="par">Devuelta</td>"""
            if ticket[4] == 3:
                filas += """<td class="par">Resuelto</td>"""
            if ticket[4] == 4:
                filas += """<td class="par">Escalado</td>"""
            if ticket[4] == 5:
                filas += """<td class="par">Pendiente Autorización</td>"""
            if ticket[4] == 6:
                filas += """<td class="par">Caducidad</td>"""

            if ticket[5] == 0:
                filas += """<td class="par"> - </td>"""
            if ticket[5] == 1:
                filas += """<td class="par">Misc.</td>"""
            if ticket[5] == 2:
                filas += """<td class="par">Datos</td>"""
            if ticket[5] == 3:
                filas += """<td class="par">VoIP</td>"""
            if ticket[5] == 4:
                filas += """<td class="par">WiFI</td>"""
            if ticket[5] == 5:
                filas += """<td class="par">Seguridad</td>"""

            filas += """
					<td class="par">%s</td>
					<td class="par">%s</td>
					<td class="par">%s</td>
				</tr>
			""" % (ticket[6], ticket[7], ticket[8])

        else:
            filas += """
			<tr>
				<td class="impar"><a href="/sdirectory/modificar.py/index?sd=%s">Modificar</a><br><a href="/sdirectory/borrar.py/index?sd=%s">Borrar</a></td>
				<td class="impar">SD%s</td>
				<td class="impar">%s</td>
			""" % (ticket[0], ticket[0], ticket[0], ticket[1])

            if ticket[2] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[2] == 1:
                filas += """<td class="impar">Incidencia</td>"""
            if ticket[2] == 2:
                filas += """<td class="impar">Petición</td>"""
            if ticket[2] == 3:
                filas += """<td class="impar">Nota</td>"""

            if ticket[3] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[3] == 1:
                filas += """<td class="impar">CAU</td>"""
            if ticket[3] == 2:
                filas += """<td class="impar">Cliente</td>"""
            if ticket[3] == 3:
                filas += """<td class="impar">CGP</td>"""

            if ticket[4] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[4] == 1:
                filas += """<td class="impar">En Proceso</td>"""
            if ticket[4] == 2:
                filas += """<td class="impar">Devuelta</td>"""
            if ticket[4] == 3:
                filas += """<td class="impar">Resuelto</td>"""
            if ticket[4] == 4:
                filas += """<td class="impar">Escalado</td>"""
            if ticket[4] == 5:
                filas += """<td class="impar">Pendiente Autorización</td>"""
            if ticket[4] == 6:
                filas += """<td class="impar">Caducidad</td>"""

            if ticket[5] == 0:
                filas += """<td class="impar"> - </td>"""
            if ticket[5] == 1:
                filas += """<td class="impar">Misc.</td>"""
            if ticket[5] == 2:
                filas += """<td class="impar">Datos</td>"""
            if ticket[5] == 3:
                filas += """<td class="impar">VoIP</td>"""
            if ticket[5] == 4:
                filas += """<td class="impar">WiFI</td>"""
            if ticket[5] == 5:
                filas += """<td class="impar">Seguridad</td>"""

            filas += """    
					<td class="impar">%s</td>
					<td class="impar">%s</td>
					<td class="impar">%s</td>
				</tr>
			""" % (ticket[6], ticket[7], ticket[8])

    return pag % (version, subtitle, filas)