Programming Business Days into Mass Delivery
AnsweredOur customer support team would like our invoices to be sent out two business days after the invoice has been created. I'm trying to create a SQL query that will accomplish this as part of the mass delivery. I can pull the business days if the 'case when' statement is part of the Select statement, but Print and Delivery won't allow me to edit the Select statement so it needs to be in the Where statement.
This is what we have so far:
SELECT T0.DocEntry AS DocEntry, T0.CardCode AS CardCode, T0.DocNum AS DocNum
FROM OINV T0 Join OCRD t1 on t0.cardcode = t1.cardcode
WHERE(t1.Groupcode in (100,111)) and t0.docTOTAL> 0 and t0.U_Type ='CUST' and
T0.docdate = (select case when DATEPART(DW,T0.docdate) = 1 Then convert (date, dateadd (D,-2,getdate()))
when DATEPART(DW,T0.docdate) = 2 Then convert (date, dateadd (D,-2,getdate()))
when DATEPART(DW,T0.docdate) = 3 Then convert (date, dateadd (D,-2,getdate()))
when DATEPART(DW,T0.docdate) = 4 Then convert (date, dateadd (D,-2,getdate()))
when DATEPART(DW,T0.docdate) = 5 Then convert (date, dateadd (D,-5,getdate()))
when DATEPART(DW,T0.docdate) = 6 Then convert (date, dateadd (D,-4,getdate()))
when DATEPART(DW,T0.docdate) = 7 Then convert (date, dateadd (D,-3,getdate()))
end)
Any help would be appreciated.
Thanks,
Janis
-
Official comment
Hi Janis,
Please try using the 'Custom' option of the Mass Delivery Configuration. Please see the following sample: https://support.boyum-it.com/hc/en-us/articles/204982387-Due-Date-Reminder-System
Thanks, Naama
Please sign in to leave a comment.
Comments
1 comment