{# Payment Request message template - calculates VAT as contained-in-gross (amount included PPN) #}
{# helper: format number as Indonesian style 1.234.567,89 #} {% macro rupiah(x) -%} {%- set s = "{:,.2f}".format(x or 0) -%} {{- s.replace(',', 'X').replace('.', ',').replace('X', '.') -}} {%- endmacro %} {# --- base amount (payment request amount) --- #} {% set amount = (doc.grand_total or doc.amount or 0) | float %} {# If amount is gross (includes 11% PPN), compute netto and ppn accordingly #} {% set netto = (amount / 1.11) if amount else 0 %} {% set ppn = amount - netto %} {# determine quantity from reference doc (Sales Order) if available #} {% set qty = 0 %} {% if ref_doc %} {% if ref_doc.total_qty %} {% set qty = ref_doc.total_qty | float %} {% else %} {% for it in ref_doc.items %} {% set qty = qty + (it.qty or 0) %} {% endfor %} {% endif %} {% endif %} {% if qty == 0 %} {% set qty = 1 %} {% endif %} {# We use a single row representing the payment request amount (user can edit nama barang manual) #} {# Per user request: Harga Satuan dan Jumlah Satuan = NETTO (amount without PPN) per design. If you want Harga Satuan to show GROSS instead, change netto -> amount/qty below. #}
No Nama Barang Banyaknya Harga Satuan Jumlah Satuan
1 {{ ref_doc.items[0].item_name if ref_doc and ref_doc.items and ref_doc.items|length>0 else "Nama Barang / Uraian" }} {{ qty | round(2) }} Rp {{ rupiah(netto) }} Rp {{ rupiah(netto) }}
Diskon Rp {{ rupiah(0) }}
PPN 11% Rp {{ rupiah(ppn) }}
Total Rp {{ rupiah(amount) }}

Terbilang : {{ frappe.utils.money_in_words(amount, (doc.currency or "IDR")) }}

Jakarta, {{ frappe.utils.formatdate(doc.transaction_date or frappe.utils.nowdate()) }}
Hormat kami,