{% set customer = frappe.get_list('Customer', filters = { 'customer_name': doc.customer_name}, fields = ['tax_id', 'fiscal_code']) %} {% set contacts = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Customer', 'link_name': doc.customer_name, 'parenttype': 'Contact'}, fields=['parent']) %} {% if customer %}
VAT {{ customer[0].tax_id }}
F.C. {{ customer[0].fiscal_code }}
{% endif %} {% if contacts %}
EMAIL {% set break = false %} {% for contact_id in contacts if not break %} {% set contact = frappe.get_doc('Contact', contact_id.parent) %} {% if contact.is_billing_contact %} {{ contact.email_id }} {% set break = true %} {% endif %} {% endfor %}
{% endif %}
RECIPIENT
{{ doc.customer_name }}
{% set links = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Customer', 'link_name': doc.customer_name, 'parenttype': 'Address'}, fields=['parent']) %} {% if links %}
{{frappe.db.get_value("Address", links[0].parent, "address_line1")}}
{{frappe.db.get_value("Address", links[0].parent, "state_code")}} {{frappe.db.get_value("Address", links[0].parent, "city")}} ({{ frappe.db.get_value("Address", links[0].parent, "state") }})
{{frappe.db.get_value("Address", links[0].parent, "country")}}
{% endif %}

PAYMENT TERMS
{% set bank_account = frappe.get_doc('Bank Account', 'BANK NAME') %} {% if bank_account %}
IBAN: {{ bank_account.iban }}
Holder: {{ bank_account.company }}
Bank: {{ bank_account.bank }}
{% endif %}
{% set quotation_items = doc.items %} {% set total_without_stamp = [] %} {% set stamp = [0] %} {% for item in quotation_items %} {% if item.item_name != 'MARCADABOLLO' %} {% set __ = total_without_stamp.append(item.base_amount) %} {% else %} {% set __ = stamp.append(1) %} {% endif %} {% endfor %} {% set total = ("€ %.2f"|format(total_without_stamp|sum)).replace('.', ',') %}
{% if (stamp|sum) > 0 %} {% endif %}
VAT Summary Taxable Taxes
0% - Operazione non soggetta a IVA ai sensi dell'art. 1, commi 54-89, Legge n. 190/2014 e succ. modifiche/ integrazioni {{ total }} € 0,00
0% - Escluso Art. 15 2,00 € 0,00
Taxable {{ total }}
{% if (stamp|sum) > 0 %}
Not taxable € 2,00
{% endif %}

{{ ("€ %.2f"|format(doc.grand_total)).replace('.', ',') }}


{% if not no_letterhead and footer %} {{ footer }} {% endif %}