Rebuild Inventory
Added Advance Invoices
This commit is contained in:
@@ -88,7 +88,7 @@ const setupPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setDocumentTypeConfig = () => {
|
const setDocumentTypeConfig = () => {
|
||||||
if(itemInfo.value.type === "invoices") {
|
if(itemInfo.value.type === "invoices" ||itemInfo.value.type === "advanceInvoices") {
|
||||||
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
|
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
|
||||||
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
||||||
} else if(itemInfo.value.type === "quotes") {
|
} else if(itemInfo.value.type === "quotes") {
|
||||||
@@ -120,7 +120,7 @@ const setCustomerData = () => {
|
|||||||
|
|
||||||
const setContactPersonData = () => {
|
const setContactPersonData = () => {
|
||||||
let profile = dataStore.activeProfile
|
let profile = dataStore.activeProfile
|
||||||
console.log(profile)
|
//console.log(profile)
|
||||||
|
|
||||||
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = profile.id
|
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = profile.id
|
||||||
|
|
||||||
@@ -132,6 +132,40 @@ const setContactPersonData = () => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showAdvanceInvoiceCalcModal = ref(false)
|
||||||
|
const advanceInvoiceData = ref({
|
||||||
|
totalSumNet: 0,
|
||||||
|
partPerPecentage: 0,
|
||||||
|
part: 0
|
||||||
|
})
|
||||||
|
const importPositions = () => {
|
||||||
|
if(itemInfo.value.type === 'advanceInvoices') {
|
||||||
|
if(advanceInvoiceData.value.totalSumNet !== 0 && advanceInvoiceData.value.partPerPecentage !== 0 && advanceInvoiceData.value.part !== 0) {
|
||||||
|
showAdvanceInvoiceCalcModal.value = false
|
||||||
|
|
||||||
|
let lastId = 0
|
||||||
|
itemInfo.value.rows.forEach(row => {
|
||||||
|
if(row.id > lastId) lastId = row.id
|
||||||
|
})
|
||||||
|
|
||||||
|
itemInfo.value.rows.push({
|
||||||
|
id: lastId +1,
|
||||||
|
mode: "free",
|
||||||
|
text: "Abschlagszahlung",
|
||||||
|
quantity: 1,
|
||||||
|
unit: 10,
|
||||||
|
price: advanceInvoiceData.value.part,
|
||||||
|
taxPercent: 19,
|
||||||
|
discountPercent: 0,
|
||||||
|
advanceInvoiceData: advanceInvoiceData.value
|
||||||
|
})
|
||||||
|
setPosNumbers()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getRowAmount = (row) => {
|
const getRowAmount = (row) => {
|
||||||
@@ -465,17 +499,73 @@ setupPage()
|
|||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Dokumenttyp:"
|
label="Dokumenttyp:"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<InputGroup>
|
||||||
:options="Object.keys(dataStore.documentTypesForCreation).map(i => {return {label: dataStore.documentTypesForCreation[i].labelSingle, type: i }})"
|
<USelectMenu
|
||||||
v-model="itemInfo.type"
|
:options="Object.keys(dataStore.documentTypesForCreation).map(i => {return {label: dataStore.documentTypesForCreation[i].labelSingle, type: i }})"
|
||||||
value-attribute="type"
|
v-model="itemInfo.type"
|
||||||
option-attribute="label"
|
value-attribute="type"
|
||||||
@change="setDocumentTypeConfig"
|
option-attribute="label"
|
||||||
|
@change="setDocumentTypeConfig"
|
||||||
|
class="flex-auto"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
v-if="itemInfo.type === 'advanceInvoices'"
|
||||||
|
icon="i-heroicons-arrow-down-tray"
|
||||||
|
@click="showAdvanceInvoiceCalcModal = true"
|
||||||
|
>Auto Positionen</UButton>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
<USlideover
|
||||||
|
v-model="showAdvanceInvoiceCalcModal"
|
||||||
>
|
>
|
||||||
<template #label>
|
<UCard class="h-full">
|
||||||
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
<template #header>
|
||||||
</template>
|
<UButton @click="importPositions">Übernehmen</UButton>
|
||||||
</USelectMenu>
|
</template>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Gesamtsumme:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="number"
|
||||||
|
:step="0.01"
|
||||||
|
v-model="advanceInvoiceData.totalSumNet"
|
||||||
|
@focusout="advanceInvoiceData.part = advanceInvoiceData.totalSumNet / 100 * advanceInvoiceData.partPerPecentage"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Prozent:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="number"
|
||||||
|
:step="0.01"
|
||||||
|
v-model="advanceInvoiceData.partPerPecentage"
|
||||||
|
@focusout="advanceInvoiceData.part = advanceInvoiceData.totalSumNet / 100 * advanceInvoiceData.partPerPecentage"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Abzurechnender Anteil:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="number"
|
||||||
|
:step="0.01"
|
||||||
|
v-model="advanceInvoiceData.part"
|
||||||
|
@focusout="advanceInvoiceData.partPerPecentage = Number((advanceInvoiceData.part / advanceInvoiceData.totalSumNet * 100).toFixed(2))"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</UCard>
|
||||||
|
|
||||||
|
</USlideover>
|
||||||
|
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Kunde:"
|
label="Kunde:"
|
||||||
@@ -747,7 +837,7 @@ setupPage()
|
|||||||
{{option.name}} - {{option.text}}
|
{{option.name}} - {{option.text}}
|
||||||
</template>
|
</template>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText && i.documentType === itemInfo.type) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText && i.documentType === itemInfo.type).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ const templateTypes = [
|
|||||||
{
|
{
|
||||||
key: "invoices",
|
key: "invoices",
|
||||||
label: "Rechnungen"
|
label: "Rechnungen"
|
||||||
|
},{
|
||||||
|
key: "advanceInvoices",
|
||||||
|
label: "Abschlagsrechnungen"
|
||||||
}, {
|
}, {
|
||||||
key: "quotes",
|
key: "quotes",
|
||||||
label: "Angebote"
|
label: "Angebote"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const {vendors} = storeToRefs(useDataStore())
|
|||||||
const {fetchVendorInvoices} = useDataStore()
|
const {fetchVendorInvoices} = useDataStore()
|
||||||
|
|
||||||
const availableDocuments = computed(() => {
|
const availableDocuments = computed(() => {
|
||||||
return dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung' && dataStore.incominginvoices.filter(x => x.document === i).length === 0))
|
return dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung' /*&& dataStore.incominginvoices.filter(x => x.document === i).length === 0*/))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<div v-if="!itemInfo.document">
|
<div v-if="!itemInfo.document">
|
||||||
<div v-if="availableDocuments.length === 0" class="w-1/2 mx-auto text-center">
|
<!-- <div v-if="availableDocuments.length === 0" class="w-1/2 mx-auto text-center">
|
||||||
<p class="text-2xl mt-5">Keine Dokumente zur Auswahl vefügbar</p>
|
<p class="text-2xl mt-5">Keine Dokumente zur Auswahl vefügbar</p>
|
||||||
<UButton
|
<UButton
|
||||||
@click="router.push(`/documents`)"
|
@click="router.push(`/documents`)"
|
||||||
@@ -193,11 +193,10 @@ setupPage()
|
|||||||
>
|
>
|
||||||
Zu den Dokumenten
|
Zu den Dokumenten
|
||||||
</UButton>
|
</UButton>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
|
|
||||||
<DocumentList
|
<DocumentList
|
||||||
v-else
|
|
||||||
:documents="availableDocuments"
|
:documents="availableDocuments"
|
||||||
:return-document-id="true"
|
:return-document-id="true"
|
||||||
@selectDocument="(documentId) => itemInfo.document = documentId"
|
@selectDocument="(documentId) => itemInfo.document = documentId"
|
||||||
|
|||||||
@@ -11,45 +11,79 @@ const toast = useToast()
|
|||||||
|
|
||||||
const inventoryChangeData = ref({
|
const inventoryChangeData = ref({
|
||||||
productId: "",
|
productId: "",
|
||||||
spaceId: "",
|
sourceSpaceId: null,
|
||||||
|
sourceProjectId: null,
|
||||||
|
destinationSpaceId: null,
|
||||||
|
destinationProjectId: null,
|
||||||
quantity: 1
|
quantity: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
const createMovement = async () => {
|
const createMovement = async () => {
|
||||||
|
|
||||||
if(mode.value === '' || !checkSpaceId(inventoryChangeData.value.spaceId) || !checkArticle(inventoryChangeData.value.productId)){
|
let movements = []
|
||||||
|
|
||||||
} else {
|
if(mode.value === 'incoming'){
|
||||||
if(mode.value === 'incoming'){
|
|
||||||
|
|
||||||
const {error} = await supabase
|
let movement = {
|
||||||
.from("movements")
|
productId: inventoryChangeData.value.productId,
|
||||||
.insert([inventoryChangeData.value])
|
spaceId: inventoryChangeData.value.destinationSpaceId,
|
||||||
.select()
|
projectId: inventoryChangeData.value.destinationProjectId,
|
||||||
if(error) console.log(error)
|
quantity: inventoryChangeData.value.quantity,
|
||||||
|
profileId: dataStore.activeProfile.id,
|
||||||
|
tenant: dataStore.currentTenant
|
||||||
} else if (mode.value === 'outgoing'){
|
|
||||||
inventoryChangeData.value.quantity *= -1
|
|
||||||
|
|
||||||
const {error} = await supabase
|
|
||||||
.from("movements")
|
|
||||||
.insert([inventoryChangeData.value])
|
|
||||||
.select()
|
|
||||||
if(error) console.log(error)
|
|
||||||
} else if (mode.value === 'change'){}
|
|
||||||
|
|
||||||
|
|
||||||
inventoryChangeData.value = {
|
|
||||||
productId: "",
|
|
||||||
spaceId: "",
|
|
||||||
quantity: 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
movements.push(movement)
|
||||||
|
|
||||||
dataStore.fetchMovements()
|
/*const {error} = await supabase
|
||||||
|
.from("movements")
|
||||||
|
.insert([inventoryChangeData.value])
|
||||||
|
.select()
|
||||||
|
if(error) console.log(error)*/
|
||||||
|
|
||||||
|
|
||||||
|
} else if (mode.value === 'outgoing'){
|
||||||
|
|
||||||
|
let movement = {
|
||||||
|
productId: inventoryChangeData.value.productId,
|
||||||
|
spaceId: inventoryChangeData.value.sourceSpaceId,
|
||||||
|
projectId: inventoryChangeData.value.sourceProjectId,
|
||||||
|
quantity: inventoryChangeData.value.quantity * -1,
|
||||||
|
profileId: dataStore.activeProfile.id,
|
||||||
|
tenant: dataStore.currentTenant
|
||||||
|
}
|
||||||
|
|
||||||
|
movements.push(movement)
|
||||||
|
} else if (mode.value === 'change'){
|
||||||
|
let outMovement = {
|
||||||
|
productId: inventoryChangeData.value.productId,
|
||||||
|
spaceId: inventoryChangeData.value.sourceSpaceId,
|
||||||
|
projectId: inventoryChangeData.value.sourceProjectId,
|
||||||
|
quantity: inventoryChangeData.value.quantity * -1,
|
||||||
|
profileId: dataStore.activeProfile.id,
|
||||||
|
tenant: dataStore.currentTenant
|
||||||
|
}
|
||||||
|
let inMovement = {
|
||||||
|
productId: inventoryChangeData.value.productId,
|
||||||
|
spaceId: inventoryChangeData.value.destinationSpaceId,
|
||||||
|
projectId: inventoryChangeData.value.destinationProjectId,
|
||||||
|
quantity: inventoryChangeData.value.quantity,
|
||||||
|
profileId: dataStore.activeProfile.id,
|
||||||
|
tenant: dataStore.currentTenant
|
||||||
|
}
|
||||||
|
|
||||||
|
movements.push(outMovement)
|
||||||
|
movements.push(inMovement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(movements)
|
||||||
|
|
||||||
|
const {error} = await supabase
|
||||||
|
.from("movements")
|
||||||
|
.insert(movements)
|
||||||
|
.select()
|
||||||
|
if(error) console.log(error)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,13 +97,17 @@ defineShortcuts({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function checkArticle(productId) {
|
function checkProductId(productId) {
|
||||||
return dataStore.products.filter(product =>product.id === productId).length > 0;
|
return dataStore.products.filter(product =>product.id === productId).length > 0;
|
||||||
}
|
}
|
||||||
function checkSpaceId(spaceId) {
|
function checkSpaceId(spaceId) {
|
||||||
return dataStore.spaces.filter(space => space.id === spaceId).length > 0;
|
return dataStore.spaces.filter(space => space.id === spaceId).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkProjectId(projectId) {
|
||||||
|
return dataStore.projects.some(i => i.id === projectId)
|
||||||
|
}
|
||||||
|
|
||||||
function changeFocusToSpaceId() {
|
function changeFocusToSpaceId() {
|
||||||
document.getElementById('spaceIdInput').focus()
|
document.getElementById('spaceIdInput').focus()
|
||||||
}
|
}
|
||||||
@@ -78,33 +116,154 @@ function changeFocusToQuantity() {
|
|||||||
document.getElementById('quantityInput').focus()
|
document.getElementById('quantityInput').focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeFocusToBarcode() {
|
||||||
|
document.getElementById('barcodeInput').focus()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const findProductByBarcodeOrEAN = (input) => {
|
||||||
|
return dataStore.products.find(i => i.barcode === input || i.ean === input)
|
||||||
|
}
|
||||||
|
|
||||||
|
const findSpaceBySpaceNumber = (input) => {
|
||||||
|
return dataStore.spaces.find(i => i.spaceNumber === input)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const barcodeInput = ref("")
|
||||||
|
const showBarcodeTip = ref(true)
|
||||||
|
|
||||||
|
const processBarcodeInput = () => {
|
||||||
|
if(findProductByBarcodeOrEAN(barcodeInput.value) && !findSpaceBySpaceNumber(barcodeInput.value)){
|
||||||
|
//Set Product
|
||||||
|
|
||||||
|
inventoryChangeData.value.productId = findProductByBarcodeOrEAN(barcodeInput.value).id
|
||||||
|
} else if (!findProductByBarcodeOrEAN(barcodeInput.value) && findSpaceBySpaceNumber(barcodeInput.value)){
|
||||||
|
//Set Space
|
||||||
|
|
||||||
|
if(mode.value === 'incoming'){
|
||||||
|
inventoryChangeData.value.destinationSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
|
||||||
|
} else if(mode.value === 'outgoing') {
|
||||||
|
inventoryChangeData.value.sourceSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
|
||||||
|
} else if(mode.value === 'change') {
|
||||||
|
if(!inventoryChangeData.value.sourceSpaceId){
|
||||||
|
inventoryChangeData.value.sourceSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
|
||||||
|
} else {
|
||||||
|
inventoryChangeData.value.destinationSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log(findSpaceBySpaceNumber(barcodeInput.value))
|
||||||
|
}
|
||||||
|
barcodeInput.value = ""
|
||||||
|
//console.log(movementData.value)
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="main">
|
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="w-80 mx-auto mt-5">
|
||||||
|
<div class="flex flex-col">
|
||||||
<UButton
|
<UButton
|
||||||
@click="mode = 'incoming'"
|
@click="mode = 'incoming'"
|
||||||
class="ml-3"
|
class="my-2"
|
||||||
:variant="mode === 'incoming' ? 'solid' : 'outline'"
|
:variant="mode === 'incoming' ? 'solid' : 'outline'"
|
||||||
>Wareneingang</UButton>
|
>Wareneingang</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
@click="mode = 'outgoing'"
|
@click="mode = 'outgoing'"
|
||||||
class="ml-1"
|
class="my-2"
|
||||||
:variant="mode === 'outgoing' ? 'solid' : 'outline'"
|
:variant="mode === 'outgoing' ? 'solid' : 'outline'"
|
||||||
>Warenausgang</UButton>
|
>Warenausgang</UButton>
|
||||||
<!-- <UButton
|
<UButton
|
||||||
@click="mode = 'change'"
|
@click="mode = 'change'"
|
||||||
class="ml-1"
|
class="my-2"
|
||||||
disabled
|
|
||||||
:variant="mode === 'change' ? 'solid' : 'outline'"
|
:variant="mode === 'change' ? 'solid' : 'outline'"
|
||||||
>Umlagern</UButton>-->
|
>Umlagern</UButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<UAlert
|
||||||
|
title="Info"
|
||||||
|
variant="outline"
|
||||||
|
color="primary"
|
||||||
|
v-if="showBarcodeTip"
|
||||||
|
@close="showBarcodeTip = false"
|
||||||
|
:close-button="{ icon: 'i-heroicons-x-mark-20-solid', color: 'gray', variant: 'link', padded: false }"
|
||||||
|
description="Über die Barcode Eingabe könenn folgende Werte automatisch erkannt werden: Quell Lagerplatz, Ziellagerplatz, Artikel(EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <UTooltip
|
||||||
|
text="Über die Barcode Eingabe könenn folgende Werte automatisch erkannt werden: Quell Lagerplatz, Ziellagerplatz, Artikel(EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt."
|
||||||
|
>-->
|
||||||
|
<UFormGroup
|
||||||
|
label="Barcode:"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
@keyup.enter="processBarcodeInput"
|
||||||
|
@focusout="processBarcodeInput"
|
||||||
|
@input="processBarcodeInput"
|
||||||
|
v-model="barcodeInput"
|
||||||
|
id="barcodeInput"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
</UFormGroup>
|
||||||
|
<!-- <template #text>
|
||||||
|
<span class="text-wrap">Über die Barcode Eingabe könenn folgende Werte automatisch erkannt werden: Quell Lagerplatz, Ziellagerplatz, Artikel(EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt.</span>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</UTooltip>-->
|
||||||
|
|
||||||
|
<UDivider
|
||||||
|
class="mt-5 w-80"
|
||||||
|
v-if="mode !== 'incoming'"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Quell Lagerplatz:"
|
||||||
|
class="mt-3 w-80"
|
||||||
|
v-if="mode !== 'incoming' "
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.spaces"
|
||||||
|
searchable
|
||||||
|
option-attribute="spaceNumber"
|
||||||
|
:color="checkSpaceId(inventoryChangeData.sourceSpaceId) ? 'primary' : 'rose'"
|
||||||
|
v-model="inventoryChangeData.sourceSpaceId"
|
||||||
|
@change="inventoryChangeData.sourceProjectId = null"
|
||||||
|
value-attribute="id"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId).description : "Kein Lagerplatz ausgewählt"}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Quell Projekt:"
|
||||||
|
class="mt-3 w-80"
|
||||||
|
v-if="mode !== 'incoming' "
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.projects"
|
||||||
|
searchable
|
||||||
|
option-attribute="name"
|
||||||
|
:color="checkProjectId(inventoryChangeData.sourceProjectId) ? 'primary' : 'rose'"
|
||||||
|
v-model="inventoryChangeData.sourceProjectId"
|
||||||
|
@change="inventoryChangeData.sourceSpaceId = null"
|
||||||
|
value-attribute="id"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.getProjectById(inventoryChangeData.sourceProjectId) ? dataStore.getProjectById(inventoryChangeData.sourceProjectId).name : "Kein Projekt ausgewählt"}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UDivider
|
||||||
|
class="mt-5 w-80"
|
||||||
|
/>
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Artikel:"
|
label="Artikel:"
|
||||||
@@ -117,7 +276,7 @@ function changeFocusToQuantity() {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
searchable
|
searchable
|
||||||
:search-attributes="['name','ean', 'barcode']"
|
:search-attributes="['name','ean', 'barcode']"
|
||||||
:color="checkArticle(inventoryChangeData.productId) ? 'primary' : 'rose'"
|
:color="checkProductId(inventoryChangeData.productId) ? 'primary' : 'rose'"
|
||||||
v-model="inventoryChangeData.productId"
|
v-model="inventoryChangeData.productId"
|
||||||
v-on:select="changeFocusToSpaceId"
|
v-on:select="changeFocusToSpaceId"
|
||||||
>
|
>
|
||||||
@@ -127,24 +286,53 @@ function changeFocusToQuantity() {
|
|||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UDivider
|
||||||
|
class="mt-5 w-80"
|
||||||
|
v-if="mode !== 'outgoing'"
|
||||||
|
/>
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Lagerplatz:"
|
label="Ziel Lagerplatz:"
|
||||||
class="mt-3 w-80"
|
class="mt-3 w-80"
|
||||||
|
v-if="mode !== 'outgoing'"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
:options="dataStore.spaces"
|
:options="dataStore.spaces"
|
||||||
searchable
|
searchable
|
||||||
option-attribute="spaceNumber"
|
option-attribute="spaceNumber"
|
||||||
:color="checkSpaceId(inventoryChangeData.spaceId) ? 'primary' : 'rose'"
|
:color="checkSpaceId(inventoryChangeData.destinationSpaceId) ? 'primary' : 'rose'"
|
||||||
v-model="inventoryChangeData.spaceId"
|
v-model="inventoryChangeData.destinationSpaceId"
|
||||||
v-on:select="changeFocusToQuantity"
|
@change="inventoryChangeData.destinationProjectId = null"
|
||||||
value-attribute="id"
|
value-attribute="id"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.spaces.find(space => space.id === inventoryChangeData.spaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.spaceId).description : "Kein Lagerplatz ausgewählt"}}
|
{{dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId).description : "Kein Lagerplatz ausgewählt"}}
|
||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Ziel Projekt:"
|
||||||
|
class="mt-3 w-80"
|
||||||
|
v-if="mode !== 'outgoing'"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.projects"
|
||||||
|
searchable
|
||||||
|
option-attribute="name"
|
||||||
|
:color="checkProjectId(inventoryChangeData.destinationProjectId) ? 'primary' : 'rose'"
|
||||||
|
v-model="inventoryChangeData.destinationProjectId"
|
||||||
|
value-attribute="id"
|
||||||
|
@change="inventoryChangeData.destinationSpaceId = null"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.getProjectById(inventoryChangeData.destinationProjectId) ? dataStore.getProjectById(inventoryChangeData.destinationProjectId).name : "Kein Projekt ausgewählt"}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UDivider
|
||||||
|
class="mt-5 w-80"
|
||||||
|
/>
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Anzahl:"
|
label="Anzahl:"
|
||||||
@@ -161,13 +349,33 @@ function changeFocusToQuantity() {
|
|||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UButton
|
<UButton
|
||||||
@click="createMovement"
|
@click="createMovement"
|
||||||
:disabled="mode === '' && checkSpaceId(inventoryChangeData.spaceId) && checkArticle(inventoryChangeData.productId)"
|
:disabled="mode === '' && checkSpaceId(inventoryChangeData.spaceId) && checkProductId(inventoryChangeData.productId)"
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
>
|
>
|
||||||
Bestätigen
|
Bestätigen
|
||||||
</UButton>
|
</UButton>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="my-3">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ const tabItems = [
|
|||||||
},{
|
},{
|
||||||
key: "events",
|
key: "events",
|
||||||
label: "Termine"
|
label: "Termine"
|
||||||
}/*,{
|
},{
|
||||||
key: "material",
|
key: "material",
|
||||||
label: "Material"
|
label: "Material"
|
||||||
}*/
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const timeTableRows = [
|
const timeTableRows = [
|
||||||
@@ -426,6 +426,23 @@ setupPage()
|
|||||||
</UTable>
|
</UTable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="item.key === 'material'" class="space-y-3">
|
||||||
|
Auf das Projekt gebuchte Artikel:
|
||||||
|
|
||||||
|
<UTable
|
||||||
|
:rows="dataStore.getStocksByProjectId(currentItem.id)"
|
||||||
|
:columns="[{key:'productId',label:'Artikel'},{key:'stock',label:'Anzahl'}]"
|
||||||
|
@select="(i) => router.push(`/products/show/${i.productId}`)"
|
||||||
|
>
|
||||||
|
<template #productId-data="{row}">
|
||||||
|
{{dataStore.getProductById(row.productId).name}}
|
||||||
|
</template>
|
||||||
|
<template #stock-data="{row}">
|
||||||
|
{{row.stock}} {{dataStore.units.find(i => i.id === dataStore.getProductById(row.productId).unit).short}}
|
||||||
|
</template>
|
||||||
|
</UTable>
|
||||||
|
|
||||||
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
labelSingle: "Rechnung",
|
labelSingle: "Rechnung",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
advanceInvoices: {
|
||||||
|
label: "Abschlagsrechnungen",
|
||||||
|
labelSingle: "Abschlagsrechnung"
|
||||||
|
},
|
||||||
quotes: {
|
quotes: {
|
||||||
label: "Angebote",
|
label: "Angebote",
|
||||||
labelSingle: "Angebot"
|
labelSingle: "Angebot"
|
||||||
@@ -765,7 +769,15 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
|
|
||||||
} else if(dataType === "createddocuments") {
|
} else if(dataType === "createddocuments") {
|
||||||
console.log(data.type)
|
console.log(data.type)
|
||||||
const numberRange = useNumberRange(data.type)
|
|
||||||
|
let type = ""
|
||||||
|
if(data.type === "advanceInvoices"){
|
||||||
|
type = "invoices"
|
||||||
|
} else {
|
||||||
|
type = data.type
|
||||||
|
}
|
||||||
|
|
||||||
|
const numberRange = useNumberRange(type)
|
||||||
data.documentNumber = await numberRange.useNextNumber()
|
data.documentNumber = await numberRange.useNextNumber()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1190,7 +1202,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const getStockByProductId = computed(() => (productId) => {
|
const getStockByProductId = computed(() => (productId) => {
|
||||||
let productMovements = movements.value.filter(movement => movement.productId === productId)
|
let productMovements = movements.value.filter(movement => movement.productId === productId && movement.projectId === null)
|
||||||
|
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
@@ -1201,6 +1213,39 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
return count
|
return count
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getStocksByProjectId = computed(() => (projectId) => {
|
||||||
|
let projectMovements = movements.value.filter(movement => movement.projectId === projectId)
|
||||||
|
|
||||||
|
let projectProducts = [... new Set(projectMovements.map(i => i.productId))]
|
||||||
|
|
||||||
|
console.log(projectProducts)
|
||||||
|
|
||||||
|
let productStocks = []
|
||||||
|
|
||||||
|
projectProducts.forEach(product => {
|
||||||
|
let count = 0
|
||||||
|
let productMovements = movements.value.filter(i => i.productId === product && i.projectId && projectId)
|
||||||
|
|
||||||
|
productMovements.forEach(movement => {
|
||||||
|
count += movement.quantity
|
||||||
|
})
|
||||||
|
|
||||||
|
productStocks.push({
|
||||||
|
productId: product,
|
||||||
|
stock: count
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
/*let count = 0
|
||||||
|
|
||||||
|
projectMovements.forEach(movement => {
|
||||||
|
count += movement.quantity
|
||||||
|
})*/
|
||||||
|
|
||||||
|
return productStocks
|
||||||
|
})
|
||||||
|
|
||||||
const getEventTypes = computed(() => {
|
const getEventTypes = computed(() => {
|
||||||
return ownTenant.value.calendarConfig.eventTypes
|
return ownTenant.value.calendarConfig.eventTypes
|
||||||
})
|
})
|
||||||
@@ -1604,6 +1649,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
getWorkingTimesByProfileId,
|
getWorkingTimesByProfileId,
|
||||||
getStartedWorkingTimes,
|
getStartedWorkingTimes,
|
||||||
getStockByProductId,
|
getStockByProductId,
|
||||||
|
getStocksByProjectId,
|
||||||
getIncomingInvoicesByVehicleId,
|
getIncomingInvoicesByVehicleId,
|
||||||
getEventTypes,
|
getEventTypes,
|
||||||
getTimeTypes,
|
getTimeTypes,
|
||||||
|
|||||||
Reference in New Issue
Block a user