{% macro money(v) -%} {%- if v is none -%}0.00 {%- else -%} {%- set s = v|string -%} {%- set s = s|replace(",", "") -%} {%- if s == "" -%}0.00 {%- else -%}{{ indian_amount(s|float) }} {%- endif -%} {%- endif -%} {%- endmacro %} {% set doc_title = doc_title if doc_title is defined else "Document" %} {% set doc_no = doc_no if doc_no is defined else "-" %} {% set doc_date = doc_date if doc_date is defined else "-" %} {% set doc = doc if doc is defined else none %} {% set quote = quote if quote is defined else none %} {% set client = client if client is defined else none %} {% set branch = branch if branch is defined else none %} {% set company_branch = company_branch if company_branch is defined else none %} {% set items = items if items is defined else [] %} {% set tenant_logo = tenant_logo if tenant_logo is defined else url_for('static', filename='img/company_logo.png') %} {% set subtotal = (doc.subtotal or 0) if doc else 0 %} {% set discount = (doc.discount or 0) if doc else 0 %} {% set taxable = (subtotal - discount) %} {% set cgst = (doc.cgst or 0) if doc else 0 %} {% set sgst = (doc.sgst or 0) if doc else 0 %} {% set igst = (doc.igst or 0) if doc else 0 %} {% set tax = (doc.tax or 0) if doc else 0 %} {% set total_amount = (doc.total_amount or 0) if doc else 0 %} {% set currency = (doc.currency or "INR") if doc else "INR" %} {% set currency_upper = currency|string|upper %} {% set currency_symbol = "₹" if currency_upper == "INR" else currency %} {% set is_intrastate = (cgst and (cgst|float) > 0) %} {% set is_inr = (currency_upper == "INR") %} {% set company_name = "-" %} {% if company_branch and company_branch.company %} {% set company_name = company_branch.company.name or company_branch.company.company_name or "-" %} {% endif %} {% set company_branch_name = "-" %} {% if company_branch %} {% set company_branch_name = company_branch.branch_name or company_branch.name or "-" %} {% endif %} {% set company_address = "-" %} {% if company_branch %} {% set company_address = company_branch.branch_address or company_branch.address or "-" %} {% endif %} {% set company_state = company_branch.state if company_branch and company_branch.state else "-" %} {% set company_country = company_branch.country if company_branch and company_branch.country else "-" %} {% set company_pin = company_branch.pin_code if company_branch and company_branch.pin_code else "-" %} {% set company_gst = "-" %} {% if company_branch %} {% set company_gst = company_branch.gst_no or company_branch.gst or "-" %} {% endif %} {% set company_pan = company_branch.company.pan if company_branch and company_branch.company and company_branch.company.pan else "-" %} {% set company_msme = company_branch.msme_no if company_branch and company_branch.msme_no else "-" %} {% set client_name = client.company_name if client and client.company_name else "-" %} {% set branch_address = branch.address if branch and branch.address else "-" %} {% set branch_city = branch.city if branch and branch.city else "-" %} {% set branch_pin = branch.pin_code if branch and branch.pin_code else "-" %} {% set branch_state = branch.state if branch and branch.state else "-" %} {% set branch_country = branch.country if branch and branch.country else "-" %} {% set branch_location = branch.branch_location if branch and branch.branch_location else "-" %} {% set branch_gst = branch.gst if branch and branch.gst else "-" %}
Company Logo

{{ doc_title }}

