You can use the purchase_order.vendor_tax_name variable to display the supplier’s configured tax name on the Purchase Order document. The companion variable purchase_order.has_vendor_tax_name? lets you check if a tax name has been set before printing it, so your template does not show an empty field.
Custom Code Example
Here is an example of how you can modify the default Purchase Order template to show the supplier tax name only when it is available.
Default Code
<li><label>Date</label><span>{{ purchase_order.created_at | date: "%d/%b/%Y"}}</span></li>
<li><label>Reference</label><span>{{ purchase_order.reference }}</span></li>
<li><label>Supplier</label><span>{{ purchase_order.supplier_name }}</span></li>
<li><label>Supplier Invoice #</label><span>{{ purchase_order.vendor_invoice_number }}</span></li>
<li><label>Supplier Tracking #</label><span>{{ purchase_order.vendor_tracking_number }}</span></li>
{% if purchase_order.has_vendor_account_number? %}
<li><label>Supplier Account #</label><span>{{ purchase_order.vendor_account_number }}</span></li>
{% endif %}Custom Code
Add the code in red to the default code shown above as follows:
<li><label>Date</label><span>{{ purchase_order.created_at | date: "%d/%b/%Y"}}</span></li>
<li><label>Reference</label><span>{{ purchase_order.reference }}</span></li>
<li><label>Supplier</label><span>{{ purchase_order.supplier_name }}</span></li>
{% if purchase_order.has_vendor_tax_name? %}
<li>
<label>Supplier Tax Name</label>
<span>{{ purchase_order.vendor_tax_name }}</span>
</li>
{% endif %}
<li><label>Supplier Invoice #</label><span>{{ purchase_order.vendor_invoice_number }}</span></li>
<li><label>Supplier Tracking #</label><span>{{ purchase_order.vendor_tracking_number }}</span></li>
{% if purchase_order.has_vendor_account_number? %}
<li><label>Supplier Account #</label><span>{{ purchase_order.vendor_account_number }}</span></li>
{% endif %}Result
When the supplier has a tax name configured, the Purchase Order will include a Supplier Tax Name line showing the value from purchase_order.vendor_tax_name. If no tax name is set for the supplier, the conditional check purchase_order.has_vendor_tax_name? fails and the extra line is not shown.
Comments
0 comments
Please sign in to leave a comment.