fix(financeiro): corrige exibicao e calculo do valor pago no recibo pdf
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m15s Details

This commit is contained in:
Sidney 2026-06-07 16:18:07 -03:00
parent b38a7abf35
commit 83720b0258
1 changed files with 3 additions and 2 deletions

View File

@ -555,7 +555,7 @@ export const pdfService = {
body: payments.map(p => [ body: payments.map(p => [
p.description || (p.type === 'registration' ? 'Matrícula' : 'Mensalidade'), p.description || (p.type === 'registration' ? 'Matrícula' : 'Mensalidade'),
p.dueDate ? p.dueDate.split('T')[0].split('-').reverse().join('/') : '', p.dueDate ? p.dueDate.split('T')[0].split('-').reverse().join('/') : '',
`R$ ${p.amount.toLocaleString('pt-BR', { minimumFractionDigits: 2 })}`, `R$ ${(Number((p as any).valor_pago) || Number(p.amount) || 0).toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`,
p.status === 'paid' ? 'Pago' : p.status === 'overdue' ? 'Atrasado' : 'Pendente' p.status === 'paid' ? 'Pago' : p.status === 'overdue' ? 'Atrasado' : 'Pendente'
]), ]),
headStyles: { fillColor: [0, 0, 0] } headStyles: { fillColor: [0, 0, 0] }
@ -594,7 +594,8 @@ export const pdfService = {
doc.setTextColor(0); doc.setTextColor(0);
doc.text(`Recebemos de: ${student.name}`, 20, 70); doc.text(`Recebemos de: ${student.name}`, 20, 70);
doc.text(`CPF: ${student.cpf || '---'}`, 20, 76); doc.text(`CPF: ${student.cpf || '---'}`, 20, 76);
doc.text(`A quantia de: R$ ${payment.amount.toLocaleString('pt-BR', { minimumFractionDigits: 2 })}`, 20, 85); const valNum = Number((payment as any).valor_pago) || Number(payment.amount) || 0;
doc.text(`A quantia de: R$ ${valNum.toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`, 20, 85);
const typeLabel = payment.type === 'registration' ? 'Taxa de Matrícula' : const typeLabel = payment.type === 'registration' ? 'Taxa de Matrícula' :
payment.type === 'monthly' ? 'Mensalidade do Curso' : 'Outros Serviços'; payment.type === 'monthly' ? 'Mensalidade do Curso' : 'Outros Serviços';