Added paymentDescription and buyerReference

This commit is contained in:
dankito 2024-11-14 20:28:15 +01:00
parent c480b2ec5e
commit cd86300d36
3 changed files with 16 additions and 2 deletions

View File

@ -25,6 +25,9 @@ class MustangMapper {
this.setZFItems(ArrayList(invoice.items.map { mapLineItem(it) })) this.setZFItems(ArrayList(invoice.items.map { mapLineItem(it) }))
this.dueDate = map(invoice.dueDate) this.dueDate = map(invoice.dueDate)
this.paymentTermDescription = invoice.paymentDescription
this.referenceNumber = invoice.buyerReference
} }
fun mapParty(party: Party): TradeParty = TradeParty( fun mapParty(party: Party): TradeParty = TradeParty(

View File

@ -8,7 +8,14 @@ class Invoice(
val sender: Party, val sender: Party,
val recipient: Party, val recipient: Party,
val items: List<LineItem>, val items: List<LineItem>,
val dueDate: LocalDate? = null, val dueDate: LocalDate? = null,
val paymentDescription: String? = null,
/**
* Unique reference number of the buyer, e.g. the Leitweg-ID required by German authorities (Behörden)
*/
val buyerReference: String? = null
) { ) {
override fun toString() = "$invoicingDate $invoiceNumber to $recipient" override fun toString() = "$invoicingDate $invoiceNumber to $recipient"
} }

View File

@ -5,11 +5,13 @@ import net.codinux.invoicing.model.LineItem
import net.codinux.invoicing.model.Party import net.codinux.invoicing.model.Party
import java.math.BigDecimal import java.math.BigDecimal
import java.time.LocalDate import java.time.LocalDate
import java.time.format.DateTimeFormatter
object DataGenerator { object DataGenerator {
const val InvoiceNumber = "12345" const val InvoiceNumber = "12345"
val InvoicingDate = LocalDate.of(2015, 10, 21) val InvoicingDate = LocalDate.of(2015, 10, 21)
val DueDate = LocalDate.of(2016, 6, 15)
const val SenderName = "Hochwürdiger Leistungserbringer" const val SenderName = "Hochwürdiger Leistungserbringer"
const val SenderStreet = "Fun Street 1" const val SenderStreet = "Fun Street 1"
@ -43,8 +45,10 @@ object DataGenerator {
sender: Party = createParty(SenderName, SenderStreet, SenderPostalCode, SenderCity, SenderCountry, SenderVatId, SenderEmail, SenderPhone), sender: Party = createParty(SenderName, SenderStreet, SenderPostalCode, SenderCity, SenderCountry, SenderVatId, SenderEmail, SenderPhone),
recipient: Party = createParty(RecipientName, RecipientStreet, RecipientPostalCode, RecipientCity, RecipientCountry, RecipientVatId, RecipientEmail, RecipientPhone), recipient: Party = createParty(RecipientName, RecipientStreet, RecipientPostalCode, RecipientCity, RecipientCountry, RecipientVatId, RecipientEmail, RecipientPhone),
items: List<LineItem> = listOf(createItem()), items: List<LineItem> = listOf(createItem()),
dueDate: LocalDate? = null dueDate: LocalDate? = DueDate,
) = Invoice(invoiceNumber, invoicingDate, sender, recipient, items, dueDate) paymentDescription: String? = dueDate?.let { "Zahlbar ohne Abzug bis ${DateTimeFormatter.ofPattern("dd.MM.yyyy").format(dueDate)}" },
buyerReference: String? = null
) = Invoice(invoiceNumber, invoicingDate, sender, recipient, items, dueDate, paymentDescription, buyerReference)
fun createParty( fun createParty(
name: String, name: String,