Ausgangsbelege um Kostenstellenzuordnung erweitern

This commit is contained in:
2026-05-26 16:21:24 +02:00
parent b59599cb92
commit cb09651d8d
11 changed files with 208 additions and 10 deletions

View File

@@ -0,0 +1,7 @@
ALTER TABLE "createddocuments" ADD COLUMN "costcentre" uuid;
--> statement-breakpoint
ALTER TABLE "services" ADD COLUMN "costcentre" uuid;
--> statement-breakpoint
ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_costcentre_costcentres_id_fk" FOREIGN KEY ("costcentre") REFERENCES "public"."costcentres"("id") ON DELETE no action ON UPDATE no action;
--> statement-breakpoint
ALTER TABLE "services" ADD CONSTRAINT "services_costcentre_costcentres_id_fk" FOREIGN KEY ("costcentre") REFERENCES "public"."costcentres"("id") ON DELETE no action ON UPDATE no action;

View File

@@ -344,6 +344,20 @@
"when": 1780174800000,
"tag": "0048_mobile_push_devices",
"breakpoints": true
},
{
"idx": 49,
"version": "7",
"when": 1780178400000,
"tag": "0049_email_cache",
"breakpoints": true
},
{
"idx": 50,
"version": "7",
"when": 1780261200000,
"tag": "0050_outgoing_document_costcentres",
"breakpoints": true
}
]
}

View File

@@ -20,6 +20,7 @@ import { plants } from "./plants"
import { authUsers } from "./auth_users"
import {serialExecutions} from "./serialexecutions";
import { outgoingsepamandates } from "./outgoingsepamandates"
import { costcentres } from "./costcentres"
export const createddocuments = pgTable("createddocuments", {
id: bigint("id", { mode: "number" })
@@ -49,6 +50,8 @@ export const createddocuments = pgTable("createddocuments", {
() => projects.id
),
costcentre: uuid("costcentre").references(() => costcentres.id),
documentNumber: text("documentNumber"),
documentDate: text("documentDate"),

View File

@@ -13,6 +13,7 @@ import {
import { tenants } from "./tenants"
import { units } from "./units"
import { authUsers } from "./auth_users"
import { costcentres } from "./costcentres"
export const services = pgTable("services", {
id: bigint("id", { mode: "number" })
@@ -35,6 +36,8 @@ export const services = pgTable("services", {
unit: bigint("unit", { mode: "number" }).references(() => units.id),
costcentre: uuid("costcentre").references(() => costcentres.id),
serviceNumber: bigint("serviceNumber", { mode: "number" }),
tags: jsonb("tags").default([]),

View File

@@ -205,6 +205,8 @@ const buildOutgoingDocumentPayload = (
if (args[field] !== undefined) payload[field] = numberArg(args, field)
}
if (args.costcentre !== undefined) payload.costcentre = stringArg(args, "costcentre")
for (const field of ["paymentDays"] as const) {
if (args[field] !== undefined) payload[field] = numberArg(args, field)
}
@@ -458,6 +460,7 @@ export const accountingTools: McpTool[] = [
contact: { type: "number" },
contract: { type: "number" },
project: { type: "number" },
costcentre: { type: "string", description: "Kostenstellen-UUID als Belegvorgabe." },
plant: { type: "number" },
documentDate: { type: "string" },
deliveryDate: { type: "string" },
@@ -512,6 +515,7 @@ export const accountingTools: McpTool[] = [
contact: { type: "number" },
contract: { type: "number" },
project: { type: "number" },
costcentre: { type: "string", description: "Kostenstellen-UUID als Belegvorgabe." },
plant: { type: "number" },
documentDate: { type: "string" },
deliveryDate: { type: "string" },

View File

@@ -378,6 +378,7 @@ async function getSaveData(item: any, tenant: any, firstDate: string, lastDate:
contract: item.contract,
address: item.address,
project: item.project,
costcentre: item.costcentre,
documentDate: executionDate,
deliveryDate: firstDate,
deliveryDateEnd: lastDate,

View File

@@ -78,7 +78,7 @@ export const resourceConfig = {
table: contracts,
searchColumns: ["name", "notes", "contractNumber", "paymentType", "billingInterval", "sepaRef", "bankingName"],
numberRangeHolder: "contractNumber",
mtoLoad: ["customer", "contracttype", "outgoingsepamandate"],
mtoLoad: ["customer", "contracttype", "contact", "outgoingsepamandate"],
},
outgoingsepamandates: {
table: outgoingsepamandates,
@@ -230,7 +230,7 @@ export const resourceConfig = {
},
createddocuments: {
table: createddocuments,
mtoLoad: ["customer", "project", "contact", "contract", "plant","letterhead","createddocument", "outgoingsepamandate"],
mtoLoad: ["customer", "project", "costcentre", "contact", "contract", "plant","letterhead","createddocument", "outgoingsepamandate"],
mtmLoad: ["statementallocations","files","createddocuments"],
mtmListLoad: ["statementallocations", "files"],
},