Files
enterprise-addons/event_iot/report/event_iot_templates.xml
T

114 lines
4.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="event_registration_badge_printer_report">
<!-- Printer Setup -->
^XA
^IDR:*.*^FS <!-- Clear memory -->
^S(CLR,R,600 ^S(CLR,P,600 ^S(CLR,Z,600 <!-- 600 DPI -->
^S(CLM,T,M1 <!-- Matte paper -->
^S(CLM,F,DL <!-- Die-cut label -->
^S(CLM,S,FP <!-- Fanfold paper -->
^S(CLM,P,ER <!-- Rear-feed -->
^S(CLM,D,W <!-- 'Gap' edge detection -->
^S(CPC,Q,N <!-- Normal print quality -->
^CI28 <!-- Use UTF-8 encoding -->
^S(CLS,P,2400 <!-- 2400 dots wide -->
^S(CLS,L,3930 <!-- 3930 dots long -->
^S(CLS,C,80 <!-- 80 dots label gap -->
^S(CLS,G,48 <!-- 48 dots left gap -->
^XZ
<t t-foreach="docs.grouped('event_id').items()" t-as="attendees_per_event">
<t t-set="event" t-value="attendees_per_event[0]._set_tz_context()"/>
<t t-set="attendees" t-value="attendees_per_event[1]"/>
<!-- Upload files to printer -->
<t t-set="logo" t-value="load_image(event.organizer_id.image_512, (800, 600))"/>
<t t-set="logo_flip" t-value="load_image(event.organizer_id.image_512, (800, 600), flip=True)"/>
<t t-if="logo">
~DYR:LOGO,A,P,<t t-out="len(logo)"/>,0,<t t-out="logo.hex()"/>
~DYR:LOGOFLIP,A,P,<t t-out="len(logo_flip)"/>,0,<t t-out="logo_flip.hex()"/>
</t>
<t t-foreach="attendees" t-as="attendee">
^XA
<t t-if="attendee.event_ticket_id">
<!-- Print ticket banner -->
<t t-set="color_hex" t-value="attendee.event_ticket_id.color"/>
<t t-set="color_rgb" t-value="(int(color_hex[1:3], 16), int(color_hex[3:5], 16), int(color_hex[5:7], 16))"/>
^F(C<t t-out="color_rgb[0]"/>,<t t-out="color_rgb[1]"/>,<t t-out="color_rgb[2]"/>,255,D,<t t-out="color_rgb[0]"/>,<t t-out="color_rgb[1]"/>,<t t-out="color_rgb[2]"/>,255,D
^FO0,1665
^GB2400,600,1,B,0
^FS
<t t-set="text_color" t-value="'0,0,0'"/>
<t t-set="font_size" t-value="160 if len(attendee.event_ticket_id.name) &lt;= 20 else 72"/>
<t t-set="y_pos" t-value="1830 - int(font_size/2)"/>
<t t-set="y_pos_inv" t-value="2100 - int(font_size/2)"/>
<!-- Print ticket type -->
^F(C<t t-out="text_color"/>,255,D,0,0,0,0,D
^FO200,<t t-out="y_pos"/>
^A0N,<t t-out="font_size"/>,<t t-out="font_size"/>
^FB2000,1,0,L
^FH^FD<t t-out="escape(attendee.event_ticket_id.name)"/>^FS
<!-- Print ticket type (reverse side) -->
^F(C<t t-out="text_color"/>,255,D,0,0,0,0,D
^FO200,<t t-out="y_pos_inv"/>
^A0I,<t t-out="font_size"/>,<t t-out="font_size"/>
^FB2000,1,0,L
^FH^FD<t t-out="escape(attendee.event_ticket_id.name)"/>^FS
</t>
<t t-set="font_size" t-value="200 if len(attendee.name) &lt;= 18 else 160 if len(attendee.name) &lt;= 22 else 120 if len(attendee.name) &lt;= 27 else 100"/>
<t t-set="y_pos" t-value="700 - int(font_size/2)"/>
<t t-set="y_pos_inv" t-value="3230 - int(font_size/2)"/>
<!-- Print attendee name -->
^FO200,<t t-out="y_pos"/>
^A0N,<t t-out="font_size"/>,<t t-out="font_size"/>
^FB2200,1,0,L
^FH^FD<t t-out="escape(attendee.name)"/>^FS
<!-- Print attendee name (reverse side) -->
^FO0,<t t-out="y_pos_inv"/>
^A0I,<t t-out="font_size"/>,<t t-out="font_size"/>
^FB2200,1,0,L
^FH^FD<t t-out="escape(attendee.name)"/>^FS
<!-- Print company logo -->
^FO1400,900
^IMR:LOGO.PNG
^FS
<!-- Print company logo (reverse side) -->
^FO200,2430
^IMR:LOGOFLIP.PNG
^FS
<t t-if="attendee.company_name">
<!-- Print attendee company -->
^FO200,850
^A0N,90,90
^FB2200,2,0,L
^FH^FD<t t-out="escape(attendee.company_name)"/>^FS
<!-- Print attendee company (reverse side) -->
^FO0,2890
^A0I,90,90
^FB2200,2,0,L
^FH^FD<t t-out="escape(attendee.company_name)"/>^FS
</t>
<!-- Signal label complete -->
^S(CUB,S,L
^XZ
</t>
</t>
</template>
</odoo>