Files
lst/lstV2/server/services/sqlServer/querys/psiReport/deliveryData.ts

28 lines
837 B
TypeScript

export const psiDeliveredData = `
use [test1_AlplaPROD2.0_Read]
declare @start_date nvarchar(30) = [startDate] --'2025-01-01'
declare @end_date nvarchar(30) = [endDate] --'2025-08-09'
select
ArticleHumanReadableId,
ArticleAlias,
cast(Quantity as int) Quantity,
--cast(DeliveryDate as time) as deliveryTime,
--cast(DeliveryDate as date) as originalDeliveryDate,
case when cast(DeliveryDate as time) between '00:00' and '07:00'
then DATEADD(DAY, -1, CONVERT(DATE, DeliveryDate))
else cast(DeliveryDate as date)
end as ShippingDate
--,*
from [order].[Release]
where case when cast(DeliveryDate as time) between '00:00' and '07:00'
then DATEADD(DAY, -1, CONVERT(DATE, DeliveryDate))
else cast(DeliveryDate as date)
end between @start_date and @end_date
and ArticleHumanReadableId in ([articles])
order by DeliveryDate`;