Many Changes

This commit is contained in:
2025-01-05 18:23:44 +01:00
parent 1c6c6e4a33
commit efbb97967a
16 changed files with 970 additions and 441 deletions

View File

@@ -457,7 +457,7 @@ const renderCurrency = (value, currency = "€") => {
const documentTotal = computed(() => {
let totalNet = 0
let total19 = 0
let totalGross = 0
let total7 = 0
itemInfo.value.rows.forEach(row => {
if(!['pagebreak','title','text'].includes(row.mode)){
@@ -466,11 +466,13 @@ const documentTotal = computed(() => {
if(row.taxPercent === 19) {
total19 = total19 + Number(rowPrice * 0.19)
} else if(row.taxPercent === 7) {
total7 = total7 + Number(rowPrice * 0.07)
}
}
})
totalGross = totalNet + total19
let totalGross = Number(totalNet.toFixed(2)) + Number(total19.toFixed(2)) + Number(total7.toFixed(2))
let totalGrossAlreadyPaid = 0
@@ -488,19 +490,14 @@ const documentTotal = computed(() => {
let sumToPay = totalGross - totalGrossAlreadyPaid
return {
totalNet: totalNet,
total19: total19,
total7: total7,
totalGross: totalGross,
totalGrossAlreadyPaid: totalGrossAlreadyPaid,
totalSumToPay: sumToPay
}
})
const processDieselPosition = () => {
@@ -831,14 +828,13 @@ const closeDocument = async () => {
await generateDocument()
let fileData = {
tags: [],
project: null
}
let fileData = {}
fileData.project = itemInfo.value.project
fileData.createdDocument = itemInfo.value.id
fileData.tags.push(dataStore.documentTypesForCreation[itemInfo.value.type].labelSingle)
fileData.createddocument = itemInfo.value.id
fileData.folder = (await supabase.from("folders").select("id").eq("tenant", profileStore.currentTenant).eq("function", itemInfo.value.type).eq("year",dayjs().format("YYYY")).single()).data.id
let tag = (await supabase.from("filetags").select("id").eq("tenant", profileStore.currentTenant).eq("createddocumenttype", itemInfo.value.type).single()).data
function dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(","),
@@ -854,7 +850,7 @@ const closeDocument = async () => {
let file = dataURLtoFile(uri.value, `${itemInfo.value.documentNumber}.pdf`)
await dataStore.uploadFiles(fileData, [file], true)
await dataStore.uploadFiles(fileData, [file],[tag.id], true)
await router.push(`/createDocument/show/${itemInfo.value.id}`)
@@ -894,13 +890,28 @@ const setRowData = (row) => {
<template>
<UDashboardNavbar>
<template #right>
<!-- <ButtonWithConfirm
v-if="itemInfo.state === 'Entwurf'"
color="rose"
variant="outline"
@confirmed="dataStore.updateItem('createddocuments',{id:itemInfo.id,archived: true}),
router.push('/createDocument')"
>
<template #button>
Archivieren
</template>
<template #header>
<span class="text-md text-black font-bold">Archivieren bestätigen</span>
</template>
Möchten Sie diesen Ausgangsbeleg wirklich archivieren?
</ButtonWithConfirm>-->
<UButton
icon="i-mdi-content-save"
@click="saveDocument('Entwurf',true)"
v-if="itemInfo.type !== 'serialInvoices' "
:disabled="!itemInfo.customer"
>
Entwurf
Entwurf speichern
</UButton>
<UButton
@click="closeDocument"
@@ -952,7 +963,7 @@ const setRowData = (row) => {
v-model="itemInfo.type"
value-attribute="type"
option-attribute="label"
@input="setDocumentTypeConfig"
@change="setDocumentTypeConfig"
class="flex-auto"
>
<template #label>

View File

@@ -21,9 +21,16 @@ const linkedDocument =ref({})
const currentTenant = ref({})
const setupPage = async () => {
if(route.params) {
if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*")
const {data,error} = await supabase.from("documents").select("id").eq("createdDocument", route.params.id).order("id",{ascending:true})
linkedDocument.value = data[data.length -1]
if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*, files(*)")
console.log(itemInfo.value)
linkedDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
//const {data,error} = await supabase.from("files").select("id").eq("createddocument", route.params.id).order("id",{ascending:true})
//linkedDocument.value = data[data.length -1]
}
@@ -72,11 +79,19 @@ const openEmail = () => {
>
E-Mail
</UButton>
<UButton
v-if="itemInfo.project"
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
icon="i-heroicons-arrow-right-end-on-rectangle"
variant="outline"
>
Projekt
</UButton>
</template>
</UDashboardToolbar>
<UDashboardPanelContent>
<object
:data="dataStore.documents.find(i => i.id === linkedDocument.id) ? dataStore.documents.find(i => i.id === linkedDocument.id).url : ''"
:data="linkedDocument.url"
class="h-full"
/>
</UDashboardPanelContent>