#ORA
Select
*
From
(
#ALL
Select
#MS
TOP (:MaxRowsCount)
#IB
First :MaxRowsCount
#ALL
Case (
Select
count(*)
from
LogStorePreferences LSP
join LogStorePreferences2 LSP2 on LSP2.Parent_ID = LSP.ID
where
LSP.PosAddressType = 0 and
LSP.StorePosition_ID = S.Position_ID and
(
LSP2.Storecard_id = :StoreCard_ID or
LSP2.Storemenuitem_id = :StoreMenuItem_ID or
LSP2.StoreCardCategory_id = :StoreCardCategory_id
)
) when 0 then 0 else 1 end
+
Case (
Select
count(*)
from
LogStorePreferences LSP
join LogStorePreferences2 LSP2 on LSP2.Parent_ID = LSP.ID
where
LSP.PosAddressType = 1 and
LSP.StorePosition_ID like Position_Code || '%' and
(
LSP2.Storecard_id = :StoreCard_ID or
LSP2.Storemenuitem_id = :StoreMenuItem_ID or
LSP2.StoreCardCategory_id = :StoreCardCategory_id
)
) when 0 then 0 else 1 end Score,
ID,
Position_ID,
Position_Code,
Position_Accessibility,
Position_Frozen,
Quantity,
QUnit,
UnitRate,
IndivisibleQuantity,
CompareStorageDate$DATE,
StoreBatch_Name,
PositionType
from
#ORA
Table
(
Cast
(
LogstoreCustOutputStrat(
:StoreCard_ID,
:Store_ID,
:StoreBatch_ID,
:SBATCH_ID_NULL,
:Quantity,
:AccessibilityLimit,
:IsAccessibilityLimitFilter,
'A',
:RespectIndivisibleQuantity)
as LogStoreCustOutputStrat_Table
)
) S
#IB
LogstoreCustOutputStrat(
:StoreCard_ID,
:Store_ID,
:StoreBatch_ID,
:SBATCH_ID_NULL,
:Quantity,
:AccessibilityLimit,
:IsAccessibilityLimitFilter,
'A',
:RespectIndivisibleQuantity) S
#MS
LogstoreCustOutputStrat(
:StoreCard_ID,
:Store_ID,
:StoreBatch_ID,
:SBATCH_ID_NULL,
:Quantity,
:AccessibilityLimit,
:IsAccessibilityLimitFilter,
'A',
:RespectIndivisibleQuantity) S
#ALL
order by
Position_Frozen Desc, 1, (Case when (QUnit = :QUnit) and (UnitRate = :UnitRate) then 0 else 1 end), 7, Position_Accessibility
#ORA
)
where
RowNum <= :MaxRowsCountGenerated by ABRA Software a.s. 27.10.2021 16:35:19