<html>
<head>
<title>Receta {{ recetum.paciente.apellido1 }} {{ recetum.paciente.nombre1 }}</title>
<link rel="shortcut icon" href="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/favicon.png') }}">
<style>
/** Set the margins of the page to 0, so the footer and the header can be of the full height and width **/
@page {
margin: 10px 10px;
}
/** Define now the real margins of every page in the PDF **/
body{
margin-top: 100px; /* tu header fijo ya lo controla */
margin-left: 15px;
margin-right: 10px;
/* RESERVA abajo: 30% dx + 10% footer */
margin-bottom: 9cm; /* 8.3 + 3.0 aprox */
font-size: 12px;
}
/** Define the header rules **/
/* header {
position: fixed;
top: 0cm;
left: 0.2cm;
right: 0cm;
height: 8cm;
}*/
header{
position: fixed;
top: 0cm;
left: 0.2cm;
right: 0cm;
height: 8cm;
z-index: 10;
}
/* evita espacio entre inline-block */
.hdr-wrap{
font-size: 0;
}
/* 2 columnas estables (sin float, sin table) */
.hdr-col{
display: inline-block;
width: 49.8%;
vertical-align: top;
position: relative; /* CLAVE: referencia del absolute */
font-size: 12px; /* devuelve tamaño normal */
}
.hdr-img{
width: 100%;
height: auto;
display: block;
image-rendering: -webkit-optimize-contrast;
}
.hdr-overlay{
position: absolute;
top: 1mm;
font-size: 12px;
line-height: 1.1;
z-index: 999;
color: #0F402D;
/* --- CAMBIOS --- */
width: auto; /* no lo limites */
max-width: 95mm; /* ancho suficiente dentro de cada mitad */
white-space: nowrap; /* una sola línea */
overflow: visible; /* NO recortes */
text-overflow: unset; /* NO ... */
font-family: Inter, Roboto, "Open Sans", Arial, sans-serif;
}
/* en la izquierda, texto pegado al lado interno (hacia el centro) */
.hdr-left .hdr-overlay{
left: 65mm; /* ajusta hacia el centro */
text-align: left;
}
/* en la derecha, texto pegado al lado interno (hacia el centro) */
/* DERECHA: alejar del logo (mover hacia el centro de la página) */
.hdr-right .hdr-overlay{
right:-5mm; /* antes 6mm -> súbelo (18-30mm según tu cabecera) */
text-align: left;
}
/** Define the footer rules **/
/* 10% final */
footer{
position: fixed;
left: 0.2cm;
right: 0;
bottom: 0;
height: 1.0cm; /* ~10% */
}
/* 30% arriba del footer */
.footer2{
position: fixed;
left: 0.2cm;
right: 0;
bottom: 1.0cm; /* pegado encima del footer */
height: 8.0cm; /* ~30% */
overflow: hidden; /* evita que invada el cuerpo */
}
/** Define the main content rules **/
main{
position: relative;
z-index: 1;
padding-top: 15px; /* ajusta 6–15px */
}
/** Background images on left and right **/
.background-left {
position: fixed;
top: 100px;
left: 0;
width: 50%;
height: 90%;
background-image: url("{{ app.request.getSchemeAndHttpHost() ~ asset('assets/images/nmed_fondo.png') }}");
background-size: contain;
background-repeat: no-repeat;
background-position: left top;
z-index: 0;
opacity: 0.1; /* Ajusta la opacidad según sea necesario */
}
.background-right {
position: fixed;
top: 100px;
right: 0;
width: 50%;
height: 90%;
background-image: url("{{ app.request.getSchemeAndHttpHost() ~ asset('assets/images/nmed_fondo.png') }}");
background-size: contain;
background-repeat: no-repeat;
background-position: right top;
z-index: 0;
opacity: 0.1; /* Ajusta la opacidad según sea necesario */
}
</style>
</head>
<body>
<div class="background-left"></div>
<div class="background-right"></div>
<!-- Define header and footer blocks before your content -->
{% set unidad = recetum.historia.agenda.sala.unidad %}
<!--header>
<div style="text-align: left; width: 49%; float: left;">
<img src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}" style="width:100%;height:auto;image-rendering: -webkit-optimize-contrast;">
</div>
<div style="text-align: left; width: 49%; float: left;">
<img src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}" style="width:100%;height:auto;image-rendering: -webkit-optimize-contrast;">
</div>
</header-->
<header>
<div class="hdr-wrap">
<div class="hdr-col hdr-left">
<img class="hdr-img"
src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}">
<div class="hdr-overlay">
<b>{{ empresa.telefono ?? '' }} {{ empresa.correo2 ?? '' }}
<br><br>
<span style="font-size:11px">{{ empresa.direccion ?? '' }}</span></b>
</div>
</div>
<div class="hdr-col hdr-right">
<img class="hdr-img"
src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}">
<div class="hdr-overlay">
<b>{{ empresa.telefono ?? '' }} {{ empresa.correo2 ?? '' }}
<br><br>
<span style="font-size:11px">{{ empresa.direccion ?? '' }}</span></b>
</div>
</div>
</div>
</header>
<div class="footer2">
<div style="width: 50%; float: left; text-align: left; font-size: 14px;">
<b>Diagnósticos:</b><br>
{% for dx in dxs %}
{{ dx.cie10.codigo }} {{ dx.cie10.nombre }}<br>
{% endfor %}
<br>
{# AGRUPAR POR TIPO #}
{% for tipo, rows in agrupado %}
<div style="border:1px solid #d1d5db;border-radius:10px;overflow:hidden;font-family:Arial,Helvetica,sans-serif;font-size:13px;">
<div style="background:#e5e7eb;padding:1px 10px;font-weight:700;">
{{ tipo }}
</div>
<table style="border-collapse:collapse;">
<thead>
<tr style="background:#f9fafb;">
<th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;width:70px;">Cant</th>
<th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;">Procedimiento</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;font-weight:700;">{{ row.cant }}</td>
<td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;">{{ row.nombre }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
<br>
</div>
<div style="width: 50%; float: right; text-align: left; font-size: 14px;">
<b>Diagnósticos:</b><br>
{% for dx in dxs %}
{{ dx.cie10.codigo }} {{ dx.cie10.nombre }}<br>
{% endfor %}
{# AGRUPAR POR TIPO #}
<br>
{% for tipo, rows in agrupado %}
<div style="border:1px solid #d1d5db;border-radius:10px;overflow:hidden;font-family:Arial,Helvetica,sans-serif;font-size:13px;">
<div style="background:#e5e7eb;padding:1px 10px;font-weight:700;">
{{ tipo }}
</div>
<table style="border-collapse:collapse;">
<thead>
<tr style="background:#f9fafb;">
<th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;width:70px;">Cant</th>
<th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;">Procedimiento</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;font-weight:700;">{{ row.cant }}</td>
<td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;">{{ row.nombre }}: {{ row.obs }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
<br>
</div>
<div style="clear: both;"></div>
</div>
<footer>
<div style="text-align: left; width: 50%; float: left; font-size: 12px;" class="ftr">
<b>Firma y Sello:</b>
</div>
<div style="text-align: left; width: 50%; float: right; font-size: 12px;" class="ftr">
<b>Próxima Cita</b>
</div>
<div style="clear: both;"></div>
</footer>
<!-- Wrap the content of your PDF inside a main tag -->
<main>
<div style="clear: both;"></div>
{% set ames = {'01': 'ENERO', '02': 'FEBRERO', '03': 'MARZO', '04': 'ABRIL', '05': 'MAYO', '06': 'JUNIO', '07': 'JULIO', '08': 'AGOSTO', '09': 'SEPTIEMBRE', '10': 'OCTUBRE', '11': 'NOVIEMBRE', '12': 'DICIEMBRE'} %}
{% set tmes = ames[recetum.fecha|date("m")] %}
<div style="width: 50%; float: left; text-align: left;font-size: 16px;">
<!--b>Fecha:</b> {{ recetum.historia.agenda.inicio|date('d') }}/{{ tmes }}/{{ recetum.historia.agenda.inicio|date('Y') }}<br-->
<b>Fecha:</b> {{ recetum.fecha|date('d') }}/{{ tmes }}/{{ recetum.fecha|date('Y') }} <b>Receta No:</b>{{ recetum.id }}<br>
<b>Paciente:</b> {{ recetum.paciente.cedula }} - {{ recetum.paciente.apellido1 }} {{ recetum.paciente.apellido2 }} {{ recetum.paciente.nombre1 }} {{ recetum.paciente.nombre2 }}<br>
<!--b>Alergias: </b> {{recetum.paciente.alergias}}<br-->
{% set preparacion = recetum.historia.agenda.preparacion %}
{% if(preparacion != null) %}
<!--b>Peso: </b> {{preparacion.peso}} Kg <b>Talla: </b> {{preparacion.estatura}} cm<br-->
{% endif %}
</div>
<div style="width: 50%; float: left; text-align: left;font-size: 16px;">
<b>Indicaciones:</b>
</div>
<div style="clear: both;"></div>
<br>
<div style="width: 48%; float: left; text-align: left; font-size: 16px;">
{% set cont = 0 %}
{% for detalle in recetum.recetaDetalles %}
{% set cont = cont + 1 %}
<div style="text-align: left; font-size: 16px;">
{{ cont }} {{ detalle.nombre }}
</div>
<div style="text-align: left; font-size: 16px;">
Cantidad: {{ detalle.cantidad }}
</div>
{% endfor %}
</div>
<br>
<div style="width: 48%; float: right; text-align: left;">
{% set cont = 0 %}
{% for detalle in recetum.recetaDetalles %}
{% set cont = cont + 1 %}
<div style="text-align: left; font-size: 16px;">
{{ cont }} {{ detalle.nombre }}
</div>
<div style="text-align: left; font-size: 16px;">
Indicacion: {{ detalle.indicacion }}
</div>
{% endfor %}
</div>
<div style="clear: both;"></div>
<div style="width: 48%; float: left; text-align: left;font-size:14px;">
{{ recetum.rp | raw }}
</div>
<div style="width: 48%; float: right; text-align: left;font-size:14px;">
{{ recetum.prescripcion | raw }}
</div>
<div style="clear: both;"></div>
</main>
</body>
</html>