Rebuild Inventory
Added Advance Invoices
This commit is contained in:
@@ -134,6 +134,10 @@ export const useDataStore = defineStore('data', () => {
|
||||
labelSingle: "Rechnung",
|
||||
|
||||
},
|
||||
advanceInvoices: {
|
||||
label: "Abschlagsrechnungen",
|
||||
labelSingle: "Abschlagsrechnung"
|
||||
},
|
||||
quotes: {
|
||||
label: "Angebote",
|
||||
labelSingle: "Angebot"
|
||||
@@ -765,7 +769,15 @@ export const useDataStore = defineStore('data', () => {
|
||||
|
||||
} else if(dataType === "createddocuments") {
|
||||
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()
|
||||
|
||||
}
|
||||
@@ -1190,7 +1202,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
})
|
||||
|
||||
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
|
||||
|
||||
@@ -1201,6 +1213,39 @@ export const useDataStore = defineStore('data', () => {
|
||||
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(() => {
|
||||
return ownTenant.value.calendarConfig.eventTypes
|
||||
})
|
||||
@@ -1604,6 +1649,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
getWorkingTimesByProfileId,
|
||||
getStartedWorkingTimes,
|
||||
getStockByProductId,
|
||||
getStocksByProjectId,
|
||||
getIncomingInvoicesByVehicleId,
|
||||
getEventTypes,
|
||||
getTimeTypes,
|
||||
|
||||
Reference in New Issue
Block a user