Quote: {{ quote.quote_code if quote else '-' }} • Version {{ quote.version if quote else '-' }} • Jobcard: {{ jobcard.jobcard_code if jobcard else '-' }}
{{ doc_no }}
Date: {{ doc_date }}
{% if doc and doc.po_number %}
PO Number: {{ doc.po_number }}
{% endif %}
Status: {{ doc.status if doc else '-' }}
Currency: {{ currency }}
{% if doc and doc.irn %}
GST E-Invoice
IRN Number
{{ doc.irn }}
Ack No
{{ doc.ack_no or "-" }}
Ack Date
{% if doc.ack_date %} {{ doc.ack_date.strftime('%d-%m-%Y %I:%M %p') }} {% else %} - {% endif %}
{% if doc.signed_qr_code is defined and doc.signed_qr_code %}
{% if doc.einvoice_qr_image %} IRN QR {% else %} IRN QR {% endif %}
Signed QR Code
{% endif %}
{% endif %}
From (Company)
{{ company_name }} {% if company_branch_name != "-" %} • {{ company_branch_name }}{% endif %}
{{ company_address }}
{% if company_state != "-" %}State: {{ company_state }}
{% endif %} {% if company_country != "-" %}Country: {{ company_country }}
{% endif %} {% if company_pin != "-" %}PIN: {{ company_pin }}
{% endif %} {% if company_gst != "-" %}GSTIN: {{ company_gst }}
{% endif %} {% if company_pan != "-" %}PAN: {{ company_pan }}
{% endif %} {% if company_msme != "-" %}MSME: {{ company_msme }}
{% endif %} {% if doc and doc.sales_person_name %} Sales Person: {{ doc.sales_person_name }}
{% endif %} {% if doc and doc.project_manager_name %} Project Manager: {{ doc.project_manager_name }}
{% endif %} {% if project_manager_email is defined and project_manager_email %} Project Manager Email: {{ project_manager_email }}
{% endif %} Finance Email: ar@crystalhues.com
Bill To (Customer)
{{ client_name }}
{{ branch_address }}
{% if branch_city != "-" %}{{ branch_city }}{% endif %} {% if branch_pin != "-" %} {{ branch_pin }}{% endif %}
{% if branch_state != "-" %}State: {{ branch_state }}
{% endif %} {% if branch_country != "-" %}Country: {{ branch_country }}
{% endif %} {% if branch_location != "-" %}Branch: {{ branch_location }}
{% endif %} GSTIN: {{ branch_gst }}
{% if doc and doc.bill_contact_name %} Contact: {{ doc.bill_contact_name }}
{% endif %} {% if doc and doc.bill_contact_phone %} Phone: {{ doc.bill_contact_phone }}
{% endif %} {% if doc and doc.bill_contact_email %} Email: {{ doc.bill_contact_email }} {% endif %}
{% for it in items %} {% endfor %} {% if items|length == 0 %} {% endif %}
S No. Item Description Service SAC Code Qty Rate Amount
{{ loop.index }}
{{ it.item_name }}
{% if it.service %}
Service: {{ it.service.name }}
{% endif %}
{{ it.description if it.description else "-" }} {{ it.service.name if it.service else "-" }} {{ it.sac_code if it.sac_code is defined and it.sac_code else "998395" }} {{ it.qty }} {{ currency_symbol }} {{ money(it.rate) }} {{ currency_symbol }} {{ money(it.amount) }}
No items found.
Subtotal
{{ currency_symbol }} {{ money(subtotal) }}
Discount
{{ currency_symbol }} {{ money(discount) }}
Taxable Value
{{ currency_symbol }} {{ money(taxable) }}
{% if is_inr %} {% if is_intrastate %}
CGST (9%)
{{ currency_symbol }} {{ money(cgst) }}
SGST (9%)
{{ currency_symbol }} {{ money(sgst) }}
IGST (18%)
{{ currency_symbol }} {{ money(0) }}
{% else %}
CGST (9%)
{{ currency_symbol }} {{ money(0) }}
SGST (9%)
{{ currency_symbol }} {{ money(0) }}
IGST (18%)
{{ currency_symbol }} {{ money(igst) }}
{% endif %}
Total GST
{{ currency_symbol }} {{ money(tax) }}
{% else %}
Tax
{{ currency_symbol }} {{ money(tax) }}
{% endif %}
Grand Total
{{ currency_symbol }} {{ money(total_amount) }}
{% if doc_title == "Credit Note" %}
Credit Note Remarks
{% endif %} {% if doc and doc.bank %}
Payment to be made
Account Holder: {{ doc.bank.account_holder_name }}
Bank: {{ doc.bank.bank_name }}
Account No: {{ doc.bank.account_no }}
IFSC: {{ doc.bank.ifsc_code or "-" }}
Branch: {{ doc.bank.branch_name or "-" }}
{% if doc.bank.swift_code %} SWIFT: {{ doc.bank.swift_code }} {% endif %}
{% endif %}
Terms & Conditions
{% if doc and doc.payment_terms %} {% endif %}