{% extends "ui/templates/base/layout.html" %} {% block content %}

Accounting · Phase 21A

Opening Balance Review & Correction

Compare previous-year Tally closing balances with current-year opening balances for Ledgers and Stock Items. Safe selected differences can be applied directly to current-year Tally masters and are re-read for verification.

{% if message %}
{{ message }}
{% endif %} {% if error %}
{{ error }}
{% endif %}
{% if selected_client %}

Phase 21A v1 intentionally requires separate previous-year and current-year Tally companies. This avoids treating a current company's latest closing balance as the prior-year audited closing.

{% endif %}
{% if selected_client and runs %}

Comparison Runs

{% for run in runs %} {% endfor %}
RunPrevious YearCurrent YearLedgersStock Items
#{{ run.id }} {{ run.previous_company_name }} {{ run.current_company_name }} {{ run.ledger_count }} {{ run.stock_item_count }} Open
{% endif %} {% if selected_run %}
Direct Tally correction control: only matched current-year masters with a genuine opening difference are eligible. Missing/new masters, ambiguous matches and stock unit differences are never changed automatically. Every applied row is re-read from Tally and marked Verified or Failed.
{% if tab=='ledgers' %}

Ledger Opening Comparison

{{ selected_run.previous_company_name }} closing → {{ selected_run.current_company_name }} opening

{% for item in ledgers %} {% else %}{% endfor %}
ApplyPrevious LedgerPY ClosingCurrent LedgerCY OpeningDifferenceStatusCorrection
{% if item.match_status=='difference' %}{% else %}—{% endif %}
{{ item.previous_name or '—' }}
{{ item.previous_group }}
{{ '%.2f'|format(item.previous_closing_balance) }}
{{ item.current_name or '—' }}
{{ item.current_group }}
{{ '%.2f'|format(item.current_opening_balance) }} {{ '%.2f'|format(item.difference) }} {{ item.match_status|replace('_',' ')|title }}{% if item.match_method %}
{{ item.match_method|replace('_',' ')|title }} · {{ item.confidence }}%
{% endif %}
{{ item.correction_status|replace('_',' ')|title }}{% if item.correction_note %}
{{ item.correction_note }}
{% endif %}
No ledger rows for this filter.
{% else %}

Stock Item Opening Comparison

Quantity, unit and value are checked separately.

{% for item in stocks %} {% else %}{% endfor %}
ApplyPrevious Stock ItemPY ClosingCurrent Stock ItemCY OpeningDifferenceStatusCorrection
{% if item.match_status in ['quantity_difference','value_difference','quantity_and_value_difference'] and item.previous_unit|lower == item.current_unit|lower %}{% else %}—{% endif %}
{{ item.previous_name or '—' }}
{{ item.previous_group }} · HSN {{ item.previous_hsn or '-' }}
{{ item.previous_closing_qty }} {{ item.previous_unit }}
₹{{ '%.2f'|format(item.previous_closing_value) }}
{{ item.current_name or '—' }}
{{ item.current_group }} · HSN {{ item.current_hsn or '-' }}
{{ item.current_opening_qty }} {{ item.current_unit }}
₹{{ '%.2f'|format(item.current_opening_value) }}
Qty {{ item.quantity_difference }}
Value ₹{{ '%.2f'|format(item.value_difference) }}
{{ item.match_status|replace('_',' ')|title }}{% if item.match_method %}
{{ item.match_method|replace('_',' ')|title }} · {{ item.confidence }}%
{% endif %}
{{ item.correction_status|replace('_',' ')|title }}{% if item.correction_note %}
{{ item.correction_note }}
{% endif %}
No stock rows for this filter.
{% endif %}

Apply selected safe corrections directly to current-year Tally

The Local Agent preflights the current opening against this comparison, applies only unchanged masters, and re-reads each master afterward. Type the confirmation phrase exactly.

{% endif %}
{% endblock %}