Add payment QR code to invoice PDFs
This commit is contained in:
@@ -95,6 +95,7 @@ const customers = ref([])
|
||||
const contacts = ref([])
|
||||
const contracts = ref([])
|
||||
const outgoingsepamandates = ref([])
|
||||
const bankaccounts = ref([])
|
||||
const texttemplates = ref([])
|
||||
const units = ref([])
|
||||
const tenantUsers = ref([])
|
||||
@@ -236,6 +237,12 @@ const setupData = async () => {
|
||||
contacts.value = await useEntities("contacts").select("*")
|
||||
contracts.value = await useEntities("contracts").select("*")
|
||||
outgoingsepamandates.value = await useEntities("outgoingsepamandates").select("*")
|
||||
try {
|
||||
bankaccounts.value = await useEntities("bankaccounts").select("*")
|
||||
} catch (error) {
|
||||
console.warn("Bankkonten konnten nicht für den Zahlungs-QR-Code geladen werden", error)
|
||||
bankaccounts.value = []
|
||||
}
|
||||
texttemplates.value = await useEntities("texttemplates").select("*")
|
||||
units.value = await useEntities("units").selectSpecial("*")
|
||||
tenantUsers.value = (await useNuxtApp().$api(`/api/tenant/users`, {
|
||||
@@ -1365,6 +1372,7 @@ const getDocumentData = async () => {
|
||||
let customerData = customers.value.find(i => i.id === itemInfo.value.customer)
|
||||
let contactData = contacts.value.find(i => i.id === itemInfo.value.contact)
|
||||
let businessInfo = auth.activeTenantData.businessInfo
|
||||
const paymentQrBankAccount = bankaccounts.value.find(account => !account.archived && !account.expired && account.iban)
|
||||
|
||||
if (auth.activeTenantData.extraModules.includes("agriculture")) {
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
@@ -1580,7 +1588,13 @@ const getDocumentData = async () => {
|
||||
agriculture: itemInfo.value.agriculture,
|
||||
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices.map(i => {
|
||||
return createddocuments.value.find(x => x.id === i)
|
||||
})
|
||||
}),
|
||||
paymentQr: paymentQrBankAccount && itemInfo.value.payment_type === "transfer" ? {
|
||||
iban: paymentQrBankAccount.iban,
|
||||
recipientName: paymentQrBankAccount.ownerName || businessInfo.name || auth.activeTenantData.name,
|
||||
amount: documentTotal.value.totalSumToPay,
|
||||
remittance: itemInfo.value.documentNumber || itemInfo.value.title,
|
||||
} : null
|
||||
}
|
||||
|
||||
console.log(returnData)
|
||||
|
||||
Reference in New Issue
Block a user