added invoices and status in cockpit, created info button for contract status types
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Invoice` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`energyContractDetailsId` INTEGER NOT NULL,
|
||||
`invoiceDate` DATETIME(3) NOT NULL,
|
||||
`invoiceType` ENUM('INTERIM', 'FINAL', 'NOT_AVAILABLE') NOT NULL,
|
||||
`documentPath` VARCHAR(191) NULL,
|
||||
`notes` VARCHAR(191) NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
INDEX `Invoice_energyContractDetailsId_idx`(`energyContractDetailsId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Invoice` ADD CONSTRAINT `Invoice_energyContractDetailsId_fkey` FOREIGN KEY (`energyContractDetailsId`) REFERENCES `EnergyContractDetails`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -596,20 +596,41 @@ model ContractTaskSubtask {
|
||||
|
||||
// ==================== ENERGY CONTRACT DETAILS ====================
|
||||
|
||||
enum InvoiceType {
|
||||
INTERIM // Zwischenrechnung
|
||||
FINAL // Schlussrechnung
|
||||
NOT_AVAILABLE // Rechnung nicht mehr zu bekommen
|
||||
}
|
||||
|
||||
model EnergyContractDetails {
|
||||
id Int @id @default(autoincrement())
|
||||
contractId Int @unique
|
||||
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||||
id Int @id @default(autoincrement())
|
||||
contractId Int @unique
|
||||
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||||
meterId Int?
|
||||
meter Meter? @relation(fields: [meterId], references: [id])
|
||||
maloId String? // Marktlokations-ID
|
||||
annualConsumption Float? // kWh für Strom, m³ für Gas
|
||||
annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)
|
||||
basePrice Float? // €/Monat
|
||||
unitPrice Float? // €/kWh (Arbeitspreis)
|
||||
meter Meter? @relation(fields: [meterId], references: [id])
|
||||
maloId String? // Marktlokations-ID
|
||||
annualConsumption Float? // kWh für Strom, m³ für Gas
|
||||
annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)
|
||||
basePrice Float? // €/Monat
|
||||
unitPrice Float? // €/kWh (Arbeitspreis)
|
||||
bonus Float?
|
||||
previousProviderName String?
|
||||
previousCustomerNumber String?
|
||||
invoices Invoice[] // Rechnungen
|
||||
}
|
||||
|
||||
model Invoice {
|
||||
id Int @id @default(autoincrement())
|
||||
energyContractDetailsId Int
|
||||
energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)
|
||||
invoiceDate DateTime
|
||||
invoiceType InvoiceType
|
||||
documentPath String? // Pflicht, außer bei NOT_AVAILABLE
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([energyContractDetailsId])
|
||||
}
|
||||
|
||||
// ==================== INTERNET CONTRACT DETAILS ====================
|
||||
|
||||
Reference in New Issue
Block a user