-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf_presupuesto.php
205 lines (195 loc) · 6.47 KB
/
pdf_presupuesto.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
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
<?php session_start();
setlocale(LC_ALL,"");
setlocale(LC_ALL,"es_MX");
include_once("datos.php");
require_once('../clases/html2pdf.class.php');
include_once("func_form.php");
$emp=$_SESSION["id_empresa"];
//funciones para convertir px->mm
function mmtopx($d){
$fc=96/25.4;
$n=$d*$fc;
return $n."px";
}
function pxtomm($d){
$fc=96/25.4;
$n=$d/$fc;
return $n."mm";
}
function checkmark(){
$url="http://".$_SERVER["HTTP_HOST"]."/img/checkmark.png";
$s='<img src="'.$url.'" style="height:10px;" />';
return $s;
}
function folio($digitos,$folio){
$usado=strlen($folio);
$salida="";
for($i=0;$i<($digitos-$usado);$i++){
$salida.="0";
}
$salida.=$folio;
return $salida;
}
//tamaño carta alto:279.4 ancho:215.9
$heightCarta=960;
$widthCarta=660;
$celdas=12;
$widthCell=$widthCarta/$celdas;
$mmCartaH=pxtomm($heightCarta);
$mmCartaW=pxtomm($widthCarta);
ob_start();
$error="";
if(isset($_GET["id_evento"])){
$eve=$_GET["id_evento"];
try{
$bd=new PDO($dsnw,$userw,$passw,$optPDO);
// para saber los datos del presupuesto
$sql="SELECT
t1.id_evento,
t1.fecha_solicitud,
t1.folio,
t1.paq_basico,
t2.salon,
t2.no_personas
FROM presupuesto t1
LEFT JOIN eventos t2 ON t1.id_evento=t2.id_evento
WHERE t1.id_evento=$eve;";
$res=$bd->query($sql);
$res1=$res->fetchAll(PDO::FETCH_ASSOC);
$evento=$res1[0];
$idPresupuesto=$evento["id_presupuesto"];
$fechaSoli=$evento["fecha_solicitud"];
$Folio=$evento["folio"];
$paqBasico=$evento["paq_basico"];
$NoPersonas = $evento["no_personas"];
$salon = $evento["salon"];
}catch(PDOException $err){
echo $err->getMessage();
}
$bd=NULL;
}
?>
<?php if($error==""){ $html='
<page backbottom="15px">
<page_footer>
<table border="0" cellpadding="0" cellspacing="0" style="font-size:13px; width:100%; margin-top:30px; padding:0 20px;">
<tr>
<td style="width:100%;vertical-align:top; text-align:center; border-top:'.pxtomm(2).' solid #484848;">
<p style="width:100%; text-align:center; margin:5px auto; font-size:10px; color:#484848">Eulogio Parra 2714 Providencia. ID Nextel 52*168895*1/52*148605*1 Tel / fax 3642-0913/ 04
<br/>
www.bichos.net
</p>
</td>
</tr>
</table>
</page_footer>
<style>
span{
display:inline-block;
padding:10px;
}
h1{
font-size:20px;
}
.spacer{
display:inline-block;
height:1px;
}
@font-face {
font-family: "NombreFont";
src:url(../css/Century_Gothic.ttf) format("truetype");
}
.div{
color: #000;
font-family: "NombreFont";
font-size:12px;
}
</style>
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="width:20%; text-align:left;">
<div style="width:80%; background-color:#E1E1E1; font-weight:bold; text-align:center; padding-top:5px; padding-bottom:5px; font-size:12px;">No. de Contrato:</div>
<div style="width:90%; font-size:12px; color:#C00; text-align:center;">'. folio(4,$Folio).'</div>
</td>
<td valign="top" style="width:60%; text-align:center; font-size:10px;">
<img src="../img/logo.png" style="width:50%;" />
</td>
<td valign="top" style="width:20%; text-align:left;"></td>
</tr>
</table>
<br/>
<table style="width:100%; font-size:10px" cellpadding="0" cellspacing="0" border="0.2" >
<tr>
<td valign="top" style="width:30%; text-align:left;">NOMBRE FESTEJADO:</td>
<td valign="top" style="width:70%; text-align:left;"></td>
</tr>
<tr>
<td valign="top" style="width:30%; ">PAQUETE BASICO:</td>
<td valign="top" style="width:70%; "></td>
</tr>
<tr>
<td valign="top" style="width:30%; text-align:left;">NIÑOS:</td>
<td valign="top" style="width:70%; text-align:left;"></td>
</tr>
<tr>
<td valign="top" style="width:30%; text-align:left;">FECHA:</td>
<td valign="top" style="width:70%; text-align:left;">'.$fechaSoli.'</td>
</tr>
<tr>
<td valign="top" style="width:30%; text-align:left;">REV.</td>
<td valign="top" style="width:70%; text-align:left;"></td>
</tr>
</table>
<br/>
<table align="center" border="0.3" cellspacing="0" cellpadding="0" style="width:100%;font-size:10px;margin-top:5px; padding:5 30px; text-align:center">
<tr align="center">
<td style="width:10%;"><strong>CANTIDAD</strong></td>
<td style="width:30%;"><strong>ARTICULO</strong></td>
<td style="width:10%;"><strong>P.UNITARIO</strong></td>
<td style="width:15%;"><strong>TOTAL</strong></td>
</tr>';
$total=0;
foreach($articulos as $id=>$d){
$total+=$d["total"];
$html.='
<tr>
<td style="width:15%;">'.$d["nombre"].'</td>
<td style="width:10%;">'.$d["cantidad"].'</td>
<td style="width:40%;text-align:center;">'. number_format($d["precio"],2).'</td>
<td style="width:10%;text-align:right;">'. number_format($d["total"],2).'</td>
</tr>';
}
$html.= '
<tr>
<td style="width:15%;text-align:center;"></td>
<td style="width:10%;"></td>
<td style="width:40%;text-align:right;">
<strong>Total:</strong>
</td>
<td style="width:10%;text-align:right;">
<strong>'.number_format($total,2).'</strong>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="font-size:13px; width:100%; margin-top:30px; padding:0 20px;">
<tr>
<td style="width:100%;vertical-align:top; text-align:center;">
Atentamente
<br />______________________
<br />'.$_SESSION["usuario"].'
</td>
</tr>
</table>
</page>';
}
else
{
echo $error;
}
$path='../docs/';
$filename="generador.pdf";
$orientar="portrait";
$topdf=new HTML2PDF($orientar,array($mmCartaW,$mmCartaH),'es');
$topdf->writeHTML($html);
$topdf->Output();
?>