(1): 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:
DECLARE @TodayDayOfWeek INT OZNAJMIAĆ @EndOfPrevWeek DateTime OZNAJMIAĆ @StartOfPrevWeek DateTime USTAWIAĆ @TodayDayOfWeek = datepart (dw, GetDate ()) USTAWIAĆ @EndOfPrevWeek = DATEADD (dd, - @TodayDayOfWeek, GetDate ()) USTAWIAĆ @StartOfPrevWeek = DATEADD (dd, - (@TodayDayOfWeek+6), GetDate ()) WYBIERAĆ WIERZCHOŁEK (100) PROCENT dbo.CreateOrder.n_OrderOriginallyPlacedTime, dbo. Plu.Plu, dbo. Plu.ItemName, dbo. Plu.Price, dbo.t_OrderLines.n_Amount, dbo.t_OrderLines.n_OrderNum, dbo.t_OrderLines.n_Type, dbo.t_OrderLines.n_MenuId, dbo.t_OrderPayment.n_Order, dbo.t_OrderPayment.n_PayAmount OD dbo.t_OrderPayment FOLOWAĆ ZEWNĘTRZNY ŁĄCZYĆ dbo.CreateOrder NA dbo.t_OrderPayment.nStoreID = dbo.CreateOrder.nStoreID I dbo.t_OrderPayment.n_Order = dbo.CreateOrder.n_OrderNum FOLOWAĆ ZEWNĘTRZNY ŁĄCZYĆ dbo.t_OrderLines NA dbo.CreateOrder.n_OrderNum = dbo.t_OrderLines.n_OrderNum FOLOWAĆ ZEWNĘTRZNY ŁĄCZYĆ dbo. Plu NA dbo.t_OrderLines.n_MenuId = dbo. Plu.n_MenuId DOKĄD (dbo.t_OrderLines.nStoreID = "528") I (dbo.CreateOrder.nStoreID = "528") I (dbo.CreateOrder.n_StatusFlags <> "6") I (dbo.t_OrderLines.n_Type <> "26") I (dbo.t_OrderLines.n_Type <> "18") I (dbo.CreateOrder.n_OrderOriginallyPlacedTime POŚRODKU KONWERTYTA (VARCHAR, @STARTOFPREVWEEK, 7) I KONWERTYTA (VARCHAR, @ENDOFPREVWEEK+1,7)) I (dbo.t_OrderLines.n_MenuId <> "2719") ROZKAZ Dbo.CreateOrder.n_OrderOriginallyPlacedTime