{% extends "ui/templates/base/layout.html" %} {% block content %} {% if synced %}
Tally accounting masters synchronized successfully.
{% endif %} {% if transactions_synced %}
Tally accounting transactions synchronized successfully.
{% endif %}

Tools · Accounting

Tally Accounting

Mirror Tally once into the client SQLite Accounting Mirror, then run accounting and audit analysis from the local .act database. Existing mapping, synchronization and write-back controls remain unchanged.

Refresh Tally Companies
{% if initialized %}
Client accounting storage was initialized successfully.
{% endif %} {% if mapped %}
Tally company mapping was saved successfully.
{% endif %} {% if unmapped %}
Tally company mapping was removed.
{% endif %} {% if command_error %}
{{ command_error }}
{% endif %} {% set agent = live_result.agent if live_result else None %} {% set tally = live_result.tally if live_result else None %} {% set accounting = live_result.accounting if live_result else None %}
ERP Local Agent
{{ 'Connected' if agent_online else 'Offline' }}
{{ storage_node.node_name if storage_node else 'No active branch agent' }}
Mapping Module
{{ 'Available' if agent and agent.tally_mapping_capability else ('Update Agent' if agent_online else 'Unavailable') }}
Agent {{ agent.version if agent and agent.version else '-' }}
TallyPrime
{{ 'Connected' if tally and tally.connected else ('Not connected' if tally else 'Not checked') }}
{{ tally.url if tally and tally.url else '127.0.0.1:9000' }}
Loaded Companies
{{ tally.company_count if tally else '-' }}
GUID-based discovery

Only clients assigned to the logged-in Partner in the active branch are shown.

{% if selected_client %}

Accounting Storage

{{ selected_client.client_name }}

{{ 'Initialized' if accounting and accounting.exists else 'Not initialized' }}
{% if accounting and accounting.exists %}
.act Database
{{ accounting.db_path }}
Schema Version
{{ accounting.metadata.schema_version or '2' }}
{% else %}
{% endif %}
{% if accounting and accounting.exists and tally and tally.connected %} {% set active_mappings = (accounting.mappings or []) | selectattr('is_active') | list %} {% if active_mappings %} {% set current_mapping = active_mappings[0] %} {% if selected_client and analysis_history %}

Recent Accounting Analysis

Stored in the client local SQLite accounting database.

{% for row in analysis_history %}{% endfor %}
RunAnalysisFY / PeriodCompleted
#{{ row.id }}{{ row.analysis_type|replace('_',' ')|title }}{{ row.financial_year }} · {{ row.period_from }} → {{ row.period_to }}{{ row.completed_at_utc }}Excel · PDF
{% endif %}

Tally Company Linked

{{ selected_client.client_name }} → {{ current_mapping.company_name }} {% if current_mapping.gstin %} · {{ current_mapping.gstin }}{% endif %}

Mapped by GUID

Mapping is a one-time setup. Open this panel only when you need to change the linked Tally company.

Change ERP Scope to Tally Company Mapping

The Tally GUID remains the permanent identifier. Company name and GSTIN are descriptive snapshots.

{% else %}

Link Tally Company

One-time setup. The Tally GUID is stored as the permanent identifier; company name and GSTIN are descriptive snapshots.

{% endif %} {% endif %} {% if accounting and accounting.exists %}

Mirror Tally to SQLite

Create or refresh the client Accounting Mirror from Tally using the high-speed read-only ODBC path. After this finishes, ERP analysis tools read the local SQLite .act data instead of repeatedly extracting from Tally.

Read-only export
Before export: open the mapped company in TallyPrime and set Tally's active period (Alt+F2) to cover the full period you want exported. The ODBC mirror reads Tally's active period; the ERP does not change Tally's period automatically.
{% if selected_mirror_registration %} Mirror registered: FY {{ selected_mirror_registration.financial_year }}{% if selected_mirror_registration.company_name %} · {{ selected_mirror_registration.company_name }}{% endif %}{% if selected_mirror_registration.last_synced_at_utc %} · last synced {{ selected_mirror_registration.last_synced_at_utc.strftime('%d-%m-%Y %H:%M') }}{% endif %}. Creating this FY again will ask for replacement confirmation. {% else %} No registered mirror for FY {{ selected_financial_year }}. Creating the mirror will register it to this client and financial year for Accounting/Audit tools. {% endif %}
Select an FY here to create or refresh that year's separate local mirror in the client's FY storage hierarchy.
{% endif %}

