{% extends "pos/base.html" %} {% load humanize %} {% block title %}Company Ledger{% if cust_name %} — {{ cust_name }}{% endif %}{% endblock %} {% block stylesheets %} {% endblock %} {% block content %}
{% for m in messages %}
{{ m }}
{% endfor %} {# ── Header ── #}
Account Ledger{% if cust_name %} — {{ cust_name }}{% endif %}
Corporate / Insurance / Credit company statements
{% if cust_id %}
PDF {% if has_openpyxl %} Excel {% endif %}
{% endif %}
{# ── Filter bar ── #}
{# Company Type Radio #}
{# Company search #}
{# Date range #}
{# Buttons #}
{% if cust_id and cust_obj %} {# ── Stats ── #}
{{ total_billed|floatformat:0|intcomma }}
Total Billed
{{ total_received|floatformat:0|intcomma }}
Total Received
{{ total_outstanding|floatformat:0|intcomma }}
Outstanding
{{ job_rows|length }}
Total Jobs
{# ── View tabs ── #}
{% if all_dates %}All dates{% else %}{{ date_from }} to {{ date_to }}{% endif %}
Transaction Ledger — {{ cust_name }}
{% for row in txn_rows %} {% empty %} {% endfor %} {% if txn_rows %} {% endif %}
Date Reference Vehicle Debit (Billed) Credit (Received) Balance Action
{{ row.date|date:"d-M-y" }} {{ row.ref }} {% if row.type == 'invoice' and row.job %}
{{ row.job.vehicle.make }} {{ row.job.vehicle.model }}
{% endif %}
{{ row.vehicle|default:"" }} {% if row.debit %}{{ row.debit|floatformat:0|intcomma }}{% else %}—{% endif %} {% if row.credit %}{{ row.credit|floatformat:0|intcomma }}{% else %}—{% endif %} {{ row.balance|floatformat:0|intcomma }} {% if row.type == 'invoice' and row.job %} View {% elif row.type == 'payment' and row.pay %} {% endif %}
No transactions in this period.
CLOSING BALANCE {{ total_billed|floatformat:0|intcomma }} {{ total_received|floatformat:0|intcomma }} {{ total_outstanding|floatformat:0|intcomma }}
Job-wise Ledger — {{ cust_name }}
{% for row in job_rows %} {# Sub-rows: payments for this job #} {% if row.payments %} {% for p in row.payments %} {% endfor %} {% endif %} {% empty %} {% endfor %} {% if job_rows %} {% endif %}
Job # Date Vehicle Invoice # Billed Cust.Share Ins.Share Received Outstanding Status Actions
#{{ row.job.job_no }} {{ row.job.job_date|date:"d-M-y" }} {{ row.job.vehicle.reg_no }}
{{ row.job.vehicle.make }} {{ row.job.vehicle.model }}
{{ row.job.invoice_no|default:"—" }} {{ row.billed|floatformat:0|intcomma }} {% if row.dep_per %} {{ row.cust_share|floatformat:0|intcomma }}
{{ row.dep_per|floatformat:1 }}%
{% else %}—{% endif %}
{% if row.dep_per %}{{ row.ins_share|floatformat:0|intcomma }}{% else %}—{% endif %} {{ row.paid|floatformat:0|intcomma }} {{ row.outstanding|floatformat:0|intcomma }} {{ row.status }} View {% if row.outstanding > 0 %} Pay {% endif %}
Receipt #{{ p.description }} — {{ p.transaction_date|date:"d-M-y" }} {{ p.amount_transaction|floatformat:0|intcomma }}
No jobs in this period.
TOTAL {{ total_billed|floatformat:0|intcomma }} {{ total_received|floatformat:0|intcomma }} {{ total_outstanding|floatformat:0|intcomma }}
{% elif cust_id == 0 %} {# No company selected yet #}
Search for a company above to view their ledger

Select company type, search by name, then click Search.

{% endif %}
{% endblock %} {% block javascripts %} {% endblock %}