-
Notifications
You must be signed in to change notification settings - Fork 0
/
operaciones.php
executable file
·142 lines (132 loc) · 5.51 KB
/
operaciones.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php require_once('db/conexion.php'); session_start(); include('inc_fechas.php'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Operaciones</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<?php include('validateform.php');
if ( $_GET['id']!="" ) // muestra la empleado seleccionada ?>
<!-- MOSTRAR ELEMENTOS DEL FORM (solo muestra Inputs y Botones -->
<script language="JavaScript" type="text/JavaScript">
function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.bgColor = clrOver;
src.borderColor = '';
}
}
function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
src.borderColor = '';
}
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
</script>
</head>
<body>
<?php
if ( isset($_SESSION['valid_admin']) ) { ?>
<?php include('menu.php'); ?>
<?php // Debug echo $_POST['nombre'];
// ALTA ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($_POST['nombre']!='' && $_POST['alta']=='Alta' ){
$sql = " INSERT INTO operaciones VALUES (NULL,'".strtoupper($_POST['nombre'])."'";
$sql .= ", '' ";
$sql .= ", '1' ";
$sql .= " ) ";
$res = $conn->query($sql);
// Debug echo $sql;
}
// Debug echo $sql_m.'<br>POST id:'.$_POST['name'];
// MODIFICAR //////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($_POST['nombre']!='' && $_POST['modificar']=='Modificar' ){
$sql_m = " UPDATE operaciones SET nombre_o = '".strtoupper($_POST['nombre'])."' WHERE operaciones_id = ".$_POST['id'];
$res_m = $conn->query($sql_m);
// Debug echo $sql_m.'<br>POST id:'.$_POST['id'];
}
// BAJA ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($_POST['borrarop'] =='Si' ){
$sql_p = "UPDATE operaciones SET publico_o = '0' WHERE operaciones_id = ".$_POST['id_baja'];
$res_p = $conn->query($sql_p);
// Debug echo $sql_p;
} ?>
<?php if($_POST['baja'] !='Baja' ){ ?>
<br><br>
<form action="operaciones.php" method="Post" enctype="multipart/form-data" name="modificarOp" id="modificarOp" onSubmit="">
<table width="500" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#195089">
<tr>
<td height="25" class="tdBordeCelesteInfBG"> Operaciones</td>
</tr>
<tr>
<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E6E6E6">
<tr>
<td width="50%" align="center"><br>
<select name="id" size="20" id="id"><?php
$sql = " SELECT * FROM operaciones WHERE publico_o = 1 ORDER BY nombre_o ASC ";
$result = $conn->query($sql);
$i = 0;
while( $row = $result->fetch_assoc() ){ ?>
<option value="<?= $row['operaciones_id'] ?>" title="<?= $row['operaciones_id'] ?>" selected><?=$row['nombre_o']?></option>
<?php $i++;
} ?>
</select>
<br><br>
</td>
<td width="50%" valign="top"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="46" colspan="2"><input name="nombre" type="text" id="nombre"></td>
</tr>
<tr>
<td width="71" height="40"> <input name="alta" id="btnAlta" type="submit" value="Alta"></td>
<td width="46" align="right"><input name="baja" id="btnBaja" type="submit" value="Baja"></td>
</tr>
<tr>
<td height="45" colspan="2"><input name="modificar" id="modificar" type="submit" value="Modificar"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</form><?php } ?>
<?php if( $_POST['baja']=='Baja' ){ ?>
<form action="operaciones.php" method="post" name="bajaOp" id="bajaOp">
<?php
$sql = " SELECT * FROM operaciones WHERE operaciones_id = ".$_POST['id'];
$result = $conn->query($sql);
$row = $result->fetch_assoc(); ?>
<table width="313" align="center">
<tr>
<td width="305"><BR><fieldset>
<font color="#FF0000"><b><br>
<u>Confirma la BAJA de la operación</u>: <br><br>
<?=$row['nombre_o'];?>
</b></font>
<input name="id_baja" type="hidden" id="id_baja" value="<?=$_POST['id'];?>">
<br><br>
<table width="65%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" height="30" align="center" valign="middle"><input name="Submit" type="submit" id="Submit" value="No"></td>
<td width="50%" height="30" align="center" valign="middle"><input name="borrarop" type="submit" id="borrarop" value="Si"></td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
</form>
<?php }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else { // fin valid_admin
echo '<meta http-equiv="refresh" content="0;URL=admin.php">';
} ?>
</body>
</html>