add print formats for erpnext

This commit is contained in:
Claudio Maradonna 2021-10-09 14:51:40 +02:00
parent da99959eb6
commit aa65822cc8
Signed by untrusted user: claudiomaradonna
GPG Key ID: B1EDCB4C3B05C387
2 changed files with 246 additions and 0 deletions

View File

@ -0,0 +1,82 @@
.print-format {
font-size: 12px;
background: white;
}
.print-heading {
border-bottom: none;
padding-bottom: 5px;
margin-bottom: 10px;
}
.print-format .letter-head {
margin-bottom: 30px;
}
.print-format label {
font-weight: normal;
font-size: 13px;
color: #4C5A67;
margin-bottom: 0;
}
.print-format .data-field {
margin-top: 0;
margin-bottom: 0;
}
.print-format .value {
color: #192734;
line-height: 1.8;
}
.print-format .section-break:not(:last-child) {
margin-bottom: 0;
}
.print-format .row:not(.section-break) {
line-height: 1.6;
margin-top: 15px !important;
}
.print-format .important .value {
font-size: 13px;
font-weight: 600;
}
.print-format th {
color: #74808b;
font-weight: normal;
border-bottom-width: 1px !important;
}
.print-format .table-bordered td, .print-format .table-bordered th {
border: 1px solid #f4f5f6;
}
.print-format .table-bordered {
border: 1px solid #f4f5f6;
}
.print-format .table-bordered thead {
text-transform: uppercase;
font-size: 8px;
}
.print-format .table-sr {
display: none;
}
.print-format td, .print-format th {
padding: 5px 10px !important;
}
.print-format .primary.compact-item {
font-weight: normal;
}
.print-format table td .value {
font-size: 12px;
line-height: 1.8;
}

View File

@ -0,0 +1,164 @@
<!-- HEADING SECTION -->
<div class="print-heading row">
<div class="col-xs-4">
<a href=""> <img src="" alt="logo" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;border: none;"></a>
</div>
<div class="col-xs-8 text-right">
{% set u_company = frappe.get_doc('Company', doc.company) %}
{% set links = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Company', 'link_name': doc.company, 'parenttype': 'Address'}, fields=['parent']) %}
<div class="strong">{{ doc.company }}</div>
{% if links %}
<div>
{{frappe.db.get_value("Address", links[0].parent, "address_line1")}} -
{{frappe.db.get_value("Address", links[0].parent, "pincode")}} -
{{frappe.db.get_value("Address", links[0].parent, "city")}}
{% set province = frappe.db.get_value("Address", links[0].parent, "state") %}
{% if province %}
({{ province }})
{% endif %}
</div>
{% endif %}
VAT: {{ u_company.tax_id }} - F.C.: {{ u_company.fiscal_code }}
<br>
<div class="h5"><strong>QUOTATION</strong> nr. <strong>{{ doc.name }}</strong> of <strong>{{ frappe.utils.formatdate(doc.get('transaction_date'),"dd-mm-yyyy") }}</strong></div>
</div>
</div>
<hr>
<!-- END SECTION -->
<!-- SECTION 2 COLUMNS -->
<!-- FIRST COLUMN -->
{% 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 %}
<div><strong>VAT</strong> {{ customer[0].tax_id }}</div>
<div><strong>F.C.</strong> {{ customer[0].fiscal_code }}</div>
{% endif %}
{% if contacts %}
<div>
<strong>EMAIL </strong>
{% 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 %}
</div>
{% endif %}
<!-- SECOND COLUMN -->
<div><small>RECIPIENT</small></div>
<div><strong>{{ doc.customer_name }}</strong></div>
{% set links = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Customer', 'link_name': doc.customer_name, 'parenttype': 'Address'}, fields=['parent']) %}
{% if links %}
<div>
{{frappe.db.get_value("Address", links[0].parent, "address_line1")}}
</div>
<div>
{{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") }})
</div>
<div>
{{frappe.db.get_value("Address", links[0].parent, "country")}}
</div>
{% endif %}
<!-- END SECTION -->
<!-- SECTION 1 COLUMN -->
<hr>
<!-- END SECTION -->
<!-- SECTION 1 COLUMN -->
<!-- ADD ITEMS (TABLE): Description, Amount, Tax Amount -->
<hr>
<!-- END SECTION -->
<!-- SECTION 1 COLUMN -->
<div><small>PAYMENT TERMS</small></div>
{% set bank_account = frappe.get_doc('Bank Account', 'BANK NAME') %}
{% if bank_account %}
<div>IBAN: <strong>{{ bank_account.iban }}</strong></div>
<div>Holder: <strong>{{ bank_account.company }}</strong></div>
<div>Bank: <strong>{{ bank_account.bank }}</strong></div>
{% endif %}
<hr>
<!-- END SECTION -->
<!-- SECTION 1 COLUMN -->
{% 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('.', ',') %}
<div class="row" style="margin-top: 0">
<div class="col-xs-7" style="border-right: 1px solid #ddd;">
<table class="table table-borderless table-condensed">
<thead>
<tr>
<th>VAT Summary</th>
<th class="text-right" width=100>Taxable</th>
<th class="text-right" width=75>Taxes</th>
</tr>
</thead>
<tbody>
<tr>
<td>
0% - <span class="font-italic">Operazione non soggetta a IVA ai sensi dell'art. 1, commi 54-89, Legge n. 190/2014 e succ. modifiche/ integrazioni</span>
</td>
<td class="text-right">{{ total }}</td>
<td class="text-right">€ 0,00</td>
</tr>
{% if (stamp|sum) > 0 %}
<tr>
<td>0% - <span class="font-italic">Escluso Art. 15</span></td>
<td class="text-right">2,00</td>
<td class="text-right">€ 0,00</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
<div class="col-xs-5 text-right">
<div>Taxable {{ total }}</div>
{% if (stamp|sum) > 0 %}
<div>Not taxable € 2,00</div>
{% endif %}
<h1>{{ ("€ %.2f"|format(doc.grand_total)).replace('.', ',') }}</h1>
</div>
</div>
<hr>
<!-- END SECTION -->
<!-- SECTION 1 COLUMN -->
<div class="col-xs-12">
{% if not no_letterhead and footer %}
{{ footer }}
{% endif %}
</div>
<!-- END SECTION -->