97 lines
3.0 KiB
TypeScript
97 lines
3.0 KiB
TypeScript
|
/**
|
||
|
* EN16931-compliant metadata interface for EInvoice
|
||
|
* Contains all additional fields required for full standards compliance
|
||
|
*/
|
||
|
|
||
|
import type { business } from '@tsclass/tsclass';
|
||
|
import type { InvoiceFormat } from './common.js';
|
||
|
|
||
|
/**
|
||
|
* Extended metadata for EN16931 compliance
|
||
|
*/
|
||
|
export interface IEInvoiceMetadata {
|
||
|
// Format identification
|
||
|
format?: InvoiceFormat;
|
||
|
version?: string;
|
||
|
profile?: string;
|
||
|
customizationId?: string;
|
||
|
|
||
|
// EN16931 Business Terms
|
||
|
vatAccountingCurrency?: string; // BT-6
|
||
|
documentTypeCode?: string; // BT-3
|
||
|
paymentMeansCode?: string; // BT-81
|
||
|
paidAmount?: number; // BT-113
|
||
|
amountDue?: number; // BT-115
|
||
|
|
||
|
// Delivery information (BG-13)
|
||
|
deliveryAddress?: {
|
||
|
streetName?: string;
|
||
|
houseNumber?: string;
|
||
|
city?: string;
|
||
|
postalCode?: string;
|
||
|
countryCode?: string; // BT-80
|
||
|
countrySubdivision?: string;
|
||
|
};
|
||
|
|
||
|
// Payment information (BG-16)
|
||
|
paymentAccount?: {
|
||
|
iban?: string; // BT-84
|
||
|
accountName?: string; // BT-85
|
||
|
bankId?: string; // BT-86
|
||
|
};
|
||
|
|
||
|
// Allowances and charges (BG-20, BG-21)
|
||
|
allowances?: Array<{
|
||
|
amount: number; // BT-92
|
||
|
baseAmount?: number; // BT-93
|
||
|
percentage?: number; // BT-94
|
||
|
vatCategoryCode?: string; // BT-95
|
||
|
vatRate?: number; // BT-96
|
||
|
reason?: string; // BT-97
|
||
|
reasonCode?: string; // BT-98
|
||
|
}>;
|
||
|
|
||
|
charges?: Array<{
|
||
|
amount: number; // BT-99
|
||
|
baseAmount?: number; // BT-100
|
||
|
percentage?: number; // BT-101
|
||
|
vatCategoryCode?: string; // BT-102
|
||
|
vatRate?: number; // BT-103
|
||
|
reason?: string; // BT-104
|
||
|
reasonCode?: string; // BT-105
|
||
|
}>;
|
||
|
|
||
|
// Extensions for specific standards
|
||
|
extensions?: Record<string, any>;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Extended item metadata for EN16931 compliance
|
||
|
*/
|
||
|
export interface IItemMetadata {
|
||
|
vatCategoryCode?: string; // BT-151
|
||
|
priceBaseQuantity?: number; // BT-149
|
||
|
exemptionReason?: string; // BT-120 (for exempt categories)
|
||
|
originCountryCode?: string; // BT-159
|
||
|
commodityCode?: string; // BT-158
|
||
|
|
||
|
// Item attributes (BG-32)
|
||
|
attributes?: Array<{
|
||
|
name: string; // BT-160
|
||
|
value: string; // BT-161
|
||
|
}>;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Extended accounting document item with metadata
|
||
|
*/
|
||
|
export interface IExtendedAccountingDocItem {
|
||
|
position: number;
|
||
|
name: string;
|
||
|
articleNumber?: string;
|
||
|
unitType: string;
|
||
|
unitQuantity: number;
|
||
|
unitNetPrice: number;
|
||
|
vatPercentage: number;
|
||
|
metadata?: IItemMetadata;
|
||
|
}
|