From a6799cba0ff74c1740220430b18ad38fea1f5a79 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 1 Oct 2024 10:39:57 +0200 Subject: [PATCH] refactor: refs #7202 modified procedure to include customsAgent field when creating an invoice --- db/routines/vn/procedures/invoiceOut_new.sql | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/invoiceOut_new.sql b/db/routines/vn/procedures/invoiceOut_new.sql index 723f33df5..6f2f7f8ff 100644 --- a/db/routines/vn/procedures/invoiceOut_new.sql +++ b/db/routines/vn/procedures/invoiceOut_new.sql @@ -105,7 +105,8 @@ BEGIN clientFk, dued, companyFk, - siiTypeInvoiceOutFk + siiTypeInvoiceOutFk, + customsAgentFk ) SELECT 1, @@ -118,9 +119,11 @@ BEGIN vCplusCorrectingInvoiceTypeFk, IF(vSerial = vSimplifiedSerial, vCplusSimplifiedInvoiceTypeFk, - vCplusStandardInvoiceTypeFk)) - FROM client - WHERE id = vClientFk; + vCplusStandardInvoiceTypeFk)), + a.customsAgentFk + FROM client c + JOIN address a ON a.id = c.defaultAddressFk + WHERE c.id = vClientFk; SET vNewInvoiceId = LAST_INSERT_ID();