Very slowly order add to ticket

periodically at a working restaurant orders are added to the table very slowly.
each addition order lasts from 20 to 30 seconds.
through the resource monitor, i track a transaction that makes more than 1000 requests per second to the database when adding an order.

the query is so long that it does not fit in the message

sql query part1

SELECT [UnionAll5].[Id] AS [C1], [UnionAll5].[Id1] AS [C2], [UnionAll5].[LastUpdateTime] AS [C3], [UnionAll5].[TicketVersion] AS [C4], [UnionAll5].[TicketUid] AS [C5], [UnionAll5].[TicketNumber] AS [C6], [UnionAll5].[Date] AS [C7], [UnionAll5].[LastOrderDate] AS [C8], [UnionAll5].[LastPaymentDate] AS [C9], [UnionAll5].[PreOrder] AS [C10], [UnionAll5].[IsClosed] AS [C11], [UnionAll5].[IsLocked] AS [C12], [UnionAll5].[RemainingAmount] AS [C13], [UnionAll5].[TotalAmount] AS [C14], [UnionAll5].[DepartmentId] AS [C15], [UnionAll5].[TerminalId] AS [C16], [UnionAll5].[TicketTypeId] AS [C17], [UnionAll5].[Note] AS [C18], [UnionAll5].[LastModifiedUserName] AS [C19], [UnionAll5].[TicketTags] AS [C20], [UnionAll5].[TicketStates] AS [C21], [UnionAll5].[TicketLogs] AS [C22], [UnionAll5].[LineSeparators] AS [C23], [UnionAll5].[ExchangeRate] AS [C24], [UnionAll5].[TaxIncluded] AS [C25], [UnionAll5].[Name] AS [C26], [UnionAll5].[Id2] AS [C27], [UnionAll5].[Id3] AS [C28], [UnionAll5].[Date1] AS [C29], [UnionAll5].[DocumentTypeId] AS [C30], [UnionAll5].[Name1] AS [C31], [UnionAll5].[C1] AS [C32], [UnionAll5].[Id4] AS [C33], [UnionAll5].[Id5] AS [C34], [UnionAll5].[TicketId] AS [C35], [UnionAll5].[WarehouseId] AS [C36], [UnionAll5].[DepartmentId1] AS [C37], [UnionAll5].[TerminalId1] AS [C38], [UnionAll5].[MenuItemId] AS [C39], [UnionAll5].[MenuItemName] AS [C40], [UnionAll5].[PortionName] AS [C41], [UnionAll5].[Price] AS [C42], [UnionAll5].[Quantity] AS [C43], [UnionAll5].[PortionCount] AS [C44], [UnionAll5].[Locked] AS [C45], [UnionAll5].[CalculatePrice] AS [C46], [UnionAll5].[DecreaseInventory] AS [C47], [UnionAll5].[IncreaseInventory] AS [C48], [UnionAll5].[OrderNumber] AS [C49], [UnionAll5].[CreatingUserName] AS [C50], [UnionAll5].[CreatedDateTime] AS [C51], [UnionAll5].[LastUpdateDateTime] AS [C52], [UnionAll5].[AccountTransactionTypeId] AS [C53], [UnionAll5].[ProductTimerValueId] AS [C54], [UnionAll5].[GroupTagName] AS [C55], [UnionAll5].[GroupTagFormat] AS [C56], [UnionAll5].[Separator] AS [C57], [UnionAll5].[PriceTag] AS [C58], [UnionAll5].[Tag] AS [C59], [UnionAll5].[DisablePortionSelection] AS [C60], [UnionAll5].[OrderUid] AS [C61], [UnionAll5].[Taxes] AS [C62], [UnionAll5].[OrderTags] AS [C63], [UnionAll5].[OrderStates] AS [C64], [UnionAll5].[TicketId1] AS [C65], [UnionAll5].[Id6] AS [C66], [UnionAll5].[ProductTimerId] AS [C67], [UnionAll5].[PriceType] AS [C68], [UnionAll5].[PriceDuration] AS [C69], [UnionAll5].[MinTime] AS [C70], [UnionAll5].[TimeRounding] AS [C71], [UnionAll5].[Start] AS [C72], [UnionAll5].[End] AS [C73], [UnionAll5].[C2] AS [C74], [UnionAll5].[C3] AS [C75], [UnionAll5].[C4] AS [C76], [UnionAll5].[C5] AS [C77], [UnionAll5].[C6] AS [C78], [UnionAll5].[C7] AS [C79], [UnionAll5].[C8] AS [C80], [UnionAll5].[C9] AS [C81], [UnionAll5].[C10] AS [C82], [UnionAll5].[C11] AS [C83], [UnionAll5].[C12] AS [C84], [UnionAll5].[C13] AS [C85], [UnionAll5].[C14] AS [C86], [UnionAll5].[C15] AS [C87], [UnionAll5].[C16] AS [C88], [UnionAll5].[C17] AS [C89], [UnionAll5].[C18] AS [C90], [UnionAll5].[C19] AS [C91], [UnionAll5].[C20] AS [C92], [UnionAll5].[C21] AS [C93], [UnionAll5].[C22] AS [C94], [UnionAll5].[C23] AS [C95], [UnionAll5].[C24] AS [C96], [UnionAll5].[C25] AS [C97], [UnionAll5].[C26] AS [C98], [UnionAll5].[C27] AS [C99], [UnionAll5].[C28] AS [C100], [UnionAll5].[C29] AS [C101], [UnionAll5].[C30] AS [C102], [UnionAll5].[C31] AS [C103], [UnionAll5].[C32] AS [C104], [UnionAll5].[C33] AS [C105], [UnionAll5].[C34] AS [C106], [UnionAll5].[C35] AS [C107], [UnionAll5].[C36] AS [C108], [UnionAll5].[C37] AS [C109], [UnionAll5].[C38] AS [C110], [UnionAll5].[C39] AS [C111], [UnionAll5].[C40] AS [C112], [UnionAll5].[C41] AS [C113], [UnionAll5].[C42] AS [C114], [UnionAll5].[C43] AS [C115], [UnionAll5].[C44] AS [C116], [UnionAll5].[C45] AS [C117], [UnionAll5].[C46] AS [C118], [UnionAll5].[C47] AS [C119], [UnionAll5].[C48] AS [C120], [UnionAll5].[C49] AS [C121], [UnionAll5].[C50] AS [C122], [UnionAll5].[C51] AS [C123], [UnionAll5].[C52] AS [C124], [UnionAll5].[C53] AS [C125], [UnionAll5].[C54] AS [C126], [UnionAll5].[C55] AS [C127], [UnionAll5].[C56] AS [C128], [UnionAll5].[C57] AS [C129], [UnionAll5].[C58] AS [C130], [UnionAll5].[C59] AS [C131], [UnionAll5].[C60] AS [C132], [UnionAll5].[C61] AS [C133], [UnionAll5].[C62] AS [C134] FROM (SELECT CASE WHEN ([Join2].[Id1] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1], [Extent1].[Id] AS [Id], [Extent1].[Id] AS [Id1], [Extent1].[LastUpdateTime] AS [LastUpdateTime], [Extent1].[TicketVersion] AS [TicketVersion], [Extent1].[TicketUid] AS [TicketUid], [Extent1].[TicketNumber] AS [TicketNumber], [Extent1].[Date] AS [Date], [Extent1].[LastOrderDate] AS [LastOrderDate], [Extent1].[LastPaymentDate] AS [LastPaymentDate], [Extent1].[PreOrder] AS [PreOrder], [Extent1].[IsClosed] AS [IsClosed], [Extent1].[IsLocked] AS [IsLocked], [Extent1].[RemainingAmount] AS [RemainingAmount], [Extent1].[TotalAmount] AS [TotalAmount], [Extent1].[DepartmentId] AS [DepartmentId], [Extent1].[TerminalId] AS [TerminalId], [Extent1].[TicketTypeId] AS [TicketTypeId], [Extent1].[Note] AS [Note], [Extent1].[LastModifiedUserName] AS [LastModifiedUserName], [Extent1].[TicketTags] AS [TicketTags], [Extent1].[TicketStates] AS [TicketStates], [Extent1].[TicketLogs] AS [TicketLogs], [Extent1].[LineSeparators] AS [LineSeparators], [Extent1].[ExchangeRate] AS [ExchangeRate], [Extent1].[TaxIncluded] AS [TaxIncluded], [Extent1].[Name] AS [Name], [Extent1].[Id] AS [Id2], [Extent2].[Id] AS [Id3], [Extent2].[Date] AS [Date1], [Extent2].[DocumentTypeId] AS [DocumentTypeId], [Extent2].[Name] AS [Name1], [Join2].[Id1] AS [Id4], [Join2].[Id1] AS [Id5], [Join2].[TicketId] AS [TicketId], [Join2].[WarehouseId] AS [WarehouseId], [Join2].[DepartmentId] AS [DepartmentId1], [Join2].[TerminalId] AS [TerminalId1], [Join2].[MenuItemId] AS [MenuItemId], [Join2].[MenuItemName] AS [MenuItemName], [Join2].[PortionName] AS [PortionName], [Join2].[Price] AS [Price], [Join2].[Quantity] AS [Quantity], [Join2].[PortionCount] AS [PortionCount], [Join2].[Locked] AS [Locked], [Join2].[CalculatePrice] AS [CalculatePrice], [Join2].[DecreaseInventory] AS [DecreaseInventory], [Join2].[IncreaseInventory] AS [IncreaseInventory], [Join2].[OrderNumber] AS [OrderNumber], [Join2].[CreatingUserName] AS [CreatingUserName], [Join2].[CreatedDateTime] AS [CreatedDateTime], [Join2].[LastUpdateDateTime] AS [LastUpdateDateTime], [Join2].[AccountTransactionTypeId] AS [AccountTransactionTypeId], [Join2].[ProductTimerValueId] AS [ProductTimerValueId], [Join2].[GroupTagName] AS [GroupTagName], [Join2].[GroupTagFormat] AS [GroupTagFormat], [Join2].[Separator] AS [Separator], [Join2].[PriceTag] AS [PriceTag], [Join2].[Tag] AS [Tag], [Join2].[DisablePortionSelection] AS [DisablePortionSelection], [Join2].[OrderUid] AS [OrderUid], [Join2].[Taxes] AS [Taxes], [Join2].[OrderTags] AS [OrderTags], [Join2].[OrderStates] AS [OrderStates], [Join2].[TicketId] AS [TicketId1], [Join2].[Id2] AS [Id6], [Join2].[ProductTimerId] AS [ProductTimerId], [Join2].[PriceType] AS [PriceType], [Join2].[PriceDuration] AS [PriceDuration], [Join2].[MinTime] AS [MinTime], [Join2].[TimeRounding] AS [TimeRounding], [Join2].[Start] AS [Start], [Join2].[End] AS [End], CAST(NULL AS int) AS [C2], CAST(NULL AS int) AS [C3], CAST(NULL AS int) AS [C4], CAST(NULL AS int) AS [C5], CAST(NULL AS int) AS [C6], CAST(NULL AS varchar(1)) AS [C7], CAST(NULL AS varchar(1)) AS [C8], CAST(NULL AS varchar(1)) AS [C9], CAST(NULL AS int) AS [C10], CAST(NULL AS int) AS [C11], CAST(NULL AS varchar(1)) AS [C12], CAST(NULL AS int) AS [C13], CAST(NULL AS int) AS [C14], CAST(NULL AS int) AS [C15], CAST(NULL AS int) AS [C16], CAST(NULL AS bit) AS [C17], CAST(NULL AS bit) AS [C18], CAST(NULL AS bit) AS [C19], CAST(NULL AS decimal(16,2)) AS [C20], CAST(NULL AS decimal(16,2)) AS [C21], CAST(NULL AS decimal(16,2)) AS [C22], CAST(NULL AS decimal(16,10)) AS [C23], CAST(NULL AS datetime2) AS [C24], CAST(NULL AS varchar(1)) AS [C25], CAST(NULL AS int) AS [C26], CAST(NULL AS int) AS [C27], CAST(NULL AS int) AS [C28], CAST(NULL AS int) AS [C29], CAST(NULL AS int) AS [C30], CAST(NULL AS varchar(1)) AS [C31], CAST(NULL AS varchar(1)) AS [C32], CAST(NULL AS datetime2) AS [C33], CAST(NULL AS int) AS [C34], CAST(NULL AS decimal(16,2)) AS [C35], CAST(NULL AS decimal(16,2)) AS [C36], CAST(NULL AS int) AS [C37], CAST(NULL AS int) AS [C38], CAST(NULL AS decimal(16,10)) AS [C39], CAST(NULL AS varchar(1)) AS [C40], CAST(NULL AS bit) AS [C41], CAST(NULL AS int) AS [C42], CAST(NULL AS int) AS [C43], CAST(NULL AS int) AS [C44], CAST(NULL AS int) AS [C45], CAST(NULL AS varchar(1)) AS [C46], CAST(NULL AS datetime2) AS [C47], CAST(NULL AS int) AS [C48], CAST(NULL AS decimal(16,2)) AS [C49], CAST(NULL AS int) AS [C50], CAST(NULL AS decimal(16,10)) AS [C51], CAST(NULL AS int) AS [C52], CAST(NULL AS int) AS [C53], CAST(NULL AS int) AS [C54], CAST(NULL AS decimal(16,2)) AS [C55], CAST(NULL AS decimal(16,10)) AS [C56], CAST(NULL AS int) AS [C57], CAST(NULL AS int) AS [C58], CAST(NULL AS int) AS [C59], CAST(NULL AS bit) AS [C60], CAST(NULL AS bit) AS [C61], CAST(NULL AS varchar(1)) AS [C62] FROM [dbo].[Tickets] AS [Extent1] LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent2] ON [Extent1].[TransactionDocument_Id] = [Extent2].[Id] LEFT OUTER JOIN (SELECT [Extent3].[Id] AS [Id1], [Extent3].[TicketId] AS [TicketId], [Extent3].[WarehouseId] AS [WarehouseId], [Extent3].[DepartmentId] AS [DepartmentId], [Extent3].[TerminalId] AS [TerminalId], [Extent3].[MenuItemId] AS [MenuItemId], [Extent3].[MenuItemName] AS [MenuItemName], [Extent3].[PortionName] AS [PortionName], [Extent3].[Price] AS [Price], [Extent3].[Quantity] AS [Quantity], [Extent3].[PortionCount] AS [PortionCount], [Extent3].[Locked] AS [Locked], [Extent3].[CalculatePrice] AS [CalculatePrice], [Extent3].[DecreaseInventory] AS [DecreaseInventory], [Extent3].[IncreaseInventory] AS [IncreaseInventory], [Extent3].[OrderNumber] AS [OrderNumber], [Extent3].[CreatingUserName] AS [CreatingUserName], [Extent3].[CreatedDateTime] AS [CreatedDateTime], [Extent3].[LastUpdateDateTime] AS [LastUpdateDateTime], [Extent3].[AccountTransactionTypeId] AS [AccountTransactionTypeId], [Extent3].[ProductTimerValueId] AS [ProductTimerValueId], [Extent3].[GroupTagName] AS [GroupTagName], [Extent3].[GroupTagFormat] AS [GroupTagFormat], [Extent3].[Separator] AS [Separator], [Extent3].[PriceTag] AS [PriceTag], [Extent3].[Tag] AS [Tag], [Extent3].[DisablePortionSelection] AS [DisablePortionSelection], [Extent3].[OrderUid] AS [OrderUid], [Extent3].[Taxes] AS [Taxes], [Extent3].[OrderTags] AS [OrderTags], [Extent3].[OrderStates] AS [OrderStates], [Extent4].[Id] AS [Id2], [Extent4].[ProductTimerId] AS [ProductTimerId], [Extent4].[PriceType] AS [PriceType], [Extent4].[PriceDuration] AS [PriceDuration], [Extent4].[MinTime] AS [MinTime], [Extent4].[TimeRounding] AS [TimeRounding], [Extent4].[Start] AS [Start], [Extent4].[End] AS [End] FROM [dbo].[Orders] AS [Extent3] LEFT OUTER JOIN [dbo].[ProductTimerValues] AS [Extent4] ON [Extent3].[ProductTimerValueId] = [Extent4].[Id] ) AS [Join2] ON [Extent1].[Id] = [Join2].[TicketId] WHERE ([Extent1].[Date] >= @p__linq__0) AND ([Extent1].[Date] < @p__linq__1) UNION ALL SELECT 2 AS [C1], [Extent5].[Id] AS [Id], [Extent5].[Id] AS [Id1], [Extent5].[LastUpdateTime] AS [LastUpdateTime], [Extent5].[TicketVersion] AS [TicketVersion], [Extent5].[TicketUid] AS [TicketUid], [Extent5].[TicketNumber] AS [TicketNumber], [Extent5].[Date] AS [Date], [Extent5].[LastOrderDate] AS [LastOrderDate], [Extent5].[LastPaymentDate] AS [LastPaymentDate], [Extent5].[PreOrder] AS [PreOrder], [Extent5].[IsClosed] AS [IsClosed], [Extent5].[IsLocked] AS [IsLocked], [Extent5].[RemainingAmount] AS [RemainingAmount], [Extent5].[TotalAmount] AS [TotalAmount], [Extent5].[DepartmentId] AS [DepartmentId], [Extent5].[TerminalId] AS [TerminalId], [Extent5].[TicketTypeId] AS [TicketTypeId], [Extent5].[Note] AS [Note], [Extent5].[LastModifiedUserName] AS [LastModifiedUserName], [Extent5].[TicketTags] AS [TicketTags], [Extent5].[TicketStates] AS [TicketStates], [Extent5].[TicketLogs] AS [TicketLogs], [Extent5].[LineSeparators] AS [LineSeparators], [Extent5].[ExchangeRate] AS [ExchangeRate], [Extent5].[TaxIncluded] AS [TaxIncluded], [Extent5].[Name] AS [Name], [Extent5].[Id] AS [Id2], [Extent6].[Id] AS [Id3], [Extent6].[Date] AS [Date1], [Extent6].[DocumentTypeId] AS [DocumentTypeId], [Extent6].[Name] AS [Name1], CAST(NULL AS int) AS [C2], CAST(NULL AS int) AS [C3], CAST(NULL AS int) AS [C4], CAST(NULL AS int) AS [C5], CAST(NULL AS int) AS [C6], CAST(NULL AS int) AS [C7], CAST(NULL AS int) AS [C8], CAST(NULL AS varchar(1)) AS [C9], CAST(NULL AS varchar(1)) AS [C10], CAST(NULL AS decimal(16,2)) AS [C11], CAST(NULL AS decimal(16,3)) AS [C12], CAST(NULL AS int) AS [C13], CAST(NULL AS bit) AS [C14], CAST(NULL AS bit) AS [C15], CAST(NULL AS bit) AS [C16], CAST(NULL AS bit) AS [C17], CAST(NULL AS int) AS [C18], CAST(NULL AS varchar(1)) AS [C19], CAST(NULL AS datetime2) AS [C20], CAST(NULL AS datetime2) AS [C21], CAST(NULL AS int) AS [C22], CAST(NULL AS int) AS [C23], CAST(NULL AS varchar(1)) AS [C24], CAST(NULL AS varchar(1)) AS [C25], CAST(NULL AS varchar(1)) AS [C26], CAST(NULL AS varchar(1)) AS [C27], CAST(NULL AS varchar(1)) AS [C28], CAST(NULL AS bit) AS [C29], CAST(NULL AS varchar(1)) AS [C30], CAST(NULL AS varchar(1)) AS [C31], CAST(NULL AS varchar(1)) AS [C32], CAST(NULL AS varchar(1)) AS [C33], CAST(NULL AS int) AS [C34], CAST(NULL AS int) AS [C35], CAST(NULL AS int) AS [C36], CAST(NULL AS int) AS [C37], CAST(NULL AS decimal(16,2)) AS [C38], CAST(NULL AS decimal(16,2)) AS [C39], CAST(NULL AS decimal(16,2)) AS [C40], CAST(NULL AS datetime2) AS [C41], CAST(NULL AS datetime2) AS [C42], [Extent7].[Id] AS [Id4], [Extent7].[EntityTypeId] AS [EntityTypeId], [Extent7].[EntityId] AS [EntityId], [Extent7].[AccountId] AS [AccountId], [Extent7].[AccountTypeId] AS [AccountTypeId], [Extent7].[EntityName] AS [EntityName], [Extent7].[EntityCustomData] AS [EntityCustomData], [Extent7].[Notes] AS [Notes], CAST(NULL AS int) AS [C43], CAST(NULL AS int) AS [C44], CAST(NULL AS varchar(1)) AS [C45], CAST(NULL AS int) AS [C46], CAST(NULL AS int) AS [C47], CAST(NULL AS int) AS [C48], CAST(NULL AS int) AS [C49], CAST(NULL AS bit) AS [C50], CAST(NULL AS bit) AS [C51], CAST(NULL AS bit) AS [C52], CAST(NULL AS decimal(16,2)) AS [C53], CAST(NULL AS decimal(16,2)) AS [C54], CAST(NULL AS decimal(16,2)) AS [C55], CAST(NULL AS decimal(16,10)) AS [C56], CAST(NULL AS datetime2) AS [C57], CAST(NULL AS varchar(1)) AS [C58], CAST(NULL AS int) AS [C59], CAST(NULL AS int) AS [C60], CAST(NULL AS int) AS [C61], CAST(NULL AS int) AS [C62], CAST(NULL AS int) AS [C63], CAST(NULL AS varchar(1)) AS [C64], CAST(NULL AS varchar(1)) AS [C65], CAST(NULL AS datetime2) AS [C66], CAST(NULL AS int) AS [C67], CAST(NULL AS decimal(16,2)) AS [C68], CAST(NULL AS decimal(16,2)) AS [C69], CAST(NULL AS int) AS [C70], CAST(NULL AS int) AS [C71], CAST(NULL AS decimal(16,10)) AS [C72], CAST(NULL AS varchar(1)) AS [C73], CAST(NULL AS bit) AS [C74], CAST(NULL AS int) AS [C75], CAST(NULL AS int) AS [C76], CAST(NULL AS int) AS [C77], CAST(NULL AS int) AS [C78], CAST(NULL AS varchar(1)) AS [C79], CAST(NULL AS datetime2) AS [C80], CAST(NULL AS int) AS [C81], CAST(NULL AS decimal(16,2)) AS [C82], CAST(NULL AS int) AS [C83], CAST(NULL AS decimal(16,10)) AS [C84], CAST(NULL AS int) AS [C85], CAST(NULL AS int) AS [C86], CAST(NULL AS int) AS [C87], CAST(NULL AS decimal(16,2)) AS [C88], CAST(NULL AS decimal(16,10)) AS [C89], CAST(NULL AS int) AS [C90], CAST(NULL AS int) AS [C91], CAST(NULL AS int) AS [C92], CAST(NULL AS bit) AS [C93], CAST(NULL AS bit) AS [C94], CAST(NULL AS varchar(1)) AS [C95] FROM [dbo].[Tickets] AS [Extent5] LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent6] ON [Extent5].[TransactionDocument_Id] = [Extent6].[Id] INNER JOIN [dbo].[TicketEntities] AS [Extent7] ON [Extent5].[Id] = [Extent7].[Ticket_Id] WHERE ([Extent5].[Date] >= @p__linq__0) AND ([Extent5].[Date] < @p__linq__1) UNION ALL SELECT 3 AS [C1], [Extent8].[Id] AS [Id], [Extent8].[Id] AS [Id1], [Extent8].[LastUpdateTime] AS [LastUpdateTime], [Extent8].[TicketVersion] AS [TicketVersion], [Extent8].[TicketUid] AS [TicketUid], [Extent8].[TicketNumber] AS [TicketNumber], [Extent8].[Date] AS [Date], [Extent8].[LastOrderDate] AS [LastOrderDate], [Extent8].[LastPaymentDate] AS [LastPaymentDate], [Extent8].[PreOrder] AS [PreOrder], [Extent8].[IsClosed] AS [IsClosed], [Extent8].[IsLocked] AS [IsLocked], [Extent8].[RemainingAmount] AS [RemainingAmount], [Extent8].[TotalAmount] AS [TotalAmount], [Extent8].[DepartmentId] AS [DepartmentId], [Extent8].[TerminalId] AS [TerminalId], [Extent8].[TicketTypeId] AS [TicketTypeId], [Extent8].[Note] AS [Note], [Extent8].[LastModifiedUserName] AS [LastModifiedUserName], [Extent8].[TicketTags] AS [TicketTags], [Extent8].[TicketStates] AS [TicketStates], [Extent8].[TicketLogs] AS [TicketLogs], [Extent8].[LineSeparators] AS [LineSeparators], [Extent8].[ExchangeRate] AS [ExchangeRate], [Extent8].[TaxIncluded] AS [TaxIncluded], [Extent8].[Name] AS [Name], [Extent8].[Id] AS [Id2], [Extent9].[Id] AS [Id3], [Extent9].[Date] AS [Date1], [Extent9].[DocumentTypeId] AS [DocumentTypeId], [Extent9].[Name] AS [Name1],

