fix build config & fixes for invoice FA1/FA2/FA3

This commit is contained in:
Michał Chudy
2025-12-03 13:42:56 +01:00
parent b9972746aa
commit 1912b5b48d
68 changed files with 1144 additions and 227 deletions

View File

@@ -1,16 +1,24 @@
import { Content } from 'pdfmake/interfaces';
import { createHeader, createLabelText, formatText, getTable } from '../../../shared/PDF-functions';
import {
createHeader,
createLabelText,
formatText,
getTable,
getValue,
hasValue,
} from '../../../shared/PDF-functions';
import FormatTyp from '../../../shared/enums/common.enum';
import { Podmiot1 } from '../../types/fa1.types';
import { generatePodmiotAdres } from './PodmiotAdres';
import { generateDaneIdentyfikacyjne } from './PodmiotDaneIdentyfikacyjne';
import { generateDaneKontaktowe } from './PodmiotDaneKontaktowe';
import { TAXPAYER_STATUS } from '../../../shared/consts/const';
export function generatePodmiot1(podmiot1: Podmiot1): Content[] {
const result: Content[] = createHeader('Sprzedawca');
result.push(
createLabelText('NrEORI: ', podmiot1.NrEORI),
createLabelText('Numer EORI: ', podmiot1.NrEORI),
createLabelText('Prefiks VAT: ', podmiot1.PrefiksPodatnika)
);
if (podmiot1.DaneIdentyfikacyjne) {
@@ -30,10 +38,11 @@ export function generatePodmiot1(podmiot1: Podmiot1): Content[] {
formatText('Dane kontaktowe', [FormatTyp.Label, FormatTyp.LabelMargin]),
...generateDaneKontaktowe(podmiot1.Email, getTable(podmiot1.Telefon))
);
}
if (hasValue(podmiot1.StatusInfoPodatnika)) {
const statusInfo: string = TAXPAYER_STATUS[getValue(podmiot1.StatusInfoPodatnika)!];
result.push(createLabelText('Status podatnika: ', podmiot1.StatusInfoPodatnika));
} else if (podmiot1.StatusInfoPodatnika) {
result.push(createLabelText('Status podatnika: ', podmiot1.StatusInfoPodatnika));
result.push(createLabelText('Status podatnika: ', statusInfo));
}
return result;
}