-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathimprimirBoletos.php
More file actions
309 lines (299 loc) · 8.91 KB
/
imprimirBoletos.php
File metadata and controls
309 lines (299 loc) · 8.91 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?php
session_start();
if($_SESSION['lang']){
$lang=$_SESSION['lang'];
switch($lang)
{
case "es":
include("lenguaje/lang-es.php");
$_SESSION['lang']=$lang;
break;
case "en":
include("lenguaje/lang-en.php");
$_SESSION['lang']=$lang;
break;
case "de":
include("lenguaje/lang-de.php");
$_SESSION['lang']=$lang;
break;
case "fr":
include("lenguaje/lang-fr.php");
$_SESSION['lang']=$lang;
break;
default:
include("lenguaje/lang-es.php");
$_SESSION['lang']=$lang;
break;
}
}else
{
include("lenguaje/lang-es.php");
}
include("db.php");
function codigo($codigo){
//para ponerlo en una lugar donde se puedan escribir archivos
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
//html PNG prefijo de localizaci�n
$PNG_WEB_DIR = 'temp/';
include "QRCode/qrlib.php";
//a webo que necesitas tener derechos para escribir y crear
if (!file_exists($PNG_TEMP_DIR))
mkdir($PNG_TEMP_DIR);
//nombre del archivo
$filename = $PNG_TEMP_DIR.'test.png';
$errorCorrectionLevel = 'H';
//Maximo del tama�o en puntos
$matrixPointSize = 4;
//Codigo
if (isset($codigo)) {
//esto es muy importante!
if (trim($codigo) == '')
die('<h1>Error</h1>');
// codigo de los boletos...
$filename = $PNG_WEB_DIR.'QRCode'.md5($codigo.'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
QRcode::png($codigo, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
return $PNG_WEB_DIR.basename($filename);
}
}
?>
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script language="javascript" type="text/javascript" src="js/util.js"></script>
<link rel="stylesheet" type="text/css" href="styles/estilo.css" />
<link rel="shortcut icon" href="images/favicon.ico"/>
<meta http-equiv="Content-Type" content="text/html; iso-8859-7">
<meta name="title" content="Sistema Web Boletaje Autobuses ">
<meta name="ROBOTS" content="INDEX,FOLLOW">
<meta http-equiv="Content-Language" content="es">
<meta name="description" content="sistema para la venta de boletos de una terminal de autobuses">
<meta name="abstract" content="sistema para la venta de boletos de una terminal de autobuses">
<meta name="keywords" content="ticket,bus,sqleros,php,mysql,javascript,autobuses, sistema web, GiS,corridas,boletos, boletaje">
<meta name="author" content="Jos� Ram�n Ib��ez">
<meta name="copyright" content="">
<meta name="rating" content="General">
<meta http-equiv="Reply-to" content="zegnhabi@gmail.com">
<meta name="creation_Date" content="07/09/1942">
<meta name="revisit-after" content="2 days">
<meta name="doc-rights" content="Public">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32712866-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title><?php echo $title5;?></title>
</head>
<body onload="Util.scrlsts();">
<div id="adsenseFooter" align="center"><script type="text/javascript"><!--
google_ad_client = "ca-pub-5193806461374156";
/* autobuses header */
google_ad_slot = "3892902209";
google_ad_width = 728;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div id="Cabecera" align="center">
<img src="images/logo.jpg" alt="Autobuses at-sqleros.herokuapp.com"/>
</div>
<?php
if(isset($_GET['id']) && isset($_GET['as']) && isset($_GET['no']))
{
//Cargamos los valores de los datos.
$id_boleto=base64_decode($_GET['id']);
$asientos=base64_decode($_GET['as']);
$asientos=explode(",",$asientos);
$nombres=base64_decode($_GET['no']);
$nombres=explode(",",$nombres);
$fechaHoy=date("Y-m-d");
?>
<div id="Cuerpo" align="center">
<table id="Notificacion" >
<tr>
<td>
<label><?php echo $SeHanComprado." ".count($asientos)." ".$Boletos;?> <a href="javascript:void(0);" onclick="Util.imprimirBoleto();"> <?php echo $Imprimir;?> </a><a href="javascript:void(0);" onclick="location.href='';"> <?php echo $Inicio;?> </a><a href="mailto:zegnhabi@gmail.com"> <?php echo $contacto;?> </a></label>
</td>
</tr>
</table>
<?php
//Insertamos los datos de los boletos.
for($i=0;$i<count($asientos);$i++)
{
//Creamos la consulta SQL para los datos de la corrida.
$consulta="insert into boletos values (null,$id_boleto,$asientos[$i],'".utf8_decode($nombres[$i])."','$fechaHoy')";
$tabla = mysqli_query($link, $consulta);
}
//Creamos la consulta SQL para los datos de los boletos.
$consulta="SELECT * FROM `boleto` WHERE `id` = $id_boleto";
?>
<div id="boleto">
<?php
for($i=0;$i<count($asientos);$i++)
{
$tabla = mysqli_query($link, $consulta);
$registro = mysqli_fetch_array($tabla);
$codigo=sprintf("Boleto: %s. Origen: %s. Destino: %s. Pasajero: %s. Fecha Salida: %s. Asiento: %s. ",
$id_boleto,
$registro['ciudad_salida'],
$registro['ciudad_llegada'],
utf8_decode($nombres[$i]),
$registro['fecha_salida'],
$asientos[$i]);
$imagen=codigo($codigo);
?>
<table id="<?php echo "cuerpoBoleto$i";?>" style="border:1px dotted;">
<tr align="center">
<td colspan="2">
<tt><?php echo $marca="Autobuses at-sqleros.herokuapp.com S.A. de C.V";?></tt>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $xorigen;?>:</tt>
</td>
<td>
<tt><?php echo $Terminaldesalida;?></tt>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $registro['ciudad_salida'];?></tt>
</td>
<td>
<tt><?php echo $registro['nombre_terminal_salida'];?></tt><br/><br/>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $xdestino;?>:</tt>
</td>
<td>
<tt><?php echo $Terminaldellegada;?></tt>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $registro['ciudad_llegada'];?></tt>
</td>
<td>
<tt><?php echo $registro['nombre_terminal_llegada'];?></tt><br/><br/>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $Fechadesalida;?></tt>
</td>
<td>
<tt><?php echo $Asiento;?></tt>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $registro['fecha_salida'];?></tt>
</td>
<td>
<tt><?php echo $asientos[$i];?></tt><br/><br/>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $Horadesalida;?></tt>
</td>
<td>
<tt><?php echo $Precio;?></tt>
</td>
</tr>
<tr align="left">
<td>
<tt><?php echo $registro['hora_salida'];?></tt>
</td>
<td>
<tt><?php echo "$".$registro['precio'];?></tt><br/><br/>
</td>
</tr>
<tr align="left">
<td colspan="2">
<tt><?php echo $Nombre;?></tt>
</td>
</tr>
<tr align="left">
<td colspan="2">
<tt><?php echo utf8_decode($nombres[$i]); ?></tt><br/><br/>
</td>
</tr>
<tr align="left">
<td colspan="2">
<tt><?php echo $LugaryfechadeEx;?></tt>
</td>
</tr>
<tr align="left">
<td colspan="2">
<tt><?php echo $registro['ciudad_salida']." a ".$fechaHoy; ?></tt><br/><br/>
</td>
</tr>
<tr align="center">
<td colspan="2">
<tt><?php echo $sugerencia;?></tt><br/><br/>
</td>
</tr>
<tr align="center">
<td colspan="2">
<img src="<?php echo $imagen;?>" height="50%" width="50%"/>
</td>
</tr>
</table>
<?php
}
?>
</div>
</div>
<br />
<i class="copy">® 2009 - <?php echo date('Y'); ?> <a href="https://at-sqleros.herokuapp.com">at-sqleros.herokuapp.com</a> <a href="mailto:zegnhabi@gmail.com?subject=Comentarios y sugerencias sistema de boletaje"> <?php $contacto;?> </a></i>
<div id="adsenseHeader" align="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5193806461374156";
/* Autobuses */
google_ad_slot = "4436487963";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</body>
</html>
<?php
}else{
?>
<div class="error">
<?php echo $excepcion;?>
</div><br />
<i class="copy">® 2009 - <?php echo date('Y'); ?> <a href="https://at-sqleros.herokuapp.com/">at-sqleros.herokuapp.com</a> <a href="mailto:zegnhabi@gmail.com?subject=Comentarios y sugerencias sistema de boletaje"> <?php $contacto;?> </a></i>
<div id="adsenseHeader" align="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5193806461374156";
/* Autobuses */
google_ad_slot = "4436487963";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</body>
</html>
<?php
}
?>