Files
Fuchs_Intranet/Fuchs_Database/dbo/Tables/fds__invoices.sql
T
StefanandClaude Sonnet 5 94aa7cbfe4 Add Cc (Zusatzempfänger) recipient support for invoice emails
Lets an invoice carry an additional Cc recipient alongside the primary
SendToEmail, sent via the ProcessWeb mailer API. Honors the
Fuchs:Email:OverrideRecipient dev safety net: when the override is
active, Cc is dropped entirely (only the single override inbox is
ever reached), never leaked to it.

- IComService.SendEmailAsync / ProcessWebComService: new optional
  `cc` parameter, included in the mailer payload only when non-empty.
- FdsInvoiceData.RawInvoiceEmailCc + BuildInvoiceParams: reads
  `new.invoiceemailcc`, posts @SendToEmailCc.
- IntranetController.Requests: reads SendToEmailCc from the loaded
  invoice row and passes it through on send/resend.
- Fuchs_Database: SendToEmailCc column on fds__invoices, threaded
  through fds__createInvoice/fds__setInvoice/fds__getInvoice and the
  fds__tt__invoice_base/_core table types.
- fis.req_txt_de.js: "Zusatzempfänger (CC)" field label.
- Tests: ProcessWebComServiceTests (Cc included/omitted/dropped under
  override); SystemStatusServiceTests mocks updated for the new
  IComService.SendEmailAsync parameter.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-10 09:09:29 +02:00

53 lines
2.8 KiB
Transact-SQL

CREATE TABLE [dbo].[fds__invoices] (
[Id] VARCHAR (10) NOT NULL,
[Version] INT CONSTRAINT [DF_fds__invoices_Version] DEFAULT ((0)) NOT NULL,
[InvoiceId] NVARCHAR (25) NULL,
[InvoiceType] CHAR (1) NOT NULL,
[InvoiceTitle] VARCHAR (100) CONSTRAINT [DF_fds__invoices_InvoiceTitle] DEFAULT ('Rechnung') NULL,
[DocumentName] VARCHAR (50) NULL,
[InvoiceBalance] NUMERIC (10, 2) NOT NULL,
[InvoiceBalance_net] NUMERIC (10, 2) NOT NULL,
[InvoiceVAT_net1] NUMERIC (10, 2) NOT NULL,
[InvoiceVAT_1] NUMERIC (5, 2) NOT NULL,
[InvoiceVAT_net2] NUMERIC (10, 2) NULL,
[InvoiceVAT_2] NUMERIC (5, 2) NULL,
[PaymentTerm] VARCHAR (5) NOT NULL,
[DueDate] DATE NOT NULL,
[CustomerId] BIGINT NULL,
[SendToAddress] NVARCHAR (1000) NULL,
[SendToEmail] NVARCHAR (255) NULL,
[SendToEmailCc] NVARCHAR (255) NULL,
[ProvisionPeriod] VARCHAR (50) NULL,
[ProvisionLocation] NVARCHAR (1000) NULL,
[PaymentStatus] CHAR (1) NULL,
[IsPayed] BIT CONSTRAINT [DF_fds__invoices_IsPayed] DEFAULT ((0)) NOT NULL,
[IsSent] BIT CONSTRAINT [DF_fds__invoices_IsSent] DEFAULT ((0)) NOT NULL,
[IsFinal] AS (CONVERT([bit],case when [DateFinalized] IS NULL then (0) else (1) end)),
[IsCanceled] AS (CONVERT([bit],case when [DateCancelled] IS NULL then (0) else (1) end)),
[Replaces_InvId] VARCHAR (50) NULL,
[CustomValues] NVARCHAR (MAX) NULL,
[SendToAddressJson] NVARCHAR (MAX) NULL,
[DateSent] DATETIME NULL,
[UserSent] VARCHAR (25) NULL,
[DateFinalized] DATETIME NULL,
[UserFinalized] VARCHAR (25) NULL,
[DateCancelled] DATETIME NULL,
[UserCancelled] VARCHAR (25) NULL,
[DateCreated] DATETIME NOT NULL,
[UserCreated] VARCHAR (25) NOT NULL,
[DateModified] DATETIME NOT NULL,
[UserModified] VARCHAR (25) NOT NULL,
[ExternalId] VARCHAR (25) NULL,
[IsExternal] BIT CONSTRAINT [DF_fds__invoices_external] DEFAULT ((0)) NULL,
[file] VARBINARY (MAX) NULL,
[file_guid] UNIQUEIDENTIFIER CONSTRAINT [DF_fds__invoices_file_guid] DEFAULT (newid()) NOT NULL,
CONSTRAINT [PK_fds__invoices] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO
CREATE NONCLUSTERED INDEX [fds__invoices__ix1]
ON [dbo].[fds__invoices]([IsFinal] ASC, [InvoiceBalance] ASC)
INCLUDE([IsPayed], [IsCanceled], [DateFinalized]);