diff --git a/.gitignore b/.gitignore index e2f0bc4..a45f7f5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ data/*.db data/*.sqlite3 .pytest_cache/ venv/ +app/modules/accounting/gst_operator_agent_runtime/.gst_exe_build_venv/ diff --git a/app/modules/accounting/templates/accounting/tally.html b/app/modules/accounting/templates/accounting/tally.html index 7447e42..cedd98a 100644 --- a/app/modules/accounting/templates/accounting/tally.html +++ b/app/modules/accounting/templates/accounting/tally.html @@ -127,214 +127,67 @@ {% if selected_client %} -
+
-

Accounting Storage

+

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.

- - {{ '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 available: 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 %}. Creating this FY again creates a new version and keeps the earlier version. -
- {% if selected_mirror_registration.mirror_local_path %} -
Registered Mirror Path
{{ selected_mirror_registration.mirror_local_path }}
- {% endif %} - {% if selected_mirror_registration.tally_data_local_path %} -
Tally Working Data Path
{{ selected_mirror_registration.tally_data_local_path }}
- {% endif %} -
+ FY {{ selected_financial_year }} · Mirror Ready {% 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. Existing canonical mirrors discovered by the Local Agent are adopted automatically; you do not need to recreate them. + 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_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 %} -
+
@@ -356,6 +216,39 @@
+
+ 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 %}
@@ -556,7 +449,7 @@ {% 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. + 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.
@@ -607,10 +500,19 @@