Merge branch 'beta'
This commit is contained in:
@@ -65,7 +65,7 @@ const uploadFiles = async () => {
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Tags:"
|
||||
label="Typ:"
|
||||
class="mt-3"
|
||||
>
|
||||
<USelectMenu
|
||||
|
||||
@@ -201,6 +201,7 @@ const resetContactRequest = () => {
|
||||
<InputGroup class="mt-3">
|
||||
<UButton
|
||||
type="submit"
|
||||
:disabled="!contactRequestData.title || !contactRequestData.message"
|
||||
>
|
||||
Senden
|
||||
</UButton>
|
||||
@@ -208,6 +209,7 @@ const resetContactRequest = () => {
|
||||
type="reset"
|
||||
color="rose"
|
||||
variant="outline"
|
||||
:disabled="!contactRequestData.title && !contactRequestData.message"
|
||||
>
|
||||
Zurücksetzen
|
||||
</UButton>
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
import dayjs from "dayjs"
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
elementId: {
|
||||
type: String
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
renderHeadline: {
|
||||
type: Boolean
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
const { metaSymbol } = useShortcuts()
|
||||
const profileStore = useProfileStore()
|
||||
const user = useSupabaseUser()
|
||||
const supabase = useSupabaseClient()
|
||||
const toast = useToast()
|
||||
const {type, elementId} = props
|
||||
const showAddHistoryItemModal = ref(false)
|
||||
const colorMode = useColorMode()
|
||||
|
||||
@@ -24,8 +24,8 @@ const items = ref([])
|
||||
|
||||
const setup = async () => {
|
||||
|
||||
if(type && elementId){
|
||||
items.value = (await supabase.from("historyitems").select().eq(type,elementId).order("created_at",{ascending: true})).data || []
|
||||
if(props.type && props.elementId){
|
||||
items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || []
|
||||
} else {
|
||||
items.value = (await supabase.from("historyitems").select().order("created_at",{ascending: true})).data || []
|
||||
|
||||
@@ -39,8 +39,8 @@ setup()
|
||||
const addHistoryItemData = ref({
|
||||
text: "",
|
||||
config: {
|
||||
type: type,
|
||||
id: elementId
|
||||
type: props.type,
|
||||
id: props.elementId
|
||||
}
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ const addHistoryItem = async () => {
|
||||
console.log(addHistoryItemData.value)
|
||||
addHistoryItemData.value.createdBy = profileStore.activeProfile.id
|
||||
|
||||
addHistoryItemData.value[type] = elementId
|
||||
addHistoryItemData.value[props.type] = props.elementId
|
||||
|
||||
const {data,error} = await supabase
|
||||
.from("historyitems")
|
||||
@@ -71,7 +71,7 @@ const addHistoryItem = async () => {
|
||||
profile: profiles.find(x => x.username === rawUsername).id,
|
||||
initiatingProfile: profileStore.activeProfile.id,
|
||||
title: "Sie wurden im Logbuch erwähnt",
|
||||
link: `/${type}s/show/${elementId}`,
|
||||
link: `/${props.type}s/show/${props.elementId}`,
|
||||
message: addHistoryItemData.value.text
|
||||
}
|
||||
})
|
||||
@@ -129,7 +129,7 @@ const renderText = (text) => {
|
||||
</UCard>
|
||||
</UModal>
|
||||
<Toolbar
|
||||
v-if="!renderHeadline && elementId && type"
|
||||
v-if="!props.renderHeadline && props.elementId && props.type"
|
||||
>
|
||||
<UButton
|
||||
@click="showAddHistoryItemModal = true"
|
||||
@@ -137,7 +137,7 @@ const renderText = (text) => {
|
||||
+ Eintrag
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<div v-else-if="renderHeadline && elementId && type">
|
||||
<div v-else-if="props.renderHeadline && props.elementId && props.type">
|
||||
<div :class="`flex justify-between`">
|
||||
<p class=""><span class="text-xl">Logbuch</span> <UBadge variant="outline">{{items.length}}</UBadge></p>
|
||||
<UButton
|
||||
|
||||
14
components/columnRenderings/phase.vue
Normal file
14
components/columnRenderings/phase.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
row: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span v-if="props.row.phases && props.row.phases.length > 0">{{props.row.phases.find(i => i.active).label}}</span>
|
||||
</template>
|
||||
@@ -6,18 +6,16 @@ let draftInvoicesSum = ref(0)
|
||||
let draftInvoicesCount = ref(0)
|
||||
let unallocatedStatements = ref(0)
|
||||
const setupPage = async () => {
|
||||
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices").filter(i => !i.archived)
|
||||
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices"||i.type === "cancellationInvoices").filter(i => !i.archived)
|
||||
|
||||
let draftDocuments = documents.filter(i => i.state === "Entwurf")
|
||||
let finalizedDocuments = documents.filter(i => i.state === "Gebucht")
|
||||
|
||||
console.log(finalizedDocuments)
|
||||
|
||||
|
||||
finalizedDocuments = finalizedDocuments.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
|
||||
|
||||
finalizedDocuments.forEach(i => {
|
||||
console.log(getDocumentSum(i))
|
||||
unpaidInvoicesSum.value += getDocumentSum(i) - i.statementallocations.reduce((n,{amount}) => n + amount, 0)
|
||||
})
|
||||
unpaidInvoicesCount.value = finalizedDocuments.length
|
||||
|
||||
43
components/displayProjectsInPhases.vue
Normal file
43
components/displayProjectsInPhases.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<script setup>
|
||||
|
||||
const phasesCounter = ref({})
|
||||
|
||||
const setupPage = async () => {
|
||||
const projects = await useSupabaseSelect("projects")
|
||||
|
||||
projects.forEach(project => {
|
||||
if(project.phases && project.phases.length > 0){
|
||||
let activePhase = project.phases.find(p => p.active)
|
||||
|
||||
if(phasesCounter.value[activePhase.label]) {
|
||||
phasesCounter.value[activePhase.label] += 1
|
||||
} else {
|
||||
phasesCounter.value[activePhase.label] = 1
|
||||
}
|
||||
|
||||
} else {
|
||||
if(phasesCounter.value["Keine Phase"]) {
|
||||
phasesCounter.value["Keine Phase"] += 1
|
||||
} else {
|
||||
phasesCounter.value["Keine Phase"] = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setupPage()
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table class="w-full">
|
||||
<tr v-for="label in Object.keys(phasesCounter)">
|
||||
<td>{{label}}</td>
|
||||
<td>{{ phasesCounter[label] }} Stk</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const baseURL = /*"http://localhost:3333" */"https://functions.fedeo.io"
|
||||
const baseURL = /*"http://localhost:3333"*/ "https://functions.fedeo.io"
|
||||
|
||||
export const useFunctions = () => {
|
||||
const supabase = useSupabaseClient()
|
||||
@@ -79,6 +79,28 @@ export const useFunctions = () => {
|
||||
|
||||
}
|
||||
|
||||
const useCreatePDF = async (invoiceData,path) => {
|
||||
const {data:{session:{access_token}}} = await supabase.auth.getSession()
|
||||
|
||||
const {data} = await axios({
|
||||
method: "POST",
|
||||
url: `${baseURL}/functions/createpdf`,
|
||||
data: {
|
||||
invoiceData: invoiceData,
|
||||
backgroundPath: path,
|
||||
returnMode: "base64"
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${access_token}`
|
||||
}
|
||||
})
|
||||
|
||||
console.log(data)
|
||||
|
||||
return `data:${data.mimeType};base64,${data.base64}`
|
||||
|
||||
}
|
||||
|
||||
const useBankingCheckInstitutions = async (bic) => {
|
||||
const {data:{session:{access_token}}} = await supabase.auth.getSession()
|
||||
|
||||
@@ -109,5 +131,5 @@ export const useFunctions = () => {
|
||||
|
||||
}
|
||||
|
||||
return {getWorkingTimesEvaluationData, useNextNumber, useCreateTicket, useBankingGenerateLink, useBankingCheckInstitutions, useBankingListRequisitions}
|
||||
return {getWorkingTimesEvaluationData, useNextNumber, useCreateTicket, useBankingGenerateLink, useBankingCheckInstitutions, useBankingListRequisitions, useCreatePDF}
|
||||
}
|
||||
@@ -11,61 +11,44 @@ defineShortcuts({
|
||||
//console.log(searchinput)
|
||||
//searchinput.value.focus()
|
||||
document.getElementById("searchinput").focus()
|
||||
},
|
||||
'escape': () => {
|
||||
//console.log(searchinput)
|
||||
//searchinput.value.focus()
|
||||
showStatementModal.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const router = useRouter()
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const bankstatements = ref([])
|
||||
|
||||
const bankaccounts = ref([])
|
||||
|
||||
const setupPage = async () => {
|
||||
bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data
|
||||
|
||||
bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").is("archived",false).eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data
|
||||
bankaccounts.value = await useSupabaseSelect("bankaccounts")
|
||||
}
|
||||
|
||||
|
||||
|
||||
const selectedStatement = ref(null)
|
||||
const showStatementModal = ref(false)
|
||||
|
||||
const templateColumns = [
|
||||
{
|
||||
key: "account",
|
||||
label: "Konto",
|
||||
sortable: true
|
||||
label: "Konto"
|
||||
},{
|
||||
key: "valueDate",
|
||||
label: "Valuta",
|
||||
sortable: true
|
||||
label: "Valuta"
|
||||
},
|
||||
{
|
||||
key: "amount",
|
||||
label: "Betrag",
|
||||
sortable: true
|
||||
label: "Betrag"
|
||||
},
|
||||
{
|
||||
key: "openAmount",
|
||||
label: "Offener Betrag",
|
||||
sortable: true
|
||||
label: "Offener Betrag"
|
||||
},
|
||||
{
|
||||
key: "partner",
|
||||
label: "Name",
|
||||
sortable: true
|
||||
label: "Name"
|
||||
},
|
||||
{
|
||||
key: "text",
|
||||
label: "Beschreibung",
|
||||
sortable: true
|
||||
label: "Beschreibung"
|
||||
}
|
||||
]
|
||||
const selectedColumns = ref(templateColumns)
|
||||
@@ -73,35 +56,23 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
||||
|
||||
|
||||
const searchString = ref('')
|
||||
const filterAccount = ref(dataStore.bankAccounts || [])
|
||||
const filterAccount = ref(bankaccounts || [])
|
||||
const showOnlyNotAssigned = ref(true)
|
||||
|
||||
const displayCurrency = (value, currency = "€") => {
|
||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
||||
}
|
||||
|
||||
const getDocumentSum = (doc) => {
|
||||
let sum = 0
|
||||
doc.rows.forEach(row => {
|
||||
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
||||
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
||||
}
|
||||
})
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
const calculateOpenSum = (statement) => {
|
||||
let startingAmount = statement.amount || 0
|
||||
let startingAmount = 0
|
||||
|
||||
statement.statementallocations.forEach(item => {
|
||||
if(item.cd_id) {
|
||||
startingAmount = startingAmount - item.amount
|
||||
} else if(item.ii_id) {
|
||||
startingAmount = Number(startingAmount) + item.amount
|
||||
}
|
||||
startingAmount += Math.abs(item.amount)
|
||||
})
|
||||
|
||||
return startingAmount.toFixed(2)
|
||||
return (Math.abs(statement.amount) - startingAmount).toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
@@ -134,11 +105,12 @@ setupPage()
|
||||
<UDashboardToolbar>
|
||||
<template #left>
|
||||
<USelectMenu
|
||||
:options="dataStore.bankAccounts"
|
||||
:options="bankaccounts"
|
||||
v-model="filterAccount"
|
||||
option-attribute="iban"
|
||||
multiple
|
||||
by="id"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
>
|
||||
<template #label>
|
||||
Konto
|
||||
@@ -158,6 +130,7 @@ setupPage()
|
||||
multiple
|
||||
class="hidden lg:block"
|
||||
by="key"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
>
|
||||
<template #label>
|
||||
Spalten
|
||||
@@ -175,7 +148,7 @@ setupPage()
|
||||
>
|
||||
|
||||
<template #account-data="{row}">
|
||||
{{row.account ? (dataStore.getBankAccountById(row.account).name ? dataStore.getBankAccountById(row.account).name :dataStore.getBankAccountById(row.account).iban) : ""}}
|
||||
{{row.account ? bankaccounts.find(i => i.id === row.account).iban : ""}}
|
||||
</template>
|
||||
<template #valueDate-data="{row}">
|
||||
{{dayjs(row.valueDate).format("DD.MM.YY")}}
|
||||
@@ -207,72 +180,7 @@ setupPage()
|
||||
</template>
|
||||
</UTable>
|
||||
|
||||
<UModal
|
||||
v-model="showStatementModal"
|
||||
class="no-doc-sroll"
|
||||
>
|
||||
|
||||
<UCard class="h-full">
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<span
|
||||
v-if="selectedStatement.amount > 0"
|
||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||
>
|
||||
{{selectedStatement.debName}}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="selectedStatement.amount < 0"
|
||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||
>
|
||||
{{selectedStatement.credName}}
|
||||
</span>
|
||||
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showStatementModal = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
{{selectedStatement.id}}
|
||||
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2 truncate">
|
||||
<p>Betrag: {{String(selectedStatement.amount.toFixed(2)).replace(".",",")}} €</p>
|
||||
<p>Buchungsdatum: {{dayjs(selectedStatement.date).format("DD.MM.YYYY")}}</p>
|
||||
<p>Werstellungsdatum: {{dayjs(selectedStatement.valueDate).format("DD.MM.YYYY")}}</p>
|
||||
<p>Partner: {{selectedStatement.amount > 0 ? selectedStatement.debName : selectedStatement.credName}}</p>
|
||||
<p>Partner IBAN: {{selectedStatement.amount > 0 ? selectedStatement.debIban : selectedStatement.credIban}}</p>
|
||||
<p>Konto: {{selectedStatement.account}}</p>
|
||||
<p class="text-wrap">Beschreibung: <br>{{selectedStatement.text}}</p>
|
||||
</div>
|
||||
<div class="w-full p-2 overflow-scroll">
|
||||
<UCard
|
||||
v-for="document in dataStore.getOpenDocuments()"
|
||||
>
|
||||
|
||||
|
||||
{{document.documentNumber ||document.reference}}
|
||||
<!-- {{document}}-->
|
||||
</UCard>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <UFormGroup>
|
||||
<USelectMenu
|
||||
:options="dataStore.createddocuments"
|
||||
/>
|
||||
</UFormGroup>-->
|
||||
|
||||
|
||||
|
||||
</UCard>
|
||||
|
||||
</UModal>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ const openIncomingInvoices = ref([])
|
||||
|
||||
const accounts = ref([])
|
||||
|
||||
const loading = ref(true)
|
||||
const setup = async () => {
|
||||
if(route.params.id) {
|
||||
itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id))
|
||||
@@ -42,12 +43,13 @@ const setup = async () => {
|
||||
openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
|
||||
openDocuments.value = openDocuments.value.map(i => {
|
||||
|
||||
console.log()
|
||||
|
||||
return {
|
||||
...i,
|
||||
docTotal: getDocumentSum(i),
|
||||
docTotal: getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i)))),
|
||||
statementTotal: Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0)),
|
||||
openSum: (Number(getDocumentSum(i)) - Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0))).toFixed(2)
|
||||
openSum: (Number(getDocumentSum(i, i.usedAdvanceInvoices.map(i => getDocumentSum(documents.find(x => x.id === i))))) - Number(i.statementallocations.reduce((n,{amount}) => n + amount, 0))).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -63,7 +65,7 @@ const setup = async () => {
|
||||
|
||||
let allocations = (await supabase.from("createddocuments").select(`*, statementallocations(*)`).eq("id",50)).data
|
||||
|
||||
|
||||
loading.value = false
|
||||
|
||||
}
|
||||
|
||||
@@ -71,19 +73,36 @@ const displayCurrency = (value, currency = "€") => {
|
||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
||||
}
|
||||
|
||||
const separateIBAN = (input) => {
|
||||
const separateIBAN = (input = "") => {
|
||||
const separates = input.match(/.{1,4}/g)
|
||||
return separates.join(" ")
|
||||
}
|
||||
|
||||
const getDocumentSum = (doc) => {
|
||||
const getDocumentSum = (doc,advanceInvoices = []) => {
|
||||
let sum = 0
|
||||
|
||||
console.log(advanceInvoices)
|
||||
|
||||
doc.rows.forEach(row => {
|
||||
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
|
||||
sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
|
||||
}
|
||||
})
|
||||
return sum
|
||||
|
||||
console.log(sum)
|
||||
|
||||
if(advanceInvoices.length > 0) {
|
||||
advanceInvoices.forEach(i => {
|
||||
console.log(i)
|
||||
sum -= i
|
||||
})
|
||||
}
|
||||
|
||||
console.log(sum)
|
||||
|
||||
|
||||
|
||||
return Number(sum.toFixed(2))
|
||||
}
|
||||
|
||||
const getInvoiceSum = (invoice) => {
|
||||
@@ -96,37 +115,16 @@ const getInvoiceSum = (invoice) => {
|
||||
}
|
||||
|
||||
const calculateOpenSum = computed(() => {
|
||||
let startingAmount = itemInfo.value.amount || 0
|
||||
let startingAmount = 0
|
||||
|
||||
itemInfo.value.statementallocations.forEach(item => {
|
||||
if(item.cd_id) {
|
||||
startingAmount = startingAmount - item.amount
|
||||
} else if(item.ii_id) {
|
||||
startingAmount = Number(startingAmount) + item.amount
|
||||
}else if(item.account) {
|
||||
startingAmount = Number(startingAmount) - item.amount
|
||||
}
|
||||
startingAmount += Math.abs(item.amount)
|
||||
})
|
||||
|
||||
return startingAmount.toFixed(2)
|
||||
return (Math.abs(itemInfo.value.amount) - startingAmount).toFixed(2)
|
||||
})
|
||||
|
||||
const calculateAllocatedSum = computed(() => {
|
||||
let startingAmount = 0
|
||||
|
||||
itemInfo.value.statementallocations.forEach(item => {
|
||||
console.log(item)
|
||||
|
||||
if(item.cd_id) {
|
||||
startingAmount = startingAmount + item.amount
|
||||
} else if(item.ii_id) {
|
||||
startingAmount = Number(startingAmount) + item.amount
|
||||
}
|
||||
})
|
||||
|
||||
return startingAmount
|
||||
|
||||
})
|
||||
|
||||
const saveAllocations = async () => {
|
||||
let allocationsToBeSaved = itemInfo.value.statementallocations.filter(i => !i.id)
|
||||
@@ -138,6 +136,14 @@ const saveAllocations = async () => {
|
||||
|
||||
}
|
||||
|
||||
const showAccountSelection = ref(false)
|
||||
const accountToSave = ref("")
|
||||
|
||||
const selectAccount = (id) => {
|
||||
accountToSave.value = id
|
||||
showAccountSelection.value = false
|
||||
}
|
||||
|
||||
const saveAllocation = async (allocation) => {
|
||||
const {data,error} = await supabase.from("statementallocations").insert({
|
||||
...allocation,
|
||||
@@ -184,37 +190,9 @@ setup()
|
||||
</template>
|
||||
<template #center>
|
||||
<h1
|
||||
:class="['text-xl','font-medium', Number(calculateOpenSum) === 0 ? ['text-primary-500'] : ['text-rose-600']]"
|
||||
:class="['text-xl','font-medium']"
|
||||
>Kontobewegung bearbeiten</h1>
|
||||
</template>
|
||||
<template #right>
|
||||
<!-- <UButton
|
||||
v-if="mode === 'edit'"
|
||||
@click="saveAllocations"
|
||||
>
|
||||
Speichern
|
||||
</UButton>-->
|
||||
<!--<UButton
|
||||
v-else-if="mode === 'create'"
|
||||
@click="dataStore.createNewItem('customers',itemInfo)"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="cancelEditorCreate"
|
||||
color="red"
|
||||
class="ml-2"
|
||||
v-if="mode === 'edit' || mode === 'create'"
|
||||
>
|
||||
Abbrechen
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="mode === 'show'"
|
||||
@click="editItem"
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>-->
|
||||
</template>
|
||||
<template #badge v-if="itemInfo">
|
||||
<UBadge
|
||||
v-if="itemInfo.incomingInvoice || itemInfo.createdDocument"
|
||||
@@ -232,9 +210,10 @@ setup()
|
||||
|
||||
<UDashboardPanelContent
|
||||
class="flex flex-row"
|
||||
v-if="!loading"
|
||||
>
|
||||
<UCard
|
||||
class="w-2/5 mx-auto mt-5"
|
||||
class="w-2/5 mx-auto "
|
||||
v-if="itemInfo"
|
||||
>
|
||||
<template #header>
|
||||
@@ -282,7 +261,9 @@ setup()
|
||||
<span class="font-semibold">Partner:</span>
|
||||
</td>
|
||||
<td>
|
||||
{{itemInfo.amount > 0 ? itemInfo.debName : itemInfo.credName}}
|
||||
<span v-if="itemInfo.debName">{{itemInfo.debName}}</span>
|
||||
<span v-else-if="itemInfo.credName">{{itemInfo.credName}}</span>
|
||||
<span v-else>-</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@@ -291,7 +272,9 @@ setup()
|
||||
<span class="font-semibold">Partner IBAN:</span>
|
||||
</td>
|
||||
<td>
|
||||
{{itemInfo.amount > 0 ? separateIBAN(itemInfo.debIban) : separateIBAN(itemInfo.credIban)}}
|
||||
<span v-if="itemInfo.debIban">{{itemInfo.debIban}}</span>
|
||||
<span v-else-if="itemInfo.credIban">{{itemInfo.credIban}}</span>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="flex-row flex justify-between">
|
||||
@@ -356,19 +339,41 @@ setup()
|
||||
|
||||
</UCard>
|
||||
|
||||
<!-- <UDivider
|
||||
class="mt-5 w-2/5 mx-auto"
|
||||
v-if="!itemInfo.createdDocument && !itemInfo.incomingInvoice"
|
||||
/>-->
|
||||
<div class="w-2/5 mx-auto">
|
||||
<UAlert
|
||||
class="mb-3"
|
||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
||||
variant="outline"
|
||||
:title="calculateOpenSum > 0 ? `${displayCurrency(calculateOpenSum)} von ${displayCurrency(Math.abs(itemInfo.amount))} nicht zugewiesen` : 'Kontobewegung vollständig zugewiesen'"
|
||||
>
|
||||
<template #description>
|
||||
<UProgress
|
||||
:value="Math.abs(itemInfo.amount) - calculateOpenSum"
|
||||
:max="Math.abs(itemInfo.amount)"
|
||||
:color="calculateOpenSum > 0 ? 'rose' : 'primary'"
|
||||
/>
|
||||
</template>
|
||||
</UAlert>
|
||||
|
||||
<div
|
||||
class="w-2/5 mx-auto"
|
||||
v-if="itemInfo.amount > 0 "
|
||||
>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
v-for="item in itemInfo.statementallocations.filter(i => i.account)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{accounts.find(i => i.id === item.account).number}} - {{accounts.find(i => i.id === item.account).label}}</span>
|
||||
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
class="mr-3"
|
||||
@click="removeAllocation(itemInfo.statementallocations.find(i => i.account === item.account).id)"
|
||||
/>
|
||||
</UCard>
|
||||
|
||||
<UDivider v-if="allocatedDocuments.length > 0">
|
||||
<span>Zugewiesene Summe: {{displayCurrency(calculateAllocatedSum)}}</span>
|
||||
</UDivider>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
@@ -377,7 +382,7 @@ setup()
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{document.customer ? document.customer.name : ""}} - {{document.documentNumber}}</span>
|
||||
<span class="font-semibold text-primary-500 text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||
<span class="font-semibold text-nowrap">{{displayCurrency(getDocumentSum(document))}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
@@ -402,28 +407,100 @@ setup()
|
||||
@click="router.push(`/createDocument/show/${document.id}`)"
|
||||
/>
|
||||
</UCard>
|
||||
<UDivider class="mt-3">
|
||||
<span>Offene Summe: {{displayCurrency(calculateOpenSum)}}</span>
|
||||
</UDivider>
|
||||
<UInput
|
||||
id="searchinput"
|
||||
v-model="searchString"
|
||||
icon="i-heroicons-funnel"
|
||||
autocomplete="off"
|
||||
placeholder="Suche..."
|
||||
class="hidden lg:block mt-3"
|
||||
@keydown.esc="$event.target.blur()"
|
||||
>
|
||||
<template #trailing>
|
||||
<UKbd value="/" />
|
||||
</template>
|
||||
</UInput>
|
||||
|
||||
<UButton
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: 20 })"
|
||||
<UDivider class="my-3">Ohne Beleg buchen</UDivider>
|
||||
|
||||
<InputGroup class="mt-3 w-full">
|
||||
<USelectMenu
|
||||
class="w-full"
|
||||
:options="accounts"
|
||||
value-attribute="id"
|
||||
option-attribute="label"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
v-model="accountToSave"
|
||||
searchable
|
||||
:search-attributes="['number','label']"
|
||||
>
|
||||
<template #label>
|
||||
<span v-if="accountToSave">{{accounts.find(i => i.id === accountToSave).number}} - {{accounts.find(i => i.id === accountToSave).label}}</span>
|
||||
<span v-else>Kein Konto ausgewählt</span>
|
||||
</template>
|
||||
<template #option="{option}">
|
||||
{{option.number}} - {{option.label}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
@click="showAccountSelection = true"
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-check"
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(calculateOpenSum), account: accountToSave })"
|
||||
>
|
||||
Buchen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="accountToSave = ''"
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
/>
|
||||
</InputGroup>
|
||||
<UModal
|
||||
v-model="showAccountSelection"
|
||||
>
|
||||
Als DP markieren
|
||||
</UButton>
|
||||
<UCard>
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||
Konto auswählen
|
||||
</h3>
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAccountSelection = false" />
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
v-for="selectableAccount in accounts"
|
||||
variant="outline"
|
||||
class="m-3"
|
||||
@click="selectAccount(selectableAccount.id)"
|
||||
>
|
||||
{{selectableAccount.label}}
|
||||
</UButton>
|
||||
</UCard>
|
||||
|
||||
</UModal>
|
||||
|
||||
<UDivider
|
||||
class="my-3"
|
||||
>
|
||||
Auf Beleg buchen
|
||||
</UDivider>
|
||||
|
||||
<InputGroup
|
||||
class="mt-3 w-full"
|
||||
>
|
||||
<UInput
|
||||
id="searchinput"
|
||||
v-model="searchString"
|
||||
icon="i-heroicons-funnel"
|
||||
autocomplete="off"
|
||||
placeholder="Suche..."
|
||||
class="hidden lg:block w-full mr-1"
|
||||
@keydown.esc="$event.target.blur()"
|
||||
>
|
||||
<template #trailing>
|
||||
<UKbd value="/" />
|
||||
</template>
|
||||
</UInput>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-x-mark"
|
||||
color="rose"
|
||||
@click="searchString = ''"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
|
||||
<UCard
|
||||
class="mt-5"
|
||||
@@ -441,7 +518,7 @@ setup()
|
||||
variant="outline"
|
||||
class="mr-3"
|
||||
v-if="!itemInfo.statementallocations.find(i => i.cd_id === document.id)"
|
||||
@click="saveAllocation({cd_id: document.id, bs_id: itemInfo.id, amount: Number(itemInfo.amount)})"
|
||||
@click="saveAllocation({cd_id: document.id, bs_id: itemInfo.id, amount: Number(document.openSum)})"
|
||||
/>
|
||||
<UButton
|
||||
icon="i-heroicons-x-mark"
|
||||
@@ -459,14 +536,6 @@ setup()
|
||||
/>
|
||||
</UCard>
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="w-2/5 mx-auto"
|
||||
v-if="itemInfo.amount < 0 "
|
||||
>
|
||||
<UDivider>
|
||||
<span>Offene Summe: {{displayCurrency(calculateOpenSum)}}</span>
|
||||
</UDivider>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
:ui="{ring: /*itemInfo.assignments.find(i => i.id === invoice.id)*/ false ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
@@ -474,7 +543,7 @@ setup()
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{dataStore.getVendorById(item.vendor).name}} - {{item.reference}}</span>
|
||||
<span>{{dataStore.getVendorById(item.vendor) ? dataStore.getVendorById(item.vendor).name : ''}} - {{item.reference}}</span>
|
||||
<span class="font-semibold text-rose-600 text-nowrap">-{{displayCurrency(getInvoiceSum(item))}}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -501,6 +570,7 @@ setup()
|
||||
|
||||
</UCard>
|
||||
</div>
|
||||
|
||||
</UDashboardPanelContent>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ const showServiceSelectionModal = ref(false)
|
||||
|
||||
const itemInfo = ref({
|
||||
type: "invoices",
|
||||
taxType: "Standard",
|
||||
customer: null,
|
||||
contact: null,
|
||||
address: {
|
||||
@@ -34,6 +35,7 @@ const itemInfo = ref({
|
||||
documentNumberTitle: "Rechnungsnummer",
|
||||
documentDate: dayjs(),
|
||||
deliveryDate: dayjs(),
|
||||
deliveryDateEnd: null,
|
||||
deliveryDateType: "Lieferdatum",
|
||||
dateOfPerformance: null,
|
||||
paymentDays: profileStore.ownTenant.standardPaymentDays,
|
||||
@@ -66,6 +68,7 @@ console.log(profileStore.ownTenant)
|
||||
const letterheads = ref([])
|
||||
const createddocuments = ref([])
|
||||
const projects = ref([])
|
||||
const plants = ref([])
|
||||
const products = ref([])
|
||||
const productcategories = ref([])
|
||||
const selectedProductcategorie = ref(null)
|
||||
@@ -83,6 +86,7 @@ const setupPage = async () => {
|
||||
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
||||
createddocuments.value = (await useSupabaseSelect("createddocuments","*"))
|
||||
projects.value = (await useSupabaseSelect("projects","*"))
|
||||
plants.value = (await useSupabaseSelect("plants","*"))
|
||||
services.value = (await useSupabaseSelect("services","*"))
|
||||
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
|
||||
products.value = (await useSupabaseSelect("products","*"))
|
||||
@@ -129,23 +133,33 @@ const setupPage = async () => {
|
||||
|
||||
setCustomerData()
|
||||
|
||||
let firstDate = null
|
||||
let lastDate = null
|
||||
|
||||
linkedDocuments.forEach(doc => {
|
||||
let lastId = 0
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.id > lastId) lastId = row.id
|
||||
})
|
||||
|
||||
if(dayjs(doc.documentDate).isBefore(firstDate) || !firstDate) firstDate = doc.documentDate
|
||||
if(dayjs(doc.documentDate).isAfter(lastDate) || !lastDate) lastDate = doc.documentDate
|
||||
|
||||
itemInfo.value.rows.push(...[
|
||||
{
|
||||
id:uuidv4(),
|
||||
mode: "title",
|
||||
text: doc.title
|
||||
text: `${doc.title} vom ${dayjs(doc.documentDate).format("DD.MM.YYYY")}`
|
||||
},
|
||||
...doc.rows
|
||||
])
|
||||
|
||||
})
|
||||
|
||||
itemInfo.value.deliveryDateType = "Leistungszeitraum"
|
||||
itemInfo.value.deliveryDate = firstDate
|
||||
itemInfo.value.deliveryDateEnd = lastDate
|
||||
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
|
||||
row.discountPercent = 0
|
||||
@@ -445,6 +459,11 @@ const findDocumentErrors = computed(() => {
|
||||
|
||||
if(itemInfo.value.project === null) errors.push({message: "Es ist kein Projekt ausgewählt", type: "info"})
|
||||
|
||||
if(['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.value.deliveryDateType)) {
|
||||
if(itemInfo.value.deliveryDateEnd === null) errors.push({message: `Es ist kein Enddatum für den ${itemInfo.value.deliveryDateType} angegeben`, type: "breaking"})
|
||||
}
|
||||
|
||||
|
||||
if(itemInfo.value.rows.length === 0) {
|
||||
errors.push({message: "Es sind keine Positionen angegeben", type: "breaking"})
|
||||
} else {
|
||||
@@ -608,7 +627,19 @@ const getDocumentData = () => {
|
||||
})
|
||||
}
|
||||
|
||||
let rows = itemInfo.value.rows.map(row => {
|
||||
let rows = itemInfo.value.rows
|
||||
|
||||
if(itemInfo.value.taxType === "13b UStG") {
|
||||
rows = rows.map(row => {
|
||||
return {
|
||||
...row,
|
||||
taxPercent: 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
rows = itemInfo.value.rows.map(row => {
|
||||
|
||||
let unit = dataStore.units.find(i => i.id === row.unit)
|
||||
|
||||
@@ -649,8 +680,8 @@ const getDocumentData = () => {
|
||||
|
||||
const generateContext = (itemInfo, contactData) => {
|
||||
return {
|
||||
vorname:contactData && contactData.firstName,
|
||||
nachname: contactData && contactData.lastName,
|
||||
vorname:(contactData && contactData.firstName) || (customerData && customerData.firstname),
|
||||
nachname: (contactData && contactData.lastName) || (customerData && customerData.lastname),
|
||||
kundenname: customerData && customerData.name,
|
||||
zahlungsziel_in_tagen:itemInfo.paymentDays,
|
||||
diesel_gesamtverbrauch: (itemInfo.agriculture && itemInfo.agriculture.dieselUsageTotal) && itemInfo.agriculture.dieselUsageTotal
|
||||
@@ -661,6 +692,7 @@ const getDocumentData = () => {
|
||||
|
||||
const returnData = {
|
||||
type: itemInfo.value.type,
|
||||
taxType: itemInfo.value.taxType,
|
||||
adressLine: `${businessInfo.name}, ${businessInfo.street}, ${businessInfo.zip} ${businessInfo.city}`,
|
||||
recipient: {
|
||||
name: customerData.name,
|
||||
@@ -670,18 +702,54 @@ const getDocumentData = () => {
|
||||
city: itemInfo.value.address.city || customerData.infoData.city,
|
||||
zip: itemInfo.value.address.zip || customerData.infoData.zip
|
||||
},
|
||||
info: {
|
||||
/*info: {
|
||||
customerNumber: customerData.customerNumber,
|
||||
documentNumber: itemInfo.value.documentNumber,
|
||||
documentNumberTitle: itemInfo.value.documentNumberTitle,
|
||||
documentDate: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"),
|
||||
deliveryDate: dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY"),
|
||||
deliveryDateEnd: itemInfo.value.deliveryDateEnd ? dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY") : null,
|
||||
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||
contactPerson: contactPerson.fullName,
|
||||
contactTel: contactPerson.fixedTel || contactPerson.mobileTel,
|
||||
contactEMail: contactPerson.email,
|
||||
project: dataStore.getProjectById(itemInfo.value.project) ? dataStore.getProjectById(itemInfo.value.project).name : null
|
||||
},
|
||||
project: projects.value.find(i => i.id === itemInfo.value.project) ? projects.value.find(i => i.id === itemInfo.value.project).name : null,
|
||||
plant: plants.value.find(i => i.id === itemInfo.value.plant) ? plants.value.find(i => i.id === itemInfo.value.plants).name : null,
|
||||
},*/
|
||||
info: [
|
||||
{
|
||||
label: itemInfo.value.documentNumberTitle,
|
||||
content: itemInfo.value.documentNumber || "XXXX",
|
||||
},{
|
||||
label: "Kundennummer",
|
||||
content: customerData.customerNumber,
|
||||
},{
|
||||
label: "Belegdatum",
|
||||
content: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"),
|
||||
},{
|
||||
label: itemInfo.value.deliveryDateType,
|
||||
content: !['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.value.deliveryDateType) ? dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY") : `${dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY")} - ${dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY")}`,
|
||||
},{
|
||||
label: "Ansprechpartner",
|
||||
content: contactPerson.fullName,
|
||||
},
|
||||
... contactPerson.fixedTel || contactPerson.mobileTel ? [{
|
||||
label: "Telefon",
|
||||
content: contactPerson.fixedTel || contactPerson.mobileTel,
|
||||
}] : [],
|
||||
... contactPerson.email ? [{
|
||||
label: "E-Mail",
|
||||
content: contactPerson.email,
|
||||
}]: [],
|
||||
... itemInfo.value.plant ? [{
|
||||
label: "Objekt",
|
||||
content: plants.value.find(i => i.id === itemInfo.value.plant).name,
|
||||
}] : [],
|
||||
... itemInfo.value.project ? [{
|
||||
label: "Projekt",
|
||||
content: projects.value.find(i => i.id === itemInfo.value.project).name
|
||||
}]: []
|
||||
],
|
||||
title: itemInfo.value.title,
|
||||
description: itemInfo.value.description,
|
||||
endText: templateEndText(generateContext(itemInfo.value, contactData)),
|
||||
@@ -711,13 +779,16 @@ const generateDocument = async () => {
|
||||
const ownTenant = profileStore.ownTenant
|
||||
const path = letterheads.value.find(i => i.id === itemInfo.value.letterhead).path
|
||||
|
||||
const {data,error} = await supabase.functions.invoke('create_pdf',{
|
||||
/*const {data,error} = await supabase.functions.invoke('create_pdf',{
|
||||
body: {
|
||||
invoiceData: getDocumentData(),
|
||||
backgroundPath: path,
|
||||
returnMode: "base64"
|
||||
}
|
||||
})
|
||||
})*/
|
||||
|
||||
uri.value = await useFunctions().useCreatePDF(getDocumentData(), path)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -728,7 +799,7 @@ const generateDocument = async () => {
|
||||
|
||||
//console.log(JSON.stringify(getDocumentData()))
|
||||
|
||||
uri.value = `data:${data.mimeType};base64,${data.base64}`
|
||||
//uri.value = `data:${data.mimeType};base64,${data.base64}`
|
||||
|
||||
//uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
||||
//alert(uri.value)
|
||||
@@ -836,14 +907,17 @@ const saveDocument = async (state,resetup = false) => {
|
||||
|
||||
let createData = {
|
||||
type: itemInfo.value.type,
|
||||
taxType: itemInfo.value.type === "invoices" ? itemInfo.value.taxType : null,
|
||||
state: itemInfo.value.state || "Entwurf",
|
||||
customer: itemInfo.value.customer,
|
||||
contact: itemInfo.value.contact,
|
||||
address: itemInfo.value.address,
|
||||
project: itemInfo.value.project,
|
||||
plant: itemInfo.value.plant,
|
||||
documentNumber: itemInfo.value.documentNumber,
|
||||
documentDate: itemInfo.value.documentDate,
|
||||
deliveryDate: itemInfo.value.deliveryDate,
|
||||
deliveryDateEnd: itemInfo.value.deliveryDateEnd,
|
||||
paymentDays: itemInfo.value.paymentDays,
|
||||
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||
info: {},
|
||||
@@ -1003,7 +1077,7 @@ const setRowData = (row) => {
|
||||
>
|
||||
<template #description>
|
||||
<ul class="list-disc ml-5">
|
||||
<li v-for="error in findDocumentErrors" :class="[...error.type === 'breaking' ? ['text-rose-600'] : ['text-white']]">
|
||||
<li v-for="error in findDocumentErrors" :class="[...error.type === 'breaking' ? ['text-rose-600'] : ['dark:text-white','text-black']]">
|
||||
{{error.message}}
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1086,6 +1160,17 @@ const setRowData = (row) => {
|
||||
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Steuertyp:"
|
||||
v-if="itemInfo.type === 'invoices'"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="['Standard','13b UStG']"
|
||||
v-model="itemInfo.taxType"
|
||||
class="w-full"
|
||||
></USelectMenu>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Briefpapier:"
|
||||
>
|
||||
@@ -1239,10 +1324,62 @@ const setRowData = (row) => {
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup
|
||||
class="w-80 mr-1"
|
||||
label="Lieferdatumsart:"
|
||||
v-if="itemInfo.type !== 'serialInvoices'"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="['Lieferdatum','Lieferzeitraum','Leistungsdatum','Leistungszeitraum','Kein Lieferdatum anzeigen']"
|
||||
v-model="itemInfo.deliveryDateType"
|
||||
/>
|
||||
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
:label="`${itemInfo.deliveryDateType}${['Lieferzeitraum', 'Leistungszeitraum'].includes(itemInfo.deliveryDateType) ? ' Start' : ''}:`"
|
||||
v-if="itemInfo.type !== 'serialInvoices'"
|
||||
class="mr-1"
|
||||
>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="itemInfo.deliveryDate ? dayjs(itemInfo.deliveryDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
class="mx-auto"
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker v-model="itemInfo.deliveryDate" @close="close" />
|
||||
</template>
|
||||
</UPopover>
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
:label="itemInfo.deliveryDateType + ' Ende:'"
|
||||
v-if="itemInfo.type !== 'serialInvoices' && ['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.deliveryDateType)"
|
||||
>
|
||||
<UPopover
|
||||
:popper="{ placement: 'bottom-start' }">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="itemInfo.deliveryDateEnd ? dayjs(itemInfo.deliveryDateEnd).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
class="mx-auto"
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker v-model="itemInfo.deliveryDateEnd" @close="close" />
|
||||
</template>
|
||||
</UPopover>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup
|
||||
label="Datum:"
|
||||
label="Belegdatum:"
|
||||
class="mr-1"
|
||||
v-if="itemInfo.type !== 'serialInvoices'"
|
||||
>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||
@@ -1257,44 +1394,12 @@ const setRowData = (row) => {
|
||||
</template>
|
||||
</UPopover>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
class="mt-3 w-80"
|
||||
label="Lieferdatumsart:"
|
||||
v-if="itemInfo.type !== 'serialInvoices'"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="['Lieferdatum'/*,'Lieferzeitraum'*/,'Leistungsdatum'/*,'Leistungszeitraum'*/,'Kein Lieferdatum anzeigen']"
|
||||
v-model="itemInfo.deliveryDateType"
|
||||
class="mb-2"
|
||||
/>
|
||||
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
:label="itemInfo.deliveryDateType"
|
||||
v-if="itemInfo.type !== 'serialInvoices'"
|
||||
>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="itemInfo.deliveryDate ? dayjs(itemInfo.deliveryDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker v-model="itemInfo.deliveryDate" @close="close" />
|
||||
</template>
|
||||
</UPopover>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
class="w-full"
|
||||
label="Zahlungsziel in Tagen:"
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">
|
||||
Zahlungsziel in Tagen:
|
||||
</span>
|
||||
</template>
|
||||
<UInput
|
||||
type="number"
|
||||
v-model="itemInfo.paymentDays"
|
||||
@@ -1326,12 +1431,51 @@ const setRowData = (row) => {
|
||||
v-model="itemInfo.contactEMail"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Objekt:"
|
||||
>
|
||||
<InputGroup>
|
||||
<USelectMenu
|
||||
:options="plants.filter(i => i.customer === itemInfo.customer)"
|
||||
v-model="itemInfo.plant"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
searchable
|
||||
searchable-placeholder="Suche..."
|
||||
:search-attributes="['name']"
|
||||
class="w-full"
|
||||
:disabled="!itemInfo.customer"
|
||||
@change="checkForOpenAdvanceInvoices"
|
||||
>
|
||||
<template #label>
|
||||
{{plants.find(i => i.id === itemInfo.plant) ? plants.find(i => i.id === itemInfo.plant).name : "Kein Objekt ausgewählt"}}
|
||||
</template>
|
||||
<template #option="{option: plant}">
|
||||
{{plant.name}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
variant="outline"
|
||||
color="rose"
|
||||
v-if="itemInfo.plant"
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="itemInfo.plant = null"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
v-if="itemInfo.plant"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/standardEntity/plants/show/${itemInfo.plant}`)"
|
||||
>Objekt</UButton>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Projekt:"
|
||||
>
|
||||
<InputGroup>
|
||||
<USelectMenu
|
||||
:options="projects.filter(i => i.customer === itemInfo.customer)"
|
||||
:options="projects.filter(i => i.customer === itemInfo.customer && (itemInfo.plant ? itemInfo.plant === i.plant : true))"
|
||||
v-model="itemInfo.project"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
@@ -1732,6 +1876,7 @@ const setRowData = (row) => {
|
||||
<USelectMenu
|
||||
:options="[19,7,0]"
|
||||
v-model="row.taxPercent"
|
||||
:disabled="itemInfo.taxType === '13b UStG'"
|
||||
>
|
||||
<template #option="{option}">
|
||||
{{option}} %
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<UDashboardNavbar>
|
||||
<UDashboardNavbar title="Ausgangsbelege" :badge="filteredRows.length">
|
||||
<template #right>
|
||||
<UInput
|
||||
id="searchinput"
|
||||
@@ -17,7 +17,7 @@
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit`)"
|
||||
>
|
||||
+ Dokument
|
||||
+ Ausgangsbeleg
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar title="Serienrechnungen">
|
||||
<UDashboardNavbar title="Serienrechnungen" :badge="filteredRows.length">
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit?type=serialInvoices`)"
|
||||
|
||||
@@ -68,11 +68,50 @@ const openEmail = () => {
|
||||
:to="dataStore.documents.find(i => i.createdDocument === itemInfo.id) ? dataStore.documents.find(i => i.createdDocument === itemInfo.id).url : ''"
|
||||
target="_blank"
|
||||
>In neuen Tab anzeigen</UButton>-->
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}`)"
|
||||
<UTooltip
|
||||
text="Übernehmen in Angebot"
|
||||
>
|
||||
Übernehmen
|
||||
</UButton>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}&type=quotes`)"
|
||||
variant="outline"
|
||||
>
|
||||
Angebot
|
||||
</UButton>
|
||||
</UTooltip>
|
||||
<UTooltip
|
||||
text="Übernehmen in Auftragsbestätigung"
|
||||
>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}&type=confirmationOrders`)"
|
||||
variant="outline"
|
||||
>
|
||||
Auftragsbestätigung
|
||||
</UButton>
|
||||
</UTooltip>
|
||||
<UTooltip
|
||||
text="Übernehmen in Lieferschein"
|
||||
>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}&type=deliveryNotes`)"
|
||||
variant="outline"
|
||||
>
|
||||
Lieferschein
|
||||
</UButton>
|
||||
</UTooltip>
|
||||
<UTooltip
|
||||
text="Übernehmen in Rechnung"
|
||||
>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}&type=invoices`)"
|
||||
variant="outline"
|
||||
>
|
||||
Rechnung
|
||||
</UButton>
|
||||
</UTooltip>
|
||||
<UButton
|
||||
@click="openEmail"
|
||||
icon="i-heroicons-envelope"
|
||||
@@ -83,17 +122,26 @@ const openEmail = () => {
|
||||
@click="router.push(`/createDocument/edit/?linkedDocument=${itemInfo.id}&loadMode=storno`)"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
v-if="itemInfo.type === 'invoices' || itemInfo.type === 'advanceInvoices'"
|
||||
>
|
||||
Stornieren
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="itemInfo.project"
|
||||
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
icon="i-heroicons-link"
|
||||
variant="outline"
|
||||
>
|
||||
Projekt
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="itemInfo.customer"
|
||||
@click="router.push(`/standardEntity/customers/show/${itemInfo.customer}`)"
|
||||
icon="i-heroicons-link"
|
||||
variant="outline"
|
||||
>
|
||||
Kunde
|
||||
</UButton>
|
||||
|
||||
</template>
|
||||
</UDashboardToolbar>
|
||||
|
||||
@@ -363,7 +363,7 @@ const showFile = (fileId) => {
|
||||
</template>
|
||||
</USelectMenu>
|
||||
|
||||
<UButton @click="modal.open(DocumentUploadModal,{fileData: {folder: currentFolder.id}})">+ Hochladen</UButton>
|
||||
<UButton @click="modal.open(DocumentUploadModal,{fileData: {folder: currentFolder.id}})">+ Datei</UButton>
|
||||
<UButton
|
||||
@click="createFolderModalOpen = true"
|
||||
variant="outline"
|
||||
|
||||
@@ -50,17 +50,14 @@ setupPage()
|
||||
const templateColumns = [
|
||||
{
|
||||
key: 'reference',
|
||||
label: "Referenz:",
|
||||
sortable: true
|
||||
label: "Referenz:"
|
||||
}, {
|
||||
key: 'state',
|
||||
label: "Status:",
|
||||
sortable: true
|
||||
label: "Status:"
|
||||
},
|
||||
{
|
||||
key: "date",
|
||||
label: "Datum",
|
||||
sortable: true
|
||||
label: "Datum"
|
||||
},
|
||||
{
|
||||
key: "vendor",
|
||||
|
||||
147
pages/incomingInvoices/show/[id].vue
Normal file
147
pages/incomingInvoices/show/[id].vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<script setup>
|
||||
import dayjs from "dayjs";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const supabase = useSupabaseClient()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
//Working
|
||||
const mode = ref(route.params.mode || "show")
|
||||
|
||||
const itemInfo = ref({
|
||||
vendor: 0,
|
||||
expense: true,
|
||||
reference: "",
|
||||
date: null,
|
||||
dueDate: null,
|
||||
paymentType: "Überweisung",
|
||||
description: "",
|
||||
state: "Entwurf",
|
||||
accounts: [
|
||||
{
|
||||
account: null,
|
||||
amountNet: null,
|
||||
amountTax: null,
|
||||
taxType: "19",
|
||||
costCentre: null
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
//Functions
|
||||
|
||||
const currentDocument = ref(null)
|
||||
|
||||
const loading = ref(true)
|
||||
|
||||
const setupPage = async () => {
|
||||
if((mode.value === "show") && route.params.id){
|
||||
itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*), vendor(*)")
|
||||
currentDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
const setState = async (newState) => {
|
||||
if(mode.value === 'show') {
|
||||
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
|
||||
} else if(mode.value === 'edit') {
|
||||
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
|
||||
}
|
||||
await router.push("/incomingInvoices")
|
||||
}
|
||||
|
||||
|
||||
|
||||
setupPage()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar :title="'Eingangsbeleg anzeigen'">
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="setState('Gebucht')"
|
||||
v-if="itemInfo.state !== 'Gebucht'"
|
||||
color="rose"
|
||||
>
|
||||
Status auf Gebucht
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
<UDashboardPanelContent v-if="!loading">
|
||||
|
||||
<div
|
||||
class="flex justify-between mt-5"
|
||||
>
|
||||
<object
|
||||
v-if="currentDocument ? currentDocument.url : false"
|
||||
:data="currentDocument.url + '#toolbar=0&navpanes=0&scrollbar=0&statusbar=0&messages=0&scrollbar=0'"
|
||||
type="application/pdf"
|
||||
class="mx-5 w-2/5 documentPreview"
|
||||
/>
|
||||
<div class="w-1/2 mx-5">
|
||||
<UCard class="truncate mb-5">
|
||||
<p>Status: {{itemInfo.state}}</p>
|
||||
<p>Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}</p>
|
||||
<p>Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}</p>
|
||||
<p v-if="itemInfo.vendor">Lieferant: <nuxt-link :to="`/standardEntity/vendors/show/${itemInfo.vendor}`">{{itemInfo.vendor.name}}</nuxt-link></p>
|
||||
<p>Bezahlt: {{itemInfo.paid ? "Ja" : "Nein"}}</p>
|
||||
<p>Beschreibung: {{itemInfo.description}}</p>
|
||||
|
||||
<!-- TODO: Buchungszeilen darstellen -->
|
||||
</UCard>
|
||||
|
||||
<UCard class="scrollContainer">
|
||||
<HistoryDisplay
|
||||
type="incomingInvoice"
|
||||
v-if="itemInfo"
|
||||
:element-id="itemInfo.id"
|
||||
render-headline
|
||||
/>
|
||||
</UCard>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</UDashboardPanelContent>
|
||||
<UProgress class="mt-3 mx-3" v-else animation="carousel"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.documentPreview {
|
||||
aspect-ratio: 1 / 1.414;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.scrollContainer {
|
||||
overflow-y: scroll;
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
height: 75vh;
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
.scrollContainer::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.lineItemRow {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
</style>
|
||||
@@ -13,27 +13,33 @@
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UDashboardPanelContent>
|
||||
<UDashboardPanelContent class="flex flex-row">
|
||||
<UDashboardCard
|
||||
class="mt-3"
|
||||
class="w-1/3 h-fit mx-2 mt-3"
|
||||
title="Anwesenheiten"
|
||||
>
|
||||
<display-present-profiles/>
|
||||
</UDashboardCard>
|
||||
|
||||
|
||||
<UDashboardCard
|
||||
<!-- <UDashboardCard
|
||||
class="mt-3"
|
||||
>
|
||||
<display-income-and-expenditure/>
|
||||
</UDashboardCard>
|
||||
</UDashboardCard>-->
|
||||
<UDashboardCard
|
||||
class="w-1/3 mt-3"
|
||||
class="w-1/3 h-fit mx-2 mt-3"
|
||||
>
|
||||
<display-open-balances/>
|
||||
</UDashboardCard>
|
||||
<UDashboardCard
|
||||
class="w-1/3 mt-3"
|
||||
class="w-1/3 h-fit mx-2 mt-3"
|
||||
title="Projekte"
|
||||
>
|
||||
<display-projects-in-phases/>
|
||||
</UDashboardCard>
|
||||
<UDashboardCard
|
||||
class="w-1/3 h-fit mx-2 mt-3"
|
||||
>
|
||||
<display-running-time/>
|
||||
</UDashboardCard>
|
||||
|
||||
@@ -31,6 +31,7 @@ import sellingPriceComposedTotal from "~/components/columnRenderings/sellingPric
|
||||
import startDate from "~/components/columnRenderings/startDate.vue"
|
||||
import endDate from "~/components/columnRenderings/endDate.vue"
|
||||
import serviceCategories from "~/components/columnRenderings/serviceCategories.vue"
|
||||
import phase from "~/components/columnRenderings/phase.vue"
|
||||
|
||||
import quantity from "~/components/helpRenderings/quantity.vue"
|
||||
import {useZipCheck} from "~/composables/useZipCheck.js";
|
||||
@@ -155,9 +156,42 @@ export const useDataStore = defineStore('data', () => {
|
||||
inputType: "text"
|
||||
}, {
|
||||
key: "name",
|
||||
label: "Name",
|
||||
label: "Firmenname",
|
||||
title: true,
|
||||
inputType: "text"
|
||||
inputType: "text",
|
||||
disabledFunction: function (item) {
|
||||
return !item.isCompany
|
||||
},
|
||||
},{
|
||||
key: "firstname",
|
||||
label: "Vorname",//TODO: Add Conditional Rendering to Datatypes
|
||||
title: true,
|
||||
inputType: "text",
|
||||
inputChangeFunction: function (row) {
|
||||
if(row.firstname && row.lastname) {
|
||||
row.name = `${row.firstname} ${row.lastname}`
|
||||
} else {
|
||||
row.name = row.firstname
|
||||
}
|
||||
},
|
||||
disabledFunction: function (item) {
|
||||
return item.isCompany
|
||||
},
|
||||
},{
|
||||
key: "lastname",
|
||||
label: "Nachname",
|
||||
title: true,
|
||||
inputType: "text",
|
||||
inputChangeFunction: function (row) {
|
||||
if(row.firstname && row.lastname) {
|
||||
row.name = `${row.firstname} ${row.lastname}`
|
||||
} else {
|
||||
row.name = row.lastname
|
||||
}
|
||||
},
|
||||
disabledFunction: function (item) {
|
||||
return item.isCompany
|
||||
},
|
||||
}, {
|
||||
key: "isCompany",
|
||||
label: "Firmenkunde",
|
||||
@@ -736,7 +770,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
default: true,
|
||||
"filterFunction": function (row) {
|
||||
if(row.phases && row.phases.length > 0) {
|
||||
return row.phases.find(i => i.active).label !== "Abgeschlossen";
|
||||
return row.phases.find(i => i.active).label !== "Abgeschlossen"
|
||||
|
||||
//return phase.label !== "Abgeschlossen";
|
||||
|
||||
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
@@ -772,7 +810,8 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
},{
|
||||
key: "phase",
|
||||
label: "Phase"
|
||||
label: "Phase",
|
||||
component: phase
|
||||
},{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
@@ -2107,6 +2146,15 @@ export const useDataStore = defineStore('data', () => {
|
||||
oldVal = "Ja"
|
||||
newVal = "Nein"
|
||||
}
|
||||
} else if(key === "archived") {
|
||||
name = "Archiviert"
|
||||
if(newVal === true){
|
||||
oldVal = "Nein"
|
||||
newVal = "Ja"
|
||||
} else if(newVal === false) {
|
||||
oldVal = "Ja"
|
||||
newVal = "Nein"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ export const useProfileStore = defineStore('profile', () => {
|
||||
}
|
||||
|
||||
async function fetchTenants () {
|
||||
tenants.value = (await supabase.from("tenants").select()).data
|
||||
tenants.value = (await supabase.from("tenants").select().order("id",{ascending: true})).data
|
||||
}
|
||||
|
||||
const getOwnProfile = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user