{% if advance_billing is defined and jobcard.quote %}
Advance Billing
Billing progress for {{ jobcard.jobcard_code }}
Advance invoices are tracked against this Jobcard and automatically deducted from the final PI.
{{ jobcard.quote.currency or 'INR' }}
Contract Taxable Value
{{ jobcard.quote.currency or 'INR' }} {{ advance_billing.contract_value|indian_amount }}
Advance Invoiced
{{ jobcard.quote.currency or 'INR' }} {{ advance_billing.invoiced|indian_amount }}
Advance In Process
{{ jobcard.quote.currency or 'INR' }} {{ advance_billing.pending|indian_amount }}
Balance Before Final Bill
{{ jobcard.quote.currency or 'INR' }} {{ advance_billing.balance|indian_amount }}
{% if advance_billing.rows %}
{% for row in advance_billing.rows %} {% endfor %}
#RequestedAmountStatusPIInvoiceNote
{{ row.id }} {{ row.requested_at.strftime('%d-%m-%Y') if row.requested_at else '-' }} {{ row.currency }} {{ row.requested_amount|indian_amount }} {{ row.status|replace('_',' ')|title }} {% if row.pi %}{{ row.pi.pi_no }}{% else %}-{% endif %} {% if row.invoice %}{{ row.invoice.invoice_no }}{% else %}-{% endif %} {{ row.note or '-' }}
{% endif %} {% if current_user.has_perm('proforma.request') and jobcard.status not in ['Ready For Billing','Completed','Sample Completed'] and advance_billing.balance > 0 %} {% if jobcard.quote.pi_request_status in ['Pending','Approval Pending'] %}
A PI request is already in progress. Complete that Finance cycle before requesting another advance.
{% else %}
{{ jobcard.quote.currency or 'INR' }}
{% endif %} {% elif jobcard.status in ['Ready For Billing','Completed'] and advance_billing.invoiced > 0 %}
Final billing adjustment: {{ jobcard.quote.currency or 'INR' }} {{ advance_billing.invoiced|indian_amount }} has already been advance billed and will be deducted automatically from the final PI.
{% endif %}
{% endif %}