diff --git a/app/modules/accounting/templates/accounting/tally.html b/app/modules/accounting/templates/accounting/tally.html index 5b6f35e..c4cf185 100644 --- a/app/modules/accounting/templates/accounting/tally.html +++ b/app/modules/accounting/templates/accounting/tally.html @@ -166,13 +166,30 @@ {% if accounting and accounting.exists and tally and tally.connected %} -
-
-

Map ERP Scope to Tally Company

-

The Tally GUID is stored as the permanent identifier. Company name and GSTIN are retained as descriptive snapshots.

-
+ {% set active_mappings = (accounting.mappings or []) | selectattr('is_active') | list %} + {% if active_mappings %} + {% set current_mapping = active_mappings[0] %} +
+ +
+
+

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.

+
-
+ @@ -211,12 +228,64 @@ +
+ +
+
+
+
+ {% 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 %}
@@ -474,7 +543,7 @@ const clientId = {{ selected_client.id if selected_client else 'null' }}; if (!clientId) return; const box=document.getElementById('fullExportProgress'); if(!box) return; - let completedReloaded=false; + let pollTimer=null; function setText(id,v){const e=document.getElementById(id);if(e)e.textContent=String(v??'');} async function pollFullExport(){ try{ @@ -486,11 +555,15 @@ const rows=j.rows||((j.mirror||{}).counts)||{}; setText('fullExportLedgers',rows.ledger_master||0); setText('fullExportVouchers',rows.voucher||rows.voucher_header||0); setText('fullExportLines',rows.voucher_ledger_entry||rows.voucher_ledger||0); setText('fullExportInventory',rows.inventory_movement||rows.inventory||0); const paths=[]; if(j.mirror_db_path)paths.push('Mirror: '+j.mirror_db_path); if(j.accounting_db_path)paths.push('Client DB: '+j.accounting_db_path); setText('fullExportPaths',paths.join(' • ')); const er=document.getElementById('fullExportError'); if(j.error){er.textContent=j.error;er.classList.remove('hidden')}else{er.classList.add('hidden')} - const btn=document.getElementById('fullExportButton'); if(btn)btn.disabled=['queued','running'].includes(String(j.status||'').toLowerCase()); - if(String(j.status||'').toLowerCase()==='completed'&&!completedReloaded){completedReloaded=true;setTimeout(()=>location.href='/tools/tally?client_id='+clientId+'&refresh=1',1800)} + const status=String(j.status||'').toLowerCase(); + const btn=document.getElementById('fullExportButton'); if(btn)btn.disabled=['queued','running'].includes(status); + if(['completed','failed','cancelled','paused'].includes(status)){ + if(pollTimer){clearInterval(pollTimer);pollTimer=null;} + } }catch(e){} } - pollFullExport(); setInterval(pollFullExport,1500); + pollTimer=setInterval(pollFullExport,1500); + pollFullExport(); })(); {% endblock %}