{% extends 'base.html' %} {% block content %}

Ledger - {{ customer.name }}

Record Payment

Current Balance

{{ balance|currency }}

{% if balance > 0 %} Customer owes {{ balance|currency }} {% else %} Customer has credit of {{ (balance * -1)|currency }} {% endif %}

{% if opening_balance_amount and opening_balance_amount > 0 %}

Opening Balance: {{ opening_balance_amount|currency }} ({% if opening_balance_type == 'debit' %}Debit - Customer owes{% else %}Credit - We owe customer{% endif %})

{% endif %}

Transaction History

{% if entries %} {% set running_balance = opening_balance or 0 %} {% if opening_balance_amount and opening_balance_amount > 0 %} {% endif %} {% for entry in entries %} {% set debit_amount = entry.debit or 0 %} {% set credit_amount = entry.credit or 0 %} {% set running_balance = running_balance + debit_amount - credit_amount %} {% endfor %}
Date Description Debit (Amount Owed) Credit (Payment) Balance Actions
{{ customer.created_at.date() if customer.created_at else 'N/A' }} Opening Balance ({{ opening_balance_type|upper }}) {% if opening_balance_type == 'debit' %}{{ opening_balance_amount|currency }}{% else %}-{% endif %} {% if opening_balance_type == 'credit' %}{{ opening_balance_amount|currency }}{% else %}-{% endif %} {{ running_balance|currency }}
{{ entry.date|date_format }} {{ entry.description }} {% if entry.debit and entry.debit > 0 %} {{ entry.debit|currency }} {% else %} - {% endif %} {% if entry.credit and entry.credit > 0 %} {{ entry.credit|currency }} {% else %} - {% endif %} {{ running_balance|currency }} Edit
Final Balance {{ balance|currency }}
{% else %}

No transactions found in this ledger.

{% endif %}
{% endblock %}