diff --git a/components/EntityShow.vue b/components/EntityShow.vue index 5dfe1b3..9135630 100644 --- a/components/EntityShow.vue +++ b/components/EntityShow.vue @@ -560,6 +560,13 @@ const getAvailableQueryStringData = (keys) => { +
+ + + + + +
diff --git a/components/costcentreDisplay.vue b/components/costcentreDisplay.vue new file mode 100644 index 0000000..5d5215b --- /dev/null +++ b/components/costcentreDisplay.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/composables/useRole.js b/composables/useRole.js index 224f3ab..7dd0f68 100644 --- a/composables/useRole.js +++ b/composables/useRole.js @@ -222,6 +222,30 @@ export const useRole = () => { label: "Aufgaben erstellen", parent: "tasks" }, + costcentres: { + label: "Kostenstellen", + showToAllUsers: false + }, + "costcentres-viewAll": { + label: "Alle Kostenstellen einsehen", + parent: "costcentres" + }, + "costcentres-create": { + label: "Kostenstellen erstellen", + parent: "costcentres" + }, + ownaccounts: { + label: "Buchungskonten", + showToAllUsers: false + }, + "ownaccounts-viewAll": { + label: "Alle Buchungskonten einsehen", + parent: "ownaccounts" + }, + "ownaccounts-create": { + label: "Buchungskonten erstellen", + parent: "ownaccounts" + }, "inventory": { label: "Lager", }, diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index 76c2009..ddb9878 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -31,6 +31,7 @@ const allocatedIncomingInvoices = ref([]) const createddocuments = ref([]) const accounts = ref([]) +const ownaccounts = ref([]) const loading = ref(true) const setup = async () => { @@ -46,6 +47,7 @@ const setup = async () => { const incominginvoices = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(id,name)")).filter(i => i.state === "Gebucht") accounts.value = (await supabase.from("accounts").select()).data + ownaccounts.value = (await supabase.from("ownaccounts").select()).data openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== useSum().getCreatedDocumentSum(i,createddocuments.value).toFixed(2)) openDocuments.value = openDocuments.value.map(i => { @@ -118,6 +120,7 @@ const saveAllocations = async () => { const showAccountSelection = ref(false) const accountToSave = ref("") +const ownAccountToSave = ref("") const selectAccount = (id) => { accountToSave.value = id @@ -376,6 +379,24 @@ setup() @click="removeAllocation(item.id)" /> + + + +
- Ohne Beleg buchen + Buchungssumme - - - - - - - - - - - - - - - - - {{selectableAccount.label}} - - + + + + Ohne Beleg buchen + + + + + + + + + + + + + + + + {{selectableAccount.label}} + + + + + + + + + + + + + + + + - { diff --git a/pages/incomingInvoices/create.vue b/pages/incomingInvoices/create.vue index d549509..fe18446 100644 --- a/pages/incomingInvoices/create.vue +++ b/pages/incomingInvoices/create.vue @@ -2,6 +2,7 @@ import InputGroup from "~/components/InputGroup.vue"; import dayjs from "dayjs"; import HistoryDisplay from "~/components/HistoryDisplay.vue"; +import {useSupabaseSelect} from "~/composables/useSupabase.js"; definePageMeta({ middleware: "auth" @@ -35,16 +36,24 @@ const itemInfo = ref({ }) const availableDocuments = ref([]) +const costcentres = ref([]) const setup = async () => { let filetype = (await supabase.from("filetags").select().eq("tenant",profileStore.currentTenant).eq("incomingDocumentType","invoices").single()).data.id console.log(filetype) let ids = (await supabase.from("files").select("id").eq("tenant",profileStore.currentTenant).eq("type", filetype).is("incominginvoice",null)).data.map(i => i.id) availableDocuments.value = await useFiles().selectSomeDocuments(ids) + } setup() +const loadCostCentres = async () => { + costcentres.value = await useSupabaseSelect("costcentres") + +} +loadCostCentres() + const useNetMode = ref(false) const loadedFile = ref(null) @@ -129,6 +138,11 @@ const createIncomingInvoice = async () => { } +const setCostCentre = async (item,data) => { + await loadCostCentres() + item.costCentre = data.id +} + @@ -145,10 +159,14 @@ const createIncomingInvoice = async () => {
+
+ Keine Dateien zum zuweisen verfügbar +
{ {{dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor) ? dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor).name : 'Lieferant auswählen'}} - - + Lieferant - + @@ -345,6 +363,9 @@ const createIncomingInvoice = async () => { + @@ -352,18 +373,25 @@ const createIncomingInvoice = async () => { label="Kostenstelle" class=" mb-3" > - + + @@ -374,6 +402,11 @@ const createIncomingInvoice = async () => { icon="i-heroicons-x-mark" @click="item.costCentre = null" /> + diff --git a/pages/incomingInvoices/edit/[id].vue b/pages/incomingInvoices/edit/[id].vue index b029af0..97b0e12 100644 --- a/pages/incomingInvoices/edit/[id].vue +++ b/pages/incomingInvoices/edit/[id].vue @@ -2,6 +2,7 @@ import InputGroup from "~/components/InputGroup.vue"; import dayjs from "dayjs"; import HistoryDisplay from "~/components/HistoryDisplay.vue"; +import {useSupabaseSelect} from "~/composables/useSupabase.js"; definePageMeta({ middleware: "auth" @@ -34,10 +35,14 @@ const itemInfo = ref({ ] }) +const costcentres = ref([]) + const setup = async () => { let filetype = (await supabase.from("filetags").select().eq("tenant",profileStore.currentTenant).eq("incomingDocumentType","invoices").single()).data.id console.log(filetype) + costcentres.value = await useSupabaseSelect("costcentres") + itemInfo.value = await useSupabaseSelectSingle("incominginvoices", route.params.id, "*, files(*)") await loadFile(itemInfo.value.files[itemInfo.value.files.length-1].id) @@ -322,20 +327,27 @@ const updateIncomingInvoice = async () => { - + + diff --git a/pages/settings/numberRanges.vue b/pages/settings/numberRanges.vue index 67de159..72c2e37 100644 --- a/pages/settings/numberRanges.vue +++ b/pages/settings/numberRanges.vue @@ -39,6 +39,9 @@ const resources = { }, deliveryNotes: { label: "Lieferscheine" + }, + costcentres: { + label: "Kostenstellen" } } diff --git a/stores/data.js b/stores/data.js index d78c5c5..e00361e 100644 --- a/stores/data.js +++ b/stores/data.js @@ -1957,6 +1957,134 @@ export const useDataStore = defineStore('data', () => { } ] }, + costcentres: { + isArchivable: true, + label: "Kostenstellen", + labelSingle: "Kostenstelle", + isStandardEntity: true, + redirect:true, + numberRangeHolder: "number", + historyItemHolder: "costcentre", + supabaseSortColumn: "number", + supabaseSelectWithInformation: "*, project(*), vehicle(*), inventoryitem(*)", + filters: [{ + name: "Archivierte ausblenden", + default: true, + "filterFunction": function (row) { + if(!row.archived) { + return true + } else { + return false + } + } + }], + templateColumns: [ + { + key: 'number', + label: "Nummer", + inputIsNumberRange: true, + inputType: "text" + }, { + key: "name", + label: "Name", + required: true, + title: true, + inputType: "text", + }, + { + key: "description", + label: "Beschreibung", + inputType: "textarea" + }, + { + key: "vehicle", + label: "Fahrzeug", + component: vehicle, + inputType: "select", + selectDataType: "vehicles", + selectOptionAttribute: "licensePlate", + selectSearchAttributes: ['licensePlate'], + }, + { + key: "inventoryitem", + label: "Inventarartikel", + inputType: "select", + selectDataType: "inventoryitems", + selectOptionAttribute: "name", + selectSearchAttributes: ['name'], + }, + { + key: "project", + label: "Projekt", + component: project, + inputType: "select", + selectDataType: "projects", + selectOptionAttribute: "name", + selectSearchAttributes: ['name'], + }, + { + key: "profiles", + label: "Berechtigte Benutzer", + inputType: "select", + selectDataType: "profiles", + selectOptionAttribute: "fullName", + selectSearchAttributes: ['fullName'], + selectMultiple: true, + component: profiles + }, + ], + showTabs: [{label: 'Informationen'},{label: 'Auswertung Kostenstelle'}] + }, + ownaccounts: { + isArchivable: true, + label: "zusätzliche Buchungskonten", + labelSingle: "zusätzliches Buchungskonto", + isStandardEntity: true, + redirect:true, + historyItemHolder: "ownaccount", + supabaseSortColumn: "number", + supabaseSelectWithInformation: "*", + filters: [{ + name: "Archivierte ausblenden", + default: true, + "filterFunction": function (row) { + if(!row.archived) { + return true + } else { + return false + } + } + }], + templateColumns: [ + { + key: 'number', + label: "Nummer", + inputType: "text" + }, { + key: "name", + label: "Name", + required: true, + title: true, + inputType: "text", + }, + { + key: "description", + label: "Beschreibung", + inputType: "textarea" + }, + { + key: "profiles", + label: "Berechtigte Benutzer", + inputType: "select", + selectDataType: "profiles", + selectOptionAttribute: "fullName", + selectSearchAttributes: ['fullName'], + selectMultiple: true, + component: profiles + }, + ], + showTabs: [{label: 'Informationen'}] + }, } const documentTypesForCreation = ref({