Add TDS review drilldowns and exclude capital accounts

This commit is contained in:
A R R R Associates
2026-09-06 21:12:14 +05:30
parent cbe594e73b
commit f211d9e6a8
4 changed files with 81 additions and 7 deletions
@@ -6,7 +6,9 @@
<div class="rounded-xl bg-white p-4 shadow-soft">
<div class="text-xs uppercase text-slate-500">{{ k|replace('_',' ') }}</div>
<div class="mt-1 text-xl font-semibold">{{ v }}</div>
{% if k == 'tds_not_deducted' and v %}
{% if k == 'candidate_transactions' and v %}
<button type="button" data-tds-filter-status="" class="mt-2 text-xs font-semibold text-brand-700 underline underline-offset-2">View all transactions</button>
{% elif k == 'tds_not_deducted' and v %}
<button type="button" data-tds-filter-status="TDS NOT DEDUCTED" class="mt-2 text-xs font-semibold text-brand-700 underline underline-offset-2">View non-deduction</button>
{% elif k == 'short_deduction' and v %}
<button type="button" data-tds-filter-status="SHORT DEDUCTION" class="mt-2 text-xs font-semibold text-brand-700 underline underline-offset-2">View short deduction</button>
@@ -42,6 +44,12 @@
<td class="p-3 text-right">{{ row.short_deduction }}</td>
<td class="p-3">
<div class="flex flex-wrap gap-x-3 gap-y-1">
<button type="button"
data-tds-filter-rule="{{ row.rule_code }}"
data-tds-filter-status=""
class="text-xs font-semibold text-brand-700 underline underline-offset-2">
All ({{ row.transactions }})
</button>
{% if row.tds_not_deducted %}
<button type="button"
data-tds-filter-rule="{{ row.rule_code }}"
@@ -58,6 +66,22 @@
Short ({{ row.short_deduction }})
</button>
{% endif %}
{% if row.ok %}
<button type="button"
data-tds-filter-rule="{{ row.rule_code }}"
data-tds-filter-status="OK"
class="text-xs font-semibold text-brand-700 underline underline-offset-2">
Deducted / OK ({{ row.ok }})
</button>
{% endif %}
{% if row.below_threshold %}
<button type="button"
data-tds-filter-rule="{{ row.rule_code }}"
data-tds-filter-status="BELOW / OUTSIDE THRESHOLD"
class="text-xs font-semibold text-brand-700 underline underline-offset-2">
Below threshold ({{ row.below_threshold }})
</button>
{% endif %}
</div>
</td>
</tr>
@@ -73,7 +97,7 @@
</div>
<button type="button" id="tdsClearFilter" class="hidden rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-semibold text-slate-700">Show all</button>
</div>
<table id="tdsTransactionTable" class="min-w-full text-sm"><thead class="bg-slate-50"><tr><th class="p-3 text-left">Date</th><th class="p-3 text-left">Party</th><th class="p-3 text-left">Ledger / Rule</th><th class="p-3 text-right">Base</th><th class="p-3 text-right">Expected</th><th class="p-3 text-right">Actual</th><th class="p-3 text-right">Liability</th><th class="p-3 text-left">Status</th></tr></thead><tbody>{% for x in review.transactions %}<tr class="border-t" data-tds-status="{{ x.status }}" data-tds-rule="{{ x.rule_code }}"><td class="p-3">{{ x.date }}</td><td class="p-3">{{ x.party }}</td><td class="p-3">{{ x.nature_ledger }}<div class="text-xs text-slate-500">{{ x.rule_name }} · {{ x.legacy_section }}</div></td><td class="p-3 text-right">{{ '%.2f'|format(x.taxable_base) }}</td><td class="p-3 text-right">{{ '%.2f'|format(x.expected_tds) }}</td><td class="p-3 text-right">{{ '%.2f'|format(x.actual_tds) }}</td><td class="p-3 text-right font-semibold">{{ '%.2f'|format(x.liability) }}</td><td class="p-3">{{ x.status }}</td></tr>{% endfor %}</tbody></table></div>{% endif %}{% if history %}<div class="rounded-2xl bg-white p-5 shadow-soft"><h2 class="font-semibold">TDS Analysis History</h2><div class="mt-3 overflow-x-auto"><table class="min-w-full text-sm"><tbody>{% for row in history %}<tr class="border-t"><td class="p-2">#{{ row.id }}</td><td class="p-2">{{ row.financial_year }}</td><td class="p-2">{{ row.period_from }} → {{ row.period_to }}</td><td class="p-2 text-right"><a class="font-semibold text-brand-700" href="/tools/tally/analysis/{{ row.id }}/download?client_id={{ selected_client.id }}&financial_year={{ row.financial_year }}&format=xlsx">Excel</a> · <a class="font-semibold text-brand-700" href="/tools/tally/analysis/{{ row.id }}/download?client_id={{ selected_client.id }}&financial_year={{ row.financial_year }}&format=pdf">PDF</a></td></tr>{% endfor %}</tbody></table></div></div>{% endif %}</div>
<table id="tdsTransactionTable" class="min-w-full text-sm"><thead class="bg-slate-50"><tr><th class="p-3 text-left">Date</th><th class="p-3 text-left">Party</th><th class="p-3 text-left">Ledger / Rule</th><th class="p-3 text-right">Base</th><th class="p-3 text-right">Expected</th><th class="p-3 text-right">Actual</th><th class="p-3 text-right">Liability</th><th class="p-3 text-left">Status</th></tr></thead><tbody>{% for x in review.transactions %}<tr class="border-t" data-tds-status="{{ x.status }}" data-tds-rule="{{ x.rule_code }}"><td class="p-3">{{ x.date }}</td><td class="p-3">{{ x.party }}</td><td class="p-3">{{ x.nature_ledger }}<div class="text-xs text-slate-500">{{ x.rule_name }} · {{ x.legacy_section }}{% if x.parent_group %} · Group: {{ x.parent_group }}{% endif %}</div></td><td class="p-3 text-right">{{ '%.2f'|format(x.taxable_base) }}</td><td class="p-3 text-right">{{ '%.2f'|format(x.expected_tds) }}</td><td class="p-3 text-right">{{ '%.2f'|format(x.actual_tds) }}</td><td class="p-3 text-right font-semibold">{{ '%.2f'|format(x.liability) }}</td><td class="p-3">{{ x.status }}</td></tr>{% endfor %}</tbody></table></div>{% endif %}{% if history %}<div class="rounded-2xl bg-white p-5 shadow-soft"><h2 class="font-semibold">TDS Analysis History</h2><div class="mt-3 overflow-x-auto"><table class="min-w-full text-sm"><tbody>{% for row in history %}<tr class="border-t"><td class="p-2">#{{ row.id }}</td><td class="p-2">{{ row.financial_year }}</td><td class="p-2">{{ row.period_from }} → {{ row.period_to }}</td><td class="p-2 text-right"><a class="font-semibold text-brand-700" href="/tools/tally/analysis/{{ row.id }}/download?client_id={{ selected_client.id }}&financial_year={{ row.financial_year }}&format=xlsx">Excel</a> · <a class="font-semibold text-brand-700" href="/tools/tally/analysis/{{ row.id }}/download?client_id={{ selected_client.id }}&financial_year={{ row.financial_year }}&format=pdf">PDF</a></td></tr>{% endfor %}</tbody></table></div></div>{% endif %}</div>
{% if review %}
<script>
@@ -96,7 +120,13 @@ document.addEventListener("DOMContentLoaded", function () {
});
const pieces = [];
if (status) pieces.push(status === "TDS NOT DEDUCTED" ? "non-deduction" : "short deduction");
if (status) {
if (status === "TDS NOT DEDUCTED") pieces.push("non-deduction");
else if (status === "SHORT DEDUCTION") pieces.push("short deduction");
else if (status === "OK") pieces.push("deducted / OK");
else if (status === "BELOW / OUTSIDE THRESHOLD") pieces.push("below / outside threshold");
else pieces.push(status.toLowerCase());
}
if (rule) pieces.push("selected category");
label.textContent = "Showing " + visible + " transaction(s)" + (pieces.length ? " for " + pieces.join(" · ") + "." : ".");
clear.classList.toggle("hidden", !status && !rule);