{% 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 %}

Client Financial-Year Tally Mirror

{{ selected_client.client_name }}

Select the financial year and the Tally data. ERP will validate the client identity, create the FY storage automatically, create/refresh the mirror, and update the Client/FY Mirror Registry.

{% if selected_mirror_registration %} FY {{ selected_financial_year }} · Mirror Ready {% else %} FY {{ selected_financial_year }} · Not Mirrored {% endif %}
{% if not agent_online %}
ERP Local Agent is offline for this branch. Start the Local Agent before creating or refreshing the mirror.
{% elif not tally or not tally.connected %}
TallyPrime is not connected. Open TallyPrime with the required company data and click Refresh Tally Companies.
{% else %}
{% if selected_mirror_registration %} Registered mirror: FY {{ selected_mirror_registration.financial_year }} · Version {{ selected_mirror_registration.version_no }}{% 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 %}. {% if selected_mirror_registration.mirror_local_path %}
{{ selected_mirror_registration.mirror_local_path }}
{% endif %} {% else %} No registered mirror for FY {{ selected_financial_year }}. The mirror will be created under the normal Client/FY directory rules and registered automatically. {% endif %}
{% endif %}
{% if selected_client and analysis_history %}

Recent Accounting Analysis

Stored against the registered Client/FY Accounting Mirror.

{% 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 %}

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
Legacy Storage / Mapping Setup

Retained for compatibility and troubleshooting. Normal mirroring above initializes storage and maintains the internal GUID mapping automatically.

{% if not accounting or not accounting.exists %}
{% endif %} {% if tally and tally.connected %}
{% endif %}
{% 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: select Client → Financial Year → Tally Data. ERP validates identity, creates/refreshes the Client/FY mirror, and updates the Mirror Registry automatically. Approved write-back tools remain controlled separately.
{% endblock %}