Advanced / Legacy Tally Controls

Manual master sync, transaction sync, active mappings and loaded-company diagnostics are retained for compatibility and troubleshooting. Normal work only requires Mirror Tally to SQLite above.

Optional
{% if accounting and accounting.exists and tally and tally.connected %}

Phase 3 · Accounting Master Sync

Select the company that is currently open/loaded in TallyPrime. The Local Agent verifies that the selected company is already mapped to this ERP client before reading masters.

Read-only
{% set last_sync = accounting.latest_master_sync if accounting else none %}
Latest Sync
{{ last_sync.completed_at_utc if last_sync and last_sync.completed_at_utc else 'Not synced yet' }}
Company
{{ last_sync.company_name if last_sync else '-' }}
Rows Stored
{{ last_sync.rows_processed if last_sync else 0 }}
Status
{{ last_sync.status|title if last_sync else '-' }}
Synced into the selected client's .act database: Groups, Ledgers, Voucher Types, Stock Groups, Stock Categories, Stock Items, Units, Cost Categories and Cost Centres. No voucher or transaction data is imported in Phase 3.
{% endif %} {% if accounting and accounting.exists and tally and tally.connected %}

Phase 4 · Accounting Transaction Sync

Read vouchers and their accounting allocations from the selected company currently open in TallyPrime. The selected company must already be mapped to this ERP client.

Read-only
{% set tx = accounting.latest_transaction_sync if accounting else none %}
Latest Sync
{{ tx.completed_at_utc if tx and tx.completed_at_utc else 'Not synced yet' }}
Period
{% if tx and tx.details %}{{ tx.details.date_from or '-' }} → {{ tx.details.date_to or '-' }}{% else %}-{% endif %}
Vouchers
{% if tx and tx.details and tx.details.counts %}{{ tx.details.counts.vouchers or 0 }}{% else %}0{% endif %}
Rows Stored
{{ tx.rows_processed if tx else 0 }}
Stored locally in the client's .act database: vouchers, ledger entries, inventory entries, bill allocations, cost-centre allocations and bank allocations. Raw voucher XML is preserved. Re-syncing a date range replaces only that company's vouchers in the selected range. No Tally data is modified.
{% endif %} {% if accounting and accounting.exists %}

Active Tally Mappings

Mappings remain valid across Tally company renames because the GUID is the persistent key.

{% if accounting.mappings %}
{% for mapping in accounting.mappings %} {% endfor %}
ERP Scope Tally Company GUID ERP GSTIN Tally GSTIN GSTIN Match Loaded Action
{% if mapping.registration_id %}
{{ mapping.registration_type_code or 'Registration' }} · {{ mapping.registration_number or mapping.registration_id }}
{{ mapping.registration_trade_name or mapping.registration_legal_name or selected_client.client_name }}
{% else %}
Client level
{{ selected_client.client_name }}
{% endif %}
{{ mapping.company_name }} {{ mapping.tally_guid }} {% if mapping.erp_gstins %} {% for gstin in mapping.erp_gstins %}
{{ gstin }}
{% endfor %} {% else %}-{% endif %}
{{ mapping.tally_gstin_display or '-' }} {% if mapping.gstin_match_status == 'matched' %} Matched {% elif mapping.gstin_match_status == 'mismatch' %} Mismatch {% elif mapping.gstin_match_status == 'tally_missing' %} Tally GSTIN unavailable {% elif mapping.gstin_match_status == 'erp_missing' %} ERP GSTIN unavailable {% else %} Unavailable {% endif %} {{ 'Yes' if mapping.currently_loaded else 'No' }}
{% else %}
No Tally company has been mapped for this client yet.
{% endif %}
{% endif %} {% if tally %}

Loaded Tally Companies

Read-only company discovery from the local TallyPrime instance.

{% if tally.companies %}
{% for company in tally.companies %} {% endfor %}
CompanyGUIDTally GSTIN
{{ company.name }} {{ company.guid or '-' }} {{ company.gstin or '-' }}
{% else %}
TallyPrime responded, but no loaded company was returned.
{% endif %}
{% endif %}
{% endif %}
Normal workflow: map the company once, mirror Tally to SQLite, then run analysis from the client .act database. Approved write-back tools remain controlled separately.
{% endblock %}