-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportePedidosSegunProveedor_pdf.php
More file actions
228 lines (199 loc) · 8.12 KB
/
Copy pathReportePedidosSegunProveedor_pdf.php
File metadata and controls
228 lines (199 loc) · 8.12 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
<?php
session_start();
require_once 'funciones/corroborar_usuario.php';
Corroborar_Usuario();
ob_start();
require_once "conn/conexion.php";
$conexion = ConexionBD();
$idProveedor = $_GET['mensaje'];
// Generación del listado de pedidos a proveedores
require_once 'funciones/CRUD-PedidosProv.php';
$ListadoPedidos = Listar_PedidosProveedoresSegunProveedor($conexion, $idProveedor);
$CantidadPedidos = count($ListadoPedidos);
include('head.php');
?>
<body style="margin: 0; padding: 0; font-family: 'Helvetica', sans-serif; color: #444;">
<style>
/* ESTILO PROFESIONAL ROCKET V2 - FILTRADO POR PROVEEDOR */
.header-main {
width: 100%;
border-bottom: 3px solid #a80a0a;
padding-bottom: 10px;
margin-bottom: 20px;
}
.logo-img { width: 150px; }
.report-title {
text-align: right;
vertical-align: bottom;
}
.report-title h1 {
color: #a80a0a;
margin: 0;
font-size: 20pt;
text-transform: uppercase;
}
.pedido-container {
margin-bottom: 30px;
border: 1px solid #eee;
border-radius: 5px;
overflow: hidden;
page-break-inside: avoid; /* Evita que un pedido se corte entre dos páginas */
}
.pedido-header {
background-color: #fcfcfc;
padding: 10px;
border-bottom: 1px solid #eee;
}
.pedido-id {
color: #a80a0a;
font-size: 13pt;
font-weight: bold;
}
.table-info {
width: 100%;
margin: 10px;
font-size: 9pt;
}
.table-info td { padding: 4px; }
.label { color: #888; text-transform: uppercase; font-size: 7pt; font-weight: bold; }
.table-items {
width: 100%;
border-collapse: collapse;
}
.table-items th {
background-color: #f4f4f4;
color: #555;
font-size: 8pt;
text-align: left;
padding: 8px;
border-bottom: 1px solid #ddd;
}
.table-items td {
padding: 8px;
font-size: 8.5pt;
border-bottom: 1px solid #f0f0f0;
}
.row-item:nth-child(even) { background-color: #fafafa; }
.total-box {
background-color: #a80a0a;
color: white;
padding: 10px;
text-align: right;
font-size: 11pt;
font-weight: bold;
}
.pdf-footer {
position: fixed;
bottom: -10px;
width: 100%;
text-align: center;
font-size: 7pt;
color: #aaa;
border-top: 1px solid #eee;
padding-top: 5px;
}
</style>
<table class="header-main">
<tr>
<td><img src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/rocket/assets/img/logo-red.png" class="logo-img"></td>
<td class="report-title">
<h1>Reporte por Proveedor</h1>
<span style="font-size: 9pt;">Historial Detallado de Pedidos</span>
</td>
</tr>
</table>
<p style="font-size: 8pt; color: #666; margin-bottom: 20px;">
<strong>Proveedor ID:</strong> <?php echo $idProveedor; ?> |
<strong>Emisión:</strong> <?php echo date("d/m/Y H:i"); ?> |
<strong>Total Pedidos Encontrados:</strong> <?php echo $CantidadPedidos; ?>
</p>
<?php
$contador = 1;
foreach ($ListadoPedidos as $ppIdPedido => $Pedido) { ?>
<div class="pedido-container">
<div class="pedido-header">
<table style="width: 100%;">
<tr>
<td class="pedido-id">ORDEN DE COMPRA #<?php echo $Pedido['ppIdPedido']; ?></td>
<td style="text-align: right; font-size: 8pt; color: #888;">Registro N° <?php echo $contador; ?></td>
</tr>
</table>
</div>
<table class="table-info">
<tr>
<td width="35%">
<span class="label">Datos del Proveedor</span><br>
<strong><?php echo $Pedido['NombreProveedor']; ?></strong><br>
<small>CUIT: <?php echo $Pedido['CuitProveedor']; ?></small><br>
<small><?php echo $Pedido['MailProveedor']; ?></small>
</td>
<td width="30%">
<span class="label">Cronología</span><br>
Emisión: <?php echo $Pedido['FechaPedido']; ?><br>
Entrega: <?php echo $Pedido['FechaEntrega']; ?>
</td>
<td width="35%">
<span class="label">Estado y Logística</span><br>
<strong><?php echo strtoupper($Pedido['EstadoPedido']); ?></strong><br>
<small><?php echo $Pedido['CondicionesDeEntrega']; ?></small>
</td>
</tr>
</table>
<table class="table-items">
<thead>
<tr>
<th width="15%">TIPO</th>
<th width="45%">ARTÍCULO / DESCRIPCIÓN</th>
<th width="10%" style="text-align: center;">CANT.</th>
<th width="15%" style="text-align: right;">P. UNIT</th>
<th width="15%" style="text-align: right;">SUBTOTAL</th>
</tr>
</thead>
<tbody>
<?php foreach ($Pedido['Detalles'] as $detalleId => $Detalle) { ?>
<tr class="row-item">
<td style="font-size: 7pt; color: #888;"><?php echo $Detalle['TipoInsumo']; ?></td>
<td>
<strong><?php
if ($Detalle['TipoInsumo'] == "Repuesto") echo $Detalle['NombreRepuesto'];
elseif ($Detalle['TipoInsumo'] == "Producto") echo $Detalle['NombreProducto'];
elseif ($Detalle['TipoInsumo'] == "Accesorio") echo $Detalle['NombreAccesorio'];
?></strong><br>
<small style="color: #777;">
<?php
if ($Detalle['TipoInsumo'] == "Repuesto") echo $Detalle['DescripcionRepuesto'];
elseif ($Detalle['TipoInsumo'] == "Producto") echo $Detalle['DescripcionProducto'];
elseif ($Detalle['TipoInsumo'] == "Accesorio") echo $Detalle['DescripcionAccesorio'];
?>
</small>
</td>
<td style="text-align: center;"><?php echo $Detalle['CantidadUnidades']; ?></td>
<td style="text-align: right;"><?php echo $Detalle['PrecioPorUnidad']; ?> USD</td>
<td style="text-align: right; font-weight: bold;"><?php echo $Detalle['Subtotal']; ?> USD</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="total-box">
TOTAL PEDIDO: <?php echo $Pedido['TotalPedido']; ?> USD
</div>
</div>
<?php $contador++; } ?>
<div class="pdf-footer">
© <?php echo date("Y"); ?> Rocket Rent a Car | Reporte de Auditoría de Proveedores | Generado por Rocket Team
</div>
</body>
</html>
<?php
$html = ob_get_clean();
require_once 'administrador/dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$options = $dompdf->getOptions();
$options->set(array('isRemoteEnabled' => true));
$dompdf->setOptions($options);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream("Reporte-Pedidos-Proveedor-".$idProveedor, array("Attachment" => false));
?>