fix(export): show approver as signatory on PDF and XLSX reports

The left signature block on generated PO documents (PDF and XLSX) was
showing the submitter's name as the authorized signatory. The signatory
should be the manager who approved the PO, since they are the one
authorizing the expenditure on behalf of the company.

The approvedBy name was already extracted from the APPROVED / APPROVED_WITH_NOTE
action at the top of the export route — it just wasn't being used in the
signature block. Now both the PDF and XLSX templates use approvedBy for
the left sig block, falling back to the submitter only if the PO has not
yet been approved (e.g. when exporting a draft).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hardik 2026-05-16 15:57:39 +05:30
parent 4c1a41fe61
commit b2bfa63f61

View file

@ -355,8 +355,8 @@ export async function GET(request: NextRequest, { params }: Props) {
ws.getRow(SIG_ROW + 1).height = 14; ws.getRow(SIG_ROW + 1).height = 14;
ws.getRow(SIG_ROW + 2).height = 14; ws.getRow(SIG_ROW + 2).height = 14;
// Left sig block (submitter) // Left sig block (approver — the manager who authorized the PO)
sc(SIG_ROW, 1, po.submitter.name, { font: fBold, border: { top: thin(), left: thin(), right: thin() }, align: alignC }); sc(SIG_ROW, 1, approvedBy || po.submitter.name, { font: fBold, border: { top: thin(), left: thin(), right: thin() }, align: alignC });
ws.mergeCells(`A${SIG_ROW}:D${SIG_ROW}`); ws.mergeCells(`A${SIG_ROW}:D${SIG_ROW}`);
sc(SIG_ROW + 1, 1, "Authorized Signatory & Stamp", { font: fSmall, border: { left: thin(), right: thin() }, align: alignC }); sc(SIG_ROW + 1, 1, "Authorized Signatory & Stamp", { font: fSmall, border: { left: thin(), right: thin() }, align: alignC });
ws.mergeCells(`A${SIG_ROW + 1}:D${SIG_ROW + 1}`); ws.mergeCells(`A${SIG_ROW + 1}:D${SIG_ROW + 1}`);
@ -636,7 +636,7 @@ export async function GET(request: NextRequest, { params }: Props) {
<!-- ── Signatures ────────────────────────────────────────────── --> <!-- ── Signatures ────────────────────────────────────────────── -->
<div class="sig"> <div class="sig">
<div class="sig-box"> <div class="sig-box">
<div class="sig-name">${po.submitter.name}</div> <div class="sig-name">${approvedBy || po.submitter.name}</div>
<div> <div>
<div class="sig-sub">Authorized Signatory &amp; Stamp</div> <div class="sig-sub">Authorized Signatory &amp; Stamp</div>
<div class="sig-sub">For, Pelagia Marine Services Pvt. Ltd.</div> <div class="sig-sub">For, Pelagia Marine Services Pvt. Ltd.</div>