templates/receta/receta_pdf_new_version.html.twig line 1

Open in your IDE?
  1. <html>
  2.     <head>
  3.         <title>Receta {{ recetum.paciente.apellido1 }} {{ recetum.paciente.nombre1 }}</title>
  4.         <link rel="shortcut icon" href="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/favicon.png') }}">
  5.         <style>
  6.             /** Set the margins of the page to 0, so the footer and the header can be of the full height and width **/
  7.             @page {
  8.                 margin: 10px 10px;
  9.             }
  10.             /** Define now the real margins of every page in the PDF **/
  11.             
  12.             body{
  13.             margin-top: 100px;     /* tu header fijo ya lo controla */
  14.             margin-left: 15px;
  15.             margin-right: 10px;
  16.             /* RESERVA abajo: 30% dx + 10% footer */
  17.             margin-bottom: 9cm; /* 8.3 + 3.0 aprox */
  18.             font-size: 12px;
  19.             }
  20.             /** Define the header rules **/
  21.            /* header {
  22.                 position: fixed;
  23.                 top: 0cm;
  24.                 left: 0.2cm;
  25.                 right: 0cm;
  26.                 height: 8cm;
  27.             }*/
  28.             header{
  29.                 position: fixed;
  30.                 top: 0cm;
  31.                 left: 0.2cm;
  32.                 right: 0cm;
  33.                 height: 8cm;
  34.                 z-index: 10;
  35.             }
  36.             /* evita espacio entre inline-block */
  37.             .hdr-wrap{
  38.                 font-size: 0;
  39.             }
  40.             /* 2 columnas estables (sin float, sin table) */
  41.             .hdr-col{
  42.                 display: inline-block;
  43.                 width: 49.8%;
  44.                 vertical-align: top;
  45.                 position: relative; /* CLAVE: referencia del absolute */
  46.                 font-size: 12px;    /* devuelve tamaño normal */
  47.             }
  48.             .hdr-img{
  49.                 width: 100%;
  50.                 height: auto;
  51.                 display: block;
  52.                 image-rendering: -webkit-optimize-contrast;
  53.             }
  54.             .hdr-overlay{
  55.                 position: absolute;
  56.                 top: 1mm;
  57.                 font-size: 12px;
  58.                 line-height: 1.1;
  59.                 z-index: 999;
  60.                 color: #0F402D;
  61.                 /* --- CAMBIOS --- */
  62.                 width: auto;           /* no lo limites */
  63.                 max-width: 95mm;       /* ancho suficiente dentro de cada mitad */
  64.                 white-space: nowrap;   /* una sola línea */
  65.                 overflow: visible;     /* NO recortes */
  66.                 text-overflow: unset;  /* NO ... */
  67.                 font-family: Inter, Roboto, "Open Sans", Arial, sans-serif;
  68.             }
  69.             /* en la izquierda, texto pegado al lado interno (hacia el centro) */
  70.             .hdr-left .hdr-overlay{
  71.                 left: 65mm;         /* ajusta hacia el centro */
  72.                 text-align: left;
  73.             }
  74.             /* en la derecha, texto pegado al lado interno (hacia el centro) */
  75.             /* DERECHA: alejar del logo (mover hacia el centro de la página) */
  76.             .hdr-right .hdr-overlay{
  77.                 right:-5mm;      /* antes 6mm -> súbelo (18-30mm según tu cabecera) */
  78.                 text-align: left;
  79.             }
  80.           
  81.             /** Define the footer rules **/
  82.             /* 10% final */
  83.             footer{
  84.             position: fixed;
  85.             left: 0.2cm;
  86.             right: 0;
  87.             bottom: 0;
  88.             height: 1.0cm;         /* ~10% */
  89.             }
  90.             /* 30% arriba del footer */
  91.             .footer2{
  92.             position: fixed;
  93.             left: 0.2cm;
  94.             right: 0;
  95.             bottom: 1.0cm;         /* pegado encima del footer */
  96.             height: 8.0cm;         /* ~30% */
  97.             overflow: hidden;      /* evita que invada el cuerpo */
  98.             }
  99.             /** Define the main content rules **/
  100.             main{
  101.   position: relative;
  102.   z-index: 1;
  103.   padding-top: 15px;   /* ajusta 6–15px */
  104. }
  105.             /** Background images on left and right **/
  106.             .background-left {
  107.                 position: fixed;
  108.                 top: 100px;
  109.                 left: 0;
  110.                 width: 50%;
  111.                 height: 90%;
  112.                 background-image: url("{{ app.request.getSchemeAndHttpHost() ~ asset('assets/images/nmed_fondo.png') }}"); 
  113.                 background-size: contain;
  114.                 background-repeat: no-repeat;
  115.                 background-position: left top;
  116.                 z-index: 0;
  117.                  opacity: 0.1; /* Ajusta la opacidad según sea necesario */
  118.             }
  119.             .background-right {
  120.                 position: fixed;
  121.                 top: 100px;
  122.                 right: 0;
  123.                 width: 50%;
  124.                 height: 90%;
  125.                 background-image: url("{{ app.request.getSchemeAndHttpHost() ~ asset('assets/images/nmed_fondo.png') }}"); 
  126.                 background-size: contain;
  127.                 background-repeat: no-repeat;
  128.                 background-position: right top;
  129.                 z-index: 0;
  130.                  opacity: 0.1; /* Ajusta la opacidad según sea necesario */
  131.             }
  132.         </style>
  133.     </head>
  134.     <body>
  135.         <div class="background-left"></div>
  136.         <div class="background-right"></div>
  137.         <!-- Define header and footer blocks before your content -->
  138.         {% set unidad = recetum.historia.agenda.sala.unidad %}
  139.         <!--header>
  140.             <div style="text-align: left; width: 49%; float: left;">
  141.                 <img src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}" style="width:100%;height:auto;image-rendering: -webkit-optimize-contrast;">
  142.             </div>
  143.             <div style="text-align: left; width: 49%; float: left;">
  144.                 <img src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}" style="width:100%;height:auto;image-rendering: -webkit-optimize-contrast;">
  145.             </div>
  146.             
  147.         </header-->
  148.         <header>
  149.             <div class="hdr-wrap">
  150.                 <div class="hdr-col hdr-left">
  151.                     <img class="hdr-img"
  152.                         src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}">
  153.                     <div class="hdr-overlay">
  154.                         <b>{{ empresa.telefono ?? '' }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ empresa.correo2 ?? '' }}
  155.                         <br><br>
  156.                         <span style="font-size:11px">{{ empresa.direccion ?? '' }}</span></b>
  157.                     </div>
  158.                 </div>
  159.                 <div class="hdr-col hdr-right">
  160.                     <img class="hdr-img"
  161.                         src="{{ app.request.getSchemeAndHttpHost() }}{{ asset('assets/images/nueva_cabecera.png') }}">
  162.                     <div class="hdr-overlay">
  163.                         <b>{{ empresa.telefono ?? '' }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ empresa.correo2 ?? '' }}
  164.                         <br><br>
  165.                         <span style="font-size:11px">{{ empresa.direccion ?? '' }}</span></b>
  166.                     </div>
  167.                 </div>
  168.             </div>
  169.         </header>
  170.         <div class="footer2">
  171.             <div style="width: 50%; float: left; text-align: left; font-size: 14px;">
  172.                 <b>Diagnósticos:</b><br>
  173.                 {% for dx in dxs %}
  174.                 {{ dx.cie10.codigo }} &nbsp;&nbsp; {{ dx.cie10.nombre }}<br>
  175.                 {% endfor %}
  176.                 <br>
  177.                 {# AGRUPAR POR TIPO #}
  178.                 {% for tipo, rows in agrupado %}
  179.                 <div style="border:1px solid #d1d5db;border-radius:10px;overflow:hidden;font-family:Arial,Helvetica,sans-serif;font-size:13px;">
  180.                     <div style="background:#e5e7eb;padding:1px 10px;font-weight:700;">
  181.                     {{ tipo }}
  182.                     </div>
  183.                     <table style="border-collapse:collapse;">
  184.                     <thead>
  185.                         <tr style="background:#f9fafb;">
  186.                         <th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;width:70px;">Cant</th>
  187.                         <th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;">Procedimiento</th>
  188.                         </tr>
  189.                     </thead>
  190.                     <tbody>
  191.                         {% for row in rows %}
  192.                         <tr>
  193.                             <td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;font-weight:700;">{{ row.cant }}</td>
  194.                             <td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;">{{ row.nombre }}</td>
  195.                         </tr>
  196.                         {% endfor %}
  197.                     </tbody>
  198.                     </table>
  199.                 </div>
  200.                 {% endfor %}
  201.                 <br>
  202.             </div>
  203.             <div style="width: 50%; float: right; text-align: left; font-size: 14px;">
  204.                 <b>Diagnósticos:</b><br>
  205.                 {% for dx in dxs %}
  206.                 {{ dx.cie10.codigo }}&nbsp;&nbsp; {{ dx.cie10.nombre }}<br>
  207.                 {% endfor %}
  208.                 {# AGRUPAR POR TIPO #}
  209.                 <br>
  210.                 {% for tipo, rows in agrupado %}
  211.                 <div style="border:1px solid #d1d5db;border-radius:10px;overflow:hidden;font-family:Arial,Helvetica,sans-serif;font-size:13px;">
  212.                     <div style="background:#e5e7eb;padding:1px 10px;font-weight:700;">
  213.                     {{ tipo }}
  214.                     </div>
  215.                     <table style="border-collapse:collapse;">
  216.                     <thead>
  217.                         <tr style="background:#f9fafb;">
  218.                         <th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;width:70px;">Cant</th>
  219.                         <th style="text-align:left;padding:1px 10px;border-bottom:1px solid #e5e7eb;">Procedimiento</th>
  220.                         </tr>
  221.                     </thead>
  222.                     <tbody>
  223.                         {% for row in rows %}
  224.                         <tr>
  225.                             <td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;font-weight:700;">{{ row.cant }}</td>
  226.                             <td style="padding:1px 10px;border-bottom:1px solid #f1f5f9;">{{ row.nombre }}: {{ row.obs }}</td>
  227.                         </tr>
  228.                         {% endfor %}
  229.                     </tbody>
  230.                     </table>
  231.                 </div>
  232.                 {% endfor %}
  233.                 <br>
  234.             </div>
  235.             <div style="clear: both;"></div>
  236.         </div>
  237.         <footer>
  238.             <div style="text-align: left; width: 50%; float: left; font-size: 12px;" class="ftr">
  239.                 <b>Firma y Sello:</b>
  240.             </div>
  241.             <div style="text-align: left; width: 50%; float: right; font-size: 12px;" class="ftr">
  242.                 <b>Próxima Cita</b>
  243.             </div>
  244.             <div style="clear: both;"></div>
  245.         </footer>
  246.         <!-- Wrap the content of your PDF inside a main tag -->
  247.         <main>
  248.             <div style="clear: both;"></div>
  249.             {% 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'} %}
  250.             {% set tmes = ames[recetum.fecha|date("m")] %}
  251.             <div style="width: 50%; float: left; text-align: left;font-size: 16px;">
  252.                 <!--b>Fecha:</b> {{ recetum.historia.agenda.inicio|date('d') }}/{{ tmes }}/{{ recetum.historia.agenda.inicio|date('Y') }}<br-->
  253.                 <b>Fecha:</b> {{ recetum.fecha|date('d') }}/{{ tmes }}/{{ recetum.fecha|date('Y') }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Receta No:</b>{{ recetum.id }}<br>
  254.                 <b>Paciente:</b> {{ recetum.paciente.cedula }} - {{ recetum.paciente.apellido1 }} {{ recetum.paciente.apellido2 }} {{ recetum.paciente.nombre1 }} {{ recetum.paciente.nombre2 }}<br>
  255.                 <!--b>Alergias: </b> {{recetum.paciente.alergias}}<br-->
  256.                 {% set preparacion = recetum.historia.agenda.preparacion %}
  257.                 {% if(preparacion != null) %}
  258.                 <!--b>Peso: </b> {{preparacion.peso}} Kg &nbsp;&nbsp;<b>Talla: </b> {{preparacion.estatura}} cm<br-->
  259.                 {% endif %}
  260.             </div>
  261.             <div style="width: 50%; float: left; text-align: left;font-size: 16px;">
  262.                 <b>Indicaciones:</b>
  263.             </div>
  264.             <div style="clear: both;"></div>
  265.             <br>
  266.             <div style="width: 48%; float: left; text-align: left; font-size: 16px;">
  267.                 {% set cont = 0 %}
  268.                 {% for detalle in recetum.recetaDetalles %}
  269.                 {% set cont = cont + 1 %}
  270.                 <div style="text-align: left; font-size: 16px;">
  271.                     {{ cont }}&nbsp;&nbsp;{{ detalle.nombre }}
  272.                 </div>
  273.                 <div style="text-align: left; font-size: 16px;">
  274.                     &nbsp;&nbsp;&nbsp;&nbsp;Cantidad: {{ detalle.cantidad }}
  275.                 </div>
  276.                 {% endfor %}
  277.             </div>
  278.             <br>
  279.             <div style="width: 48%; float: right; text-align: left;">
  280.                 {% set cont = 0 %}
  281.                 {% for detalle in recetum.recetaDetalles %}
  282.                 {% set cont = cont + 1 %}
  283.                 <div style="text-align: left; font-size: 16px;">
  284.                     {{ cont }}&nbsp;&nbsp;{{ detalle.nombre }}
  285.                 </div>
  286.                 <div style="text-align: left; font-size: 16px;">
  287.                     &nbsp;&nbsp;&nbsp;&nbsp;Indicacion: {{ detalle.indicacion }}
  288.                 </div>
  289.                 {% endfor %}
  290.             </div>
  291.             <div style="clear: both;"></div>
  292.             <div style="width: 48%; float: left; text-align: left;font-size:14px;">
  293.                 {{ recetum.rp | raw }}
  294.             </div>
  295.             <div style="width: 48%; float: right; text-align: left;font-size:14px;">
  296.                 {{ recetum.prescripcion | raw }}
  297.             </div>
  298.             <div style="clear: both;"></div>
  299.             
  300.             
  301.         </main>
  302.     </body>
  303. </html>