mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Inciado link presupuesto PDF con backend
This commit is contained in:
@ -13,13 +13,18 @@ class PrintPresupuestos extends BaseController
|
||||
public function index()
|
||||
{
|
||||
|
||||
//return view('pdf_view');
|
||||
return view(getenv('theme.path').'pdfs/presupuesto');
|
||||
$presupuestoModel = model('App\Models\Presupuestos\PresupuestoModel');
|
||||
|
||||
$data['presupuesto'] = $presupuestoModel->getResourceForPdf(8)->get()->getRow();
|
||||
|
||||
|
||||
return view(getenv('theme.path').'pdfs/presupuesto', $data);
|
||||
}
|
||||
public function generar(){
|
||||
$dompdf = new \Dompdf\Dompdf(['isRemoteEnabled' => true]);
|
||||
//$dompdf->loadHtml(view('pdf_view'));
|
||||
$dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto'));
|
||||
//$dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto'));
|
||||
$dompdf->loadHtml($this->index());
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
$dompdf->stream('presupuesto-demo.pdf');
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
@ -258,7 +259,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
],
|
||||
"inc_rei" => [
|
||||
"integer" => "Presupuestos.validation.integer",
|
||||
|
||||
|
||||
],
|
||||
"coleccion" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
@ -277,8 +278,9 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
],
|
||||
"referencia_cliente" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
@ -324,14 +326,14 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
if(empty($search))
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else{
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach($search as $col_search){
|
||||
if($col_search[0] != 1)
|
||||
foreach ($search as $col_search) {
|
||||
if ($col_search[0] != 1)
|
||||
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
else{
|
||||
else {
|
||||
$dates = explode(" ", $col_search[2]);
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . ">=", $dates[0]);
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . "<=", $dates[1]);
|
||||
@ -340,6 +342,41 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResourceForPdf($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.created_at AS fecha, t1.titulo AS titulo, t1.autor AS autor, t1.ferro AS ferro,
|
||||
t1.ferro_digital AS ferro_digital, t1.prototipo AS prototipo, t1.solapas AS solapas,
|
||||
t1.solapas_ancho AS solapas_ancho, t1.paginas AS paginas, t1.tirada AS tirada, t1.coleccion AS coleccion,
|
||||
t1.total_presupuesto AS total_presupuesto, t1.total_precio_unidad AS total_precio_unidad,
|
||||
t2.nombre AS cliente,
|
||||
CONCAT(t3.first_name, ' ', t3.last_name) AS comercial, t3.email AS email_comercial,
|
||||
t1.inc_rei AS inc_rei,
|
||||
t6.estado AS estado"
|
||||
);
|
||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
|
||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.id", $presupuesto_id);
|
||||
|
||||
return $builder;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -37,34 +37,34 @@
|
||||
PRESUPUESTO Nº:
|
||||
</th>
|
||||
<th class="num_presupuesto">
|
||||
<?= "obj->id" ?>
|
||||
<?= $presupuesto->id ?>
|
||||
</th>
|
||||
<th class="intro_cliente">
|
||||
CLIENTE:
|
||||
</th>
|
||||
<th class="cliente letra">
|
||||
<?= "obj->customer->name" ?>
|
||||
<?= $presupuesto->cliente ?>
|
||||
</th>
|
||||
<th class="intro_fecha">
|
||||
FECHA:
|
||||
</th>
|
||||
<th class="fecha">
|
||||
<?= date("d/m/Y") ?>
|
||||
<?= $presupuesto->fecha ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="6" class="titulo">
|
||||
<span style="font-weight: bold">Título:</span> <?= "obj->titulo" ?>
|
||||
<span style="font-weight: bold">Título:</span> <?= $presupuesto->titulo ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="coleccion">
|
||||
<span style="font-weight: bold">Colección:</span> <?= "obj->coleccion" ?>
|
||||
<span style="font-weight: bold">Colección:</span> <?= $presupuesto->coleccion ?>
|
||||
</td>
|
||||
<td colspan="3" class="autor">
|
||||
<span style="font-weight: bold">Autor:</span> <?= "obj->autor" ?>
|
||||
<span style="font-weight: bold">Autor:</span> <?= $presupuesto->autor ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -83,11 +83,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="t">Ferro</td>
|
||||
<td class="v">TBD</td>
|
||||
<td class="v"><?php echo (($presupuesto->ferro == 1) ? "SI" : "NO"); ?></td>
|
||||
<td class="t-first">Prototipo</td>
|
||||
<td class="v-first">SI</td>
|
||||
<td class="v-first"><?php echo (($presupuesto->prototipo == 1) ? "SI" : "NO"); ?></td>
|
||||
<td class="t-second">Ferro Digital</td>
|
||||
<td class="v-second">SI</td>
|
||||
<td class="v-second"><?php echo (($presupuesto->ferro_digital == 1) ? "SI" : "NO"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="t">Formato</td>
|
||||
@ -97,7 +97,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="t">Nº de páginas totales</td>
|
||||
<td class="v" colspan="5"><?= "obj->paginas" ?></td>
|
||||
<td class="v" colspan="5"><?= $presupuesto->paginas ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="t">Nº de páginas ByN</td>
|
||||
@ -169,9 +169,9 @@
|
||||
<td class="t">Tipo</td>
|
||||
<td class="v"><?= "encuardernado" ?></td>
|
||||
<td class="t-first">Solapas</td>
|
||||
<td class="v-first"><?= "solapas_portada" ?></td>
|
||||
<td class="v-first"><?php echo (($presupuesto->solapas == 1) ? "SI" : "NO"); ?></td>
|
||||
<td class="t-second">Ancho</td>
|
||||
<td class="v-second">TBD cm</td>
|
||||
<td class="v-second"><?= $presupuesto->solapas_ancho ?> cm</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -252,7 +252,7 @@
|
||||
<tr>
|
||||
<td class="hidden"></td>
|
||||
<td class="hidden"></td>
|
||||
<td class="tirada">TBD uds.</td>
|
||||
<td class="tirada"><?= $presupuesto->tirada ?> uds.</td>
|
||||
<td class="precio">TBD €</td>
|
||||
<td class="precio">TBD €</td>
|
||||
<td class="precio">TBD €</td>
|
||||
@ -277,8 +277,7 @@
|
||||
comercial el día que se oficialice el pedido, dado que pueda darse la situación de que no haya stock
|
||||
disponible o que su precio haya variado considerablemente, para así poder ofrecerle alternativas.</p>
|
||||
<p class="texto-email">Esperando que los precios se ajusten a sus necesidades,<br/>
|
||||
<?= "obj->customer->salesman->name" ?> <?= "obj->customer->salesman->lastname" ?> •
|
||||
email: <?= "obj->customer->salesman->email" ?></p>
|
||||
<?= $presupuesto->comercial ?> • email: <?= $presupuesto->email_comercial ?></p>
|
||||
<p class="texto-asteriscos">(*) En el formato de desarrollo de cubierta están contemplados los 3 mm. de vuelta
|
||||
de solapas en caso de llevarlas.<br/>
|
||||
(**) Estos precios están sujetos a análisis de cobertura de tinta del archivo PDF de interior.</p>
|
||||
|
||||
Reference in New Issue
Block a user