/
busqueda_factura.php
169 lines (153 loc) · 7.47 KB
/
busqueda_factura.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
session_start();
$_SESSION['login'];
extract($_GET);
if ($_SESSION['login']!=true){
echo "<script>window.location = './login.php'</script>";
}
//archivos comunes *********************************
include_once ('./common.html');
include ("./conexion.php");
echo "<text style='font-size:10px;'>".$_SESSION['username']."</text>";
require_once('./menuprincipal.php');
//**************************************************
include ("./llenarlistas.php");
include ("./tools.php");
include ("./model.php");
datevalidsp();
$model=new Model();
$db=new MySQL();
extract($_GET);
?>
<html>
<head>
<title>Ninfac</title>
<!--creado por Julio Castillo, abril de 2013-->
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="" type="text/css">
</head>
<body class="PageBODY">
<form action="" method="get" name="frm" style="background-color: white">
<center>
<div style="border: 1px seagreen solid; border-radius: 1px; width: 800px; position: relative;">
<div id='frm_errorloc' class='frm_strings' style="background-color:orange; border: 0px; text-align: center"></div>
<table style="width:100%">
<tr>
<td colspan="4" align="center" style="border: 1px gainsboro outset; background: gainsboro">
<font class="FormHeaderFONT">Búsqueda de Facturación</font>
</td>
</tr>
<tr >
<td class="" align="right">
<font class="ColumnFONT"><b>Número de documento</b></font>
</td><td colspan="3" align="left" class="">
<input type="text" name="n_documento" value="<?php if(isset($n_documento)) echo $n_documento; ?>" id="n_documento" size="10" maxlength="10" tabindex="6" />
</td>
</td>
</tr>
<tr >
<td class="" align="right">
<font class="ColumnFONT"><b>Fecha: </b>desde</font>
</td><td colspan="3" align="left" class="">
<input type="text" name="finicio" value="<?php if(isset($finicio)) echo $finicio; ?>" id="finicio" size="10" maxlength="10" tabindex="6" onBlur="formatofecha(this.id, this.value); date_system_valid(this.id)" onkeyup="mascara(this,'/',patron,true)"/></input>
<input type="button" value="..." id="finicio_btn" tabindex="7" ></input>
<!--<font class="ColumnFONT"><b>hasta</b></font>-->
Hasta <input type="text" name="ffin" value="<?php if(isset($ffin)) echo $ffin; ?>" id="ffin" size="10" maxlength="10" tabindex="8" onBlur="formatofecha(this.id, this.value); date_system_valid(this.id)" onkeyup="mascara(this,'/',patron,true)" /></input>
<input type="button" value="..." id="ffin_btn" tabindex="9" ></input>
</td>
</td>
</tr>
<td colspan="4" align="center" class="">
<br><input type="submit" value="Buscar facturación" tabindex="10" /></td>
</tr>
</table>
</div>
</form>
<?php
if (isset($cambio_estado) && $cambio_estado=='I'){
$model->cambiar_estado_facturacin($id,'I');
}
elseif (isset($cambio_estado) && $cambio_estado=='A'){
$model->cambiar_estado_facturacin($id,'A');
}
if ((isset($finicio) && isset($ffin)) || isset($n_documento)) {
if (isset($finicio)) $finicio = datetosql($finicio);
if (isset($ffin)) $ffin = datetosql($ffin);
$consulta=$model->get_lista_factura($finicio, $ffin, $n_documento);
?>
<br>
<div align="center">
<table class="FormTABLE" style="border: 1px gainsboro solid; border-collapse: collapse;">
<td colspan="9"><a href="factura_ins.php">Agregar facturación</a></td>
<tr><td style="border: 1px black solid; padding: 0px 1px 0px 1px">Corr</td>
<td style="border: 1px black solid">Tipo de documento</td>
<td style="border: 1px black solid;" width="100px">Número Doc.</td>
<td style="border: 1px black solid;" width="100px">Fecha Doc.</td>
<td style="border: 1px black solid; padding: 0px 1px 0px 1px">Cliente</td>
<td style="border: 1px black solid; padding: 0px 1px 0px 1px">Condición pago</td>
<td style="border: 1px black solid; padding: 0px 1px 0px 1px">Estado</td>
<?php
$i=0;
while ($row = $db->fetch_array($consulta)){
$i++;
?>
<tr>
<td align="center" style="background-color: white;border: 1px gainsboro solid; padding: 3px"><font class="ColumnFONT"><?php echo $i; ?></td>
<td style="background-color: white; border: 1px gainsboro solid; font-family: arial; font-size: 15px">
<a href="factura_ins.php?req=3&id_documento=<?=$row['id']; ?>"><? echo $row['tipo_documento']; ?></a></td>
<td style="background-color: white;border: 1px gainsboro solid;"><font class="ColumnFONT"><? echo $row['n_documento']; ?></td>
<td style="background-color: white;border: 1px gainsboro solid;font-weight: normal;"><font class="ColumnFONT"><? echo $row['fecha_documento']; ?></td>
<td style="background-color: white;border: 1px gainsboro solid;font-size: 10px;"><? echo htmlentities($row['id_cliente']); ?></td>
<td style="background-color: white;border: 1px gainsboro solid;font-weight: normal;"><font class="ColumnFONT"><? echo htmlentities($row['condicion_pago']); ?></td>
<td style="background-color: white;border: 1px gainsboro solid;font-weight: normal;"><font class="ColumnFONT">
<?php
if ($row['estado']=='A') { ?>
<a href="busqueda_factura.php?cambio_estado=I&id=<?php echo $row['id']; ?>"><?php echo $row['estado']; ?></a>
<?php
}
else {
?>
<a href="busqueda_factura.php?cambio_estado=A&id=<?php echo $row['id']; ?>"><?php echo $row['estado']; ?></a>
<?php
}
?>
</td>
<?php
}
?>
</tr>
</table>
</div>
<?php } ?>
</body>
<script language="Javascript">
Calendar.setup({
inputField : "finicio",
trigger : "finicio_btn",
onSelect : function() { this.hide() },
showTime : 12,
weekNumbers: true,
//dateFormat : "%Y-%m-%d %I:%M %p"
dateFormat : "%d/%m/%Y",
align : ""
});
Calendar.setup({
inputField : "ffin",
trigger : "ffin_btn",
onSelect : function() { this.hide() },
showTime : 12,
weekNumbers: true,
//dateFormat : "%Y-%m-%d %I:%M %p"
dateFormat : "%d/%m/%Y",
align : ""
});
function popup(URL) {
myWindow = window.open(URL, '" + "', 'scrollbars=yes, width=600, height=600, top = 50');
}
var frmvalidator = new Validator("frm");
frmvalidator.EnableOnPageErrorDisplaySingleBox();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("finicio", "required", "Ingrese fecha desde");
frmvalidator.addValidation("ffin", "required", "Ingrese fecha de fin");
</script>
</html>