fix(compliance): improve compliance
This commit is contained in:
@ -60,16 +60,17 @@ export class XRechnungEncoder extends UBLEncoder {
|
||||
|
||||
// Add or update Buyer Reference (required for XRechnung)
|
||||
let buyerRef = root.getElementsByTagName('cbc:BuyerReference')[0];
|
||||
const buyerReferenceValue = (invoice as any).buyerReference || metadata?.businessReferences?.buyerReference || invoice.id;
|
||||
if (!buyerRef) {
|
||||
// Find where to insert it (after DocumentCurrencyCode)
|
||||
const currencyCode = root.getElementsByTagName('cbc:DocumentCurrencyCode')[0];
|
||||
if (currencyCode) {
|
||||
buyerRef = doc.createElement('cbc:BuyerReference');
|
||||
buyerRef.textContent = invoice.buyerReference || invoice.id;
|
||||
buyerRef.textContent = buyerReferenceValue;
|
||||
currencyCode.parentNode!.insertBefore(buyerRef, currencyCode.nextSibling);
|
||||
}
|
||||
} else if (!buyerRef.textContent || buyerRef.textContent.trim() === '') {
|
||||
buyerRef.textContent = invoice.buyerReference || invoice.id;
|
||||
buyerRef.textContent = buyerReferenceValue;
|
||||
}
|
||||
|
||||
// Update payment terms to German
|
||||
|
Reference in New Issue
Block a user