added place to telecommunication, added contract documents, added invoice to other contracts

This commit is contained in:
2026-03-25 16:55:48 +01:00
parent eaa94e766a
commit 3dd4f7b656
30 changed files with 3424 additions and 90 deletions
+23
View File
@@ -59,6 +59,7 @@ export async function addInvoice(energyContractDetailsId: number, data: CreateIn
return prisma.invoice.create({
data: {
energyContractDetailsId,
contractId: energyDetails.contractId,
invoiceDate: data.invoiceDate,
invoiceType: data.invoiceType,
documentPath: data.documentPath,
@@ -67,6 +68,28 @@ export async function addInvoice(energyContractDetailsId: number, data: CreateIn
});
}
/**
* Rechnung direkt über contractId hinzufügen (für alle Vertragstypen)
*/
export async function addInvoiceByContract(contractId: number, data: CreateInvoiceData) {
return prisma.invoice.create({
data: {
contractId,
invoiceDate: data.invoiceDate,
invoiceType: data.invoiceType,
documentPath: data.documentPath,
notes: data.notes,
},
});
}
export async function getInvoicesByContract(contractId: number) {
return prisma.invoice.findMany({
where: { contractId },
orderBy: { invoiceDate: 'desc' },
});
}
/**
* Rechnung aktualisieren
*/