form 16 renaming done

This commit is contained in:
Aaditya Jaiswal 2026-04-14 20:12:41 +05:30
parent 872bda4731
commit 44a19bbfea

View File

@ -709,8 +709,7 @@ function sanitizeForm16PdfCertSegment(text: string): string {
/**
* PDF file name after successful 26AS match + credit note:
* [TAN]_[AY]_[Quarter]_[Name and address of deductor]_[Certificate][_Vn].pdf
* Revised submissions (version > 1) append _V2, _V3, ...
* [TAN]_[Assessment Year]_[Quarter]_[Name and address of deductor]_[Certificate].pdf
*/
function buildForm16CreditNoteSuccessPdfFileName(sub: Form16aSubmission): string {
const tan = normalizeTanNumber(String(sub.tanNumber || ''))
@ -730,13 +729,12 @@ function buildForm16CreditNoteSuccessPdfFileName(sub: Form16aSubmission): string
if (!nameAddr) nameAddr = String(sub.deductorName || 'Deductor').trim();
let deductorSan = sanitizeForm16PdfDeductorSegment(nameAddr, 150);
const certSan = sanitizeForm16PdfCertSegment(String(sub.form16aNumber || ''));
const ver = typeof sub.version === 'number' && sub.version > 1 ? `_V${sub.version}` : '';
let base = `${tan}_${ay}_${q}_${deductorSan}_${certSan}${ver}`;
let base = `${tan}_${ay}_${q}_${deductorSan}_${certSan}`;
if (base.length > 220) {
const over = base.length - 220;
const shorter = Math.max(20, deductorSan.length - over - 5);
deductorSan = sanitizeForm16PdfDeductorSegment(nameAddr, shorter);
base = `${tan}_${ay}_${q}_${deductorSan}_${certSan}${ver}`;
base = `${tan}_${ay}_${q}_${deductorSan}_${certSan}`;
}
return `${base}.pdf`;
}