Add adaptive paced Tally extraction for cash payment review

This commit is contained in:
A R R R Associates
2026-09-03 23:37:14 +05:30
parent 3a4370d35e
commit 247c545d20
5 changed files with 253 additions and 159 deletions
+4 -1
View File
@@ -195,8 +195,11 @@ def cash_payment_review(
"cash_limit": float(setting.cash_limit),
"split_window_days": int(setting.split_window_days),
"near_limit_percent": float(setting.near_limit_percent),
"tally_batch_days": 7,
"tally_pause_seconds": 1.5,
"tally_retry_pause_seconds": 3.0,
},
timeout_seconds=300,
timeout_seconds=900,
)
if result.get("ok"):
review = (result.get("result") or {}).get("cash_payment_review")
@@ -64,7 +64,7 @@
{% if review %}
<section class="space-y-4">
{% if review.safe_paced_mode %}
<div class="rounded-2xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-800">Completed in safe-paced mode using {{ review.tally_request_batches or 0 }} Tally voucher batch(es), with approximately {{ review.tally_pause_ms or 0 }} ms pause between batches.</div>
<div class="rounded-2xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-800">Completed in adaptive safe-paced mode using {{ review.tally_request_batches or 0 }} successful voucher batch(es) across {{ review.tally_request_count or 0 }} Tally request(s), with {{ review.tally_retry_count or 0 }} retry/retries and {{ review.tally_fallback_batches or 0 }} adaptive fallback(s). The agent pauses approximately {{ review.tally_pause_ms or 0 }} ms between Tally calls.</div>
{% endif %}
<div class="grid gap-4 md:grid-cols-2 xl:grid-cols-5">
{% for label, value in [('Vouchers reviewed', review.summary.vouchers_reviewed), ('Cash payments', review.summary.cash_payment_vouchers), ('Single-voucher exceptions', review.summary.single_voucher_exceptions), ('Same-day exceptions', review.summary.same_day_exceptions), ('Possible split patterns', review.summary.possible_split_patterns)] %}
@@ -133,7 +133,7 @@
<div class="mt-4 grid grid-cols-4 gap-2 text-center text-[11px] font-semibold uppercase tracking-wide text-slate-400">
<span>Agent</span><span>Tally</span><span>Vouchers</span><span>Analysis</span>
</div>
<p class="mt-4 text-xs text-slate-500">Tally is deliberately read in smaller monthly batches with pauses between requests. Please keep TallyPrime and the ERP Local Agent open until this finishes.</p>
<p class="mt-4 text-xs text-slate-500">Tally is deliberately read in 7-day batches with pauses between requests. If a batch times out, the agent automatically retries and reduces it to 3-day and then 1-day batches. Please keep TallyPrime and the ERP Local Agent open until this finishes.</p>
</div>
</div>
<script>
@@ -149,8 +149,9 @@
[8, 'Sending the review request to the ERP Local Agent…'],
[18, 'Connecting to TallyPrime on the workstation…'],
[32, 'Reading cash and ledger masters…'],
[48, 'Reading vouchers in safe monthly batches…'],
[64, 'Continuing voucher scan with controlled pauses…'],
[42, 'Reading vouchers in safe 7-day batches…'],
[58, 'Continuing voucher extraction with 1.5 second pauses…'],
[70, 'Large batches automatically fall back to 3-day or 1-day reads if needed…'],
[78, 'Checking same-day cash payment aggregation…'],
[88, 'Checking possible split-payment patterns…'],
[94, 'Preparing the compliance report…']
@@ -169,7 +170,7 @@
bar.style.width = stage[0] + '%';
pct.textContent = stage[0] + '%';
text.textContent = stage[1];
if (i < stages.length) window.setTimeout(advance, i < 4 ? 1300 : 2200);
if (i < stages.length) window.setTimeout(advance, i < 4 ? 1800 : 4500);
};
advance();
});