Added Agriculture
Removed Prices for Delivery Notes
This commit is contained in:
@@ -565,28 +565,33 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText("Einheitspreis", {
|
||||
...getCoordinatesForPDFLib(135,137, page1),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
if( invoiceData.type !== "deliveryNotes") {
|
||||
pages[pageCounter - 1].drawText("Einheitspreis", {
|
||||
...getCoordinatesForPDFLib(135,137, page1),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
pages[pageCounter - 1].drawText("Gesamt", {
|
||||
y: getCoordinatesForPDFLib(25,137, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,137,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
}
|
||||
|
||||
pages[pageCounter - 1].drawText("Gesamt", {
|
||||
y: getCoordinatesForPDFLib(25,137, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,137,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
let rowHeight = 145
|
||||
|
||||
|
||||
|
||||
let rowHeight = 145.5
|
||||
|
||||
let pageIndex = 0
|
||||
|
||||
@@ -619,65 +624,95 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
|
||||
console.log(row.text.match(/.{1,35}/g))
|
||||
|
||||
pages[pageCounter - 1].drawText(row.text.match(/.{1,35}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight, page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
//let textLineBreaks = (row.text.match(/\n/g) || []).length
|
||||
let textAutoLines = (row.text.match(/.{1,35}/g) || []).length
|
||||
console.log(textAutoLines)
|
||||
|
||||
|
||||
if(row.descriptionText) {
|
||||
pages[pageCounter - 1].drawText(row.descriptionText.match(/.{1,70}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight + ( textAutoLines * 4), page1),
|
||||
if(invoiceData.type !== "deliveryNotes") {
|
||||
pages[pageCounter - 1].drawText(row.text.match(/.{1,35}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight, page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
font: fontBold
|
||||
})
|
||||
} else {
|
||||
pages[pageCounter - 1].drawText(row.text.match(/.{1,80}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight, page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
font: fontBold
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
pages[pageCounter - 1].drawText(row.price, {
|
||||
...getCoordinatesForPDFLib(135,rowHeight, page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
maxWidth: 240
|
||||
})
|
||||
//let textLineBreaks = (row.text.match(/\n/g) || []).length
|
||||
let textAutoLines = (invoiceData.type !== "deliveryNotes" ? row.text.match(/.{1,35}/g) : row.text.match(/.{1,80}/g) || []).length
|
||||
console.log(textAutoLines)
|
||||
|
||||
pages[pageCounter - 1].drawText(row.rowAmount, {
|
||||
y: getCoordinatesForPDFLib(25,rowHeight, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,rowHeight,page1).x + 490 - font.widthOfTextAtSize(row.rowAmount,10),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
})
|
||||
console.log(row)
|
||||
|
||||
if(row.discountPercent > 0) {
|
||||
pages[pageCounter - 1].drawText(row.discountText, {
|
||||
y: getCoordinatesForPDFLib(25,rowHeight + 5, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,rowHeight + 5,page1).x + 490 - font.widthOfTextAtSize(row.discountText,8),
|
||||
size:8,
|
||||
|
||||
if(row.descriptionText) {
|
||||
if(invoiceData.type !== "deliveryNotes") {
|
||||
pages[pageCounter - 1].drawText(row.descriptionText.match(/.{1,70}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight + ( textAutoLines * 4), page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
})
|
||||
} else {
|
||||
pages[pageCounter - 1].drawText(row.descriptionText.match(/.{1,80}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(52,rowHeight + ( textAutoLines * 4), page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(invoiceData.type !== "deliveryNotes") {
|
||||
pages[pageCounter - 1].drawText(row.price, {
|
||||
...getCoordinatesForPDFLib(135,rowHeight, page1),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
maxWidth: 240
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(row.rowAmount, {
|
||||
y: getCoordinatesForPDFLib(25,rowHeight, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,rowHeight,page1).x + 490 - font.widthOfTextAtSize(row.rowAmount,10),
|
||||
size:10,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
})
|
||||
|
||||
if(row.discountPercent > 0) {
|
||||
pages[pageCounter - 1].drawText(row.discountText, {
|
||||
y: getCoordinatesForPDFLib(25,rowHeight + 5, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,rowHeight + 5,page1).x + 490 - font.widthOfTextAtSize(row.discountText,8),
|
||||
size:8,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(row.descriptionText) {
|
||||
let lineBreaks = (row.descriptionText.match(/\n/g) || []).length
|
||||
let autoLines = (row.descriptionText.match(/.{1,70}/g) || []).length
|
||||
@@ -766,26 +801,30 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
page.drawText("Einheitspreis", {
|
||||
...getCoordinatesForPDFLib(135,22, page1),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
if(invoiceData.type !== "deliveryNotes"){
|
||||
page.drawText("Einheitspreis", {
|
||||
...getCoordinatesForPDFLib(135,22, page1),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
page.drawText("Gesamt", {
|
||||
y: getCoordinatesForPDFLib(25,22, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,22,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
page.drawText("Gesamt", {
|
||||
y: getCoordinatesForPDFLib(25,22, page1).y,
|
||||
x: getCoordinatesForPDFLib(25,22,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pageCounter += 1;
|
||||
pageIndex = 0;
|
||||
@@ -848,7 +887,7 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(row.text.match(/.{1,60}/g).join("\n"), {
|
||||
...getCoordinatesForPDFLib(21,rowHeight - 3, page1),
|
||||
...getCoordinatesForPDFLib(21,rowHeight - 2.6, page1),
|
||||
size:12,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:12,
|
||||
@@ -868,11 +907,15 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
lineHeight:10,
|
||||
opacity: 1,
|
||||
})
|
||||
|
||||
let addHeight = (row.descriptionText.match(/.{1,80}/g) || []).length * 4 + 10
|
||||
console.log(addHeight)
|
||||
rowHeight += addHeight
|
||||
} else {
|
||||
rowHeight += 6
|
||||
}
|
||||
|
||||
let addHeight = (row.descriptionText.match(/.{1,80}/g) || []).length * 4 + 10
|
||||
console.log(addHeight)
|
||||
rowHeight += addHeight
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -889,84 +932,89 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
|
||||
//Footer
|
||||
//console.log(rowHeight)
|
||||
//rowHeight += 25
|
||||
pages[pageCounter - 1].drawRectangle({
|
||||
...getCoordinatesForPDFLib(20,rowHeight, page1),
|
||||
width: 180 * 2.83,
|
||||
height: 8 * 2.83,
|
||||
color: rgb(0,0,0),
|
||||
opacity: 0.25
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawRectangle({
|
||||
...getCoordinatesForPDFLib(20,rowHeight +16, page1),
|
||||
width: 180 * 2.83,
|
||||
height: 8 * 2.83,
|
||||
color: rgb(0,0,0),
|
||||
opacity: 0.25
|
||||
})
|
||||
if(invoiceData.type !== "deliveryNotes"){
|
||||
pages[pageCounter - 1].drawRectangle({
|
||||
...getCoordinatesForPDFLib(20,rowHeight, page1),
|
||||
width: 180 * 2.83,
|
||||
height: 8 * 2.83,
|
||||
color: rgb(0,0,0),
|
||||
opacity: 0.25
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText("Nettobetrag", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight-3, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
pages[pageCounter - 1].drawRectangle({
|
||||
...getCoordinatesForPDFLib(20,rowHeight +16, page1),
|
||||
width: 180 * 2.83,
|
||||
height: 8 * 2.83,
|
||||
color: rgb(0,0,0),
|
||||
opacity: 0.25
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.totalNet, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight-3, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight-3,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalNet,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
pages[pageCounter - 1].drawText("Nettobetrag", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight-3, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText("zzgl. 19% MwSt", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight+5, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.totalNet, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight-3, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight-3,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalNet,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.total19, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight+5, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight+5,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.total19,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
pages[pageCounter - 1].drawText("zzgl. 19% MwSt", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight+5, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.total19, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight+5, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight+5,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.total19,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText("Gesamtsumme", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight+13, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.totalGross, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight+13, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight+13,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalGross,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
}
|
||||
|
||||
pages[pageCounter - 1].drawText("Gesamtsumme", {
|
||||
...getCoordinatesForPDFLib(21,rowHeight+13, page1),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font: fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.total.totalGross, {
|
||||
y: getCoordinatesForPDFLib(21,rowHeight+13, page1).y,
|
||||
x: getCoordinatesForPDFLib(21,rowHeight+13,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalGross,11),
|
||||
size:11,
|
||||
color:rgb(0,0,0),
|
||||
lineHeight:11,
|
||||
opacity: 1,
|
||||
maxWidth: 240,
|
||||
font:fontBold
|
||||
})
|
||||
|
||||
pages[pageCounter - 1].drawText(invoiceData.endText,{
|
||||
...getCoordinatesForPDFLib(20,rowHeight+22, page1),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup>
|
||||
import dayjs from "dayjs"
|
||||
import Handlebars from "handlebars"
|
||||
import {useNumberRange} from "~/composables/useNumberRange.js";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const user = useSupabaseUser()
|
||||
@@ -102,6 +104,48 @@ const setupPage = async () => {
|
||||
|
||||
setContactPersonData()
|
||||
|
||||
if(route.query.linkedDocuments) {
|
||||
|
||||
let linkedDocuments = (await supabase.from("createddocuments").select().in("id",JSON.parse(route.query.linkedDocuments))).data
|
||||
|
||||
//TODO: Implement Checking for Same Customer, Contact and Project
|
||||
|
||||
itemInfo.value.customer = linkedDocuments[0].customer
|
||||
itemInfo.value.project = linkedDocuments[0].project
|
||||
itemInfo.value.contact = linkedDocuments[0].contact
|
||||
|
||||
setCustomerData()
|
||||
|
||||
linkedDocuments.forEach(doc => {
|
||||
let lastId = 0
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.id > lastId) lastId = row.id
|
||||
})
|
||||
|
||||
itemInfo.value.rows.push(...[
|
||||
{
|
||||
id:uuidv4(),
|
||||
mode: "text",
|
||||
text: doc.title
|
||||
},
|
||||
...doc.rows
|
||||
])
|
||||
|
||||
})
|
||||
|
||||
if(linkedDocuments.find(i => i.agriculture)){
|
||||
itemInfo.value.rows = itemInfo.value.rows.filter(i => i.key !== "dieselPos")
|
||||
|
||||
itemInfo.value.rows.push({
|
||||
id:uuidv4(),
|
||||
mode: "text",
|
||||
text: "Allgemein"
|
||||
})
|
||||
|
||||
processDieselPosition()
|
||||
}
|
||||
}
|
||||
|
||||
if(route.query.linkedDocument) {
|
||||
itemInfo.value.linkedDocument = route.query.linkedDocument
|
||||
|
||||
@@ -228,7 +272,7 @@ const addPosition = (mode) => {
|
||||
|
||||
if(mode === 'free'){
|
||||
let rowData = {
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "free",
|
||||
text: "",
|
||||
quantity: 1,
|
||||
@@ -242,7 +286,7 @@ const addPosition = (mode) => {
|
||||
|
||||
} else if(mode === 'normal'){
|
||||
itemInfo.value.rows.push({
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "normal",
|
||||
quantity: 1,
|
||||
price: 0,
|
||||
@@ -252,7 +296,7 @@ const addPosition = (mode) => {
|
||||
})
|
||||
} else if(mode === 'service'){
|
||||
let rowData = {
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "service",
|
||||
quantity: 1,
|
||||
price: 0,
|
||||
@@ -265,17 +309,17 @@ const addPosition = (mode) => {
|
||||
itemInfo.value.rows.push({...rowData, ...dataStore.ownTenant.extraModules.includes("agriculture") ? {agriculture: {}}: {}})
|
||||
} else if(mode === "pagebreak") {
|
||||
itemInfo.value.rows.push({
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "pagebreak",
|
||||
})
|
||||
} else if(mode === "title") {
|
||||
itemInfo.value.rows.push({
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "title",
|
||||
})
|
||||
} else if(mode === "text") {
|
||||
itemInfo.value.rows.push({
|
||||
id: lastId +1,
|
||||
id: uuidv4(),
|
||||
mode: "text",
|
||||
})
|
||||
}
|
||||
@@ -434,9 +478,15 @@ const getDocumentData = () => {
|
||||
|
||||
let customerData = dataStore.getCustomerById(itemInfo.value.customer)
|
||||
let contactData = dataStore.getContactById(itemInfo.value.contact)
|
||||
let userData = dataStore.getProfileById(user.value.id)
|
||||
let businessInfo = dataStore.ownTenant.businessInfo
|
||||
|
||||
if(dataStore.ownTenant.extraModules.includes("agriculture")) {
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.agriculture && row.agriculture.dieselUsage) {
|
||||
row.agriculture.description = `${row.agriculture.dieselUsage} L Diesel zu ${renderCurrency(row.agriculture.dieselPrice)}/L verbraucht ${row.description ? "\n" + row.description : ""}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let rows = itemInfo.value.rows.map(row => {
|
||||
|
||||
@@ -446,6 +496,16 @@ const getDocumentData = () => {
|
||||
if(row.mode === 'normal') row.text = dataStore.getProductById(row.product).name
|
||||
if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name
|
||||
|
||||
console.log(row)
|
||||
|
||||
if(row.agriculture?.description) {
|
||||
console.log("Row has Agri")
|
||||
row.descriptionText = row.agriculture.description
|
||||
} else if(row.description) {
|
||||
console.log("Row has no Agri")
|
||||
row.descriptionText = row.description
|
||||
}
|
||||
|
||||
return {
|
||||
...row,
|
||||
rowAmount: `${getRowAmount(row)} €`,
|
||||
@@ -463,37 +523,6 @@ const getDocumentData = () => {
|
||||
//Compile Start & EndText
|
||||
const templateStartText = Handlebars.compile(itemInfo.value.startText);
|
||||
const templateEndText = Handlebars.compile(itemInfo.value.endText);
|
||||
/*console.log(templateStartText({
|
||||
vorname: contactData ? contactData.firstName : "",
|
||||
nachname: contactData ? contactData.lastName : ""
|
||||
}))*/
|
||||
//console.log(templateEndText({zahlungsziel_in_tagen: itemInfo.value.paymentDays}))
|
||||
|
||||
|
||||
if(dataStore.ownTenant.extraModules.includes("agriculture")) {
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.agriculture && row.agriculture.dieselUsage) {
|
||||
row.agriculture.description = `${row.agriculture.dieselUsage} L Diesel zu ${renderCurrency(row.agriculture.dieselPrice)}/L verbraucht ${row.description ? "\n" + row.description : ""}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//Check if Agricultural Description is Present
|
||||
itemInfo.value.rows = itemInfo.value.rows.map(row => {
|
||||
|
||||
let descriptionText = ""
|
||||
|
||||
if(row.agriculture && row.agriculture.description) {
|
||||
descriptionText = row.agriculture.description
|
||||
} else {
|
||||
descriptionText = row.description ? row.description : null
|
||||
}
|
||||
|
||||
return {
|
||||
...row,
|
||||
descriptionText: descriptionText
|
||||
}
|
||||
})
|
||||
|
||||
const generateContext = (itemInfo, contactData) => {
|
||||
return {
|
||||
@@ -508,6 +537,7 @@ const getDocumentData = () => {
|
||||
|
||||
|
||||
const returnData = {
|
||||
type: itemInfo.value.type,
|
||||
adressLine: `${businessInfo.name}, ${businessInfo.street}, ${businessInfo.zip} ${businessInfo.city}`,
|
||||
recipient: {
|
||||
name: customerData.name,
|
||||
@@ -1285,11 +1315,11 @@ setupPage()
|
||||
<th>Name</th>
|
||||
<th>Menge</th>
|
||||
<th>Einheit</th>
|
||||
<th>Preis</th>
|
||||
<th>Steuer</th>
|
||||
<th>Rabatt</th>
|
||||
<th v-if="itemInfo.type !== 'deliveryNotes'">Preis</th>
|
||||
<th v-if="itemInfo.type !== 'deliveryNotes'">Steuer</th>
|
||||
<th v-if="itemInfo.type !== 'deliveryNotes'">Rabatt</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Gesamt</th>
|
||||
<th v-if="itemInfo.type !== 'deliveryNotes'">Gesamt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -1504,7 +1534,7 @@ setupPage()
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.price"
|
||||
@@ -1518,7 +1548,7 @@ setupPage()
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
|
||||
>
|
||||
<USelectMenu
|
||||
@@ -1536,7 +1566,7 @@ setupPage()
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.discountPercent"
|
||||
@@ -1628,7 +1658,7 @@ setupPage()
|
||||
</UModal>
|
||||
</td>
|
||||
<td
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
|
||||
<p class="text-right font-bold whitespace-nowrap"><span v-if="row.discountPercent !== 0" class="line-through mr-2 text-rose-500">{{getRowAmountUndiscounted(row)}} €</span>{{getRowAmount(row)}} €</p>
|
||||
@@ -1703,6 +1733,8 @@ setupPage()
|
||||
|
||||
<div class="w-full flex justify-end">
|
||||
<table class="w-1/3">
|
||||
<div class="w-full flex justify-end" v-if="itemInfo.type !== 'deliveryNotes'">
|
||||
<table class="w-1/3" v-if="itemInfo.rows.length > 0">
|
||||
<tr>
|
||||
<td class="font-bold">Netto:</td>
|
||||
<td class="text-right">{{documentTotal.totalNet}}</td>
|
||||
|
||||
Reference in New Issue
Block a user