{%- macro format(amount, currency) -%} {% if not currency %}{% set currency = 'BRL' %}{% endif %} {% if amount %} {% if amount < 0 %} ({{ (amount/100)|number_format(2,',','.') }}) {% else %} {{ (amount/100)|number_format(2,',','.') }} {% endif %} {% else %} 0,00 {% endif %} {%- endmacro -%} {%- macro pos(t = 0, l = 0, b = 0, r = 0) -%} {% if t %}position: fixed; top: {{t}}mm;{% endif %} {% if r %}right: {{r}}mm;{% endif %} {% if b %}bottom: {{b}}mm;{% endif %} {% if l %}left: {{l}}mm;{% endif %} {%- endmacro -%} {%- macro pos1(arr) -%} {{ _self.pos(arr[0],arr[1],arr[2],arr[3]) }} {%- endmacro -%} {%- macro tam(w = 0, h = 0, float = 0) -%} {% if float %}float: {{float}};{% endif %} {% if w %}width: {{w}};{% endif %} {% if h %}height: {{h}};{% endif %} {%- endmacro -%} {%- macro tam1(arr) -%} {{ _self.tam(arr[0],arr[1],arr[2]) }} {%- endmacro -%} {%- macro txt(s = 0, sp = 0, b = 0, lh = 0, al = 0, fm = 0) -%} {% if s %}font-size: {{s}}mm;{% endif %} {% if sp %}letter-spacing: {{sp}}mm;{% endif %} {% if b %}font-weight: bold;{% endif %} {% if lh %}line-height: {{lh}}mm;{% endif %} {% if al %}text-align: {{al}};{% endif %} {% if fm %}font-family: {{fm}};{% endif %} {%- endmacro -%} {%- macro txt1(arr) -%} {{ _self.txt(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5]) }} {%- endmacro -%} {%- macro pad(t = 0, l = 0, b, r) -%} padding: {{t}}mm {{r|default(l)}}mm {{b|default(t)}}mm {{l}}mm; {%- endmacro -%} {%- macro pad1(arr) -%} {% if arr|length %} {{ _self.pad(arr[0],arr[1],arr[2],arr[3]) }} {% endif %} {%- endmacro -%} {%- macro mar(t = 0, l = 0, b = 0, r = 0) -%} {% if t or l or b or r %}margin: {{t}}mm {{r|default(l)}}mm {{b|default(t)}}mm {{l}}mm;{% endif %} {%- endmacro -%} {%- macro mar1(arr) -%} {{ _self.mar(arr[0],arr[1],arr[2],arr[3]) }} {%- endmacro -%} {%- macro cor(f = 0, b = 0) -%} {% if f %}color: {{f}};{% endif %} {% if b %}background-color: {{b}};{% endif %} {%- endmacro -%} {%- macro cor1(arr) -%} {% if arr|length %} {{ _self.cor(arr[0],arr[1]) }} {% endif %} {%- endmacro -%} {%- macro bor(t = 0, c = 0, s = 0) -%} {% if t %}border: {{t}} {{s??'solid'}} {{c??'black'}};{% endif %} {%- endmacro -%} {%- macro bor1(arr) -%} {% if arr|length %} {{ _self.bor(arr[0],arr[1],arr[2]) }} {% endif %} {%- endmacro -%} {%- macro mes(txt) -%} {% if txt == 'Jan' %}janeiro {% elseif txt == 'Fev' %}fevereiro {% elseif txt == 'Jun' %}Junho {% elseif txt == 'Oct' %}outubro {% elseif txt == 'Nov' %}novembro {% elseif txt == 'Dec' %}dezembro {% endif %} {%- endmacro -%} {%- macro showValue(row, campo, tipo = '') -%} {% if tipo == 'moeda' %} R$ {{ _self.format(row[campo]) }} {% elseif tipo == 'percentual' %} % {{ _self.format(row[campo]) }} {% elseif tipo == 'texto' %} {{ campo }} {% else %} {{ row[campo] }} {% endif %} {%- endmacro -%} {%- macro table(data, cols, style = null, evenColor = null) -%}
| {{ _self.showValue(row, col.campo, col.tipo) }} | {% endfor %}