Compare commits
3 Commits
bbb893dd6c
...
52c182cb5f
| Author | SHA1 | Date | |
|---|---|---|---|
| 52c182cb5f | |||
| 9cef3964e9 | |||
| cf0fb724a2 |
3
backend/db/migrations/0018_account_chart.sql
Normal file
3
backend/db/migrations/0018_account_chart.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE "accounts" ADD COLUMN "accountChart" text DEFAULT 'skr03' NOT NULL;
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "tenants" ADD COLUMN "accountChart" text DEFAULT 'skr03' NOT NULL;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE "createddocuments"
|
||||||
|
ALTER COLUMN "customSurchargePercentage" TYPE double precision
|
||||||
|
USING "customSurchargePercentage"::double precision;
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
jsonb,
|
jsonb,
|
||||||
boolean,
|
boolean,
|
||||||
smallint,
|
smallint,
|
||||||
|
doublePrecision,
|
||||||
uuid,
|
uuid,
|
||||||
} from "drizzle-orm/pg-core"
|
} from "drizzle-orm/pg-core"
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ export const createddocuments = pgTable("createddocuments", {
|
|||||||
|
|
||||||
taxType: text("taxType"),
|
taxType: text("taxType"),
|
||||||
|
|
||||||
customSurchargePercentage: smallint("customSurchargePercentage")
|
customSurchargePercentage: doublePrecision("customSurchargePercentage")
|
||||||
.notNull()
|
.notNull()
|
||||||
.default(0),
|
.default(0),
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,48 @@ export const tenants = pgTable(
|
|||||||
timeTracking: true,
|
timeTracking: true,
|
||||||
planningBoard: true,
|
planningBoard: true,
|
||||||
workingTimeTracking: true,
|
workingTimeTracking: true,
|
||||||
|
dashboard: true,
|
||||||
|
historyitems: true,
|
||||||
|
tasks: true,
|
||||||
|
wiki: true,
|
||||||
|
files: true,
|
||||||
|
createdletters: true,
|
||||||
|
documentboxes: true,
|
||||||
|
helpdesk: true,
|
||||||
|
email: true,
|
||||||
|
members: true,
|
||||||
|
customers: true,
|
||||||
|
vendors: true,
|
||||||
|
contactsList: true,
|
||||||
|
staffTime: true,
|
||||||
|
createDocument: true,
|
||||||
|
serialInvoice: true,
|
||||||
|
incomingInvoices: true,
|
||||||
|
costcentres: true,
|
||||||
|
accounts: true,
|
||||||
|
ownaccounts: true,
|
||||||
|
banking: true,
|
||||||
|
spaces: true,
|
||||||
|
customerspaces: true,
|
||||||
|
customerinventoryitems: true,
|
||||||
|
inventoryitems: true,
|
||||||
|
inventoryitemgroups: true,
|
||||||
|
products: true,
|
||||||
|
productcategories: true,
|
||||||
|
services: true,
|
||||||
|
servicecategories: true,
|
||||||
|
memberrelations: true,
|
||||||
|
staffProfiles: true,
|
||||||
|
hourrates: true,
|
||||||
|
projecttypes: true,
|
||||||
|
contracttypes: true,
|
||||||
|
plants: true,
|
||||||
|
settingsNumberRanges: true,
|
||||||
|
settingsEmailAccounts: true,
|
||||||
|
settingsBanking: true,
|
||||||
|
settingsTexttemplates: true,
|
||||||
|
settingsTenant: true,
|
||||||
|
export: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ownFields: jsonb("ownFields"),
|
ownFields: jsonb("ownFields"),
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
"start": "node dist/src/index.js",
|
"start": "node dist/src/index.js",
|
||||||
"schema:index": "ts-node scripts/generate-schema-index.ts",
|
"schema:index": "ts-node scripts/generate-schema-index.ts",
|
||||||
"bankcodes:update": "tsx scripts/generate-de-bank-codes.ts",
|
"bankcodes:update": "tsx scripts/generate-de-bank-codes.ts",
|
||||||
"members:import:csv": "tsx scripts/import-members-csv.ts"
|
"members:import:csv": "tsx scripts/import-members-csv.ts",
|
||||||
|
"accounts:import:skr42": "ts-node scripts/import-skr42-accounts.ts"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ function normalizeUuid(value: unknown): string | null {
|
|||||||
return trimmed.length ? trimmed : null;
|
return trimmed.length ? trimmed : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitizeCompositionRows(value: unknown): CompositionRow[] {
|
||||||
|
if (!Array.isArray(value)) return [];
|
||||||
|
return value.filter((entry): entry is CompositionRow => !!entry && typeof entry === "object");
|
||||||
|
}
|
||||||
|
|
||||||
export async function recalculateServicePricesForTenant(server: FastifyInstance, tenantId: number, updatedBy?: string | null) {
|
export async function recalculateServicePricesForTenant(server: FastifyInstance, tenantId: number, updatedBy?: string | null) {
|
||||||
const [services, products, hourrates] = await Promise.all([
|
const [services, products, hourrates] = await Promise.all([
|
||||||
server.db.select().from(schema.services).where(eq(schema.services.tenant, tenantId)),
|
server.db.select().from(schema.services).where(eq(schema.services.tenant, tenantId)),
|
||||||
@@ -88,94 +93,111 @@ export async function recalculateServicePricesForTenant(server: FastifyInstance,
|
|||||||
materialPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "material"),
|
materialPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "material"),
|
||||||
workerTotal: getJsonNumber(service.sellingPriceComposed, "worker"),
|
workerTotal: getJsonNumber(service.sellingPriceComposed, "worker"),
|
||||||
workerPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "worker"),
|
workerPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "worker"),
|
||||||
materialComposition: Array.isArray(service.materialComposition) ? service.materialComposition as CompositionRow[] : [],
|
materialComposition: sanitizeCompositionRows(service.materialComposition),
|
||||||
personalComposition: Array.isArray(service.personalComposition) ? service.personalComposition as CompositionRow[] : [],
|
personalComposition: sanitizeCompositionRows(service.personalComposition),
|
||||||
};
|
};
|
||||||
memo.set(serviceId, lockedResult);
|
memo.set(serviceId, lockedResult);
|
||||||
return lockedResult;
|
return lockedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.add(serviceId);
|
stack.add(serviceId);
|
||||||
|
try {
|
||||||
|
const materialComposition = sanitizeCompositionRows(service.materialComposition);
|
||||||
|
const personalComposition = sanitizeCompositionRows(service.personalComposition);
|
||||||
|
const hasMaterialComposition = materialComposition.length > 0;
|
||||||
|
const hasPersonalComposition = personalComposition.length > 0;
|
||||||
|
|
||||||
const materialComposition: CompositionRow[] = Array.isArray(service.materialComposition)
|
// Ohne Zusammensetzung keine automatische Überschreibung:
|
||||||
? (service.materialComposition as CompositionRow[])
|
// manuell gepflegte Preise sollen erhalten bleiben.
|
||||||
: [];
|
if (!hasMaterialComposition && !hasPersonalComposition) {
|
||||||
const personalComposition: CompositionRow[] = Array.isArray(service.personalComposition)
|
const manualResult = {
|
||||||
? (service.personalComposition as CompositionRow[])
|
sellingTotal: getJsonNumber(service.sellingPriceComposed, "total") || toNumber(service.sellingPrice),
|
||||||
: [];
|
purchaseTotal: getJsonNumber(service.purchasePriceComposed, "total"),
|
||||||
|
materialTotal: getJsonNumber(service.sellingPriceComposed, "material"),
|
||||||
let materialTotal = 0;
|
materialPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "material"),
|
||||||
let materialPurchaseTotal = 0;
|
workerTotal: getJsonNumber(service.sellingPriceComposed, "worker"),
|
||||||
|
workerPurchaseTotal: getJsonNumber(service.purchasePriceComposed, "worker"),
|
||||||
const normalizedMaterialComposition = materialComposition.map((entry) => {
|
materialComposition,
|
||||||
const quantity = toNumber(entry.quantity);
|
personalComposition,
|
||||||
const productId = normalizeId(entry.product);
|
};
|
||||||
const childServiceId = normalizeId(entry.service);
|
memo.set(serviceId, manualResult);
|
||||||
|
return manualResult;
|
||||||
let sellingPrice = toNumber(entry.price);
|
|
||||||
let purchasePrice = toNumber(entry.purchasePrice);
|
|
||||||
|
|
||||||
if (productId) {
|
|
||||||
const product = productMap.get(productId);
|
|
||||||
sellingPrice = toNumber(product?.selling_price);
|
|
||||||
purchasePrice = toNumber(product?.purchase_price);
|
|
||||||
} else if (childServiceId) {
|
|
||||||
const child = calculateService(childServiceId);
|
|
||||||
sellingPrice = toNumber(child.sellingTotal);
|
|
||||||
purchasePrice = toNumber(child.purchaseTotal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
materialTotal += quantity * sellingPrice;
|
let materialTotal = 0;
|
||||||
materialPurchaseTotal += quantity * purchasePrice;
|
let materialPurchaseTotal = 0;
|
||||||
|
|
||||||
return {
|
const normalizedMaterialComposition = materialComposition.map((entry) => {
|
||||||
...entry,
|
const quantity = toNumber(entry.quantity);
|
||||||
price: round2(sellingPrice),
|
const productId = normalizeId(entry.product);
|
||||||
purchasePrice: round2(purchasePrice),
|
const childServiceId = normalizeId(entry.service);
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
let workerTotal = 0;
|
let sellingPrice = toNumber(entry.price);
|
||||||
let workerPurchaseTotal = 0;
|
let purchasePrice = toNumber(entry.purchasePrice);
|
||||||
const normalizedPersonalComposition = personalComposition.map((entry) => {
|
|
||||||
const quantity = toNumber(entry.quantity);
|
|
||||||
const hourrateId = normalizeUuid(entry.hourrate);
|
|
||||||
|
|
||||||
let sellingPrice = toNumber(entry.price);
|
if (productId) {
|
||||||
let purchasePrice = toNumber(entry.purchasePrice);
|
const product = productMap.get(productId);
|
||||||
|
sellingPrice = toNumber(product?.selling_price);
|
||||||
if (hourrateId) {
|
purchasePrice = toNumber(product?.purchase_price);
|
||||||
const hourrate = hourrateMap.get(hourrateId);
|
} else if (childServiceId) {
|
||||||
if (hourrate) {
|
const child = calculateService(childServiceId);
|
||||||
sellingPrice = toNumber(hourrate.sellingPrice);
|
sellingPrice = toNumber(child.sellingTotal);
|
||||||
purchasePrice = toNumber(hourrate.purchase_price);
|
purchasePrice = toNumber(child.purchaseTotal);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
workerTotal += quantity * sellingPrice;
|
materialTotal += quantity * sellingPrice;
|
||||||
workerPurchaseTotal += quantity * purchasePrice;
|
materialPurchaseTotal += quantity * purchasePrice;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...entry,
|
...entry,
|
||||||
price: round2(sellingPrice),
|
price: round2(sellingPrice),
|
||||||
purchasePrice: round2(purchasePrice),
|
purchasePrice: round2(purchasePrice),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let workerTotal = 0;
|
||||||
|
let workerPurchaseTotal = 0;
|
||||||
|
const normalizedPersonalComposition = personalComposition.map((entry) => {
|
||||||
|
const quantity = toNumber(entry.quantity);
|
||||||
|
const hourrateId = normalizeUuid(entry.hourrate);
|
||||||
|
|
||||||
|
let sellingPrice = toNumber(entry.price);
|
||||||
|
let purchasePrice = toNumber(entry.purchasePrice);
|
||||||
|
|
||||||
|
if (hourrateId) {
|
||||||
|
const hourrate = hourrateMap.get(hourrateId);
|
||||||
|
if (hourrate) {
|
||||||
|
sellingPrice = toNumber(hourrate.sellingPrice);
|
||||||
|
purchasePrice = toNumber(hourrate.purchase_price);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
workerTotal += quantity * sellingPrice;
|
||||||
|
workerPurchaseTotal += quantity * purchasePrice;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...entry,
|
||||||
|
price: round2(sellingPrice),
|
||||||
|
purchasePrice: round2(purchasePrice),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = {
|
||||||
|
sellingTotal: round2(materialTotal + workerTotal),
|
||||||
|
purchaseTotal: round2(materialPurchaseTotal + workerPurchaseTotal),
|
||||||
|
materialTotal: round2(materialTotal),
|
||||||
|
materialPurchaseTotal: round2(materialPurchaseTotal),
|
||||||
|
workerTotal: round2(workerTotal),
|
||||||
|
workerPurchaseTotal: round2(workerPurchaseTotal),
|
||||||
|
materialComposition: normalizedMaterialComposition,
|
||||||
|
personalComposition: normalizedPersonalComposition,
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const result = {
|
memo.set(serviceId, result);
|
||||||
sellingTotal: round2(materialTotal + workerTotal),
|
return result;
|
||||||
purchaseTotal: round2(materialPurchaseTotal + workerPurchaseTotal),
|
} finally {
|
||||||
materialTotal: round2(materialTotal),
|
stack.delete(serviceId);
|
||||||
materialPurchaseTotal: round2(materialPurchaseTotal),
|
}
|
||||||
workerTotal: round2(workerTotal),
|
|
||||||
workerPurchaseTotal: round2(workerPurchaseTotal),
|
|
||||||
materialComposition: normalizedMaterialComposition,
|
|
||||||
personalComposition: normalizedPersonalComposition,
|
|
||||||
};
|
|
||||||
|
|
||||||
memo.set(serviceId, result);
|
|
||||||
stack.delete(serviceId);
|
|
||||||
return result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ const queryConfigPlugin: FastifyPluginAsync<QueryConfigPluginOptions> = async (
|
|||||||
|
|
||||||
const query = req.query as Record<string, any>
|
const query = req.query as Record<string, any>
|
||||||
|
|
||||||
console.log(query)
|
|
||||||
|
|
||||||
// Pagination deaktivieren?
|
// Pagination deaktivieren?
|
||||||
const disablePagination =
|
const disablePagination =
|
||||||
query.noPagination === 'true' ||
|
query.noPagination === 'true' ||
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export default async function meRoutes(server: FastifyInstance) {
|
|||||||
name: tenants.name,
|
name: tenants.name,
|
||||||
short: tenants.short,
|
short: tenants.short,
|
||||||
locked: tenants.locked,
|
locked: tenants.locked,
|
||||||
|
features: tenants.features,
|
||||||
extraModules: tenants.extraModules,
|
extraModules: tenants.extraModules,
|
||||||
businessInfo: tenants.businessInfo,
|
businessInfo: tenants.businessInfo,
|
||||||
numberRanges: tenants.numberRanges,
|
numberRanges: tenants.numberRanges,
|
||||||
|
|||||||
@@ -15,8 +15,241 @@ const showMembersNav = computed(() => {
|
|||||||
const showMemberRelationsNav = computed(() => {
|
const showMemberRelationsNav = computed(() => {
|
||||||
return tenantExtraModules.value.includes("verein") && has("members")
|
return tenantExtraModules.value.includes("verein") && has("members")
|
||||||
})
|
})
|
||||||
|
const tenantFeatures = computed(() => auth.activeTenantData?.features || {})
|
||||||
|
const featureEnabled = (key) => tenantFeatures.value?.[key] !== false
|
||||||
|
|
||||||
const links = computed(() => {
|
const links = computed(() => {
|
||||||
|
const organisationChildren = [
|
||||||
|
has("tasks") && featureEnabled("tasks") ? {
|
||||||
|
label: "Aufgaben",
|
||||||
|
to: "/tasks",
|
||||||
|
icon: "i-heroicons-rectangle-stack"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("wiki") ? {
|
||||||
|
label: "Wiki",
|
||||||
|
to: "/wiki",
|
||||||
|
icon: "i-heroicons-book-open"
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const documentChildren = [
|
||||||
|
featureEnabled("files") ? {
|
||||||
|
label: "Dateien",
|
||||||
|
to: "/files",
|
||||||
|
icon: "i-heroicons-document"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("createdletters") ? {
|
||||||
|
label: "Anschreiben",
|
||||||
|
to: "/createdletters",
|
||||||
|
icon: "i-heroicons-document",
|
||||||
|
disabled: true
|
||||||
|
} : null,
|
||||||
|
featureEnabled("documentboxes") ? {
|
||||||
|
label: "Boxen",
|
||||||
|
to: "/standardEntity/documentboxes",
|
||||||
|
icon: "i-heroicons-archive-box",
|
||||||
|
disabled: true
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const communicationChildren = [
|
||||||
|
featureEnabled("helpdesk") ? {
|
||||||
|
label: "Helpdesk",
|
||||||
|
to: "/helpdesk",
|
||||||
|
icon: "i-heroicons-chat-bubble-left-right",
|
||||||
|
disabled: true
|
||||||
|
} : null,
|
||||||
|
featureEnabled("email") ? {
|
||||||
|
label: "E-Mail",
|
||||||
|
to: "/email/new",
|
||||||
|
icon: "i-heroicons-envelope",
|
||||||
|
disabled: true
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const contactsChildren = [
|
||||||
|
showMembersNav.value && featureEnabled("members") ? {
|
||||||
|
label: "Mitglieder",
|
||||||
|
to: "/standardEntity/members",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
} : null,
|
||||||
|
has("customers") && featureEnabled("customers") ? {
|
||||||
|
label: "Kunden",
|
||||||
|
to: "/standardEntity/customers",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
} : null,
|
||||||
|
has("vendors") && featureEnabled("vendors") ? {
|
||||||
|
label: "Lieferanten",
|
||||||
|
to: "/standardEntity/vendors",
|
||||||
|
icon: "i-heroicons-truck"
|
||||||
|
} : null,
|
||||||
|
has("contacts") && featureEnabled("contactsList") ? {
|
||||||
|
label: "Ansprechpartner",
|
||||||
|
to: "/standardEntity/contacts",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const staffChildren = [
|
||||||
|
featureEnabled("staffTime") ? {
|
||||||
|
label: "Zeiten",
|
||||||
|
to: "/staff/time",
|
||||||
|
icon: "i-heroicons-clock",
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const accountingChildren = [
|
||||||
|
featureEnabled("createDocument") ? {
|
||||||
|
label: "Ausgangsbelege",
|
||||||
|
to: "/createDocument",
|
||||||
|
icon: "i-heroicons-document-text"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("serialInvoice") ? {
|
||||||
|
label: "Serienvorlagen",
|
||||||
|
to: "/createDocument/serialInvoice",
|
||||||
|
icon: "i-heroicons-document-text"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("incomingInvoices") ? {
|
||||||
|
label: "Eingangsbelege",
|
||||||
|
to: "/incomingInvoices",
|
||||||
|
icon: "i-heroicons-document-text",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("costcentres") ? {
|
||||||
|
label: "Kostenstellen",
|
||||||
|
to: "/standardEntity/costcentres",
|
||||||
|
icon: "i-heroicons-document-currency-euro"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("accounts") ? {
|
||||||
|
label: "Buchungskonten",
|
||||||
|
to: "/accounts",
|
||||||
|
icon: "i-heroicons-document-text",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("ownaccounts") ? {
|
||||||
|
label: "zusätzliche Buchungskonten",
|
||||||
|
to: "/standardEntity/ownaccounts",
|
||||||
|
icon: "i-heroicons-document-text"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("banking") ? {
|
||||||
|
label: "Bank",
|
||||||
|
to: "/banking",
|
||||||
|
icon: "i-heroicons-document-text",
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const inventoryChildren = [
|
||||||
|
has("spaces") && featureEnabled("spaces") ? {
|
||||||
|
label: "Lagerplätze",
|
||||||
|
to: "/standardEntity/spaces",
|
||||||
|
icon: "i-heroicons-square-3-stack-3d"
|
||||||
|
} : null,
|
||||||
|
has("inventoryitems") && featureEnabled("customerspaces") ? {
|
||||||
|
label: "Kundenlagerplätze",
|
||||||
|
to: "/standardEntity/customerspaces",
|
||||||
|
icon: "i-heroicons-squares-plus"
|
||||||
|
} : null,
|
||||||
|
has("inventoryitems") && featureEnabled("customerinventoryitems") ? {
|
||||||
|
label: "Kundeninventar",
|
||||||
|
to: "/standardEntity/customerinventoryitems",
|
||||||
|
icon: "i-heroicons-qr-code"
|
||||||
|
} : null,
|
||||||
|
has("inventoryitems") && featureEnabled("inventoryitems") ? {
|
||||||
|
label: "Inventar",
|
||||||
|
to: "/standardEntity/inventoryitems",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
} : null,
|
||||||
|
has("inventoryitems") && featureEnabled("inventoryitemgroups") ? {
|
||||||
|
label: "Inventargruppen",
|
||||||
|
to: "/standardEntity/inventoryitemgroups",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const masterDataChildren = [
|
||||||
|
has("products") && featureEnabled("products") ? {
|
||||||
|
label: "Artikel",
|
||||||
|
to: "/standardEntity/products",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
} : null,
|
||||||
|
has("productcategories") && featureEnabled("productcategories") ? {
|
||||||
|
label: "Artikelkategorien",
|
||||||
|
to: "/standardEntity/productcategories",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
|
} : null,
|
||||||
|
has("services") && featureEnabled("services") ? {
|
||||||
|
label: "Leistungen",
|
||||||
|
to: "/standardEntity/services",
|
||||||
|
icon: "i-heroicons-wrench-screwdriver"
|
||||||
|
} : null,
|
||||||
|
has("servicecategories") && featureEnabled("servicecategories") ? {
|
||||||
|
label: "Leistungskategorien",
|
||||||
|
to: "/standardEntity/servicecategories",
|
||||||
|
icon: "i-heroicons-wrench-screwdriver"
|
||||||
|
} : null,
|
||||||
|
showMemberRelationsNav.value && featureEnabled("memberrelations") ? {
|
||||||
|
label: "Mitgliedsverhältnisse",
|
||||||
|
to: "/standardEntity/memberrelations",
|
||||||
|
icon: "i-heroicons-identification"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("staffProfiles") ? {
|
||||||
|
label: "Mitarbeiter",
|
||||||
|
to: "/staff/profiles",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("hourrates") ? {
|
||||||
|
label: "Stundensätze",
|
||||||
|
to: "/standardEntity/hourrates",
|
||||||
|
icon: "i-heroicons-user-group"
|
||||||
|
} : null,
|
||||||
|
featureEnabled("projecttypes") ? {
|
||||||
|
label: "Projekttypen",
|
||||||
|
to: "/projecttypes",
|
||||||
|
icon: "i-heroicons-clipboard-document-list",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("contracttypes") ? {
|
||||||
|
label: "Vertragstypen",
|
||||||
|
to: "/standardEntity/contracttypes",
|
||||||
|
icon: "i-heroicons-document-duplicate",
|
||||||
|
} : null,
|
||||||
|
has("vehicles") && featureEnabled("vehicles") ? {
|
||||||
|
label: "Fahrzeuge",
|
||||||
|
to: "/standardEntity/vehicles",
|
||||||
|
icon: "i-heroicons-truck"
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
|
const settingsChildren = [
|
||||||
|
featureEnabled("settingsNumberRanges") ? {
|
||||||
|
label: "Nummernkreise",
|
||||||
|
to: "/settings/numberRanges",
|
||||||
|
icon: "i-heroicons-clipboard-document-list",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("settingsEmailAccounts") ? {
|
||||||
|
label: "E-Mail Konten",
|
||||||
|
to: "/settings/emailaccounts",
|
||||||
|
icon: "i-heroicons-envelope",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("settingsBanking") ? {
|
||||||
|
label: "Bankkonten",
|
||||||
|
to: "/settings/banking",
|
||||||
|
icon: "i-heroicons-currency-euro",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("settingsTexttemplates") ? {
|
||||||
|
label: "Textvorlagen",
|
||||||
|
to: "/settings/texttemplates",
|
||||||
|
icon: "i-heroicons-clipboard-document-list",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("settingsTenant") ? {
|
||||||
|
label: "Firmeneinstellungen",
|
||||||
|
to: "/settings/tenant",
|
||||||
|
icon: "i-heroicons-building-office",
|
||||||
|
} : null,
|
||||||
|
featureEnabled("export") ? {
|
||||||
|
label: "Export",
|
||||||
|
to: "/export",
|
||||||
|
icon: "i-heroicons-clipboard-document-list"
|
||||||
|
} : null,
|
||||||
|
].filter(Boolean)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...(auth.profile?.pinned_on_navigation || []).map(pin => {
|
...(auth.profile?.pinned_on_navigation || []).map(pin => {
|
||||||
if (pin.type === "external") {
|
if (pin.type === "external") {
|
||||||
@@ -37,290 +270,89 @@ const links = computed(() => {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
{
|
featureEnabled("dashboard") ? {
|
||||||
id: 'dashboard',
|
id: 'dashboard',
|
||||||
label: "Dashboard",
|
label: "Dashboard",
|
||||||
to: "/",
|
to: "/",
|
||||||
icon: "i-heroicons-home"
|
icon: "i-heroicons-home"
|
||||||
},
|
} : null,
|
||||||
{
|
featureEnabled("historyitems") ? {
|
||||||
id: 'historyitems',
|
id: 'historyitems',
|
||||||
label: "Logbuch",
|
label: "Logbuch",
|
||||||
to: "/historyitems",
|
to: "/historyitems",
|
||||||
icon: "i-heroicons-book-open"
|
icon: "i-heroicons-book-open"
|
||||||
},
|
} : null,
|
||||||
{
|
...(organisationChildren.length > 0 ? [{
|
||||||
label: "Organisation",
|
label: "Organisation",
|
||||||
icon: "i-heroicons-rectangle-stack",
|
icon: "i-heroicons-rectangle-stack",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
children: [
|
children: organisationChildren
|
||||||
...has("tasks") ? [{
|
}] : []),
|
||||||
label: "Aufgaben",
|
...(documentChildren.length > 0 ? [{
|
||||||
to: "/tasks",
|
|
||||||
icon: "i-heroicons-rectangle-stack"
|
|
||||||
}] : [],
|
|
||||||
...true ? [{
|
|
||||||
label: "Wiki",
|
|
||||||
to: "/wiki",
|
|
||||||
icon: "i-heroicons-book-open"
|
|
||||||
}] : [],
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Dokumente",
|
label: "Dokumente",
|
||||||
icon: "i-heroicons-rectangle-stack",
|
icon: "i-heroicons-rectangle-stack",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
children: [
|
children: documentChildren
|
||||||
{
|
}] : []),
|
||||||
label: "Dateien",
|
...(communicationChildren.length > 0 ? [{
|
||||||
to: "/files",
|
|
||||||
icon: "i-heroicons-document"
|
|
||||||
}, {
|
|
||||||
label: "Anschreiben",
|
|
||||||
to: "/createdletters",
|
|
||||||
icon: "i-heroicons-document",
|
|
||||||
disabled: true
|
|
||||||
}, {
|
|
||||||
label: "Boxen",
|
|
||||||
to: "/standardEntity/documentboxes",
|
|
||||||
icon: "i-heroicons-archive-box",
|
|
||||||
disabled: true
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Kommunikation",
|
label: "Kommunikation",
|
||||||
icon: "i-heroicons-megaphone",
|
icon: "i-heroicons-megaphone",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
children: [
|
children: communicationChildren
|
||||||
{
|
}] : []),
|
||||||
label: "Helpdesk",
|
...(contactsChildren.length > 0 ? [{
|
||||||
to: "/helpdesk",
|
|
||||||
icon: "i-heroicons-chat-bubble-left-right",
|
|
||||||
disabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "E-Mail",
|
|
||||||
to: "/email/new",
|
|
||||||
icon: "i-heroicons-envelope",
|
|
||||||
disabled: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...(has("customers") || has("vendors") || has("contacts") || showMembersNav.value) ? [{
|
|
||||||
label: "Kontakte",
|
label: "Kontakte",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
icon: "i-heroicons-user-group",
|
icon: "i-heroicons-user-group",
|
||||||
children: [
|
children: contactsChildren
|
||||||
...showMembersNav.value ? [{
|
}] : []),
|
||||||
label: "Mitglieder",
|
...(staffChildren.length > 0 ? [{
|
||||||
to: "/standardEntity/members",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
}] : [],
|
|
||||||
...has("customers") ? [{
|
|
||||||
label: "Kunden",
|
|
||||||
to: "/standardEntity/customers",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
}] : [],
|
|
||||||
...has("vendors") ? [{
|
|
||||||
label: "Lieferanten",
|
|
||||||
to: "/standardEntity/vendors",
|
|
||||||
icon: "i-heroicons-truck"
|
|
||||||
}] : [],
|
|
||||||
...has("contacts") ? [{
|
|
||||||
label: "Ansprechpartner",
|
|
||||||
to: "/standardEntity/contacts",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
}] : [],
|
|
||||||
]
|
|
||||||
}] : [],
|
|
||||||
{
|
|
||||||
label: "Mitarbeiter",
|
label: "Mitarbeiter",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
icon: "i-heroicons-user-group",
|
icon: "i-heroicons-user-group",
|
||||||
children: [
|
children: staffChildren
|
||||||
...true ? [{
|
}] : []),
|
||||||
label: "Zeiten",
|
...(accountingChildren.length > 0 ? [{
|
||||||
to: "/staff/time",
|
|
||||||
icon: "i-heroicons-clock",
|
|
||||||
}] : [],
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...[{
|
|
||||||
label: "Buchhaltung",
|
label: "Buchhaltung",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
icon: "i-heroicons-chart-bar-square",
|
icon: "i-heroicons-chart-bar-square",
|
||||||
children: [
|
children: accountingChildren
|
||||||
{
|
}] : []),
|
||||||
label: "Ausgangsbelege",
|
...(inventoryChildren.length > 0 ? [{
|
||||||
to: "/createDocument",
|
|
||||||
icon: "i-heroicons-document-text"
|
|
||||||
}, {
|
|
||||||
label: "Serienvorlagen",
|
|
||||||
to: "/createDocument/serialInvoice",
|
|
||||||
icon: "i-heroicons-document-text"
|
|
||||||
}, {
|
|
||||||
label: "Eingangsbelege",
|
|
||||||
to: "/incomingInvoices",
|
|
||||||
icon: "i-heroicons-document-text",
|
|
||||||
}, {
|
|
||||||
label: "Kostenstellen",
|
|
||||||
to: "/standardEntity/costcentres",
|
|
||||||
icon: "i-heroicons-document-currency-euro"
|
|
||||||
}, {
|
|
||||||
label: "Buchungskonten",
|
|
||||||
to: "/accounts",
|
|
||||||
icon: "i-heroicons-document-text",
|
|
||||||
}, {
|
|
||||||
label: "zusätzliche Buchungskonten",
|
|
||||||
to: "/standardEntity/ownaccounts",
|
|
||||||
icon: "i-heroicons-document-text"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Bank",
|
|
||||||
to: "/banking",
|
|
||||||
icon: "i-heroicons-document-text",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
...has("inventory") ? [{
|
|
||||||
label: "Lager",
|
label: "Lager",
|
||||||
icon: "i-heroicons-puzzle-piece",
|
icon: "i-heroicons-puzzle-piece",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
children: [
|
children: inventoryChildren
|
||||||
...has("spaces") ? [{
|
}] : []),
|
||||||
label: "Lagerplätze",
|
...(masterDataChildren.length > 0 ? [{
|
||||||
to: "/standardEntity/spaces",
|
|
||||||
icon: "i-heroicons-square-3-stack-3d"
|
|
||||||
}] : [],
|
|
||||||
...has("inventoryitems") ? [{
|
|
||||||
label: "Kundenlagerplätze",
|
|
||||||
to: "/standardEntity/customerspaces",
|
|
||||||
icon: "i-heroicons-squares-plus"
|
|
||||||
}] : [],
|
|
||||||
...has("inventoryitems") ? [{
|
|
||||||
label: "Kundeninventar",
|
|
||||||
to: "/standardEntity/customerinventoryitems",
|
|
||||||
icon: "i-heroicons-qr-code"
|
|
||||||
}] : [],
|
|
||||||
...has("inventoryitems") ? [{
|
|
||||||
label: "Inventar",
|
|
||||||
to: "/standardEntity/inventoryitems",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
}] : [],
|
|
||||||
...has("inventoryitems") ? [{
|
|
||||||
label: "Inventargruppen",
|
|
||||||
to: "/standardEntity/inventoryitemgroups",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
}] : [],
|
|
||||||
]
|
|
||||||
}] : [],
|
|
||||||
{
|
|
||||||
label: "Stammdaten",
|
label: "Stammdaten",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
icon: "i-heroicons-clipboard-document",
|
icon: "i-heroicons-clipboard-document",
|
||||||
children: [
|
children: masterDataChildren
|
||||||
...has("products") ? [{
|
}] : []),
|
||||||
label: "Artikel",
|
|
||||||
to: "/standardEntity/products",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
}] : [],
|
|
||||||
...has("productcategories") ? [{
|
|
||||||
label: "Artikelkategorien",
|
|
||||||
to: "/standardEntity/productcategories",
|
|
||||||
icon: "i-heroicons-puzzle-piece"
|
|
||||||
}] : [],
|
|
||||||
...has("services") ? [{
|
|
||||||
label: "Leistungen",
|
|
||||||
to: "/standardEntity/services",
|
|
||||||
icon: "i-heroicons-wrench-screwdriver"
|
|
||||||
}] : [],
|
|
||||||
...has("servicecategories") ? [{
|
|
||||||
label: "Leistungskategorien",
|
|
||||||
to: "/standardEntity/servicecategories",
|
|
||||||
icon: "i-heroicons-wrench-screwdriver"
|
|
||||||
}] : [],
|
|
||||||
...showMemberRelationsNav.value ? [{
|
|
||||||
label: "Mitgliedsverhältnisse",
|
|
||||||
to: "/standardEntity/memberrelations",
|
|
||||||
icon: "i-heroicons-identification"
|
|
||||||
}] : [],
|
|
||||||
{
|
|
||||||
label: "Mitarbeiter",
|
|
||||||
to: "/staff/profiles",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Stundensätze",
|
|
||||||
to: "/standardEntity/hourrates",
|
|
||||||
icon: "i-heroicons-user-group"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Projekttypen",
|
|
||||||
to: "/projecttypes",
|
|
||||||
icon: "i-heroicons-clipboard-document-list",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Vertragstypen",
|
|
||||||
to: "/standardEntity/contracttypes",
|
|
||||||
icon: "i-heroicons-document-duplicate",
|
|
||||||
},
|
|
||||||
...has("vehicles") ? [{
|
|
||||||
label: "Fahrzeuge",
|
|
||||||
to: "/standardEntity/vehicles",
|
|
||||||
icon: "i-heroicons-truck"
|
|
||||||
}] : [],
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
...has("projects") ? [{
|
...(has("projects") && featureEnabled("projects")) ? [{
|
||||||
label: "Projekte",
|
label: "Projekte",
|
||||||
to: "/standardEntity/projects",
|
to: "/standardEntity/projects",
|
||||||
icon: "i-heroicons-clipboard-document-check"
|
icon: "i-heroicons-clipboard-document-check"
|
||||||
}] : [],
|
}] : [],
|
||||||
...has("contracts") ? [{
|
...(has("contracts") && featureEnabled("contracts")) ? [{
|
||||||
label: "Verträge",
|
label: "Verträge",
|
||||||
to: "/standardEntity/contracts",
|
to: "/standardEntity/contracts",
|
||||||
icon: "i-heroicons-clipboard-document"
|
icon: "i-heroicons-clipboard-document"
|
||||||
}] : [],
|
}] : [],
|
||||||
...has("plants") ? [{
|
...(has("plants") && featureEnabled("plants")) ? [{
|
||||||
label: "Objekte",
|
label: "Objekte",
|
||||||
to: "/standardEntity/plants",
|
to: "/standardEntity/plants",
|
||||||
icon: "i-heroicons-clipboard-document"
|
icon: "i-heroicons-clipboard-document"
|
||||||
}] : [],
|
}] : [],
|
||||||
{
|
...(settingsChildren.length > 0 ? [{
|
||||||
label: "Einstellungen",
|
label: "Einstellungen",
|
||||||
defaultOpen: false,
|
defaultOpen: false,
|
||||||
icon: "i-heroicons-cog-8-tooth",
|
icon: "i-heroicons-cog-8-tooth",
|
||||||
children: [
|
children: settingsChildren
|
||||||
{
|
}] : []),
|
||||||
label: "Nummernkreise",
|
].filter(Boolean)
|
||||||
to: "/settings/numberRanges",
|
|
||||||
icon: "i-heroicons-clipboard-document-list",
|
|
||||||
}, {
|
|
||||||
label: "E-Mail Konten",
|
|
||||||
to: "/settings/emailaccounts",
|
|
||||||
icon: "i-heroicons-envelope",
|
|
||||||
}, {
|
|
||||||
label: "Bankkonten",
|
|
||||||
to: "/settings/banking",
|
|
||||||
icon: "i-heroicons-currency-euro",
|
|
||||||
}, {
|
|
||||||
label: "Textvorlagen",
|
|
||||||
to: "/settings/texttemplates",
|
|
||||||
icon: "i-heroicons-clipboard-document-list",
|
|
||||||
}, {
|
|
||||||
label: "Firmeneinstellungen",
|
|
||||||
to: "/settings/tenant",
|
|
||||||
icon: "i-heroicons-building-office",
|
|
||||||
}, {
|
|
||||||
label: "Export",
|
|
||||||
to: "/export",
|
|
||||||
icon: "i-heroicons-clipboard-document-list"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const accordionItems = computed(() =>
|
const accordionItems = computed(() =>
|
||||||
|
|||||||
@@ -6,8 +6,20 @@ const props = defineProps({
|
|||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const descriptionText = computed(() => {
|
||||||
|
const description = props.row?.description
|
||||||
|
if (!description) return ""
|
||||||
|
if (typeof description === "string") return description
|
||||||
|
if (typeof description === "object") {
|
||||||
|
if (typeof description.text === "string" && description.text.trim().length) {
|
||||||
|
return description.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String(description)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="props.row.description" v-html="props.row.description.html"/>
|
<div v-if="descriptionText">{{ descriptionText }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,239 +1,279 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { Line } from "vue-chartjs";
|
||||||
|
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
|
const tempStore = useTempStore()
|
||||||
|
|
||||||
let incomeData = ref({})
|
const amountMode = ref("net")
|
||||||
let expenseData = ref({})
|
const granularity = ref("year")
|
||||||
|
const selectedYear = ref(dayjs().year())
|
||||||
|
const selectedMonth = ref(dayjs().month() + 1)
|
||||||
|
|
||||||
const setup = async () => {
|
const incomeDocuments = ref([])
|
||||||
let incomeRawData = (await useEntities("createddocuments").select()).filter(i => i.state === "Gebucht" && ['invoices','advanceInvoices','cancellationInvoices'].includes(i.type))
|
const expenseInvoices = ref([])
|
||||||
|
|
||||||
let incomeRawFilteredData = incomeRawData.filter(x => x.state === 'Gebucht' && incomeRawData.find(i => i.linkedDocument && i.linkedDocument.id === x.id && i.type === 'cancellationInvoices') && ['invoices','advanceInvoices'].includes(row.type))
|
const granularityOptions = [
|
||||||
|
{ label: "Jahr", value: "year" },
|
||||||
|
{ label: "Monat", value: "month" }
|
||||||
|
]
|
||||||
|
|
||||||
|
const monthOptions = [
|
||||||
|
{ label: "Januar", value: 1 },
|
||||||
|
{ label: "Februar", value: 2 },
|
||||||
|
{ label: "März", value: 3 },
|
||||||
|
{ label: "April", value: 4 },
|
||||||
|
{ label: "Mai", value: 5 },
|
||||||
|
{ label: "Juni", value: 6 },
|
||||||
|
{ label: "Juli", value: 7 },
|
||||||
|
{ label: "August", value: 8 },
|
||||||
|
{ label: "September", value: 9 },
|
||||||
|
{ label: "Oktober", value: 10 },
|
||||||
|
{ label: "November", value: 11 },
|
||||||
|
{ label: "Dezember", value: 12 }
|
||||||
|
]
|
||||||
|
|
||||||
let expenseRawData =(await useEntities("incominginvoices").select())
|
const normalizeMode = (value) => value === "gross" ? "gross" : "net"
|
||||||
let withoutInvoiceRawData = (await useEntities("statementallocations").select()).filter(i => i.account)
|
const normalizeGranularity = (value) => value === "month" ? "month" : "year"
|
||||||
|
|
||||||
let withoutInvoiceRawDataExpenses = []
|
watch(
|
||||||
let withoutInvoiceRawDataIncomes = []
|
() => tempStore.settings?.dashboardIncomeExpenseView,
|
||||||
|
(storedView) => {
|
||||||
|
const legacyMode = tempStore.settings?.dashboardIncomeExpenseMode
|
||||||
|
|
||||||
withoutInvoiceRawData.forEach(i => {
|
amountMode.value = normalizeMode(storedView?.amountMode || legacyMode)
|
||||||
if(i.amount > 0) {
|
granularity.value = normalizeGranularity(storedView?.granularity)
|
||||||
withoutInvoiceRawDataIncomes.push({
|
|
||||||
id: i.id,
|
const nextYear = Number(storedView?.year)
|
||||||
date: dayjs(i.created_at).format("DD-MM-YY"),
|
const nextMonth = Number(storedView?.month)
|
||||||
amount: Math.abs(i.amount),
|
|
||||||
bs_id: i.bs_id
|
selectedYear.value = Number.isFinite(nextYear) ? nextYear : dayjs().year()
|
||||||
})
|
selectedMonth.value = Number.isFinite(nextMonth) && nextMonth >= 1 && nextMonth <= 12
|
||||||
} else if(i.amount < 0) {
|
? nextMonth
|
||||||
withoutInvoiceRawDataExpenses.push({
|
: dayjs().month() + 1
|
||||||
id: i.id,
|
},
|
||||||
date: dayjs(i.created_at).format("DD-MM-YY"),
|
{ immediate: true }
|
||||||
amount: Math.abs(i.amount),
|
)
|
||||||
bs_id: i.bs_id
|
|
||||||
})
|
watch([amountMode, granularity, selectedYear, selectedMonth], () => {
|
||||||
}
|
tempStore.modifySettings("dashboardIncomeExpenseView", {
|
||||||
|
amountMode: amountMode.value,
|
||||||
|
granularity: granularity.value,
|
||||||
|
year: selectedYear.value,
|
||||||
|
month: selectedMonth.value
|
||||||
})
|
})
|
||||||
|
|
||||||
/*withoutInvoiceRawDataExpenses.forEach(i => {
|
// Backward compatibility for any existing consumers.
|
||||||
expenseData.value[i.date] ? expenseData.value[i.date] = Number((expenseData.value[i.date] + i.amount).toFixed(2)) : expenseData.value[i.date] = i.amount
|
tempStore.modifySettings("dashboardIncomeExpenseMode", amountMode.value)
|
||||||
})
|
|
||||||
|
|
||||||
withoutInvoiceRawDataIncomes.forEach(i => {
|
|
||||||
incomeData.value[i.date] ? incomeData.value[i.date] = Number((incomeData.value[i.date] + i.amount).toFixed(2)) : incomeData.value[i.date] = i.amount
|
|
||||||
})*/
|
|
||||||
|
|
||||||
expenseRawData = expenseRawData.filter(i => i.date).map(i => {
|
|
||||||
let amount = 0
|
|
||||||
|
|
||||||
i.accounts.forEach(a => {
|
|
||||||
amount += a.amountNet
|
|
||||||
})
|
|
||||||
|
|
||||||
amount = Number(amount.toFixed(2))
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: i.id,
|
|
||||||
date: dayjs(i.date).format("DD-MM-YY"),
|
|
||||||
amount
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
expenseRawData.forEach(i => {
|
|
||||||
expenseData.value[i.date] ? expenseData.value[i.date] = Number((expenseData.value[i.date] + i.amount).toFixed(2)) : expenseData.value[i.date] = i.amount
|
|
||||||
})
|
|
||||||
|
|
||||||
let expenseMonths = {
|
|
||||||
"01": 0,
|
|
||||||
"02": 0,
|
|
||||||
"03": 0,
|
|
||||||
"04": 0,
|
|
||||||
"05": 0,
|
|
||||||
"06": 0,
|
|
||||||
"07": 0,
|
|
||||||
"08": 0,
|
|
||||||
"09": 0,
|
|
||||||
"10": 0,
|
|
||||||
"11": 0,
|
|
||||||
"12": 0,
|
|
||||||
|
|
||||||
}
|
|
||||||
Object.keys(expenseMonths).forEach(month => {
|
|
||||||
let dates = Object.keys(expenseData.value).filter(i => i.split("-")[1] === month && i.split("-")[2] === dayjs().format("YY"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dates.forEach(date => {
|
|
||||||
if(expenseMonths[month]){
|
|
||||||
expenseMonths[month] = Number((expenseMonths[month] + expenseData.value[date]).toFixed(2))
|
|
||||||
} else {
|
|
||||||
expenseMonths[month] = expenseData.value[date]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
expenseData.value = expenseMonths
|
|
||||||
|
|
||||||
|
|
||||||
incomeRawData = incomeRawData.map(i => {
|
|
||||||
let amount = 0
|
|
||||||
|
|
||||||
i.rows.forEach(r => {
|
|
||||||
if(r.mode !== "pagebreak" && r.mode !== "title" && r.mode !== "text"){
|
|
||||||
amount += r.price * r.quantity * (1 - r.discountPercent/100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
amount = Number(amount.toFixed(2))
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: i.id,
|
|
||||||
date: dayjs(i.documentDate).format("DD-MM-YY"),
|
|
||||||
amount
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
incomeRawData.forEach(i => {
|
|
||||||
incomeData.value[i.date] ? incomeData.value[i.date] = Number((incomeData.value[i.date] + i.amount).toFixed(2)) : incomeData.value[i.date] = i.amount
|
|
||||||
})
|
|
||||||
|
|
||||||
let incomeMonths = {
|
|
||||||
"01": 0,
|
|
||||||
"02": 0,
|
|
||||||
"03": 0,
|
|
||||||
"04": 0,
|
|
||||||
"05": 0,
|
|
||||||
"06": 0,
|
|
||||||
"07": 0,
|
|
||||||
"08": 0,
|
|
||||||
"09": 0,
|
|
||||||
"10": 0,
|
|
||||||
"11": 0,
|
|
||||||
"12": 0,
|
|
||||||
|
|
||||||
}
|
|
||||||
Object.keys(incomeMonths).forEach(month => {
|
|
||||||
let dates = Object.keys(incomeData.value).filter(i => i.split("-")[1] === month && i.split("-")[2] === dayjs().format("YY"))
|
|
||||||
|
|
||||||
dates.forEach(date => {
|
|
||||||
if(incomeMonths[month]){
|
|
||||||
incomeMonths[month] = Number((incomeMonths[month] + incomeData.value[date]).toFixed(2))
|
|
||||||
} else {
|
|
||||||
incomeMonths[month] = incomeData.value[date]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
incomeData.value = incomeMonths
|
|
||||||
}
|
|
||||||
|
|
||||||
const days = computed(() => {
|
|
||||||
let days = []
|
|
||||||
|
|
||||||
days = Object.keys(incomeData.value)
|
|
||||||
|
|
||||||
let expenseDays = Object.keys(expenseData.value)
|
|
||||||
|
|
||||||
expenseDays.forEach(expenseDay => {
|
|
||||||
if(!days.find(i => i === expenseDay)){
|
|
||||||
days.push(expenseDay)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
days = days.sort(function(a, b) {
|
|
||||||
var keyA = dayjs(a, "DD-MM-YY"),
|
|
||||||
keyB = dayjs(b, "DD-MM-YY");
|
|
||||||
// Compare the 2 dates
|
|
||||||
if (keyA.isBefore(keyB,'day')) {
|
|
||||||
return -1;
|
|
||||||
} else if(keyB.isBefore(keyA, 'day')) {
|
|
||||||
return 1
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return days
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/*const chartData = computed(() => {
|
const loadData = async () => {
|
||||||
return {
|
const [docs, incoming] = await Promise.all([
|
||||||
labels: days.value,
|
useEntities("createddocuments").select(),
|
||||||
datasets: [
|
useEntities("incominginvoices").select()
|
||||||
{
|
])
|
||||||
label: 'Einnahmen',
|
|
||||||
data: [2, 1, 16, 3, 2],
|
incomeDocuments.value = (docs || []).filter((item) => item.state === "Gebucht" && ["invoices", "advanceInvoices", "cancellationInvoices"].includes(item.type))
|
||||||
backgroundColor: 'rgba(20, 255, 0, 0.3)',
|
expenseInvoices.value = (incoming || []).filter((item) => item.date)
|
||||||
borderColor: 'red',
|
}
|
||||||
borderWidth: 2,
|
|
||||||
}
|
const yearsInData = computed(() => {
|
||||||
]
|
const years = new Set([dayjs().year()])
|
||||||
|
|
||||||
|
incomeDocuments.value.forEach((item) => {
|
||||||
|
const parsed = dayjs(item.documentDate)
|
||||||
|
if (parsed.isValid()) years.add(parsed.year())
|
||||||
|
})
|
||||||
|
|
||||||
|
expenseInvoices.value.forEach((item) => {
|
||||||
|
const parsed = dayjs(item.date)
|
||||||
|
if (parsed.isValid()) years.add(parsed.year())
|
||||||
|
})
|
||||||
|
|
||||||
|
return Array.from(years).sort((a, b) => b - a)
|
||||||
|
})
|
||||||
|
|
||||||
|
const yearOptions = computed(() => yearsInData.value.map((year) => ({ label: String(year), value: year })))
|
||||||
|
|
||||||
|
watch(yearsInData, (years) => {
|
||||||
|
if (!years.includes(selectedYear.value) && years.length > 0) {
|
||||||
|
selectedYear.value = years[0]
|
||||||
}
|
}
|
||||||
})*/
|
}, { immediate: true })
|
||||||
|
|
||||||
|
const computeDocumentAmount = (doc) => {
|
||||||
|
let amount = 0
|
||||||
|
|
||||||
|
;(doc.rows || []).forEach((row) => {
|
||||||
|
if (["pagebreak", "title", "text"].includes(row.mode)) return
|
||||||
|
|
||||||
|
const net = Number(row.price || 0) * Number(row.quantity || 0) * (1 - Number(row.discountPercent || 0) / 100)
|
||||||
|
const taxPercent = Number(row.taxPercent)
|
||||||
|
const gross = net * (1 + (Number.isFinite(taxPercent) ? taxPercent : 0) / 100)
|
||||||
|
|
||||||
|
amount += amountMode.value === "gross" ? gross : net
|
||||||
|
})
|
||||||
|
|
||||||
|
return Number(amount.toFixed(2))
|
||||||
|
}
|
||||||
|
|
||||||
|
const computeIncomingInvoiceAmount = (invoice) => {
|
||||||
|
let amount = 0
|
||||||
|
|
||||||
|
;(invoice.accounts || []).forEach((account) => {
|
||||||
|
const net = Number(account.amountNet || 0)
|
||||||
|
const tax = Number(account.amountTax || 0)
|
||||||
|
const grossValue = Number(account.amountGross)
|
||||||
|
const gross = Number.isFinite(grossValue) ? grossValue : (net + tax)
|
||||||
|
|
||||||
|
amount += amountMode.value === "gross" ? gross : net
|
||||||
|
})
|
||||||
|
|
||||||
|
return Number(amount.toFixed(2))
|
||||||
|
}
|
||||||
|
|
||||||
|
const buckets = computed(() => {
|
||||||
|
const income = {}
|
||||||
|
const expense = {}
|
||||||
|
|
||||||
|
if (granularity.value === "year") {
|
||||||
|
for (let month = 1; month <= 12; month += 1) {
|
||||||
|
const key = String(month).padStart(2, "0")
|
||||||
|
income[key] = 0
|
||||||
|
expense[key] = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const daysInMonth = dayjs(`${selectedYear.value}-${String(selectedMonth.value).padStart(2, "0")}-01`).daysInMonth()
|
||||||
|
|
||||||
|
for (let day = 1; day <= daysInMonth; day += 1) {
|
||||||
|
const key = String(day).padStart(2, "0")
|
||||||
|
income[key] = 0
|
||||||
|
expense[key] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incomeDocuments.value.forEach((doc) => {
|
||||||
|
const docDate = dayjs(doc.documentDate)
|
||||||
|
if (!docDate.isValid() || docDate.year() !== selectedYear.value) return
|
||||||
|
if (granularity.value === "month" && docDate.month() + 1 !== selectedMonth.value) return
|
||||||
|
|
||||||
|
const key = granularity.value === "year"
|
||||||
|
? String(docDate.month() + 1).padStart(2, "0")
|
||||||
|
: String(docDate.date()).padStart(2, "0")
|
||||||
|
|
||||||
|
income[key] = Number((income[key] + computeDocumentAmount(doc)).toFixed(2))
|
||||||
|
})
|
||||||
|
|
||||||
|
expenseInvoices.value.forEach((invoice) => {
|
||||||
|
const invoiceDate = dayjs(invoice.date)
|
||||||
|
if (!invoiceDate.isValid() || invoiceDate.year() !== selectedYear.value) return
|
||||||
|
if (granularity.value === "month" && invoiceDate.month() + 1 !== selectedMonth.value) return
|
||||||
|
|
||||||
|
const key = granularity.value === "year"
|
||||||
|
? String(invoiceDate.month() + 1).padStart(2, "0")
|
||||||
|
: String(invoiceDate.date()).padStart(2, "0")
|
||||||
|
|
||||||
|
expense[key] = Number((expense[key] + computeIncomingInvoiceAmount(invoice)).toFixed(2))
|
||||||
|
})
|
||||||
|
|
||||||
|
return { income, expense }
|
||||||
|
})
|
||||||
|
|
||||||
|
const chartLabels = computed(() => {
|
||||||
|
if (granularity.value === "year") {
|
||||||
|
return ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.keys(buckets.value.income).map((day) => `${day}.`)
|
||||||
|
})
|
||||||
|
|
||||||
import { Line } from 'vue-chartjs'
|
|
||||||
const chartData = computed(() => {
|
const chartData = computed(() => {
|
||||||
|
const keys = Object.keys(buckets.value.income).sort()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
labels: ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],
|
labels: chartLabels.value,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Ausgaben',
|
label: "Ausgaben",
|
||||||
backgroundColor: '#f87979',
|
backgroundColor: "#f87979",
|
||||||
borderColor: '#f87979',
|
borderColor: "#f87979",
|
||||||
data: Object.keys(expenseData.value).sort().map(i => expenseData.value[i]),
|
data: keys.map((key) => buckets.value.expense[key]),
|
||||||
tension: 0.3,
|
tension: 0.3,
|
||||||
},{
|
},
|
||||||
label: 'Einnahmen',
|
{
|
||||||
backgroundColor: '#69c350',
|
label: "Einnahmen",
|
||||||
borderColor: '#69c350',
|
backgroundColor: "#69c350",
|
||||||
data: Object.keys(incomeData.value).sort().map(i => incomeData.value[i]),
|
borderColor: "#69c350",
|
||||||
|
data: keys.map((key) => buckets.value.income[key]),
|
||||||
tension: 0.3
|
tension: 0.3
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const chartOptions = ref({
|
const chartOptions = ref({
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
setup()
|
loadData()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Line
|
<div class="h-full flex flex-col gap-2">
|
||||||
:data="chartData"
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||||
:options="chartOptions"
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
/>
|
<USelectMenu
|
||||||
|
v-model="granularity"
|
||||||
|
:options="granularityOptions"
|
||||||
|
value-attribute="value"
|
||||||
|
option-attribute="label"
|
||||||
|
class="w-28"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<USelectMenu
|
||||||
|
v-model="selectedYear"
|
||||||
|
:options="yearOptions"
|
||||||
|
value-attribute="value"
|
||||||
|
option-attribute="label"
|
||||||
|
class="w-24"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<USelectMenu
|
||||||
|
v-if="granularity === 'month'"
|
||||||
|
v-model="selectedMonth"
|
||||||
|
:options="monthOptions"
|
||||||
|
value-attribute="value"
|
||||||
|
option-attribute="label"
|
||||||
|
class="w-36"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<UButtonGroup size="xs">
|
||||||
|
<UButton
|
||||||
|
:variant="amountMode === 'net' ? 'solid' : 'outline'"
|
||||||
|
@click="amountMode = 'net'"
|
||||||
|
>
|
||||||
|
Netto
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
:variant="amountMode === 'gross' ? 'solid' : 'outline'"
|
||||||
|
@click="amountMode = 'gross'"
|
||||||
|
>
|
||||||
|
Brutto
|
||||||
|
</UButton>
|
||||||
|
</UButtonGroup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-1 min-h-[280px]">
|
||||||
|
<Line
|
||||||
|
:data="chartData"
|
||||||
|
:options="chartOptions"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -2073,6 +2073,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
type="number"
|
type="number"
|
||||||
|
step="0.01"
|
||||||
v-model="itemInfo.customSurchargePercentage"
|
v-model="itemInfo.customSurchargePercentage"
|
||||||
@change="updateCustomSurcharge"
|
@change="updateCustomSurcharge"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -158,13 +158,24 @@
|
|||||||
<UDivider label="Vorlagen auswählen" />
|
<UDivider label="Vorlagen auswählen" />
|
||||||
|
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
||||||
<UInput
|
<div class="flex flex-col sm:flex-row gap-2 w-full sm:w-auto">
|
||||||
v-model="modalSearch"
|
<UInput
|
||||||
icon="i-heroicons-magnifying-glass"
|
v-model="modalSearch"
|
||||||
placeholder="Kunde oder Vertrag suchen..."
|
icon="i-heroicons-magnifying-glass"
|
||||||
class="w-full sm:w-64"
|
placeholder="Kunde oder Vertrag suchen..."
|
||||||
size="sm"
|
class="w-full sm:w-64"
|
||||||
/>
|
size="sm"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<USelectMenu
|
||||||
|
v-model="selectedExecutionIntervall"
|
||||||
|
:options="executionIntervallOptions"
|
||||||
|
option-attribute="label"
|
||||||
|
value-attribute="value"
|
||||||
|
size="sm"
|
||||||
|
class="w-full sm:w-52"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<span class="text-xs text-gray-500 hidden sm:inline">
|
<span class="text-xs text-gray-500 hidden sm:inline">
|
||||||
@@ -201,11 +212,14 @@
|
|||||||
{{displayCurrency(calculateDocSum(row))}}
|
{{displayCurrency(calculateDocSum(row))}}
|
||||||
</template>
|
</template>
|
||||||
<template #serialConfig.intervall-data="{row}">
|
<template #serialConfig.intervall-data="{row}">
|
||||||
{{ row.serialConfig?.intervall }}
|
{{ getIntervallLabel(row.serialConfig?.intervall) }}
|
||||||
</template>
|
</template>
|
||||||
<template #contract-data="{row}">
|
<template #contract-data="{row}">
|
||||||
{{row.contract?.contractNumber}} - {{row.contract?.name}}
|
{{row.contract?.contractNumber}} - {{row.contract?.name}}
|
||||||
</template>
|
</template>
|
||||||
|
<template #plant-data="{row}">
|
||||||
|
{{ row.plant?.name || "-" }}
|
||||||
|
</template>
|
||||||
</UTable>
|
</UTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -287,6 +301,7 @@ const executionDate = ref(dayjs().format('YYYY-MM-DD'))
|
|||||||
const selectedExecutionRows = ref([])
|
const selectedExecutionRows = ref([])
|
||||||
const isExecuting = ref(false)
|
const isExecuting = ref(false)
|
||||||
const modalSearch = ref("") // NEU: Suchstring für das Modal
|
const modalSearch = ref("") // NEU: Suchstring für das Modal
|
||||||
|
const selectedExecutionIntervall = ref("all")
|
||||||
|
|
||||||
// --- SerialExecutions State ---
|
// --- SerialExecutions State ---
|
||||||
const showExecutionsSlideover = ref(false)
|
const showExecutionsSlideover = ref(false)
|
||||||
@@ -295,7 +310,7 @@ const executionsLoading = ref(false)
|
|||||||
const finishingId = ref(null)
|
const finishingId = ref(null)
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
items.value = await useEntities("createddocuments").select("*, customer(id,name), contract(id,name, contractNumber)","documentDate",undefined,true)
|
items.value = await useEntities("createddocuments").select("*, customer(id,name), contract(id,name, contractNumber), plant(id,name)","documentDate",undefined,true)
|
||||||
await fetchExecutions()
|
await fetchExecutions()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,30 +405,78 @@ const filteredRows = computed(() => {
|
|||||||
return useSearch(searchString.value, temp.slice().reverse())
|
return useSearch(searchString.value, temp.slice().reverse())
|
||||||
})
|
})
|
||||||
|
|
||||||
// Basis Liste für das Modal (nur Aktive)
|
// Basis Liste für das Modal (nur aktive und nicht archivierte Vorlagen)
|
||||||
const activeTemplates = computed(() => {
|
const activeTemplates = computed(() => {
|
||||||
return items.value
|
return items.value
|
||||||
.filter(i => i.type === "serialInvoices" && !!i.serialConfig?.active)
|
.filter(i => i.type === "serialInvoices" && !!i.serialConfig?.active && !i.archived)
|
||||||
.map(i => ({...i}))
|
.map(i => ({...i}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const intervallLabelMap = {
|
||||||
|
"wöchentlich": "Wöchentlich",
|
||||||
|
"2 - wöchentlich": "Alle 2 Wochen",
|
||||||
|
"monatlich": "Monatlich",
|
||||||
|
"vierteljährlich": "Quartalsweise",
|
||||||
|
"halbjährlich": "Halbjährlich",
|
||||||
|
"jährlich": "Jährlich"
|
||||||
|
}
|
||||||
|
|
||||||
|
const getIntervallLabel = (intervall) => {
|
||||||
|
if (!intervall) return "-"
|
||||||
|
return intervallLabelMap[intervall] || intervall
|
||||||
|
}
|
||||||
|
|
||||||
|
const executionIntervallOptions = computed(() => {
|
||||||
|
const availableIntervals = [...new Set(
|
||||||
|
activeTemplates.value
|
||||||
|
.map(row => row.serialConfig?.intervall)
|
||||||
|
.filter(Boolean)
|
||||||
|
)]
|
||||||
|
|
||||||
|
const sorted = availableIntervals.sort((a, b) =>
|
||||||
|
getIntervallLabel(a).localeCompare(getIntervallLabel(b), 'de')
|
||||||
|
)
|
||||||
|
|
||||||
|
return [
|
||||||
|
{label: 'Alle Intervalle', value: 'all'},
|
||||||
|
...sorted.map(intervall => ({
|
||||||
|
label: getIntervallLabel(intervall),
|
||||||
|
value: intervall
|
||||||
|
}))
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
// NEU: Gefilterte Liste für das Modal basierend auf der Suche
|
// NEU: Gefilterte Liste für das Modal basierend auf der Suche
|
||||||
const filteredExecutionList = computed(() => {
|
const filteredExecutionList = computed(() => {
|
||||||
if (!modalSearch.value) return activeTemplates.value
|
let filtered = [...activeTemplates.value]
|
||||||
|
|
||||||
|
if (selectedExecutionIntervall.value !== 'all') {
|
||||||
|
filtered = filtered.filter(
|
||||||
|
row => row.serialConfig?.intervall === selectedExecutionIntervall.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modalSearch.value) return filtered
|
||||||
|
|
||||||
const term = modalSearch.value.toLowerCase()
|
const term = modalSearch.value.toLowerCase()
|
||||||
|
|
||||||
return activeTemplates.value.filter(row => {
|
return filtered.filter(row => {
|
||||||
const customerName = row.customer?.name?.toLowerCase() || ""
|
const customerName = row.customer?.name?.toLowerCase() || ""
|
||||||
const contractNum = row.contract?.contractNumber?.toLowerCase() || ""
|
const contractNum = row.contract?.contractNumber?.toLowerCase() || ""
|
||||||
const contractName = row.contract?.name?.toLowerCase() || ""
|
const contractName = row.contract?.name?.toLowerCase() || ""
|
||||||
|
const plantName = row.plant?.name?.toLowerCase() || ""
|
||||||
|
|
||||||
return customerName.includes(term) ||
|
return customerName.includes(term) ||
|
||||||
contractNum.includes(term) ||
|
contractNum.includes(term) ||
|
||||||
contractName.includes(term)
|
contractName.includes(term) ||
|
||||||
|
plantName.includes(term)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(selectedExecutionIntervall, () => {
|
||||||
|
selectedExecutionRows.value = [...filteredExecutionList.value]
|
||||||
|
})
|
||||||
|
|
||||||
// NEU: Alle auswählen (nur die aktuell sichtbaren/gefilterten)
|
// NEU: Alle auswählen (nur die aktuell sichtbaren/gefilterten)
|
||||||
const selectAllTemplates = () => {
|
const selectAllTemplates = () => {
|
||||||
// WICHTIG: Überschreibt nicht bestehende Auswahl, sondern fügt hinzu oder ersetzt.
|
// WICHTIG: Überschreibt nicht bestehende Auswahl, sondern fügt hinzu oder ersetzt.
|
||||||
@@ -469,6 +532,7 @@ const templateColumns = [
|
|||||||
|
|
||||||
const executionColumns = [
|
const executionColumns = [
|
||||||
{key: 'partner', label: "Kunde"},
|
{key: 'partner', label: "Kunde"},
|
||||||
|
{key: 'plant', label: "Objekt"},
|
||||||
{key: 'contract', label: "Vertrag"},
|
{key: 'contract', label: "Vertrag"},
|
||||||
{key: 'serialConfig.intervall', label: "Intervall"},
|
{key: 'serialConfig.intervall', label: "Intervall"},
|
||||||
{key: "amount", label: "Betrag"},
|
{key: "amount", label: "Betrag"},
|
||||||
@@ -509,8 +573,9 @@ const calculateDocSum = (row) => {
|
|||||||
|
|
||||||
const openExecutionModal = () => {
|
const openExecutionModal = () => {
|
||||||
executionDate.value = dayjs().format('YYYY-MM-DD')
|
executionDate.value = dayjs().format('YYYY-MM-DD')
|
||||||
selectedExecutionRows.value = []
|
|
||||||
modalSearch.value = "" // Reset Search
|
modalSearch.value = "" // Reset Search
|
||||||
|
selectedExecutionIntervall.value = "all"
|
||||||
|
selectedExecutionRows.value = []
|
||||||
showExecutionModal.value = true
|
showExecutionModal.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,4 +622,4 @@ const executeSerialInvoices = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<UDashboardPanelContent>
|
<UDashboardPanelContent>
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<UDashboardCard
|
<UDashboardCard
|
||||||
title="Einnahmen und Ausgaben(netto)"
|
title="Einnahmen und Ausgaben"
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
>
|
>
|
||||||
<display-income-and-expenditure/>
|
<display-income-and-expenditure/>
|
||||||
@@ -89,4 +89,4 @@ const { isNotificationsSlideoverOpen } = useDashboard()
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,108 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
|
const defaultFeatures = {
|
||||||
|
objects: true,
|
||||||
|
calendar: true,
|
||||||
|
contacts: true,
|
||||||
|
projects: true,
|
||||||
|
vehicles: true,
|
||||||
|
contracts: true,
|
||||||
|
inventory: true,
|
||||||
|
accounting: true,
|
||||||
|
timeTracking: true,
|
||||||
|
planningBoard: true,
|
||||||
|
workingTimeTracking: true,
|
||||||
|
dashboard: true,
|
||||||
|
historyitems: true,
|
||||||
|
tasks: true,
|
||||||
|
wiki: true,
|
||||||
|
files: true,
|
||||||
|
createdletters: true,
|
||||||
|
documentboxes: true,
|
||||||
|
helpdesk: true,
|
||||||
|
email: true,
|
||||||
|
members: true,
|
||||||
|
customers: true,
|
||||||
|
vendors: true,
|
||||||
|
contactsList: true,
|
||||||
|
staffTime: true,
|
||||||
|
createDocument: true,
|
||||||
|
serialInvoice: true,
|
||||||
|
incomingInvoices: true,
|
||||||
|
costcentres: true,
|
||||||
|
accounts: true,
|
||||||
|
ownaccounts: true,
|
||||||
|
banking: true,
|
||||||
|
spaces: true,
|
||||||
|
customerspaces: true,
|
||||||
|
customerinventoryitems: true,
|
||||||
|
inventoryitems: true,
|
||||||
|
inventoryitemgroups: true,
|
||||||
|
products: true,
|
||||||
|
productcategories: true,
|
||||||
|
services: true,
|
||||||
|
servicecategories: true,
|
||||||
|
memberrelations: true,
|
||||||
|
staffProfiles: true,
|
||||||
|
hourrates: true,
|
||||||
|
projecttypes: true,
|
||||||
|
contracttypes: true,
|
||||||
|
plants: true,
|
||||||
|
settingsNumberRanges: true,
|
||||||
|
settingsEmailAccounts: true,
|
||||||
|
settingsBanking: true,
|
||||||
|
settingsTexttemplates: true,
|
||||||
|
settingsTenant: true,
|
||||||
|
export: true,
|
||||||
|
}
|
||||||
|
const featureOptions = [
|
||||||
|
{ key: "dashboard", label: "Dashboard" },
|
||||||
|
{ key: "historyitems", label: "Logbuch" },
|
||||||
|
{ key: "tasks", label: "Aufgaben" },
|
||||||
|
{ key: "wiki", label: "Wiki" },
|
||||||
|
{ key: "files", label: "Dateien" },
|
||||||
|
{ key: "createdletters", label: "Anschreiben" },
|
||||||
|
{ key: "documentboxes", label: "Boxen" },
|
||||||
|
{ key: "helpdesk", label: "Helpdesk" },
|
||||||
|
{ key: "email", label: "E-Mail" },
|
||||||
|
{ key: "members", label: "Mitglieder" },
|
||||||
|
{ key: "customers", label: "Kunden" },
|
||||||
|
{ key: "vendors", label: "Lieferanten" },
|
||||||
|
{ key: "contactsList", label: "Ansprechpartner" },
|
||||||
|
{ key: "staffTime", label: "Mitarbeiter: Zeiten" },
|
||||||
|
{ key: "createDocument", label: "Buchhaltung: Ausgangsbelege" },
|
||||||
|
{ key: "serialInvoice", label: "Buchhaltung: Serienvorlagen" },
|
||||||
|
{ key: "incomingInvoices", label: "Buchhaltung: Eingangsbelege" },
|
||||||
|
{ key: "costcentres", label: "Buchhaltung: Kostenstellen" },
|
||||||
|
{ key: "accounts", label: "Buchhaltung: Buchungskonten" },
|
||||||
|
{ key: "ownaccounts", label: "Buchhaltung: Zusätzliche Buchungskonten" },
|
||||||
|
{ key: "banking", label: "Buchhaltung: Bank" },
|
||||||
|
{ key: "spaces", label: "Lagerplätze" },
|
||||||
|
{ key: "customerspaces", label: "Kundenlagerplätze" },
|
||||||
|
{ key: "customerinventoryitems", label: "Kundeninventar" },
|
||||||
|
{ key: "inventoryitems", label: "Inventar" },
|
||||||
|
{ key: "inventoryitemgroups", label: "Inventargruppen" },
|
||||||
|
{ key: "products", label: "Stammdaten: Artikel" },
|
||||||
|
{ key: "productcategories", label: "Stammdaten: Artikelkategorien" },
|
||||||
|
{ key: "services", label: "Stammdaten: Leistungen" },
|
||||||
|
{ key: "servicecategories", label: "Stammdaten: Leistungskategorien" },
|
||||||
|
{ key: "memberrelations", label: "Stammdaten: Mitgliedsverhältnisse" },
|
||||||
|
{ key: "staffProfiles", label: "Stammdaten: Mitarbeiter" },
|
||||||
|
{ key: "hourrates", label: "Stammdaten: Stundensätze" },
|
||||||
|
{ key: "projecttypes", label: "Stammdaten: Projekttypen" },
|
||||||
|
{ key: "contracttypes", label: "Stammdaten: Vertragstypen" },
|
||||||
|
{ key: "vehicles", label: "Stammdaten: Fahrzeuge" },
|
||||||
|
{ key: "projects", label: "Projekte" },
|
||||||
|
{ key: "contracts", label: "Verträge" },
|
||||||
|
{ key: "plants", label: "Objekte" },
|
||||||
|
{ key: "settingsNumberRanges", label: "Einstellungen: Nummernkreise" },
|
||||||
|
{ key: "settingsEmailAccounts", label: "Einstellungen: E-Mail Konten" },
|
||||||
|
{ key: "settingsBanking", label: "Einstellungen: Bankkonten" },
|
||||||
|
{ key: "settingsTexttemplates", label: "Einstellungen: Textvorlagen" },
|
||||||
|
{ key: "settingsTenant", label: "Einstellungen: Firmeneinstellungen" },
|
||||||
|
{ key: "export", label: "Einstellungen: Export" },
|
||||||
|
]
|
||||||
|
|
||||||
const itemInfo = ref({
|
const itemInfo = ref({
|
||||||
features: {},
|
features: {},
|
||||||
@@ -13,7 +115,7 @@ const setupPage = async () => {
|
|||||||
console.log(itemInfo.value)
|
console.log(itemInfo.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const features = ref(auth.activeTenantData.features)
|
const features = ref({ ...defaultFeatures, ...(auth.activeTenantData?.features || {}) })
|
||||||
const businessInfo = ref(auth.activeTenantData.businessInfo)
|
const businessInfo = ref(auth.activeTenantData.businessInfo)
|
||||||
const accountChart = ref(auth.activeTenantData.accountChart || "skr03")
|
const accountChart = ref(auth.activeTenantData.accountChart || "skr03")
|
||||||
const accountChartOptions = [
|
const accountChartOptions = [
|
||||||
@@ -33,8 +135,12 @@ const updateTenant = async (newData) => {
|
|||||||
if (res) {
|
if (res) {
|
||||||
itemInfo.value = res
|
itemInfo.value = res
|
||||||
auth.activeTenantData = res
|
auth.activeTenantData = res
|
||||||
|
features.value = { ...defaultFeatures, ...(res?.features || {}) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const saveFeatures = async () => {
|
||||||
|
await updateTenant({features: features.value})
|
||||||
|
}
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
</script>
|
</script>
|
||||||
@@ -50,6 +156,8 @@ setupPage()
|
|||||||
label: 'Dokubox'
|
label: 'Dokubox'
|
||||||
},{
|
},{
|
||||||
label: 'Rechnung & Kontakt'
|
label: 'Rechnung & Kontakt'
|
||||||
|
},{
|
||||||
|
label: 'Funktionen'
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
@@ -131,59 +239,11 @@ setupPage()
|
|||||||
class="mb-5"
|
class="mb-5"
|
||||||
/>
|
/>
|
||||||
<UCheckbox
|
<UCheckbox
|
||||||
label="Kalendar"
|
v-for="option in featureOptions"
|
||||||
v-model="features.calendar"
|
:key="option.key"
|
||||||
@change="updateTenant({features: features})"
|
:label="option.label"
|
||||||
/>
|
v-model="features[option.key]"
|
||||||
<UCheckbox
|
@change="saveFeatures"
|
||||||
label="Kontakte"
|
|
||||||
v-model="features.contacts"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Plantafel"
|
|
||||||
v-model="features.planningBoard"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Zeiterfassung"
|
|
||||||
v-model="features.timeTracking"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Anwesenheiten"
|
|
||||||
v-model="features.workingTimeTracking"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Lager"
|
|
||||||
v-model="features.inventory"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Fahrzeuge"
|
|
||||||
v-model="features.vehicles"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Buchhaltung"
|
|
||||||
v-model="features.accounting"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Projekte"
|
|
||||||
v-model="features.projects"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Verträge"
|
|
||||||
v-model="features.contracts"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
|
||||||
<UCheckbox
|
|
||||||
label="Objekte"
|
|
||||||
v-model="features.objects"
|
|
||||||
@change="updateTenant({features: features})"
|
|
||||||
/>
|
/>
|
||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1237,9 +1237,9 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
selectOptionAttribute: "name",
|
selectOptionAttribute: "name",
|
||||||
selectSearchAttributes: ['name'],
|
selectSearchAttributes: ['name'],
|
||||||
},{
|
},{
|
||||||
key: "description",
|
key: "description.text",
|
||||||
label: "Beschreibung",
|
label: "Beschreibung",
|
||||||
inputType:"editor",
|
inputType:"textarea",
|
||||||
component: description
|
component: description
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -502,9 +502,22 @@ export async function createCustomerInventoryItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchPlants(token: string, includeArchived = false): Promise<Plant[]> {
|
export async function fetchPlants(token: string, includeArchived = false): Promise<Plant[]> {
|
||||||
const plants = await apiRequest<Plant[]>('/api/resource/plants', { token });
|
const plants = await apiRequest<Array<Plant & { description?: unknown }>>('/api/resource/plants', { token });
|
||||||
if (includeArchived) return plants || [];
|
const normalized = (plants || []).map((plant) => {
|
||||||
return (plants || []).filter((plant) => !plant.archived);
|
const legacyDescription = typeof plant.description === 'string'
|
||||||
|
? plant.description
|
||||||
|
: (plant.description && typeof plant.description === 'object' && 'text' in (plant.description as Record<string, unknown>)
|
||||||
|
? String((plant.description as Record<string, unknown>).text || '')
|
||||||
|
: null);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...plant,
|
||||||
|
description: legacyDescription || null,
|
||||||
|
} as Plant;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (includeArchived) return normalized;
|
||||||
|
return normalized.filter((plant) => !plant.archived);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createPlant(
|
export async function createPlant(
|
||||||
@@ -518,7 +531,15 @@ export async function createPlant(
|
|||||||
return apiRequest<Plant>('/api/resource/plants', {
|
return apiRequest<Plant>('/api/resource/plants', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
token,
|
token,
|
||||||
body: payload,
|
body: {
|
||||||
|
name: payload.name,
|
||||||
|
customer: payload.customer ?? null,
|
||||||
|
description: {
|
||||||
|
text: payload.description?.trim() || '',
|
||||||
|
html: '',
|
||||||
|
json: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user