update
This commit is contained in:
@ -72,7 +72,19 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
const totalAmount = this.getNumber('//ram:GrandTotalAmount');
|
||||
|
||||
// Extract notes
|
||||
const notes = this.extractNotes();
|
||||
const allNotes = this.extractNotes();
|
||||
|
||||
// Extract subject and notes separately
|
||||
let subject = `Invoice ${invoiceId}`;
|
||||
let notes = [...allNotes];
|
||||
|
||||
// If the first note doesn't look like a payment term or other standard note,
|
||||
// treat it as the subject
|
||||
if (allNotes.length > 0 && !allNotes[0].toLowerCase().includes('due in') &&
|
||||
!allNotes[0].toLowerCase().includes('payment')) {
|
||||
subject = allNotes[0];
|
||||
notes = allNotes.slice(1); // Remove subject from notes
|
||||
}
|
||||
|
||||
// Check for reverse charge
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
@ -93,7 +105,7 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
incidenceId: invoiceId,
|
||||
from: seller,
|
||||
to: buyer,
|
||||
subject: `Invoice ${invoiceId}`,
|
||||
subject: subject,
|
||||
items: items,
|
||||
dueInDays: dueInDays,
|
||||
reverseCharge: reverseCharge,
|
||||
|
Reference in New Issue
Block a user