Add function to retrieve company address as JSON and update invoice procedures
- Created a new function `fds__getCompanyAddressJson` to return a company's postal address as a structured JSON object. - Modified stored procedures `fds__createInvoice`, `fds__setInvoice`, and `fds__prepInvoice` to include a new parameter `@SendToAddressJson` for handling the address data. - Updated the invoice table and user-defined types to accommodate the new `SendToAddressJson` field. - Ensured that the address data is properly retrieved and stored in the invoice records.
This commit is contained in:
@@ -356,6 +356,7 @@ BEGIN
|
||||
, [paymentterms] = N'10wd'
|
||||
, [invoiceemail] = (SELECT TOP(1) [SupportMail] FROM @company where IsEmailInvoicingActive = 1)
|
||||
, [invoiceaddress] = (SELECT TOP(1) CONCAT([name], CHAR(10), [address]) FROM @company ORDER BY IsEmailInvoicingActive DESC)
|
||||
, [invoiceaddressData] = [dbo].[fds__getCompanyAddressJson]((SELECT TOP(1) [id] FROM @company ORDER BY IsEmailInvoicingActive DESC))
|
||||
, [tax_servicerefund] = 0.2
|
||||
, [CustomerId] = [CustomerId]
|
||||
, [invoicetitle] = CASE WHEN @type = 'i' THEN (CASE WHEN @NUM_of_int_Invoices > 0 THEN CAST((@NUM_of_int_Invoices + 1) as varchar(3)) + '. ' ELSE '' END) + 'Abschlagsrechnung'
|
||||
|
||||
Reference in New Issue
Block a user