query part2
`CAST(NULL AS int) AS [C2], 
    CAST(NULL AS int) AS [C3], 
    CAST(NULL AS int) AS [C4], 
    CAST(NULL AS int) AS [C5], 
    CAST(NULL AS int) AS [C6], 
    CAST(NULL AS int) AS [C7], 
    CAST(NULL AS int) AS [C8], 
    CAST(NULL AS varchar(1)) AS [C9], 
    CAST(NULL AS varchar(1)) AS [C10], 
    CAST(NULL AS decimal(16,2)) AS [C11], 
    CAST(NULL AS decimal(16,3)) AS [C12], 
    CAST(NULL AS int) AS [C13], 
    CAST(NULL AS bit) AS [C14], 
    CAST(NULL AS bit) AS [C15], 
    CAST(NULL AS bit) AS [C16], 
    CAST(NULL AS bit) AS [C17], 
    CAST(NULL AS int) AS [C18], 
    CAST(NULL AS varchar(1)) AS [C19], 
    CAST(NULL AS datetime2) AS [C20], 
    CAST(NULL AS datetime2) AS [C21], 
    CAST(NULL AS int) AS [C22], 
    CAST(NULL AS int) AS [C23], 
    CAST(NULL AS varchar(1)) AS [C24], 
    CAST(NULL AS varchar(1)) AS [C25], 
    CAST(NULL AS varchar(1)) AS [C26], 
    CAST(NULL AS varchar(1)) AS [C27], 
    CAST(NULL AS varchar(1)) AS [C28], 
    CAST(NULL AS bit) AS [C29], 
    CAST(NULL AS varchar(1)) AS [C30], 
    CAST(NULL AS varchar(1)) AS [C31], 
    CAST(NULL AS varchar(1)) AS [C32], 
    CAST(NULL AS varchar(1)) AS [C33], 
    CAST(NULL AS int) AS [C34], 
    CAST(NULL AS int) AS [C35], 
    CAST(NULL AS int) AS [C36], 
    CAST(NULL AS int) AS [C37], 
    CAST(NULL AS decimal(16,2)) AS [C38], 
    CAST(NULL AS decimal(16,2)) AS [C39], 
    CAST(NULL AS decimal(16,2)) AS [C40], 
    CAST(NULL AS datetime2) AS [C41], 
    CAST(NULL AS datetime2) AS [C42], 
    CAST(NULL AS int) AS [C43], 
    CAST(NULL AS int) AS [C44], 
    CAST(NULL AS int) AS [C45], 
    CAST(NULL AS int) AS [C46], 
    CAST(NULL AS int) AS [C47], 
    CAST(NULL AS varchar(1)) AS [C48], 
    CAST(NULL AS varchar(1)) AS [C49], 
    CAST(NULL AS varchar(1)) AS [C50], 
    [Extent10].[Id] AS [Id4], 
    [Extent10].[TicketId] AS [TicketId], 
    [Extent10].[Name] AS [Name2], 
    [Extent10].[Order] AS [Order], 
    [Extent10].[CalculationTypeId] AS [CalculationTypeId], 
    [Extent10].[AccountTransactionTypeId] AS [AccountTransactionTypeId], 
    [Extent10].[CalculationType] AS [CalculationType], 
    [Extent10].[IncludeTax] AS [IncludeTax], 
    [Extent10].[DecreaseAmount] AS [DecreaseAmount], 
    [Extent10].[UsePlainSum] AS [UsePlainSum], 
    [Extent10].[Amount] AS [Amount], 
    [Extent10].[CalculationAmount] AS [CalculationAmount], 
    [Extent10].[Rounding] AS [Rounding], 
    [Extent10].[ExchangeRate] AS [ExchangeRate1], 
    [Extent10].[LastUpdateDate] AS [LastUpdateDate], 
    [Extent10].[LastUpdatedUser] AS [LastUpdatedUser], 
    [Extent10].[TicketId] AS [TicketId1], 
    CAST(NULL AS int) AS [C51], 
    CAST(NULL AS int) AS [C52], 
    CAST(NULL AS int) AS [C53], 
    CAST(NULL AS int) AS [C54], 
    CAST(NULL AS varchar(1)) AS [C55], 
    CAST(NULL AS varchar(1)) AS [C56], 
    CAST(NULL AS datetime2) AS [C57], 
    CAST(NULL AS int) AS [C58], 
    CAST(NULL AS decimal(16,2)) AS [C59], 
    CAST(NULL AS decimal(16,2)) AS [C60], 
    CAST(NULL AS int) AS [C61], 
    CAST(NULL AS int) AS [C62], 
    CAST(NULL AS decimal(16,10)) AS [C63], 
    CAST(NULL AS varchar(1)) AS [C64], 
    CAST(NULL AS bit) AS [C65], 
    CAST(NULL AS int) AS [C66], 
    CAST(NULL AS int) AS [C67], 
    CAST(NULL AS int) AS [C68], 
    CAST(NULL AS int) AS [C69], 
    CAST(NULL AS varchar(1)) AS [C70], 
    CAST(NULL AS datetime2) AS [C71], 
    CAST(NULL AS int) AS [C72], 
    CAST(NULL AS decimal(16,2)) AS [C73], 
    CAST(NULL AS int) AS [C74], 
    CAST(NULL AS decimal(16,10)) AS [C75], 
    CAST(NULL AS int) AS [C76], 
    CAST(NULL AS int) AS [C77], 
    CAST(NULL AS int) AS [C78], 
    CAST(NULL AS decimal(16,2)) AS [C79], 
    CAST(NULL AS decimal(16,10)) AS [C80], 
    CAST(NULL AS int) AS [C81], 
    CAST(NULL AS int) AS [C82], 
    CAST(NULL AS int) AS [C83], 
    CAST(NULL AS bit) AS [C84], 
    CAST(NULL AS bit) AS [C85], 
    CAST(NULL AS varchar(1)) AS [C86]
    FROM   [dbo].[Tickets] AS [Extent8]
    LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent9] ON [Extent8].[TransactionDocument_Id] = [Extent9].[Id]
    INNER JOIN [dbo].[Calculations] AS [Extent10] ON [Extent8].[Id] = [Extent10].[TicketId]
    WHERE ([Extent8].[Date] >= @p__linq__0) AND ([Extent8].[Date] < @p__linq__1)
UNION ALL
    SELECT 
    4 AS [C1], 
    [Extent11].[Id] AS [Id], 
    [Extent11].[Id] AS [Id1], 
    [Extent11].[LastUpdateTime] AS [LastUpdateTime], 
    [Extent11].[TicketVersion] AS [TicketVersion], 
    [Extent11].[TicketUid] AS [TicketUid], 
    [Extent11].[TicketNumber] AS [TicketNumber], 
    [Extent11].[Date] AS [Date], 
    [Extent11].[LastOrderDate] AS [LastOrderDate], 
    [Extent11].[LastPaymentDate] AS [LastPaymentDate], 
    [Extent11].[PreOrder] AS [PreOrder], 
    [Extent11].[IsClosed] AS [IsClosed], 
    [Extent11].[IsLocked] AS [IsLocked], 
    [Extent11].[RemainingAmount] AS [RemainingAmount], 
    [Extent11].[TotalAmount] AS [TotalAmount], 
    [Extent11].[DepartmentId] AS [DepartmentId], 
    [Extent11].[TerminalId] AS [TerminalId], 
    [Extent11].[TicketTypeId] AS [TicketTypeId], 
    [Extent11].[Note] AS [Note], 
    [Extent11].[LastModifiedUserName] AS [LastModifiedUserName], 
    [Extent11].[TicketTags] AS [TicketTags], 
    [Extent11].[TicketStates] AS [TicketStates], 
    [Extent11].[TicketLogs] AS [TicketLogs], 
    [Extent11].[LineSeparators] AS [LineSeparators], 
    [Extent11].[ExchangeRate] AS [ExchangeRate], 
    [Extent11].[TaxIncluded] AS [TaxIncluded], 
    [Extent11].[Name] AS [Name], 
    [Extent11].[Id] AS [Id2], 
    [Extent12].[Id] AS [Id3], 
    [Extent12].[Date] AS [Date1], 
    [Extent12].[DocumentTypeId] AS [DocumentTypeId], 
    [Extent12].[Name] AS [Name1], 
    CAST(NULL AS int) AS [C2], 
    CAST(NULL AS int) AS [C3], 
    CAST(NULL AS int) AS [C4], 
    CAST(NULL AS int) AS [C5], 
    CAST(NULL AS int) AS [C6], 
    CAST(NULL AS int) AS [C7], 
    CAST(NULL AS int) AS [C8], 
    CAST(NULL AS varchar(1)) AS [C9], 
    CAST(NULL AS varchar(1)) AS [C10], 
    CAST(NULL AS decimal(16,2)) AS [C11], 
    CAST(NULL AS decimal(16,3)) AS [C12], 
    CAST(NULL AS int) AS [C13], 
    CAST(NULL AS bit) AS [C14], 
    CAST(NULL AS bit) AS [C15], 
    CAST(NULL AS bit) AS [C16], 
    CAST(NULL AS bit) AS [C17], 
    CAST(NULL AS int) AS [C18], 
    CAST(NULL AS varchar(1)) AS [C19], 
    CAST(NULL AS datetime2) AS [C20], 
    CAST(NULL AS datetime2) AS [C21], 
    CAST(NULL AS int) AS [C22], 
    CAST(NULL AS int) AS [C23], 
    CAST(NULL AS varchar(1)) AS [C24], 
    CAST(NULL AS varchar(1)) AS [C25], 
    CAST(NULL AS varchar(1)) AS [C26], 
    CAST(NULL AS varchar(1)) AS [C27], 
    CAST(NULL AS varchar(1)) AS [C28], 
    CAST(NULL AS bit) AS [C29], 
    CAST(NULL AS varchar(1)) AS [C30], 
    CAST(NULL AS varchar(1)) AS [C31], 
    CAST(NULL AS varchar(1)) AS [C32], 
    CAST(NULL AS varchar(1)) AS [C33], 
    CAST(NULL AS int) AS [C34], 
    CAST(NULL AS int) AS [C35], 
    CAST(NULL AS int) AS [C36], 
    CAST(NULL AS int) AS [C37], 
    CAST(NULL AS decimal(16,2)) AS [C38], 
    CAST(NULL AS decimal(16,2)) AS [C39], 
    CAST(NULL AS decimal(16,2)) AS [C40], 
    CAST(NULL AS datetime2) AS [C41], 
    CAST(NULL AS datetime2) AS [C42], 
    CAST(NULL AS int) AS [C43], 
    CAST(NULL AS int) AS [C44], 
    CAST(NULL AS int) AS [C45], 
    CAST(NULL AS int) AS [C46], 
    CAST(NULL AS int) AS [C47], 
    CAST(NULL AS varchar(1)) AS [C48], 
    CAST(NULL AS varchar(1)) AS [C49], 
    CAST(NULL AS varchar(1)) AS [C50], 
    CAST(NULL AS int) AS [C51], 
    CAST(NULL AS int) AS [C52], 
    CAST(NULL AS varchar(1)) AS [C53], 
    CAST(NULL AS int) AS [C54], 
    CAST(NULL AS int) AS [C55], 
    CAST(NULL AS int) AS [C56], 
    CAST(NULL AS int) AS [C57], 
    CAST(NULL AS bit) AS [C58], 
    CAST(NULL AS bit) AS [C59], 
    CAST(NULL AS bit) AS [C60], 
    CAST(NULL AS decimal(16,2)) AS [C61], 
    CAST(NULL AS decimal(16,2)) AS [C62], 
    CAST(NULL AS decimal(16,2)) AS [C63], 
    CAST(NULL AS decimal(16,10)) AS [C64], 
    CAST(NULL AS datetime2) AS [C65], 
    CAST(NULL AS varchar(1)) AS [C66], 
    CAST(NULL AS int) AS [C67], 
    [Extent13].[Id] AS [Id4], 
    [Extent13].[TicketId] AS [TicketId], 
    [Extent13].[PaymentTypeId] AS [PaymentTypeId], 
    [Extent13].[DepartmentId] AS [DepartmentId1], 
    [Extent13].[Name] AS [Name2], 
    [Extent13].[Description] AS [Description], 
    [Extent13].[Date] AS [Date2], 
    [Extent13].[AccountTransactionId] AS [AccountTransactionId], 
    [Extent13].[Amount] AS [Amount], 
    [Extent13].[TenderedAmount] AS [TenderedAmount], 
    [Extent13].[UserId] AS [UserId], 
    [Extent13].[TerminalId] AS [TerminalId1], 
    [Extent13].[ExchangeRate] AS [ExchangeRate1], 
    [Extent13].[PaymentData] AS [PaymentData], 
    [Extent13].[CanAdjustTip] AS [CanAdjustTip], 
    [Extent13].[TicketId] AS [TicketId1], 
    CAST(NULL AS int) AS [C68], 
    CAST(NULL AS int) AS [C69], 
    CAST(NULL AS int) AS [C70], 
    CAST(NULL AS varchar(1)) AS [C71], 
    CAST(NULL AS datetime2) AS [C72], 
    CAST(NULL AS int) AS [C73], 
    CAST(NULL AS decimal(16,2)) AS [C74], 
    CAST(NULL AS int) AS [C75], 
    CAST(NULL AS decimal(16,10)) AS [C76], 
    CAST(NULL AS int) AS [C77], 
    CAST(NULL AS int) AS [C78], 
    CAST(NULL AS int) AS [C79], 
    CAST(NULL AS decimal(16,2)) AS [C80], 
    CAST(NULL AS decimal(16,10)) AS [C81], 
    CAST(NULL AS int) AS [C82], 
    CAST(NULL AS int) AS [C83], 
    CAST(NULL AS int) AS [C84], 
    CAST(NULL AS bit) AS [C85], 
    CAST(NULL AS bit) AS [C86], 
    CAST(NULL AS varchar(1)) AS [C87]
    FROM   [dbo].[Tickets] AS [Extent11]
    LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent12] ON [Extent11].[TransactionDocument_Id] = [Extent12].[Id]
    INNER JOIN [dbo].[Payments] AS [Extent13] ON [Extent11].[Id] = [Extent13].[TicketId]
    WHERE ([Extent11].[Date] >= @p__linq__0) AND ([Extent11].[Date] < @p__linq__1)
UNION ALL
    SELECT 
    5 AS [C1], 
    [Extent14].[Id] AS [Id], 
    [Extent14].[Id] AS [Id1], 
    [Extent14].[LastUpdateTime] AS [LastUpdateTime], 
    [Extent14].[TicketVersion] AS [TicketVersion], 
    [Extent14].[TicketUid] AS [TicketUid], 
    [Extent14].[TicketNumber] AS [TicketNumber], 
    [Extent14].[Date] AS [Date], 
    [Extent14].[LastOrderDate] AS [LastOrderDate], 
    [Extent14].[LastPaymentDate] AS [LastPaymentDate], 
    [Extent14].[PreOrder] AS [PreOrder], 
    [Extent14].[IsClosed] AS [IsClosed], 
    [Extent14].[IsLocked] AS [IsLocked], 
    [Extent14].[RemainingAmount] AS [RemainingAmount], 
    [Extent14].[TotalAmount] AS [TotalAmount], 
    [Extent14].[DepartmentId] AS [DepartmentId], 
    [Extent14].[TerminalId] AS [TerminalId], 
    [Extent14].[TicketTypeId] AS [TicketTypeId], 
    [Extent14].[Note] AS [Note], 
    [Extent14].[LastModifiedUserName] AS [LastModifiedUserName], 
    [Extent14].[TicketTags] AS [TicketTags], 
    [Extent14].[TicketStates] AS [TicketStates], 
    [Extent14].[TicketLogs] AS [TicketLogs], 
    [Extent14].[LineSeparators] AS [LineSeparators], 
    [Extent14].[ExchangeRate] AS [ExchangeRate], 
    [Extent14].[TaxIncluded] AS [TaxIncluded], 
    [Extent14].[Name] AS [Name], 
    [Extent14].[Id] AS [Id2], 
    [Extent15].[Id] AS [Id3], 
    [Extent15].[Date] AS [Date1], 
    [Extent15].[DocumentTypeId] AS [DocumentTypeId], 
    [Extent15].[Name] AS [Name1], 
    CAST(NULL AS int) AS [C2], 
    CAST(NULL AS int) AS [C3], 
    CAST(NULL AS int) AS [C4], 
    CAST(NULL AS int) AS [C5], 
    CAST(NULL AS int) AS [C6], 
    CAST(NULL AS int) AS [C7], 
    CAST(NULL AS int) AS [C8], 
    CAST(NULL AS varchar(1)) AS [C9], 
    CAST(NULL AS varchar(1)) AS [C10], 
    CAST(NULL AS decimal(16,2)) AS [C11], 
    CAST(NULL AS decimal(16,3)) AS [C12], 
    CAST(NULL AS int) AS [C13], 
    CAST(NULL AS bit) AS [C14], 
    CAST(NULL AS bit) AS [C15], 
    CAST(NULL AS bit) AS [C16], 
    CAST(NULL AS bit) AS [C17], 
    CAST(NULL AS int) AS [C18], 
    CAST(NULL AS varchar(1)) AS [C19], 
    CAST(NULL AS datetime2) AS [C20], 
    CAST(NULL AS datetime2) AS [C21], 
    CAST(NULL AS int) AS [C22], 
    CAST(NULL AS int) AS [C23], 
    CAST(NULL AS varchar(1)) AS [C24], 
    CAST(NULL AS varchar(1)) AS [C25], 
    CAST(NULL AS varchar(1)) AS [C26], 
    CAST(NULL AS varchar(1)) AS [C27], 
    CAST(NULL AS varchar(1)) AS [C28], 
    CAST(NULL AS bit) AS [C29], 
    CAST(NULL AS varchar(1)) AS [C30], 
    CAST(NULL AS varchar(1)) AS [C31], 
    CAST(NULL AS varchar(1)) AS [C32], 
    CAST(NULL AS varchar(1)) AS [C33], 
    CAST(NULL AS int) AS [C34], 
    CAST(NULL AS int) AS [C35], 
    CAST(NULL AS int) AS [C36], 
    CAST(NULL AS int) AS [C37], 
    CAST(NULL AS decimal(16,2)) AS [C38], 
    CAST(NULL AS decimal(16,2)) AS [C39], 
    CAST(NULL AS decimal(16,2)) AS [C40], 
    CAST(NULL AS datetime2) AS [C41], 
    CAST(NULL AS datetime2) AS [C42], 
    CAST(NULL AS int) AS [C43], 
    CAST(NULL AS int) AS [C44], 
    CAST(NULL AS int) AS [C45], 
    CAST(NULL AS int) AS [C46], 
    CAST(NULL AS int) AS [C47], 
    CAST(NULL AS varchar(1)) AS [C48], 
    CAST(NULL AS varchar(1)) AS [C49], 
    CAST(NULL AS varchar(1)) AS [C50], 
    CAST(NULL AS int) AS [C51], 
    CAST(NULL AS int) AS [C52], 
    CAST(NULL AS varchar(1)) AS [C53], 
    CAST(NULL AS int) AS [C54], 
    CAST(NULL AS int) AS [C55], 
    CAST(NULL AS int) AS [C56], 
    CAST(NULL AS int) AS [C57], 
    CAST(NULL AS bit) AS [C58], 
    CAST(NULL AS bit) AS [C59], 
    CAST(NULL AS bit) AS [C60], 
    CAST(NULL AS decimal(16,2)) AS [C61], 
    CAST(NULL AS decimal(16,2)) AS [C62], 
    CAST(NULL AS decimal(16,2)) AS [C63], 
    CAST(NULL AS decimal(16,10)) AS [C64], 
    CAST(NULL AS datetime2) AS [C65], 
    CAST(NULL AS varchar(1)) AS [C66], 
    CAST(NULL AS int) AS [C67], 
    CAST(NULL AS int) AS [C68], 
    CAST(NULL AS int) AS [C69], 
    CAST(NULL AS int) AS [C70], 
    CAST(NULL AS int) AS [C71], 
    CAST(NULL AS varchar(1)) AS [C72], 
    CAST(NULL AS varchar(1)) AS [C73], 
    CAST(NULL AS datetime2) AS [C74], 
    CAST(NULL AS int) AS [C75], 
    CAST(NULL AS decimal(16,2)) AS [C76], 
    CAST(NULL AS decimal(16,2)) AS [C77], 
    CAST(NULL AS int) AS [C78], 
    CAST(NULL AS int) AS [C79], 
    CAST(NULL AS decimal(16,10)) AS [C80], 
    CAST(NULL AS varchar(1)) AS [C81], 
    CAST(NULL AS bit) AS [C82], 
    CAST(NULL AS int) AS [C83], 
    [Extent16].[Id] AS [Id4], 
    [Extent16].[TicketId] AS [TicketId], 
    [Extent16].[ChangePaymentTypeId] AS [ChangePaymentTypeId], 
    [Extent16].[Name] AS [Name2], 
    [Extent16].[Date] AS [Date2], 
    [Extent16].[AccountTransactionId] AS [AccountTransactionId], 
    [Extent16].[Amount] AS [Amount], 
    [Extent16].[UserId] AS [UserId], 
    [Extent16].[ExchangeRate] AS [ExchangeRate1], 
    [Extent16].[TicketId] AS [TicketId1], 
    CAST(NULL AS int) AS [C84], 
    CAST(NULL AS int) AS [C85], 
    CAST(NULL AS decimal(16,2)) AS [C86], 
    CAST(NULL AS decimal(16,10)) AS [C87], 
    CAST(NULL AS int) AS [C88], 
    CAST(NULL AS int) AS [C89], 
    CAST(NULL AS int) AS [C90], 
    CAST(NULL AS bit) AS [C91], 
    CAST(NULL AS bit) AS [C92], 
    CAST(NULL AS varchar(1)) AS [C93]
    FROM   [dbo].[Tickets] AS [Extent14]
    LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent15] ON [Extent14].[TransactionDocument_Id] = [Extent15].[Id]
    INNER JOIN [dbo].[ChangePayments] AS [Extent16] ON [Extent14].[Id] = [Extent16].[TicketId]
    WHERE ([Extent14].[Date] >= @p__linq__0) AND ([Extent14].[Date] < @p__linq__1)
UNION ALL
    SELECT 
    6 AS [C1], 
    [Extent17].[Id] AS [Id], 
    [Extent17].[Id] AS [Id1], 
    [Extent17].[LastUpdateTime] AS [LastUpdateTime], 
    [Extent17].[TicketVersion] AS [TicketVersion], 
    [Extent17].[TicketUid] AS [TicketUid], 
    [Extent17].[TicketNumber] AS [TicketNumber], 
    [Extent17].[Date] AS [Date], 
    [Extent17].[LastOrderDate] AS [LastOrderDate], 
    [Extent17].[LastPaymentDate] AS [LastPaymentDate], 
    [Extent17].[PreOrder] AS [PreOrder], 
    [Extent17].[IsClosed] AS [IsClosed], 
    [Extent17].[IsLocked] AS [IsLocked], 
    [Extent17].[RemainingAmount] AS [RemainingAmount], 
    [Extent17].[TotalAmount] AS [TotalAmount], 
    [Extent17].[DepartmentId] AS [DepartmentId], 
    [Extent17].[TerminalId] AS [TerminalId], 
    [Extent17].[TicketTypeId] AS [TicketTypeId], 
    [Extent17].[Note] AS [Note], 
    [Extent17].[LastModifiedUserName] AS [LastModifiedUserName], 
    [Extent17].[TicketTags] AS [TicketTags], 
    [Extent17].[TicketStates] AS [TicketStates], 
    [Extent17].[TicketLogs] AS [TicketLogs], 
    [Extent17].[LineSeparators] AS [LineSeparators], 
    [Extent17].[ExchangeRate] AS [ExchangeRate], 
    [Extent17].[TaxIncluded] AS [TaxIncluded], 
    [Extent17].[Name] AS [Name], 
    [Extent17].[Id] AS [Id2], 
    [Extent18].[Id] AS [Id3], 
    [Extent18].[Date] AS [Date1], 
    [Extent18].[DocumentTypeId] AS [DocumentTypeId], 
    [Extent18].[Name] AS [Name1], 
    CAST(NULL AS int) AS [C2], 
    CAST(NULL AS int) AS [C3], 
    CAST(NULL AS int) AS [C4], 
    CAST(NULL AS int) AS [C5], 
    CAST(NULL AS int) AS [C6], 
    CAST(NULL AS int) AS [C7], 
    CAST(NULL AS int) AS [C8], 
    CAST(NULL AS varchar(1)) AS [C9], 
    CAST(NULL AS varchar(1)) AS [C10], 
    CAST(NULL AS decimal(16,2)) AS [C11], 
    CAST(NULL AS decimal(16,3)) AS [C12], 
    CAST(NULL AS int) AS [C13], 
    CAST(NULL AS bit) AS [C14], 
    CAST(NULL AS bit) AS [C15], 
    CAST(NULL AS bit) AS [C16], 
    CAST(NULL AS bit) AS [C17], 
    CAST(NULL AS int) AS [C18], 
    CAST(NULL AS varchar(1)) AS [C19], 
    CAST(NULL AS datetime2) AS [C20], 
    CAST(NULL AS datetime2) AS [C21], 
    CAST(NULL AS int) AS [C22], 
    CAST(NULL AS int) AS [C23], 
    CAST(NULL AS varchar(1)) AS [C24], 
    CAST(NULL AS varchar(1)) AS [C25], 
    CAST(NULL AS varchar(1)) AS [C26], 
    CAST(NULL AS varchar(1)) AS [C27], 
    CAST(NULL AS varchar(1)) AS [C28], 
    CAST(NULL AS bit) AS [C29], 
    CAST(NULL AS varchar(1)) AS [C30], 
    CAST(NULL AS varchar(1)) AS [C31], 
    CAST(NULL AS varchar(1)) AS [C32], 
    CAST(NULL AS varchar(1)) AS [C33], 
    CAST(NULL AS int) AS [C34], 
    CAST(NULL AS int) AS [C35], 
    CAST(NULL AS int) AS [C36], 
    CAST(NULL AS int) AS [C37], 
    CAST(NULL AS decimal(16,2)) AS [C38], 
    CAST(NULL AS decimal(16,2)) AS [C39], 
    CAST(NULL AS decimal(16,2)) AS [C40], 
    CAST(NULL AS datetime2) AS [C41], 
    CAST(NULL AS datetime2) AS [C42], 
    CAST(NULL AS int) AS [C43], 
    CAST(NULL AS int) AS [C44], 
    CAST(NULL AS int) AS [C45], 
    CAST(NULL AS int) AS [C46], 
    CAST(NULL AS int) AS [C47], 
    CAST(NULL AS varchar(1)) AS [C48], 
    CAST(NULL AS varchar(1)) AS [C49], 
    CAST(NULL AS varchar(1)) AS [C50], 
    CAST(NULL AS int) AS [C51], 
    CAST(NULL AS int) AS [C52], 
    CAST(NULL AS varchar(1)) AS [C53], 
    CAST(NULL AS int) AS [C54], 
    CAST(NULL AS int) AS [C55], 
    CAST(NULL AS int) AS [C56], 
    CAST(NULL AS int) AS [C57], 
    CAST(NULL AS bit) AS [C58], 
    CAST(NULL AS bit) AS [C59], 
    CAST(NULL AS bit) AS [C60], 
    CAST(NULL AS decimal(16,2)) AS [C61], 
    CAST(NULL AS decimal(16,2)) AS [C62], 
    CAST(NULL AS decimal(16,2)) AS [C63], 
    CAST(NULL AS decimal(16,10)) AS [C64], 
    CAST(NULL AS datetime2) AS [C65], 
    CAST(NULL AS varchar(1)) AS [C66], 
    CAST(NULL AS int) AS [C67], 
    CAST(NULL AS int) AS [C68], 
    CAST(NULL AS int) AS [C69], 
    CAST(NULL AS int) AS [C70], 
    CAST(NULL AS int) AS [C71], 
    CAST(NULL AS varchar(1)) AS [C72], 
    CAST(NULL AS varchar(1)) AS [C73], 
    CAST(NULL AS datetime2) AS [C74], 
    CAST(NULL AS int) AS [C75], 
    CAST(NULL AS decimal(16,2)) AS [C76], 
    CAST(NULL AS decimal(16,2)) AS [C77], 
    CAST(NULL AS int) AS [C78], 
    CAST(NULL AS int) AS [C79], 
    CAST(NULL AS decimal(16,10)) AS [C80], 
    CAST(NULL AS varchar(1)) AS [C81], 
    CAST(NULL AS bit) AS [C82], 
    CAST(NULL AS int) AS [C83], 
    CAST(NULL AS int) AS [C84], 
    CAST(NULL AS int) AS [C85], 
    CAST(NULL AS int) AS [C86], 
    CAST(NULL AS varchar(1)) AS [C87], 
    CAST(NULL AS datetime2) AS [C88], 
    CAST(NULL AS int) AS [C89], 
    CAST(NULL AS decimal(16,2)) AS [C90], 
    CAST(NULL AS int) AS [C91], 
    CAST(NULL AS decimal(16,10)) AS [C92], 
    CAST(NULL AS int) AS [C93], 
    [Extent19].[Id] AS [Id4], 
    [Extent19].[AccountTransactionDocumentId] AS [AccountTransactionDocumentId], 
    [Extent19].[Amount] AS [Amount], 
    [Extent19].[ExchangeRate] AS [ExchangeRate1], 
    [Extent19].[AccountTransactionTypeId] AS [AccountTransactionTypeId], 
    [Extent19].[SourceAccountTypeId] AS [SourceAccountTypeId], 
    [Extent19].[TargetAccountTypeId] AS [TargetAccountTypeId], 
    [Extent19].[IsReversed] AS [IsReversed], 
    [Extent19].[Reversable] AS [Reversable], 
    [Extent19].[Name] AS [Name2]
    FROM   [dbo].[Tickets] AS [Extent17]
    LEFT OUTER JOIN [dbo].[AccountTransactionDocuments] AS [Extent18] ON [Extent17].[TransactionDocument_Id] = [Extent18].[Id]
    INNER JOIN [dbo].[AccountTransactions] AS [Extent19] ON [Extent17].[TransactionDocument_Id] = [Extent19].[AccountTransactionDocumentId]
    WHERE ([Extent17].[Date] >= @p__linq__0) AND ([Extent17].[Date] < @p__linq__1)) AS [UnionAll5]
ORDER BY [UnionAll5].[Id1] ASC, [UnionAll5].[Id3] ASC, [UnionAll5].[C1] ASC`

Please update SambaPOS V5 Versiyon
Fixed versiyon number is : 5.2.24B
URL : https://sambapos.com/?wpfb_dl=215

it’s all on 5.2.24

See the B, there is a revision.

what?
This is the same

url identic

url is irellevent, they could have replaced file.
I am saying that he specifies with a B which to me suggests a revision.
If its not a new version and your up to date I would start by looking at the following rule types in your automation for potential issues based on order adding causing an issue;

Order Added
Ticket Total Changed

and then moving on to rules related to actions in those rule types, ie, default order added would also update ticket state, so would want to check for potential issues in ticket state changed/updated rules.

I would start by looking at the following rule types in your automation for potential issues based on order adding causing an issue;
Order Added
Ticket Total Changed
and then moving on to rules related to actions in those rule types, ie, default order added would also update ticket state, so would want to check for potential issues in ticket state changed/updated rules.

I did it first, checked all the rules that could in any way affect the add order to ticket.

url is irellevent, they could have replaced file.
I am saying that he specifies with a B which to me suggests a revision.
If its not a new version and your up to date.

I hope so.
just in case, reinstalled the program at this link.

Not same.
Please update B revision.

1 Like