none
Ошибки оптимизатора в кластере RRS feed

  • Вопрос

  • Странная ситуация: один и тот же запрос на одном и том же сервере в кластере дико свопится и выполнение уходит на многие часы в то время как другой экземпляр сервера но уже вне кластера на том же самом сервере позволяет выполнить расчет за несколько минут.
    Оптимизатор орет также что у него хэш рекурсия и ошибки сортировки в результате нехватки памяти.

    ХЭЛП ПЛИЗ!
    11 апреля 2007 г. 10:42

Ответы

Все ответы

  • Планы выполнения давайте, set showplan_all on перед запросом.

    Что за хэш-рекурсия, не представляю. Но вообще слова хэш и ошибка памяти говорят о том, что оптимизатор выполняет слияние хешированием и сильно ошибается в предположении о числе рядов. Я бы в первую очередь посмотрел наличие свежей статистики, причем сделанной по 100% таблицы, а не по 10, как по дефолту. Или таска update statistics 100% при наличии sql 2005 sp2, или rebuild index.

     

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.ru/udb9/html/cb93c620-4be9-4362-8bf0-af3f2048bdaf.htm

    Да, точно, сверился с BOL:

    Класс событий Hash Warning можно использовать для мониторинга возникновения рекурсии хэша или остановки хэширования (аварийного хэширования) во время операции хэширования.

    Рекурсия хэша возникает, когда входные данные не помещаются в доступную память, что приводит к разбиению их на несколько отдельно обрабатываемых секций. Если какая-либо из этих секций все же не помещается в доступную память, она разбивается на подсекции, которые также обрабатываются отдельно. Процесс разбиения продолжается, либо пока все секции не будут помещаться в доступную память, либо пока не будет достигнут максимальный уровень рекурсии (который можно проверить в столбце данных IntegerData).

    Аварийное хэширование происходит, когда операция хэширования достигает максимального уровня рекурсии и переходит к альтернативному плану обработки оставшихся секционированных данных. Причиной этого обычно становятся ассиметричные данные.

    Рекурсии и аварийное хэширование приводят к снижению производительности сервера. Для устранения или уменьшения частоты появления рекурсий и аварийного хэширования можно применить следующие методы.

    • Удостовериться в том, что для соединяемых или группируемых столбцов существует статистика.

    • Если для столбцов существует статистика, обновить ее.

    • Использовать другой тип соединения. Например, соединения MERGE или LOOP, если это допустимо.

    • Увеличить объем доступной памяти на компьютере. Рекурсии и аварийное хэширование возникают, когда в машине недостаточно памяти для обработки имеющихся запросов и их приходится сбрасывать на диск.

    Создание или обновление статистики по столбцу, включенному в соединение, представляет собой наиболее эффективный способ уменьшения числа рекурсий или аварийного хэширования.

     

    http://blogs.msdn.com/craigfr/archive/2006/08/10/687630.aspx ну и вот еще.

    11 апреля 2007 г. 11:33
  • Легко, это запрос:

    exec sp_executesql N'SELECT
    0xb5810011256efa0a11db26ce394d16b4 f_1,
    #V8TblAli1_Q_000_T_001._Q_006_F_000TRef _sf_2TRef,
    #V8TblAli1_Q_000_T_001._Q_006_F_000RRef _sf_2RRef,
    #V8TblAli1_Q_000_T_001._Q_006_F_001 _sf_3,
    #V8TblAli1_Q_000_T_001._Q_006_F_002RRef f_2,
    #V8TblAli1_Q_000_T_001._Q_006_F_004RRef f_3,
    #V8TblAli1_Q_000_T_001._Q_006_F_006_TYPE f_4,
    #V8TblAli1_Q_000_T_001._Q_006_F_006_RTRef f_5,
    #V8TblAli1_Q_000_T_001._Q_006_F_006_RRRef f_6,
    #V8TblAli1_Q_000_T_001._Q_006_F_007_TYPE f_7,
    #V8TblAli1_Q_000_T_001._Q_006_F_007_RTRef f_8,
    #V8TblAli1_Q_000_T_001._Q_006_F_007_RRRef f_9,
    #V8TblAli1_Q_000_T_001._Q_006_F_008_TYPE f_10,
    #V8TblAli1_Q_000_T_001._Q_006_F_008_RTRef f_11,
    #V8TblAli1_Q_000_T_001._Q_006_F_008_RRRef f_12,
    #V8TblAli1_Q_000_T_001._Q_006_F_005RRef f_13,
    #V8TblAli1_Q_000_T_001._Q_006_F_009_TYPE f_14,
    #V8TblAli1_Q_000_T_001._Q_006_F_009_RTRef f_15,
    #V8TblAli1_Q_000_T_001._Q_006_F_009_RRRef f_16,
    #V8TblAli1_Q_000_T_001._Q_006_F_010_TYPE f_17,
    #V8TblAli1_Q_000_T_001._Q_006_F_010_RTRef f_18,
    #V8TblAli1_Q_000_T_001._Q_006_F_010_RRRef f_19,
    #V8TblAli1_Q_000_T_001._Q_006_F_011_TYPE f_20,
    #V8TblAli1_Q_000_T_001._Q_006_F_011_RTRef f_21,
    #V8TblAli1_Q_000_T_001._Q_006_F_011_RRRef f_22,
    #V8TblAli1_Q_000_T_001._Q_006_F_012RRef f_23,
    #V8TblAli1_Q_000_T_001._Q_006_F_013RRef f_24,
    #V8TblAli1_Q_000_T_001._Q_006_F_014_TYPE f_25,
    #V8TblAli1_Q_000_T_001._Q_006_F_014_RTRef f_26,
    #V8TblAli1_Q_000_T_001._Q_006_F_014_RRRef f_27,
    #V8TblAli1_Q_000_T_001._Q_006_F_015_TYPE f_28,
    #V8TblAli1_Q_000_T_001._Q_006_F_015_RTRef f_29,
    #V8TblAli1_Q_000_T_001._Q_006_F_015_RRRef f_30,
    #V8TblAli1_Q_000_T_001._Q_006_F_016_TYPE f_31,
    #V8TblAli1_Q_000_T_001._Q_006_F_016_RTRef f_32,
    #V8TblAli1_Q_000_T_001._Q_006_F_016_RRRef f_33,
    #V8TblAli1_Q_000_T_001._Q_006_F_017_TYPE f_34,
    #V8TblAli1_Q_000_T_001._Q_006_F_017_RTRef f_35,
    #V8TblAli1_Q_000_T_001._Q_006_F_017_RRRef f_36,
    #V8TblAli1_Q_000_T_001._Q_006_F_018_TYPE f_37,
    #V8TblAli1_Q_000_T_001._Q_006_F_018_RTRef f_38,
    #V8TblAli1_Q_000_T_001._Q_006_F_018_RRRef f_39,
    #V8TblAli1_Q_000_T_001._Q_006_F_019_TYPE f_40,
    #V8TblAli1_Q_000_T_001._Q_006_F_019_RTRef f_41,
    #V8TblAli1_Q_000_T_001._Q_006_F_019_RRRef f_42,
    #V8TblAli1_Q_000_T_001._Q_006_F_020RRef f_43,
    #V8TblAli1_Q_000_T_001._Q_006_F_021RRef f_44,
    #V8TblAli1_Q_000_T_001._Q_006_F_022 f_45,
    #V8TblAli1_Q_000_T_001._Q_006_F_023RRef f_46,
    #V8TblAli1_Q_000_T_001._Q_006_F_024RRef f_47,
    #V8TblAli1_Q_000_T_001._Q_006_F_025RRef f_48,
    #V8TblAli1_Q_000_T_001._Q_006_F_031 f_49,
    #V8TblAli1_Q_000_T_001._Q_006_F_035RRef f_50,
    #V8TblAli1_Q_000_T_001._Q_006_F_037RRef f_51,
    #V8TblAli1_Q_000_T_001._Q_006_F_036RRef f_52,
    #V8TblAli1_Q_000_T_001._Q_006_F_026RRef f_53,
    #V8TblAli1_Q_000_T_001._Q_006_F_027RRef f_54,
    #V8TblAli1_Q_000_T_001._Q_006_F_028 f_55,
    #V8TblAli1_Q_000_T_001._Q_006_F_029 f_56,
    #V8TblAli1_Q_000_T_001._Q_006_F_030 f_57,
    #V8TblAli1_Q_000_T_001._Q_006_F_032RRef f_58,
    #V8TblAli1_Q_000_T_001._Q_006_F_033RRef f_59,
    #V8TblAli1_Q_000_T_001._Q_006_F_034 f_60,
    CASE
    WHEN #V8TblAli1_Q_000_T_001._Q_006_F_004RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_005RRef <>
    0x00000000000000000000000000000000 OR
    #V8TblAli1_Q_000_T_001._Q_006_F_003 < {ts ''2007-03-01 00:00:00''} OR
    _CalcKind282._Fld3982RRef = 0xb9b3af28e5e196ed463006496a0bc66c
    THEN CAST(NULL AS BINARY(16))
    ELSE _CalcKind282._Fld3982RRef
    END f_61,
    ISNULL(_Acc1_ExtDim3950_Q_000_T_002._LineNo, CAST(0 AS NUMERIC(1,0))) f_62,
    ISNULL(_Acc1_ExtDim3950_Q_000_T_003._LineNo, CAST(0 AS NUMERIC(1,0))) f_63,
    ISNULL(_Acc1_ExtDim3950_Q_000_T_004._LineNo, CAST(0 AS NUMERIC(1,0))) f_64,
    ISNULL(_Acc2_ExtDim3953_Q_000_T_007._LineNo, CAST(0 AS NUMERIC(1,0))) f_65,
    ISNULL(_Acc2_ExtDim3953_Q_000_T_008._LineNo, CAST(0 AS NUMERIC(1,0))) f_66,
    ISNULL(_Acc2_ExtDim3953_Q_000_T_009._LineNo, CAST(0 AS NUMERIC(1,0))) f_67,
    ISNULL(_Acc1_ExtDim3950_Q_000_T_005._LineNo, CAST(0 AS NUMERIC(1,0))) f_68,
    ISNULL(_Acc2_ExtDim3953_Q_000_T_006._LineNo, CAST(0 AS NUMERIC(1,0))) f_69,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4047DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_002RRef) f_70,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4051DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_003RRef) f_71,
    CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_004_RTRef = 0x00000049
    THEN _Reference73._Fld584RRef
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_005_RTRef = 0x00000049
    THEN _Reference73_1._Fld584RRef
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_006_RTRef = 0x00000049
    THEN _Reference73_2._Fld584RRef
    ELSE CAST(NULL AS BINARY(16))
    END f_72,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4048Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE) f_73,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4048Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4048Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4048Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_004_RTRef
    END) f_74,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4048Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4048Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4048Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_004_RRRef
    END) f_75,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4049Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE) f_76,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4049Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4049Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4049Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_005_RTRef
    END) f_77,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4049Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4049Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4049Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_005_RRRef
    END) f_78,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4050Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE) f_79,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4050Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4050Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4050Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_006_RTRef
    END) f_80,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4050Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4050Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4050Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_006_RRRef
    END) f_81,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4052Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_007_TYPE) f_82,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4052Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4052Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4052Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_007_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_007_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_007_RTRef
    END) f_83,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4052Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4052Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4052Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_007_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_007_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_007_RRRef
    END) f_84,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4053Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_008_TYPE) f_85,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4053Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4053Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4053Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_008_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_008_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_008_RTRef
    END) f_86,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4053Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4053Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4053Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_008_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_008_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_008_RRRef
    END) f_87,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4054Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_009_TYPE) f_88,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4054Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4054Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4054Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_009_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_009_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_009_RTRef
    END) f_89,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4054Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4054Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4054Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_009_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_009_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_009_RRRef
    END) f_90,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4055DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_010RRef) f_91,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4059DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_011RRef) f_92,
    ISNULL(_Acc2_ExtDim3953_Q_000_T_012._LineNo, CAST(0 AS NUMERIC(1,0))) f_93,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4056Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_012_TYPE) f_94,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4056Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4056Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4056Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_012_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_012_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_012_RTRef
    END) f_95,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4056Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4056Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4056Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_012_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_012_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_012_RRRef
    END) f_96,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4057Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_013_TYPE) f_97,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4057Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4057Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4057Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_013_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_013_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_013_RTRef
    END) f_98,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4057Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4057Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4057Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_013_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_013_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_013_RRRef
    END) f_99,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4058Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_014_TYPE) f_100,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4058Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4058Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4058Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_014_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_014_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_014_RTRef
    END) f_101,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4058Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4058Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4058Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_014_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_014_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_014_RRRef
    END) f_102,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4060Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_015_TYPE) f_103,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4060Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4060Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4060Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_015_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_015_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_015_RTRef
    END) f_104,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4060Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4060Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4060Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_015_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_015_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_015_RRRef
    END) f_105,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4061Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_016_TYPE) f_106,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4061Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4061Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4061Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_016_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_016_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_016_RTRef
    END) f_107,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4061Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4061Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4061Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_016_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_016_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_016_RRRef
    END) f_108,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4062Dim_TYPE, #V8TblAli3_Q_000_T_011._Q_008_F_017_TYPE) f_109,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4062Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4062Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4062Dim_RTRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_017_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_017_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_017_RTRef
    END) f_110,
    ISNULL(CASE
    WHEN #V8TblAli2_Q_000_T_010._Fld4062Dim_TYPE IS NOT NULL AND #V8TblAli2_Q_000_T_010._Fld4062Dim_TYPE IN (0x01,0x08)
    THEN #V8TblAli2_Q_000_T_010._Fld4062Dim_RRRef
    END, CASE
    WHEN #V8TblAli3_Q_000_T_011._Q_008_F_017_TYPE IS NOT NULL AND #V8TblAli3_Q_000_T_011._Q_008_F_017_TYPE IN (0x01,0x08)
    THEN #V8TblAli3_Q_000_T_011._Q_008_F_017_RRRef
    END) f_111,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4063DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_018RRef) f_112,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4064DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_019RRef) f_113,
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4044Base, #V8TblAli3_Q_000_T_011._Q_008_F_020) f_114,
    CAST(CAST(CASE
    WHEN ISNULL(#V8TblAli5_Q_000_T_014._Fld2994AP, CAST(0 AS NUMERIC(1,0))) = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(10,2))
    ELSE CAST(CAST(CAST(CAST(ISNULL(#V8TblAli4_Q_000_T_013._Q_010_F_002, CAST(0 AS NUMERIC(1,0))) AS NUMERIC(16,6)) /
    #V8TblAli5_Q_000_T_014._Fld2994AP AS NUMERIC(22,10)) * ISNULL(#V8TblAli5_Q_000_T_014._Fld2994AAP, CAST(0 AS NUMERIC(1,0))) AS NUMERIC(38,10))
    AS NUMERIC(10,2))
    END AS NUMERIC(16,8)) * CASE
    WHEN #V8TblAli1_Q_000_T_001._Q_006_F_031 = 0x01
    THEN CAST(-1 AS NUMERIC(1,0))
    ELSE CAST(1 AS NUMERIC(1,0))
    END AS NUMERIC(19,10)) f_115,
    ISNULL(CAST(#V8TblAli6_Q_000_T_015._Q_012_F_003 * CASE
    WHEN #V8TblAli1_Q_000_T_001._Q_006_F_031 = 0x01
    THEN CAST(-1 AS NUMERIC(1,0))
    ELSE CAST(1 AS NUMERIC(1,0))
    END AS NUMERIC(23,10)), CAST(0 AS NUMERIC(1,0))) f_116,
    _Reference84._Description _sf_1
    FROM
    (
    SELECT
    _CalcReg4113_Q_006_T_001._RecorderTRef _Q_006_F_000TRef,
    _CalcReg4113_Q_006_T_001._RecorderRRef _Q_006_F_000RRef,
    _CalcReg4113_Q_006_T_001._LineNo _Q_006_F_001,
    _CalcReg4113_Q_006_T_001._Fld4114RRef _Q_006_F_002RRef,
    CASE
    WHEN _CalcKind282._Fld3973RRef IN
    (0xa10632c580309ab445fe6e0673358e29,0xbc6653438d580f8b4893a5e5cdcbf3c0,0x9c7f84c5af1d6682486585064b23dab3,0xa2c97ffbef28f4674f20824a80eab857,0x9a38775fc0369f1c44e3224b3278f903,0x8248c62572173fff4f83672bc7fcb3f2,0x87cee7a0408b77714221ebde6c803da5)
    THEN _CalcReg4113_Q_006_T_001._Fld4130
    WHEN _CalcKind282._BaseAsAct = 0x01
    THEN _CalcReg4113_Q_006_T_001._APDateTill
    ELSE _CalcReg4113_Q_006_T_001._BPDateTill
    END _Q_006_F_003,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld560RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld560RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld560RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_004RRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld564RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld564RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld564RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_005RRef,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN CASE
    WHEN #V8TblAli4_Q_006_T_008._Q_005_F_002RRef IS NOT NULL
    THEN 0x08
    ELSE NULL
    END
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld561_TYPE = 0x01 OR
    _Reference71._Fld561_TYPE = 0x08 AND _Reference71._Fld561_RTRef IS NOT NULL AND _Reference71._Fld561_RRRef IS NOT NULL
    THEN _Reference71._Fld561_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld561_TYPE = 0x01 OR
    _Reference71_1._Fld561_TYPE = 0x08 AND _Reference71_1._Fld561_RTRef IS NOT NULL AND _Reference71_1._Fld561_RRRef IS NOT NULL
    THEN _Reference71_1._Fld561_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld561_TYPE = 0x01 OR
    _Reference71_2._Fld561_TYPE = 0x08 AND _Reference71_2._Fld561_RTRef IS NOT NULL AND _Reference71_2._Fld561_RRRef IS NOT NULL
    THEN _Reference71_2._Fld561_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_006_TYPE,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN CASE
    WHEN #V8TblAli4_Q_006_T_008._Q_005_F_002RRef IS NOT NULL
    THEN 0x0000002E
    ELSE NULL
    END
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld561_TYPE = 0x08
    THEN _Reference71._Fld561_RTRef
    WHEN _Reference71._Fld561_TYPE IS NULL OR
    _Reference71._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld561_TYPE = 0x08
    THEN _Reference71_1._Fld561_RTRef
    WHEN _Reference71_1._Fld561_TYPE IS NULL OR
    _Reference71_1._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld561_TYPE = 0x08
    THEN _Reference71_2._Fld561_RTRef
    WHEN _Reference71_2._Fld561_TYPE IS NULL OR
    _Reference71_2._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_006_RTRef,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN #V8TblAli4_Q_006_T_008._Q_005_F_002RRef
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld561_TYPE = 0x08
    THEN _Reference71._Fld561_RRRef
    WHEN _Reference71._Fld561_TYPE IS NULL OR
    _Reference71._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld561_TYPE = 0x08
    THEN _Reference71_1._Fld561_RRRef
    WHEN _Reference71_1._Fld561_TYPE IS NULL OR
    _Reference71_1._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld561_TYPE = 0x08
    THEN _Reference71_2._Fld561_RRRef
    WHEN _Reference71_2._Fld561_TYPE IS NULL OR
    _Reference71_2._Fld561_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_006_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld562_TYPE = 0x01 OR
    _Reference71._Fld562_TYPE = 0x08 AND _Reference71._Fld562_RTRef IS NOT NULL AND _Reference71._Fld562_RRRef IS NOT NULL
    THEN _Reference71._Fld562_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld562_TYPE = 0x01 OR
    _Reference71_1._Fld562_TYPE = 0x08 AND _Reference71_1._Fld562_RTRef IS NOT NULL AND _Reference71_1._Fld562_RRRef IS NOT NULL
    THEN _Reference71_1._Fld562_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld562_TYPE = 0x01 OR
    _Reference71_2._Fld562_TYPE = 0x08 AND _Reference71_2._Fld562_RTRef IS NOT NULL AND _Reference71_2._Fld562_RRRef IS NOT NULL
    THEN _Reference71_2._Fld562_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_007_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld562_TYPE = 0x08
    THEN _Reference71._Fld562_RTRef
    WHEN _Reference71._Fld562_TYPE IS NULL OR
    _Reference71._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld562_TYPE = 0x08
    THEN _Reference71_1._Fld562_RTRef
    WHEN _Reference71_1._Fld562_TYPE IS NULL OR
    _Reference71_1._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld562_TYPE = 0x08
    THEN _Reference71_2._Fld562_RTRef
    WHEN _Reference71_2._Fld562_TYPE IS NULL OR
    _Reference71_2._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_007_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld562_TYPE = 0x08
    THEN _Reference71._Fld562_RRRef
    WHEN _Reference71._Fld562_TYPE IS NULL OR
    _Reference71._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld562_TYPE = 0x08
    THEN _Reference71_1._Fld562_RRRef
    WHEN _Reference71_1._Fld562_TYPE IS NULL OR
    _Reference71_1._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld562_TYPE = 0x08
    THEN _Reference71_2._Fld562_RRRef
    WHEN _Reference71_2._Fld562_TYPE IS NULL OR
    _Reference71_2._Fld562_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_007_RRRef,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN CASE
    WHEN #V8TblAli4_Q_006_T_008._Q_005_F_003RRef IS NOT NULL
    THEN 0x08
    ELSE NULL
    END
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld563_TYPE = 0x01 OR
    _Reference71._Fld563_TYPE = 0x08 AND _Reference71._Fld563_RTRef IS NOT NULL AND _Reference71._Fld563_RRRef IS NOT NULL
    THEN _Reference71._Fld563_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld563_TYPE = 0x01 OR
    _Reference71_1._Fld563_TYPE = 0x08 AND _Reference71_1._Fld563_RTRef IS NOT NULL AND _Reference71_1._Fld563_RRRef IS NOT NULL
    THEN _Reference71_1._Fld563_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld563_TYPE = 0x01 OR
    _Reference71_2._Fld563_TYPE = 0x08 AND _Reference71_2._Fld563_RTRef IS NOT NULL AND _Reference71_2._Fld563_RRRef IS NOT NULL
    THEN _Reference71_2._Fld563_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_008_TYPE,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN CASE
    WHEN #V8TblAli4_Q_006_T_008._Q_005_F_003RRef IS NOT NULL
    THEN 0x00001328
    ELSE NULL
    END
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld563_TYPE = 0x08
    THEN _Reference71._Fld563_RTRef
    WHEN _Reference71._Fld563_TYPE IS NULL OR
    _Reference71._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld563_TYPE = 0x08
    THEN _Reference71_1._Fld563_RTRef
    WHEN _Reference71_1._Fld563_TYPE IS NULL OR
    _Reference71_1._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld563_TYPE = 0x08
    THEN _Reference71_2._Fld563_RTRef
    WHEN _Reference71_2._Fld563_TYPE IS NULL OR
    _Reference71_2._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_008_RTRef,
    CASE
    WHEN NOT #V8TblAli4_Q_006_T_008._Q_005_F_000RRef IS NULL AND #V8TblAli4_Q_006_T_008._Q_005_F_001RRef = 0xb2261948dffd13cf445f2d645130e4d9
    THEN #V8TblAli4_Q_006_T_008._Q_005_F_003RRef
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld563_TYPE = 0x08
    THEN _Reference71._Fld563_RRRef
    WHEN _Reference71._Fld563_TYPE IS NULL OR
    _Reference71._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld563_TYPE = 0x08
    THEN _Reference71_1._Fld563_RRRef
    WHEN _Reference71_1._Fld563_TYPE IS NULL OR
    _Reference71_1._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld563_TYPE = 0x08
    THEN _Reference71_2._Fld563_RRRef
    WHEN _Reference71_2._Fld563_TYPE IS NULL OR
    _Reference71_2._Fld563_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_008_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld565_TYPE = 0x01 OR
    _Reference71._Fld565_TYPE = 0x08 AND _Reference71._Fld565_RTRef IS NOT NULL AND _Reference71._Fld565_RRRef IS NOT NULL
    THEN _Reference71._Fld565_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld565_TYPE = 0x01 OR
    _Reference71_1._Fld565_TYPE = 0x08 AND _Reference71_1._Fld565_RTRef IS NOT NULL AND _Reference71_1._Fld565_RRRef IS NOT NULL
    THEN _Reference71_1._Fld565_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld565_TYPE = 0x01 OR
    _Reference71_2._Fld565_TYPE = 0x08 AND _Reference71_2._Fld565_RTRef IS NOT NULL AND _Reference71_2._Fld565_RRRef IS NOT NULL
    THEN _Reference71_2._Fld565_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_009_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld565_TYPE = 0x08
    THEN _Reference71._Fld565_RTRef
    WHEN _Reference71._Fld565_TYPE IS NULL OR
    _Reference71._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld565_TYPE = 0x08
    THEN _Reference71_1._Fld565_RTRef
    WHEN _Reference71_1._Fld565_TYPE IS NULL OR
    _Reference71_1._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld565_TYPE = 0x08
    THEN _Reference71_2._Fld565_RTRef
    WHEN _Reference71_2._Fld565_TYPE IS NULL OR
    _Reference71_2._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_009_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld565_TYPE = 0x08
    THEN _Reference71._Fld565_RRRef
    WHEN _Reference71._Fld565_TYPE IS NULL OR
    _Reference71._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld565_TYPE = 0x08
    THEN _Reference71_1._Fld565_RRRef
    WHEN _Reference71_1._Fld565_TYPE IS NULL OR
    _Reference71_1._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld565_TYPE = 0x08
    THEN _Reference71_2._Fld565_RRRef
    WHEN _Reference71_2._Fld565_TYPE IS NULL OR
    _Reference71_2._Fld565_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_009_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld566_TYPE = 0x01 OR
    _Reference71._Fld566_TYPE = 0x08 AND _Reference71._Fld566_RTRef IS NOT NULL AND _Reference71._Fld566_RRRef IS NOT NULL
    THEN _Reference71._Fld566_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld566_TYPE = 0x01 OR
    _Reference71_1._Fld566_TYPE = 0x08 AND _Reference71_1._Fld566_RTRef IS NOT NULL AND _Reference71_1._Fld566_RRRef IS NOT NULL
    THEN _Reference71_1._Fld566_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld566_TYPE = 0x01 OR
    _Reference71_2._Fld566_TYPE = 0x08 AND _Reference71_2._Fld566_RTRef IS NOT NULL AND _Reference71_2._Fld566_RRRef IS NOT NULL
    THEN _Reference71_2._Fld566_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_010_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld566_TYPE = 0x08
    THEN _Reference71._Fld566_RTRef
    WHEN _Reference71._Fld566_TYPE IS NULL OR
    _Reference71._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld566_TYPE = 0x08
    THEN _Reference71_1._Fld566_RTRef
    WHEN _Reference71_1._Fld566_TYPE IS NULL OR
    _Reference71_1._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld566_TYPE = 0x08
    THEN _Reference71_2._Fld566_RTRef
    WHEN _Reference71_2._Fld566_TYPE IS NULL OR
    _Reference71_2._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_010_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld566_TYPE = 0x08
    THEN _Reference71._Fld566_RRRef
    WHEN _Reference71._Fld566_TYPE IS NULL OR
    _Reference71._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld566_TYPE = 0x08
    THEN _Reference71_1._Fld566_RRRef
    WHEN _Reference71_1._Fld566_TYPE IS NULL OR
    _Reference71_1._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld566_TYPE = 0x08
    THEN _Reference71_2._Fld566_RRRef
    WHEN _Reference71_2._Fld566_TYPE IS NULL OR
    _Reference71_2._Fld566_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_010_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld567_TYPE = 0x01 OR
    _Reference71._Fld567_TYPE = 0x08 AND _Reference71._Fld567_RTRef IS NOT NULL AND _Reference71._Fld567_RRRef IS NOT NULL
    THEN _Reference71._Fld567_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld567_TYPE = 0x01 OR
    _Reference71_1._Fld567_TYPE = 0x08 AND _Reference71_1._Fld567_RTRef IS NOT NULL AND _Reference71_1._Fld567_RRRef IS NOT NULL
    THEN _Reference71_1._Fld567_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld567_TYPE = 0x01 OR
    _Reference71_2._Fld567_TYPE = 0x08 AND _Reference71_2._Fld567_RTRef IS NOT NULL AND _Reference71_2._Fld567_RRRef IS NOT NULL
    THEN _Reference71_2._Fld567_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_011_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld567_TYPE = 0x08
    THEN _Reference71._Fld567_RTRef
    WHEN _Reference71._Fld567_TYPE IS NULL OR
    _Reference71._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld567_TYPE = 0x08
    THEN _Reference71_1._Fld567_RTRef
    WHEN _Reference71_1._Fld567_TYPE IS NULL OR
    _Reference71_1._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld567_TYPE = 0x08
    THEN _Reference71_2._Fld567_RTRef
    WHEN _Reference71_2._Fld567_TYPE IS NULL OR
    _Reference71_2._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_011_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld567_TYPE = 0x08
    THEN _Reference71._Fld567_RRRef
    WHEN _Reference71._Fld567_TYPE IS NULL OR
    _Reference71._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld567_TYPE = 0x08
    THEN _Reference71_1._Fld567_RRRef
    WHEN _Reference71_1._Fld567_TYPE IS NULL OR
    _Reference71_1._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld567_TYPE = 0x08
    THEN _Reference71_2._Fld567_RRRef
    WHEN _Reference71_2._Fld567_TYPE IS NULL OR
    _Reference71_2._Fld567_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_011_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld568RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld568RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld568RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_012RRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld572RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld572RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld572RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_013RRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld569_TYPE = 0x01 OR
    _Reference71._Fld569_TYPE = 0x08 AND _Reference71._Fld569_RTRef IS NOT NULL AND _Reference71._Fld569_RRRef IS NOT NULL
    THEN _Reference71._Fld569_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld569_TYPE = 0x01 OR
    _Reference71_1._Fld569_TYPE = 0x08 AND _Reference71_1._Fld569_RTRef IS NOT NULL AND _Reference71_1._Fld569_RRRef IS NOT NULL
    THEN _Reference71_1._Fld569_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld569_TYPE = 0x01 OR
    _Reference71_2._Fld569_TYPE = 0x08 AND _Reference71_2._Fld569_RTRef IS NOT NULL AND _Reference71_2._Fld569_RRRef IS NOT NULL
    THEN _Reference71_2._Fld569_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_014_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld569_TYPE = 0x08
    THEN _Reference71._Fld569_RTRef
    WHEN _Reference71._Fld569_TYPE IS NULL OR
    _Reference71._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld569_TYPE = 0x08
    THEN _Reference71_1._Fld569_RTRef
    WHEN _Reference71_1._Fld569_TYPE IS NULL OR
    _Reference71_1._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld569_TYPE = 0x08
    THEN _Reference71_2._Fld569_RTRef
    WHEN _Reference71_2._Fld569_TYPE IS NULL OR
    _Reference71_2._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_014_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld569_TYPE = 0x08
    THEN _Reference71._Fld569_RRRef
    WHEN _Reference71._Fld569_TYPE IS NULL OR
    _Reference71._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld569_TYPE = 0x08
    THEN _Reference71_1._Fld569_RRRef
    WHEN _Reference71_1._Fld569_TYPE IS NULL OR
    _Reference71_1._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld569_TYPE = 0x08
    THEN _Reference71_2._Fld569_RRRef
    WHEN _Reference71_2._Fld569_TYPE IS NULL OR
    _Reference71_2._Fld569_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_014_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld570_TYPE = 0x01 OR
    _Reference71._Fld570_TYPE = 0x08 AND _Reference71._Fld570_RTRef IS NOT NULL AND _Reference71._Fld570_RRRef IS NOT NULL
    THEN _Reference71._Fld570_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld570_TYPE = 0x01 OR
    _Reference71_1._Fld570_TYPE = 0x08 AND _Reference71_1._Fld570_RTRef IS NOT NULL AND _Reference71_1._Fld570_RRRef IS NOT NULL
    THEN _Reference71_1._Fld570_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld570_TYPE = 0x01 OR
    _Reference71_2._Fld570_TYPE = 0x08 AND _Reference71_2._Fld570_RTRef IS NOT NULL AND _Reference71_2._Fld570_RRRef IS NOT NULL
    THEN _Reference71_2._Fld570_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_015_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld570_TYPE = 0x08
    THEN _Reference71._Fld570_RTRef
    WHEN _Reference71._Fld570_TYPE IS NULL OR
    _Reference71._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld570_TYPE = 0x08
    THEN _Reference71_1._Fld570_RTRef
    WHEN _Reference71_1._Fld570_TYPE IS NULL OR
    _Reference71_1._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld570_TYPE = 0x08
    THEN _Reference71_2._Fld570_RTRef
    WHEN _Reference71_2._Fld570_TYPE IS NULL OR
    _Reference71_2._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_015_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld570_TYPE = 0x08
    THEN _Reference71._Fld570_RRRef
    WHEN _Reference71._Fld570_TYPE IS NULL OR
    _Reference71._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld570_TYPE = 0x08
    THEN _Reference71_1._Fld570_RRRef
    WHEN _Reference71_1._Fld570_TYPE IS NULL OR
    _Reference71_1._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld570_TYPE = 0x08
    THEN _Reference71_2._Fld570_RRRef
    WHEN _Reference71_2._Fld570_TYPE IS NULL OR
    _Reference71_2._Fld570_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_015_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld571_TYPE = 0x01 OR
    _Reference71._Fld571_TYPE = 0x08 AND _Reference71._Fld571_RTRef IS NOT NULL AND _Reference71._Fld571_RRRef IS NOT NULL
    THEN _Reference71._Fld571_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld571_TYPE = 0x01 OR
    _Reference71_1._Fld571_TYPE = 0x08 AND _Reference71_1._Fld571_RTRef IS NOT NULL AND _Reference71_1._Fld571_RRRef IS NOT NULL
    THEN _Reference71_1._Fld571_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld571_TYPE = 0x01 OR
    _Reference71_2._Fld571_TYPE = 0x08 AND _Reference71_2._Fld571_RTRef IS NOT NULL AND _Reference71_2._Fld571_RRRef IS NOT NULL
    THEN _Reference71_2._Fld571_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_016_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld571_TYPE = 0x08
    THEN _Reference71._Fld571_RTRef
    WHEN _Reference71._Fld571_TYPE IS NULL OR
    _Reference71._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld571_TYPE = 0x08
    THEN _Reference71_1._Fld571_RTRef
    WHEN _Reference71_1._Fld571_TYPE IS NULL OR
    _Reference71_1._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld571_TYPE = 0x08
    THEN _Reference71_2._Fld571_RTRef
    WHEN _Reference71_2._Fld571_TYPE IS NULL OR
    _Reference71_2._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_016_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld571_TYPE = 0x08
    THEN _Reference71._Fld571_RRRef
    WHEN _Reference71._Fld571_TYPE IS NULL OR
    _Reference71._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld571_TYPE = 0x08
    THEN _Reference71_1._Fld571_RRRef
    WHEN _Reference71_1._Fld571_TYPE IS NULL OR
    _Reference71_1._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld571_TYPE = 0x08
    THEN _Reference71_2._Fld571_RRRef
    WHEN _Reference71_2._Fld571_TYPE IS NULL OR
    _Reference71_2._Fld571_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_016_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld573_TYPE = 0x01 OR
    _Reference71._Fld573_TYPE = 0x08 AND _Reference71._Fld573_RTRef IS NOT NULL AND _Reference71._Fld573_RRRef IS NOT NULL
    THEN _Reference71._Fld573_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld573_TYPE = 0x01 OR
    _Reference71_1._Fld573_TYPE = 0x08 AND _Reference71_1._Fld573_RTRef IS NOT NULL AND _Reference71_1._Fld573_RRRef IS NOT NULL
    THEN _Reference71_1._Fld573_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld573_TYPE = 0x01 OR
    _Reference71_2._Fld573_TYPE = 0x08 AND _Reference71_2._Fld573_RTRef IS NOT NULL AND _Reference71_2._Fld573_RRRef IS NOT NULL
    THEN _Reference71_2._Fld573_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_017_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld573_TYPE = 0x08
    THEN _Reference71._Fld573_RTRef
    WHEN _Reference71._Fld573_TYPE IS NULL OR
    _Reference71._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld573_TYPE = 0x08
    THEN _Reference71_1._Fld573_RTRef
    WHEN _Reference71_1._Fld573_TYPE IS NULL OR
    _Reference71_1._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld573_TYPE = 0x08
    THEN _Reference71_2._Fld573_RTRef
    WHEN _Reference71_2._Fld573_TYPE IS NULL OR
    _Reference71_2._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_017_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld573_TYPE = 0x08
    THEN _Reference71._Fld573_RRRef
    WHEN _Reference71._Fld573_TYPE IS NULL OR
    _Reference71._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld573_TYPE = 0x08
    THEN _Reference71_1._Fld573_RRRef
    WHEN _Reference71_1._Fld573_TYPE IS NULL OR
    _Reference71_1._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld573_TYPE = 0x08
    THEN _Reference71_2._Fld573_RRRef
    WHEN _Reference71_2._Fld573_TYPE IS NULL OR
    _Reference71_2._Fld573_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_017_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld574_TYPE = 0x01 OR
    _Reference71._Fld574_TYPE = 0x08 AND _Reference71._Fld574_RTRef IS NOT NULL AND _Reference71._Fld574_RRRef IS NOT NULL
    THEN _Reference71._Fld574_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld574_TYPE = 0x01 OR
    _Reference71_1._Fld574_TYPE = 0x08 AND _Reference71_1._Fld574_RTRef IS NOT NULL AND _Reference71_1._Fld574_RRRef IS NOT NULL
    THEN _Reference71_1._Fld574_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld574_TYPE = 0x01 OR
    _Reference71_2._Fld574_TYPE = 0x08 AND _Reference71_2._Fld574_RTRef IS NOT NULL AND _Reference71_2._Fld574_RRRef IS NOT NULL
    THEN _Reference71_2._Fld574_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_018_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld574_TYPE = 0x08
    THEN _Reference71._Fld574_RTRef
    WHEN _Reference71._Fld574_TYPE IS NULL OR
    _Reference71._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld574_TYPE = 0x08
    THEN _Reference71_1._Fld574_RTRef
    WHEN _Reference71_1._Fld574_TYPE IS NULL OR
    _Reference71_1._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld574_TYPE = 0x08
    THEN _Reference71_2._Fld574_RTRef
    WHEN _Reference71_2._Fld574_TYPE IS NULL OR
    _Reference71_2._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_018_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld574_TYPE = 0x08
    THEN _Reference71._Fld574_RRRef
    WHEN _Reference71._Fld574_TYPE IS NULL OR
    _Reference71._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld574_TYPE = 0x08
    THEN _Reference71_1._Fld574_RRRef
    WHEN _Reference71_1._Fld574_TYPE IS NULL OR
    _Reference71_1._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld574_TYPE = 0x08
    THEN _Reference71_2._Fld574_RRRef
    WHEN _Reference71_2._Fld574_TYPE IS NULL OR
    _Reference71_2._Fld574_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_018_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld575_TYPE = 0x01 OR
    _Reference71._Fld575_TYPE = 0x08 AND _Reference71._Fld575_RTRef IS NOT NULL AND _Reference71._Fld575_RRRef IS NOT NULL
    THEN _Reference71._Fld575_TYPE
    ELSE NULL
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld575_TYPE = 0x01 OR
    _Reference71_1._Fld575_TYPE = 0x08 AND _Reference71_1._Fld575_RTRef IS NOT NULL AND _Reference71_1._Fld575_RRRef IS NOT NULL
    THEN _Reference71_1._Fld575_TYPE
    ELSE NULL
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld575_TYPE = 0x01 OR
    _Reference71_2._Fld575_TYPE = 0x08 AND _Reference71_2._Fld575_RTRef IS NOT NULL AND _Reference71_2._Fld575_RRRef IS NOT NULL
    THEN _Reference71_2._Fld575_TYPE
    ELSE NULL
    END
    ELSE CASE
    WHEN 0x01 = 0x01
    THEN 0x01
    ELSE NULL
    END
    END _Q_006_F_019_TYPE,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld575_TYPE = 0x08
    THEN _Reference71._Fld575_RTRef
    WHEN _Reference71._Fld575_TYPE IS NULL OR
    _Reference71._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld575_TYPE = 0x08
    THEN _Reference71_1._Fld575_RTRef
    WHEN _Reference71_1._Fld575_TYPE IS NULL OR
    _Reference71_1._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld575_TYPE = 0x08
    THEN _Reference71_2._Fld575_RTRef
    WHEN _Reference71_2._Fld575_TYPE IS NULL OR
    _Reference71_2._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(4))
    ELSE 0x00000000
    END
    END _Q_006_F_019_RTRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71._Fld575_TYPE = 0x08
    THEN _Reference71._Fld575_RRRef
    WHEN _Reference71._Fld575_TYPE IS NULL OR
    _Reference71._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_1._Fld575_TYPE = 0x08
    THEN _Reference71_1._Fld575_RRRef
    WHEN _Reference71_1._Fld575_TYPE IS NULL OR
    _Reference71_1._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN CASE
    WHEN _Reference71_2._Fld575_TYPE = 0x08
    THEN _Reference71_2._Fld575_RRRef
    WHEN _Reference71_2._Fld575_TYPE IS NULL OR
    _Reference71_2._Fld575_TYPE NOT IN (0x01,0x08)
    THEN NULL
    ELSE 0x00000000000000000000000000000000
    END
    ELSE CASE
    WHEN 0x01 IS NULL OR
    0x01 NOT IN (0x01,0x08)
    THEN CAST(NULL AS BINARY(16))
    ELSE 0x00000000000000000000000000000000
    END
    END _Q_006_F_019_RRRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld576RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld576RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld576RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_020RRef,
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _Reference71._Fld577RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_1._Fld577RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN _Reference71_2._Fld577RRef
    ELSE 0x00000000000000000000000000000000
    END _Q_006_F_021RRef,
    CASE
    WHEN _CalcKind282._Fld3981 = 0x01
    THEN _InfoReg3401_Q_006_T_005._Fld3405
    ELSE CAST(NULL AS NUMERIC(8,5))
    END _Q_006_F_022,
    CASE
    WHEN _CalcKind282._Fld3981 = 0x01
    THEN _InfoReg3401_Q_006_T_005._Fld3406RRef
    ELSE CAST(NULL AS BINARY(16))
    END _Q_006_F_023RRef,
    CASE
    WHEN _CalcKind282._Fld3981 = 0x01
    THEN _InfoReg3401_Q_006_T_005._Fld3407RRef
    ELSE CAST(NULL AS BINARY(16))
    END _Q_006_F_024RRef,
    _CalcReg4113_Q_006_T_001._CalcKindRRef _Q_006_F_025RRef,
    _CalcReg4113_Q_006_T_001._Fld4128RRef _Q_006_F_026RRef,
    _CalcReg4113_Q_006_T_001._Fld4116RRef _Q_006_F_027RRef,
    _CalcReg4113_Q_006_T_001._Fld4117 _Q_006_F_028,
    _CalcReg4113_Q_006_T_001._APDateFrom _Q_006_F_029,
    _CalcReg4113_Q_006_T_001._APDateTill _Q_006_F_030,
    _CalcReg4113_Q_006_T_001._Storno _Q_006_F_031,
    _CalcReg4113_Q_006_T_001._Fld4124RRef _Q_006_F_032RRef,
    _CalcReg4113_Q_006_T_001._Fld4125RRef _Q_006_F_033RRef,
    _CalcReg4113_Q_006_T_001._Fld4131 _Q_006_F_034,
    _CalcKind282._Fld3973RRef _Q_006_F_035RRef,
    _CalcKind282._Fld3977RRef _Q_006_F_036RRef,
    CASE
    WHEN _CalcReg4113_Q_006_T_001._RecorderTRef = 0x0000007B
    THEN _Document123._Fld1524RRef
    ELSE CAST(NULL AS BINARY(16))
    END _Q_006_F_037RRef
    FROM
    _CalcReg4113 _CalcReg4113_Q_006_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_Q_006_T_001._CalcKindRRef = _CalcKind282._IDRRef
    LEFT OUTER JOIN _InfoReg3458 _InfoReg3458_Q_006_T_002 WITH(NOLOCK)
    INNER JOIN (
    SELECT
    _CalcReg4113_Q_001_T_001._Fld4114RRef _Q_001_F_000RRef,
    _CalcReg4113_Q_001_T_001._Fld4115RRef _Q_001_F_001RRef,
    _CalcReg4113_Q_001_T_001._Fld4116RRef _Q_001_F_002RRef,
    _CalcReg4113_Q_001_T_001._CalcKindRRef _Q_001_F_003RRef,
    MAX(_InfoReg3458_Q_001_T_002._Period) _Q_001_F_004
    FROM
    _CalcReg4113 _CalcReg4113_Q_001_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _InfoReg3458 _InfoReg3458_Q_001_T_002 WITH(NOLOCK)
    ON _CalcReg4113_Q_001_T_001._Fld4114RRef = _InfoReg3458_Q_001_T_002._Fld3459RRef AND _CalcReg4113_Q_001_T_001._Fld4115RRef =
    _InfoReg3458_Q_001_T_002._Fld3460RRef AND _CalcReg4113_Q_001_T_001._Fld4116RRef = _InfoReg3458_Q_001_T_002._Fld3461RRef AND
    _InfoReg3458_Q_001_T_002._Fld3462_TYPE = 0x08 AND _InfoReg3458_Q_001_T_002._Fld3462_RTRef = 0x0000011A AND
    _CalcReg4113_Q_001_T_001._CalcKindRRef = _InfoReg3458_Q_001_T_002._Fld3462_RRRef AND _InfoReg3458_Q_001_T_002._Period <=
    _CalcReg4113_Q_001_T_001._APDateFrom
    WHERE
    _CalcReg4113_Q_001_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_001_T_001._Period = @P2
    GROUP BY
    _CalcReg4113_Q_001_T_001._Fld4114RRef,
    _CalcReg4113_Q_001_T_001._Fld4115RRef,
    _CalcReg4113_Q_001_T_001._Fld4116RRef,
    _CalcReg4113_Q_001_T_001._CalcKindRRef
    ) #V8TblAli1_Q_006_T_003
    ON #V8TblAli1_Q_006_T_003._Q_001_F_000RRef = _InfoReg3458_Q_006_T_002._Fld3459RRef AND #V8TblAli1_Q_006_T_003._Q_001_F_001RRef =
    _InfoReg3458_Q_006_T_002._Fld3460RRef AND #V8TblAli1_Q_006_T_003._Q_001_F_002RRef = _InfoReg3458_Q_006_T_002._Fld3461RRef AND
    _InfoReg3458_Q_006_T_002._Fld3462_TYPE = 0x08 AND _InfoReg3458_Q_006_T_002._Fld3462_RTRef = 0x0000011A AND
    #V8TblAli1_Q_006_T_003._Q_001_F_003RRef = _InfoReg3458_Q_006_T_002._Fld3462_RRRef AND #V8TblAli1_Q_006_T_003._Q_001_F_004 =
    _InfoReg3458_Q_006_T_002._Period
    ON _InfoReg3458_Q_006_T_002._Fld3459RRef = _CalcReg4113_Q_006_T_001._Fld4114RRef AND _InfoReg3458_Q_006_T_002._Fld3460RRef =
    _CalcReg4113_Q_006_T_001._Fld4115RRef AND _InfoReg3458_Q_006_T_002._Fld3461RRef = _CalcReg4113_Q_006_T_001._Fld4116RRef AND
    _InfoReg3458_Q_006_T_002._Fld3462_TYPE = 0x08 AND _InfoReg3458_Q_006_T_002._Fld3462_RTRef = 0x0000011A AND
    _InfoReg3458_Q_006_T_002._Fld3462_RRRef = _CalcReg4113_Q_006_T_001._CalcKindRRef
    LEFT OUTER JOIN (
    SELECT
    _InfoReg3695_Q_003_T_001._Fld3699RRef _Q_003_F_000RRef,
    #V8TblAli1_Q_003_T_002._Q_002_F_000RRef _Q_003_F_001RRef,
    #V8TblAli1_Q_003_T_002._Q_002_F_001RRef _Q_003_F_002RRef,
    #V8TblAli1_Q_003_T_002._Q_002_F_002RRef _Q_003_F_003RRef,
    #V8TblAli1_Q_003_T_002._Q_002_F_003 _Q_003_F_004,
    #V8TblAli1_Q_003_T_002._Q_002_F_004 _Q_003_F_005
    FROM
    _InfoReg3695 _InfoReg3695_Q_003_T_001 WITH(NOLOCK)
    INNER JOIN (
    SELECT
    _CalcReg4113_Q_002_T_001._Fld4114RRef _Q_002_F_000RRef,
    _CalcReg4113_Q_002_T_001._Fld4115RRef _Q_002_F_001RRef,
    _CalcReg4113_Q_002_T_001._Fld4116RRef _Q_002_F_002RRef,
    MAX(_InfoReg3695_Q_002_T_002._Period) _Q_002_F_003,
    _CalcReg4113_Q_002_T_001._APDateFrom _Q_002_F_004
    FROM
    _CalcReg4113 _CalcReg4113_Q_002_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _InfoReg3695 _InfoReg3695_Q_002_T_002 WITH(NOLOCK)
    ON _CalcReg4113_Q_002_T_001._Fld4114RRef = _InfoReg3695_Q_002_T_002._Fld3696RRef AND _CalcReg4113_Q_002_T_001._Fld4115RRef =
    _InfoReg3695_Q_002_T_002._Fld3697RRef AND _CalcReg4113_Q_002_T_001._Fld4116RRef = _InfoReg3695_Q_002_T_002._Fld3698RRef AND
    _InfoReg3695_Q_002_T_002._Period <= _CalcReg4113_Q_002_T_001._APDateFrom
    WHERE
    _CalcReg4113_Q_002_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_002_T_001._Period = @P2
    GROUP BY
    _CalcReg4113_Q_002_T_001._Fld4114RRef,
    _CalcReg4113_Q_002_T_001._Fld4115RRef,
    _CalcReg4113_Q_002_T_001._Fld4116RRef,
    _CalcReg4113_Q_002_T_001._APDateFrom
    ) #V8TblAli1_Q_003_T_002
    ON #V8TblAli1_Q_003_T_002._Q_002_F_000RRef = _InfoReg3695_Q_003_T_001._Fld3696RRef AND #V8TblAli1_Q_003_T_002._Q_002_F_001RRef =
    _InfoReg3695_Q_003_T_001._Fld3697RRef AND #V8TblAli1_Q_003_T_002._Q_002_F_002RRef = _InfoReg3695_Q_003_T_001._Fld3698RRef AND
    #V8TblAli1_Q_003_T_002._Q_002_F_003 = _InfoReg3695_Q_003_T_001._Period
    ) #V8TblAli2_Q_006_T_004
    ON _CalcReg4113_Q_006_T_001._APDateFrom = #V8TblAli2_Q_006_T_004._Q_003_F_005 AND _CalcReg4113_Q_006_T_001._Fld4114RRef =
    #V8TblAli2_Q_006_T_004._Q_003_F_001RRef AND _CalcReg4113_Q_006_T_001._Fld4115RRef = #V8TblAli2_Q_006_T_004._Q_003_F_002RRef AND
    _CalcReg4113_Q_006_T_001._Fld4116RRef = #V8TblAli2_Q_006_T_004._Q_003_F_003RRef
    LEFT OUTER JOIN _InfoReg3401 _InfoReg3401_Q_006_T_005 WITH(NOLOCK)
    INNER JOIN (
    SELECT
    _CalcReg4113_Q_004_T_001._Fld4114RRef _Q_004_F_000RRef,
    _CalcReg4113_Q_004_T_001._Fld4116RRef _Q_004_F_001RRef,
    MAX(_InfoReg3401_Q_004_T_002._Period) _Q_004_F_002,
    _CalcReg4113_Q_004_T_001._Fld4115RRef _Q_004_F_003RRef
    FROM
    _CalcReg4113 _CalcReg4113_Q_004_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _InfoReg3401 _InfoReg3401_Q_004_T_002 WITH(NOLOCK)
    ON _CalcReg4113_Q_004_T_001._Fld4114RRef = _InfoReg3401_Q_004_T_002._Fld3402RRef AND _CalcReg4113_Q_004_T_001._Fld4116RRef =
    _InfoReg3401_Q_004_T_002._Fld3404RRef AND _InfoReg3401_Q_004_T_002._Period <= _CalcReg4113_Q_004_T_001._APDateFrom AND
    _CalcReg4113_Q_004_T_001._Fld4115RRef = _InfoReg3401_Q_004_T_002._Fld3403RRef
    WHERE
    _CalcReg4113_Q_004_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_004_T_001._Period = @P2
    GROUP BY
    _CalcReg4113_Q_004_T_001._Fld4114RRef,
    _CalcReg4113_Q_004_T_001._Fld4116RRef,
    _CalcReg4113_Q_004_T_001._Fld4115RRef
    ) #V8TblAli3_Q_006_T_006
    ON #V8TblAli3_Q_006_T_006._Q_004_F_000RRef = _InfoReg3401_Q_006_T_005._Fld3402RRef AND #V8TblAli3_Q_006_T_006._Q_004_F_001RRef =
    _InfoReg3401_Q_006_T_005._Fld3404RRef AND #V8TblAli3_Q_006_T_006._Q_004_F_002 = _InfoReg3401_Q_006_T_005._Period AND
    _InfoReg3401_Q_006_T_005._Fld3403RRef = #V8TblAli3_Q_006_T_006._Q_004_F_003RRef
    ON _InfoReg3401_Q_006_T_005._Fld3402RRef = _CalcReg4113_Q_006_T_001._Fld4114RRef AND _InfoReg3401_Q_006_T_005._Fld3404RRef =
    _CalcReg4113_Q_006_T_001._Fld4116RRef
    LEFT OUTER JOIN _CalcReg4040 _CalcReg4040_Q_006_T_007 WITH(NOLOCK)
    ON _CalcReg4040_Q_006_T_007._Fld4041RRef = _CalcReg4113_Q_006_T_001._Fld4114RRef AND _CalcReg4040_Q_006_T_007._Fld4043RRef =
    _CalcReg4113_Q_006_T_001._Fld4116RRef AND _CalcReg4040_Q_006_T_007._CalcKindRRef = _CalcReg4113_Q_006_T_001._CalcKindRRef AND
    _CalcReg4040_Q_006_T_007._APDateFrom = _CalcReg4113_Q_006_T_001._APDateFrom AND _CalcReg4040_Q_006_T_007._APDateTill =
    _CalcReg4113_Q_006_T_001._APDateTill AND _CalcReg4113_Q_006_T_001._Fld4115RRef = _CalcReg4040_Q_006_T_007._Fld4042RRef
    LEFT OUTER JOIN (
    SELECT
    _Document129_Q_005_T_002._IDRRef _Q_005_F_000RRef,
    _Document129_VT1725_Q_005_T_001._Fld1727RRef _Q_005_F_001RRef,
    _Document129_VT1725_Q_005_T_001._Fld4949RRef _Q_005_F_002RRef,
    _Document129_VT1725_Q_005_T_001._Fld4950RRef _Q_005_F_003RRef
    FROM
    _Document129_VT1725 _Document129_VT1725_Q_005_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _Document129 _Document129_Q_005_T_002 WITH(NOLOCK)
    ON _Document129_VT1725_Q_005_T_001._Document129_IDRRef = _Document129_Q_005_T_002._IDRRef
    ) #V8TblAli4_Q_006_T_008
    ON _CalcReg4113_Q_006_T_001._RecorderTRef = 0x00000081 AND _CalcReg4113_Q_006_T_001._RecorderRRef = #V8TblAli4_Q_006_T_008._Q_005_F_000RRef
    LEFT OUTER JOIN _Document123 WITH(NOLOCK)
    ON _CalcReg4113_Q_006_T_001._RecorderTRef = 0x0000007B AND _CalcReg4113_Q_006_T_001._RecorderRRef = _Document123._IDRRef
    LEFT OUTER JOIN _Reference71 _Reference71_1 WITH(NOLOCK)
    ON _CalcKind282._Fld3976RRef = _Reference71_1._IDRRef
    LEFT OUTER JOIN _Reference71 WITH(NOLOCK)
    ON _InfoReg3458_Q_006_T_002._Fld3463RRef = _Reference71._IDRRef
    LEFT OUTER JOIN _Reference71 _Reference71_2 WITH(NOLOCK)
    ON #V8TblAli2_Q_006_T_004._Q_003_F_000RRef = _Reference71_2._IDRRef
    WHERE
    _CalcReg4040_Q_006_T_007._Fld4041RRef IS NULL AND _CalcReg4113_Q_006_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_006_T_001._Period = @P2 AND
    CASE
    WHEN _InfoReg3458_Q_006_T_002._Fld3463RRef <> 0x00000000000000000000000000000000
    THEN _InfoReg3458_Q_006_T_002._Fld3463RRef
    WHEN _CalcKind282._Fld3976RRef <> 0x00000000000000000000000000000000
    THEN _CalcKind282._Fld3976RRef
    WHEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef <> 0x00000000000000000000000000000000
    THEN #V8TblAli2_Q_006_T_004._Q_003_F_000RRef
    ELSE 0xb227ba250496a1234a845c6e56705bdf
    END <> @P3 AND _CalcKind282._Fld3973RRef <> @P4
    ) #V8TblAli1_Q_000_T_001
    LEFT OUTER JOIN _Acc1_ExtDim3950 _Acc1_ExtDim3950_Q_000_T_002 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_004RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_004RRef =
    _Acc1_ExtDim3950_Q_000_T_002._Acc1_IDRRef AND _Acc1_ExtDim3950_Q_000_T_002._DimKindRRef = 0x870cef15904ca7e347798bbfc30f780b
    LEFT OUTER JOIN _Acc1_ExtDim3950 _Acc1_ExtDim3950_Q_000_T_003 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_005RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_005RRef =
    _Acc1_ExtDim3950_Q_000_T_003._Acc1_IDRRef AND _Acc1_ExtDim3950_Q_000_T_003._DimKindRRef = 0x870cef15904ca7e347798bbfc30f780b
    LEFT OUTER JOIN _Acc1_ExtDim3950 _Acc1_ExtDim3950_Q_000_T_004 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_004RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_004RRef =
    _Acc1_ExtDim3950_Q_000_T_004._Acc1_IDRRef AND _Acc1_ExtDim3950_Q_000_T_004._DimKindRRef = 0xae9e83155956fd114934fec363b26cf0
    LEFT OUTER JOIN _Acc1_ExtDim3950 _Acc1_ExtDim3950_Q_000_T_005 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_004RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_004RRef =
    _Acc1_ExtDim3950_Q_000_T_005._Acc1_IDRRef AND _Acc1_ExtDim3950_Q_000_T_005._DimKindRRef = 0xb1cccf7913896204431152bb6a6ada17
    LEFT OUTER JOIN _Acc2_ExtDim3953 _Acc2_ExtDim3953_Q_000_T_006 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_013RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_013RRef =
    _Acc2_ExtDim3953_Q_000_T_006._Acc2_IDRRef AND _Acc2_ExtDim3953_Q_000_T_006._DimKindRRef = 0x9a81c4f3e5a65569419526bd2cac1c61
    LEFT OUTER JOIN _Acc2_ExtDim3953 _Acc2_ExtDim3953_Q_000_T_007 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_012RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_012RRef =
    _Acc2_ExtDim3953_Q_000_T_007._Acc2_IDRRef AND _Acc2_ExtDim3953_Q_000_T_007._DimKindRRef = 0x870cef15904ca7e347798bbfc30f780b
    LEFT OUTER JOIN _Acc2_ExtDim3953 _Acc2_ExtDim3953_Q_000_T_008 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_013RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_013RRef =
    _Acc2_ExtDim3953_Q_000_T_008._Acc2_IDRRef AND _Acc2_ExtDim3953_Q_000_T_008._DimKindRRef = 0x870cef15904ca7e347798bbfc30f780b
    LEFT OUTER JOIN _Acc2_ExtDim3953 _Acc2_ExtDim3953_Q_000_T_009 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_012RRef <> 0x00000000000000000000000000000000 AND #V8TblAli1_Q_000_T_001._Q_006_F_012RRef =
    _Acc2_ExtDim3953_Q_000_T_009._Acc2_IDRRef AND _Acc2_ExtDim3953_Q_000_T_009._DimKindRRef = 0xae9e83155956fd114934fec363b26cf0
    LEFT OUTER JOIN (
    SELECT
    #V8TblAli1_RESULT._RecorderTRef _RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef _RecorderRRef,
    #V8TblAli1_RESULT._LineNo _LineNo,
    SUM(#V8TblAli1_RESULT._Fld4044Base) _Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef _Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE _Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef _Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef _Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE _Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef _Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef _Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE _Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef _Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef _Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef _Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE _Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef _Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef _Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE _Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef _Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef _Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE _Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef _Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef _Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef _Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE _Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef _Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef _Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE _Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef _Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef _Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE _Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef _Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef _Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef _Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE _Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef _Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef _Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE _Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef _Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef _Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE _Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef _Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef _Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef _Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef _Fld4064DimRRef
    FROM
    (
    SELECT
    #V8TblAli1_RESULT._RecorderTRef _RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef _RecorderRRef,
    #V8TblAli1_RESULT._LineNo _LineNo,
    CAST(#V8TblAli1_RESULT._Fld4044Base * CASE
    WHEN #V8TblAli1_RESULT._CALEND = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(1 AS NUMERIC(1,0)) AS NUMERIC(22,10))
    ELSE CAST(CAST(SUM(_InfoReg2989._Fld2994) AS NUMERIC(16,6)) / #V8TblAli1_RESULT._CALEND AS NUMERIC(22,10))
    END AS NUMERIC(38,10)) _Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef _Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE _Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef _Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef _Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE _Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef _Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef _Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE _Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef _Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef _Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef _Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE _Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef _Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef _Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE _Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef _Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef _Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE _Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef _Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef _Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef _Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE _Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef _Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef _Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE _Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef _Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef _Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE _Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef _Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef _Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef _Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE _Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef _Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef _Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE _Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef _Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef _Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE _Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef _Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef _Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef _Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef _Fld4064DimRRef
    FROM
    (
    SELECT
    _CalcReg4113_MAIN._RecorderTRef _RecorderTRef,
    _CalcReg4113_MAIN._RecorderRRef _RecorderRRef,
    _CalcReg4113_MAIN._LineNo _LineNo,
    SUM(#TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4044) _Fld4044Base,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4047RRef _Fld4047DimRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_TYPE _Fld4048Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_RTRef _Fld4048Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_RRRef _Fld4048Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_TYPE _Fld4049Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_RTRef _Fld4049Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_RRRef _Fld4049Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_TYPE _Fld4050Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_RTRef _Fld4050Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_RRRef _Fld4050Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4051RRef _Fld4051DimRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_TYPE _Fld4052Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_RTRef _Fld4052Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_RRRef _Fld4052Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_TYPE _Fld4053Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_RTRef _Fld4053Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_RRRef _Fld4053Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_TYPE _Fld4054Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_RTRef _Fld4054Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_RRRef _Fld4054Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4055RRef _Fld4055DimRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_TYPE _Fld4056Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_RTRef _Fld4056Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_RRRef _Fld4056Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_TYPE _Fld4057Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_RTRef _Fld4057Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_RRRef _Fld4057Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_TYPE _Fld4058Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_RTRef _Fld4058Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_RRRef _Fld4058Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4059RRef _Fld4059DimRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_TYPE _Fld4060Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_RTRef _Fld4060Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_RRRef _Fld4060Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_TYPE _Fld4061Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_RTRef _Fld4061Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_RRRef _Fld4061Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_TYPE _Fld4062Dim_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_RTRef _Fld4062Dim_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_RRRef _Fld4062Dim_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4063RRef _Fld4063DimRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4064RRef _Fld4064DimRRef,
    #V8TblAli1_CALEND_BY_RECORD._CALEND _CALEND,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4045RRef _Fld4045IRRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4046RRef _Fld4046IRRRef,
    CASE
    WHEN CASE
    WHEN NOT _CalcKind282_CK._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateFrom
    WHEN _CalcRegActPer4136_MAINACTPER._APDateFrom IS NULL
    THEN _CalcReg4113_MAIN._APDateFrom
    ELSE _CalcRegActPer4136_MAINACTPER._APDateFrom
    END > #TMPb327219248193e294c27f8480c03d364_SLAVE._DATEFROM
    THEN CASE
    WHEN NOT _CalcKind282_CK._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateFrom
    WHEN _CalcRegActPer4136_MAINACTPER._APDateFrom IS NULL
    THEN _CalcReg4113_MAIN._APDateFrom
    ELSE _CalcRegActPer4136_MAINACTPER._APDateFrom
    END
    ELSE #TMPb327219248193e294c27f8480c03d364_SLAVE._DATEFROM
    END _DATEFROM,
    CASE
    WHEN CASE
    WHEN NOT _CalcKind282._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateTill
    WHEN _CalcRegActPer4136_MAINACTPER._APDateTill IS NULL
    THEN _CalcReg4113_MAIN._APDateTill
    ELSE _CalcRegActPer4136_MAINACTPER._APDateTill
    END < #TMPb327219248193e294c27f8480c03d364_SLAVE._DATETILL
    THEN CASE
    WHEN NOT _CalcKind282_CK._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateTill
    WHEN _CalcRegActPer4136_MAINACTPER._APDateTill IS NULL
    THEN _CalcReg4113_MAIN._APDateTill
    ELSE _CalcRegActPer4136_MAINACTPER._APDateTill
    END
    ELSE #TMPb327219248193e294c27f8480c03d364_SLAVE._DATETILL
    END _DATETILL
    FROM
    _CalcReg4113 _CalcReg4113_MAIN WITH(NOLOCK)
    INNER JOIN _CalcKind282 _CalcKind282_CK WITH(NOLOCK)
    ON _CalcKind282_CK._IDRRef = _CalcReg4113_MAIN._CalcKindRRef
    LEFT OUTER JOIN _CalcRegActPer4136 _CalcRegActPer4136_MAINACTPER WITH(NOLOCK)
    ON _CalcReg4113_MAIN._RecorderTRef = _CalcRegActPer4136_MAINACTPER._RecorderTRef AND _CalcReg4113_MAIN._RecorderRRef =
    _CalcRegActPer4136_MAINACTPER._RecorderRRef AND _CalcReg4113_MAIN._LineNo = _CalcRegActPer4136_MAINACTPER._LineNo AND
    _CalcKind282_CK._BaseAsAct = 0x01
    LEFT OUTER JOIN #tt5 #TMPb327219248193e294c27f8480c03d364_SLAVE WITH(NOLOCK)
    ON _CalcReg4113_MAIN._Fld4114RRef = #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4041RRef AND _CalcReg4113_MAIN._Fld4115RRef =
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4042RRef AND _CalcReg4113_MAIN._Fld4116RRef =
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4043RRef AND #TMPb327219248193e294c27f8480c03d364_SLAVE._DATEFROM <= CASE
    WHEN NOT _CalcKind282_CK._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateTill
    WHEN _CalcRegActPer4136_MAINACTPER._APDateTill IS NULL
    THEN _CalcReg4113_MAIN._APDateTill
    ELSE _CalcRegActPer4136_MAINACTPER._APDateTill
    END AND #TMPb327219248193e294c27f8480c03d364_SLAVE._DATETILL >= CASE
    WHEN NOT _CalcKind282_CK._BaseAsAct = 0x01
    THEN _CalcReg4113_MAIN._BPDateFrom
    WHEN _CalcRegActPer4136_MAINACTPER._APDateFrom IS NULL
    THEN _CalcReg4113_MAIN._APDateFrom
    ELSE _CalcRegActPer4136_MAINACTPER._APDateFrom
    END
    INNER JOIN _CalcKind282 WITH(NOLOCK)
    INNER JOIN _CalcKind282_BaseCK _CalcKind282_BaseCK_BASECALCKIND WITH(NOLOCK)
    ON _CalcKind282._IDRRef = _CalcKind282_BaseCK_BASECALCKIND._CalcKind282_IDRRef
    ON _CalcKind282_BaseCK_BASECALCKIND._BaseCKBaseCKRRef = #TMPb327219248193e294c27f8480c03d364_SLAVE._CalcKindRRef AND
    _CalcKind282_BaseCK_BASECALCKIND._CalcKind282_IDRRef = _CalcReg4113_MAIN._CalcKindRRef
    INNER JOIN (
    SELECT
    #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderTRef _RecorderTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderRRef _RecorderRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._LineNo _LineNo,
    SUM(#TMPb327219248193e294c27f8480c03d364_SLAVE._CALEND) _CALEND
    FROM
    #tt5 #TMPb327219248193e294c27f8480c03d364_SLAVE WITH(NOLOCK)
    GROUP BY
    #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._LineNo
    ) #V8TblAli1_CALEND_BY_RECORD
    ON #V8TblAli1_CALEND_BY_RECORD._RecorderTRef = #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderTRef AND
    #V8TblAli1_CALEND_BY_RECORD._RecorderRRef = #TMPb327219248193e294c27f8480c03d364_SLAVE._RecorderRRef AND #V8TblAli1_CALEND_BY_RECORD._LineNo
    = #TMPb327219248193e294c27f8480c03d364_SLAVE._LineNo
    LEFT OUTER JOIN _CalcKind282 _CalcKind282_1 WITH(NOLOCK)
    ON _CalcReg4113_MAIN._CalcKindRRef = _CalcKind282_1._IDRRef
    WHERE
    _CalcReg4113_MAIN._Fld4132RRef = @P1 AND _CalcReg4113_MAIN._Period = @P2 AND NOT _CalcKind282_1._Fld3973RRef IN
    (@P5,@P6,@P7,@P8,@P9,@P10,@P11) AND _CalcReg4113_MAIN._BPDateTill < @P2
    GROUP BY
    _CalcReg4113_MAIN._RecorderTRef,
    _CalcReg4113_MAIN._RecorderRRef,
    _CalcReg4113_MAIN._LineNo,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4047RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4048_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4049_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4050_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4051RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4052_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4053_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4054_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4055RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4056_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4057_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4058_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4059RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4060_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4061_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_TYPE,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_RTRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4062_RRRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4063RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4064RRef,
    #V8TblAli1_CALEND_BY_RECORD._CALEND,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4045RRef,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._Fld4046RRef,
    _CalcKind282_CK._BaseAsAct,
    _CalcKind282._BaseAsAct,
    _CalcReg4113_MAIN._BPDateFrom,
    _CalcReg4113_MAIN._BPDateTill,
    _CalcReg4113_MAIN._APDateFrom,
    _CalcReg4113_MAIN._APDateTill,
    _CalcRegActPer4136_MAINACTPER._APDateFrom,
    _CalcRegActPer4136_MAINACTPER._APDateTill,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._DATEFROM,
    #TMPb327219248193e294c27f8480c03d364_SLAVE._DATETILL
    ) #V8TblAli1_RESULT
    LEFT OUTER JOIN _InfoReg2989 WITH(NOLOCK)
    ON _InfoReg2989._Fld2992 >= #V8TblAli1_RESULT._DATEFROM AND _InfoReg2989._Fld2992 <= #V8TblAli1_RESULT._DATETILL AND
    #V8TblAli1_RESULT._Fld4045IRRRef = _InfoReg2989._Fld2990RRef AND #V8TblAli1_RESULT._Fld4046IRRRef = _InfoReg2989._Fld2991RRef
    GROUP BY
    #V8TblAli1_RESULT._RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef,
    #V8TblAli1_RESULT._LineNo,
    #V8TblAli1_RESULT._Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef,
    #V8TblAli1_RESULT._CALEND,
    #V8TblAli1_RESULT._DATEFROM,
    #V8TblAli1_RESULT._DATETILL
    ) #V8TblAli1_RESULT
    GROUP BY
    #V8TblAli1_RESULT._RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef,
    #V8TblAli1_RESULT._LineNo,
    #V8TblAli1_RESULT._Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef
    ) #V8TblAli2_Q_000_T_010
    ON (#V8TblAli1_Q_000_T_001._Q_006_F_004RRef = 0x00000000000000000000000000000000 OR
    #V8TblAli1_Q_000_T_001._Q_006_F_005RRef = 0x00000000000000000000000000000000) AND #V8TblAli1_Q_000_T_001._Q_006_F_000TRef =
    #V8TblAli2_Q_000_T_010._RecorderTRef AND #V8TblAli1_Q_000_T_001._Q_006_F_000RRef = #V8TblAli2_Q_000_T_010._RecorderRRef AND
    #V8TblAli1_Q_000_T_001._Q_006_F_001 = #V8TblAli2_Q_000_T_010._LineNo
    LEFT OUTER JOIN (
    SELECT
    _CalcReg4113_Q_008_T_001._RecorderTRef _Q_008_F_000TRef,
    _CalcReg4113_Q_008_T_001._RecorderRRef _Q_008_F_000RRef,
    _CalcReg4113_Q_008_T_001._LineNo _Q_008_F_001,
    #V8TblAli1_Q_008_T_002._Fld4047DimRRef _Q_008_F_002RRef,
    #V8TblAli1_Q_008_T_002._Fld4051DimRRef _Q_008_F_003RRef,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_TYPE _Q_008_F_004_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_RTRef _Q_008_F_004_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_RRRef _Q_008_F_004_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_TYPE _Q_008_F_005_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_RTRef _Q_008_F_005_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_RRRef _Q_008_F_005_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_TYPE _Q_008_F_006_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_RTRef _Q_008_F_006_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_RRRef _Q_008_F_006_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_TYPE _Q_008_F_007_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_RTRef _Q_008_F_007_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_RRRef _Q_008_F_007_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_TYPE _Q_008_F_008_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_RTRef _Q_008_F_008_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_RRRef _Q_008_F_008_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_TYPE _Q_008_F_009_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_RTRef _Q_008_F_009_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_RRRef _Q_008_F_009_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4055DimRRef _Q_008_F_010RRef,
    #V8TblAli1_Q_008_T_002._Fld4059DimRRef _Q_008_F_011RRef,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_TYPE _Q_008_F_012_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_RTRef _Q_008_F_012_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_RRRef _Q_008_F_012_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_TYPE _Q_008_F_013_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_RTRef _Q_008_F_013_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_RRRef _Q_008_F_013_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_TYPE _Q_008_F_014_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_RTRef _Q_008_F_014_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_RRRef _Q_008_F_014_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_TYPE _Q_008_F_015_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_RTRef _Q_008_F_015_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_RRRef _Q_008_F_015_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_TYPE _Q_008_F_016_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_RTRef _Q_008_F_016_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_RRRef _Q_008_F_016_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_TYPE _Q_008_F_017_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_RTRef _Q_008_F_017_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_RRRef _Q_008_F_017_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4063DimRRef _Q_008_F_018RRef,
    #V8TblAli1_Q_008_T_002._Fld4064DimRRef _Q_008_F_019RRef,
    SUM(CASE
    WHEN #V8TblAli1_Q_008_T_002._CalcKindRRef IN
    (0x88cdb74bd2bb1e9f4788b89fd596dd0e,0xbf039c3c98dfd95e41cba12e60eb772a,0xa4ec600fb4dcf6b741c647ec4a647b41)
    THEN CAST(#V8TblAli1_Q_008_T_002._Fld4044Base * #V8TblAli1_Q_008_T_002._Fld4150 AS NUMERIC(38,10))
    WHEN #V8TblAli1_Q_008_T_002._Fld4155 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(38,10))
    ELSE CAST(CASE
    WHEN #V8TblAli1_Q_008_T_002._CalcKindRRef IN
    (0xa47395c8bb72a48a4e6c2c8074a69af5,0x90b884177dcce0e9442968bc65e56b9c,0xa16c053588c052c840c194aa19aa1a08)
    THEN CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4044Base * #V8TblAli1_Q_008_T_002._Fld4150 AS NUMERIC(38,10)) * CASE
    WHEN #V8TblAli1_Q_008_T_002._Fld4147 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(17,10))
    ELSE CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4146 AS NUMERIC(11,6)) / #V8TblAli1_Q_008_T_002._Fld4147 AS NUMERIC(17,10))
    END AS NUMERIC(38,8))
    WHEN #V8TblAli1_Q_008_T_002._CalcKindRRef IN
    (0x90b0087d331cd4c34ecd808e7e900776,0xaa373e027ab619414f6f9de9813ff9ca,0xa4950d0ccfe795f642a25ad3ef6e1017)
    THEN CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4044Base * #V8TblAli1_Q_008_T_002._Fld4150 AS NUMERIC(38,10)) AS NUMERIC(38,8))
    WHEN #V8TblAli1_Q_008_T_002._CalcKindRRef IN
    (0xbef92f16763b138f435103137db8d638,0x8ca89454672308a347f44b949493337e,0x940e203368ac15654bd9e011bfe95b2f)
    THEN CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4044Base * CASE
    WHEN #V8TblAli1_Q_008_T_002._Fld4147 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(17,10))
    ELSE CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4146 AS NUMERIC(11,6)) / #V8TblAli1_Q_008_T_002._Fld4147 AS NUMERIC(17,10))
    END AS NUMERIC(38,10)) AS NUMERIC(38,8))
    ELSE #V8TblAli1_Q_008_T_002._Fld4044Base
    END * CASE
    WHEN #V8TblAli1_Q_008_T_002._Fld4155 > #V8TblAli1_Q_008_T_002._Fld4154
    THEN CAST(CAST(#V8TblAli1_Q_008_T_002._Fld4154 AS NUMERIC(10,8)) / #V8TblAli1_Q_008_T_002._Fld4155 AS NUMERIC(12,10))
    ELSE CAST(CAST(1 AS NUMERIC(1,0)) AS NUMERIC(12,10))
    END AS NUMERIC(38,10))
    END) _Q_008_F_020
    FROM
    _CalcReg4113 _CalcReg4113_Q_008_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_Q_008_T_001._CalcKindRRef = _CalcKind282._IDRRef
    INNER JOIN (
    SELECT
    #V8TblAli1_RESULT._RecorderTRef _RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef _RecorderRRef,
    #V8TblAli1_RESULT._CalcKindRRef _CalcKindRRef,
    #V8TblAli1_RESULT._Fld4142RRef _Fld4142RRef,
    #V8TblAli1_RESULT._Fld4143RRef _Fld4143RRef,
    #V8TblAli1_RESULT._Fld4144RRef _Fld4144RRef,
    #V8TblAli1_RESULT._Fld4146 _Fld4146,
    #V8TblAli1_RESULT._Fld4147 _Fld4147,
    #V8TblAli1_RESULT._Fld4150 _Fld4150,
    #V8TblAli1_RESULT._Fld4151 _Fld4151,
    #V8TblAli1_RESULT._Fld4152 _Fld4152,
    #V8TblAli1_RESULT._Fld4153RRef _Fld4153RRef,
    #V8TblAli1_RESULT._Fld4154 _Fld4154,
    #V8TblAli1_RESULT._Fld4155 _Fld4155,
    #V8TblAli1_RESULT._Fld4899 _Fld4899,
    SUM(#V8TblAli1_RESULT._Fld4044Base) _Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef _Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE _Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef _Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef _Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE _Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef _Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef _Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE _Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef _Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef _Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef _Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE _Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef _Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef _Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE _Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef _Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef _Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE _Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef _Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef _Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef _Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE _Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef _Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef _Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE _Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef _Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef _Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE _Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef _Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef _Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef _Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE _Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef _Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef _Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE _Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef _Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef _Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE _Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef _Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef _Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef _Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef _Fld4064DimRRef
    FROM
    (
    SELECT
    #V8TblAli1_RESULT._RecorderTRef _RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef _RecorderRRef,
    #V8TblAli1_RESULT._CalcKindRRef _CalcKindRRef,
    #V8TblAli1_RESULT._Fld4142RRef _Fld4142RRef,
    #V8TblAli1_RESULT._Fld4143RRef _Fld4143RRef,
    #V8TblAli1_RESULT._Fld4144RRef _Fld4144RRef,
    #V8TblAli1_RESULT._Fld4146 _Fld4146,
    #V8TblAli1_RESULT._Fld4147 _Fld4147,
    #V8TblAli1_RESULT._Fld4150 _Fld4150,
    #V8TblAli1_RESULT._Fld4151 _Fld4151,
    #V8TblAli1_RESULT._Fld4152 _Fld4152,
    #V8TblAli1_RESULT._Fld4153RRef _Fld4153RRef,
    #V8TblAli1_RESULT._Fld4154 _Fld4154,
    #V8TblAli1_RESULT._Fld4155 _Fld4155,
    #V8TblAli1_RESULT._Fld4899 _Fld4899,
    CAST(#V8TblAli1_RESULT._Fld4044Base * CASE
    WHEN #V8TblAli1_RESULT._CALEND = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(1 AS NUMERIC(1,0)) AS NUMERIC(22,10))
    ELSE CAST(CAST(SUM(_InfoReg2989._Fld2994) AS NUMERIC(16,6)) / #V8TblAli1_RESULT._CALEND AS NUMERIC(22,10))
    END AS NUMERIC(38,10)) _Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef _Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE _Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef _Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef _Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE _Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef _Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef _Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE _Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef _Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef _Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef _Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE _Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef _Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef _Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE _Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef _Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef _Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE _Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef _Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef _Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef _Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE _Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef _Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef _Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE _Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef _Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef _Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE _Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef _Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef _Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef _Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE _Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef _Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef _Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE _Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef _Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef _Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE _Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef _Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef _Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef _Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef _Fld4064DimRRef,
    #V8TblAli1_RESULT._LineNo _LineNo
    FROM
    (
    SELECT
    _CalcReg4141_MAIN._RecorderTRef _RecorderTRef,
    _CalcReg4141_MAIN._RecorderRRef _RecorderRRef,
    _CalcReg4141_MAIN._CalcKindRRef _CalcKindRRef,
    _CalcReg4141_MAIN._Fld4142RRef _Fld4142RRef,
    _CalcReg4141_MAIN._Fld4143RRef _Fld4143RRef,
    _CalcReg4141_MAIN._Fld4144RRef _Fld4144RRef,
    _CalcReg4141_MAIN._Fld4146 _Fld4146,
    _CalcReg4141_MAIN._Fld4147 _Fld4147,
    _CalcReg4141_MAIN._Fld4150 _Fld4150,
    _CalcReg4141_MAIN._Fld4151 _Fld4151,
    _CalcReg4141_MAIN._Fld4152 _Fld4152,
    _CalcReg4141_MAIN._Fld4153RRef _Fld4153RRef,
    _CalcReg4141_MAIN._Fld4154 _Fld4154,
    _CalcReg4141_MAIN._Fld4155 _Fld4155,
    _CalcReg4141_MAIN._Fld4899 _Fld4899,
    SUM(#TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4044) _Fld4044Base,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4047RRef _Fld4047DimRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_TYPE _Fld4048Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_RTRef _Fld4048Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_RRRef _Fld4048Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_TYPE _Fld4049Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_RTRef _Fld4049Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_RRRef _Fld4049Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_TYPE _Fld4050Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_RTRef _Fld4050Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_RRRef _Fld4050Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4051RRef _Fld4051DimRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_TYPE _Fld4052Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_RTRef _Fld4052Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_RRRef _Fld4052Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_TYPE _Fld4053Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_RTRef _Fld4053Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_RRRef _Fld4053Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_TYPE _Fld4054Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_RTRef _Fld4054Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_RRRef _Fld4054Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4055RRef _Fld4055DimRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_TYPE _Fld4056Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_RTRef _Fld4056Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_RRRef _Fld4056Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_TYPE _Fld4057Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_RTRef _Fld4057Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_RRRef _Fld4057Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_TYPE _Fld4058Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_RTRef _Fld4058Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_RRRef _Fld4058Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4059RRef _Fld4059DimRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_TYPE _Fld4060Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_RTRef _Fld4060Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_RRRef _Fld4060Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_TYPE _Fld4061Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_RTRef _Fld4061Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_RRRef _Fld4061Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_TYPE _Fld4062Dim_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_RTRef _Fld4062Dim_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_RRRef _Fld4062Dim_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4063RRef _Fld4063DimRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4064RRef _Fld4064DimRRef,
    _CalcReg4141_MAIN._LineNo _LineNo,
    #V8TblAli1_CALEND_BY_RECORD._CALEND _CALEND,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4045RRef _Fld4045IRRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4046RRef _Fld4046IRRRef,
    CASE
    WHEN _CalcReg4141_MAIN._BPDateFrom > #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATEFROM
    THEN _CalcReg4141_MAIN._BPDateFrom
    ELSE #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATEFROM
    END _DATEFROM,
    CASE
    WHEN _CalcReg4141_MAIN._BPDateTill < #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATETILL
    THEN _CalcReg4141_MAIN._BPDateTill
    ELSE #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATETILL
    END _DATETILL
    FROM
    _CalcReg4141 _CalcReg4141_MAIN WITH(NOLOCK)
    LEFT OUTER JOIN #tt6 #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE WITH(NOLOCK)
    ON _CalcReg4141_MAIN._Fld4142RRef = #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4041RRef AND _CalcReg4141_MAIN._Fld4143RRef =
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4042RRef AND _CalcReg4141_MAIN._Fld4144RRef =
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4043RRef AND #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATEFROM <=
    _CalcReg4141_MAIN._BPDateTill AND #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATETILL >= _CalcReg4141_MAIN._BPDateFrom
    INNER JOIN _CalcKind283_BaseCK _CalcKind283_BaseCK_BASECALCKIND WITH(NOLOCK)
    ON _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_TYPE = 0x08 AND _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_RTRef = 0x0000011A AND
    _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_RRRef = #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._CalcKindRRef AND
    _CalcKind283_BaseCK_BASECALCKIND._CalcKind283_IDRRef = _CalcReg4141_MAIN._CalcKindRRef
    INNER JOIN (
    SELECT
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderTRef _RecorderTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderRRef _RecorderRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._LineNo _LineNo,
    SUM(#TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._CALEND) _CALEND
    FROM
    #tt6 #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE WITH(NOLOCK)
    GROUP BY
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._LineNo
    ) #V8TblAli1_CALEND_BY_RECORD
    ON #V8TblAli1_CALEND_BY_RECORD._RecorderTRef = #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderTRef AND
    #V8TblAli1_CALEND_BY_RECORD._RecorderRRef = #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._RecorderRRef AND #V8TblAli1_CALEND_BY_RECORD._LineNo
    = #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._LineNo
    WHERE
    _CalcReg4141_MAIN._Fld4143RRef = @P12 AND _CalcReg4141_MAIN._Period = @P2
    GROUP BY
    _CalcReg4141_MAIN._RecorderTRef,
    _CalcReg4141_MAIN._RecorderRRef,
    _CalcReg4141_MAIN._CalcKindRRef,
    _CalcReg4141_MAIN._Fld4142RRef,
    _CalcReg4141_MAIN._Fld4143RRef,
    _CalcReg4141_MAIN._Fld4144RRef,
    _CalcReg4141_MAIN._Fld4146,
    _CalcReg4141_MAIN._Fld4147,
    _CalcReg4141_MAIN._Fld4150,
    _CalcReg4141_MAIN._Fld4151,
    _CalcReg4141_MAIN._Fld4152,
    _CalcReg4141_MAIN._Fld4153RRef,
    _CalcReg4141_MAIN._Fld4154,
    _CalcReg4141_MAIN._Fld4155,
    _CalcReg4141_MAIN._Fld4899,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4047RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4048_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4049_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4050_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4051RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4052_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4053_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4054_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4055RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4056_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4057_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4058_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4059RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4060_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4061_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_TYPE,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_RTRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4062_RRRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4063RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4064RRef,
    _CalcReg4141_MAIN._LineNo,
    #V8TblAli1_CALEND_BY_RECORD._CALEND,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4045RRef,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._Fld4046RRef,
    _CalcReg4141_MAIN._BPDateFrom,
    _CalcReg4141_MAIN._BPDateTill,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATEFROM,
    #TMPa8e8b287e4be7b454da1145cc694c0de_SLAVE._DATETILL
    ) #V8TblAli1_RESULT
    LEFT OUTER JOIN _InfoReg2989 WITH(NOLOCK)
    ON _InfoReg2989._Fld2992 >= #V8TblAli1_RESULT._DATEFROM AND _InfoReg2989._Fld2992 <= #V8TblAli1_RESULT._DATETILL AND
    #V8TblAli1_RESULT._Fld4045IRRRef = _InfoReg2989._Fld2990RRef AND #V8TblAli1_RESULT._Fld4046IRRRef = _InfoReg2989._Fld2991RRef
    GROUP BY
    #V8TblAli1_RESULT._RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef,
    #V8TblAli1_RESULT._CalcKindRRef,
    #V8TblAli1_RESULT._Fld4142RRef,
    #V8TblAli1_RESULT._Fld4143RRef,
    #V8TblAli1_RESULT._Fld4144RRef,
    #V8TblAli1_RESULT._Fld4146,
    #V8TblAli1_RESULT._Fld4147,
    #V8TblAli1_RESULT._Fld4150,
    #V8TblAli1_RESULT._Fld4151,
    #V8TblAli1_RESULT._Fld4152,
    #V8TblAli1_RESULT._Fld4153RRef,
    #V8TblAli1_RESULT._Fld4154,
    #V8TblAli1_RESULT._Fld4155,
    #V8TblAli1_RESULT._Fld4899,
    #V8TblAli1_RESULT._Fld4044Base,
    #V8TblAli1_RESULT._Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef,
    #V8TblAli1_RESULT._LineNo,
    #V8TblAli1_RESULT._CALEND,
    #V8TblAli1_RESULT._DATEFROM,
    #V8TblAli1_RESULT._DATETILL
    ) #V8TblAli1_RESULT
    GROUP BY
    #V8TblAli1_RESULT._RecorderTRef,
    #V8TblAli1_RESULT._RecorderRRef,
    #V8TblAli1_RESULT._CalcKindRRef,
    #V8TblAli1_RESULT._Fld4142RRef,
    #V8TblAli1_RESULT._Fld4143RRef,
    #V8TblAli1_RESULT._Fld4144RRef,
    #V8TblAli1_RESULT._Fld4146,
    #V8TblAli1_RESULT._Fld4147,
    #V8TblAli1_RESULT._Fld4150,
    #V8TblAli1_RESULT._Fld4151,
    #V8TblAli1_RESULT._Fld4152,
    #V8TblAli1_RESULT._Fld4153RRef,
    #V8TblAli1_RESULT._Fld4154,
    #V8TblAli1_RESULT._Fld4155,
    #V8TblAli1_RESULT._Fld4899,
    #V8TblAli1_RESULT._Fld4047DimRRef,
    #V8TblAli1_RESULT._Fld4048Dim_TYPE,
    #V8TblAli1_RESULT._Fld4048Dim_RTRef,
    #V8TblAli1_RESULT._Fld4048Dim_RRRef,
    #V8TblAli1_RESULT._Fld4049Dim_TYPE,
    #V8TblAli1_RESULT._Fld4049Dim_RTRef,
    #V8TblAli1_RESULT._Fld4049Dim_RRRef,
    #V8TblAli1_RESULT._Fld4050Dim_TYPE,
    #V8TblAli1_RESULT._Fld4050Dim_RTRef,
    #V8TblAli1_RESULT._Fld4050Dim_RRRef,
    #V8TblAli1_RESULT._Fld4051DimRRef,
    #V8TblAli1_RESULT._Fld4052Dim_TYPE,
    #V8TblAli1_RESULT._Fld4052Dim_RTRef,
    #V8TblAli1_RESULT._Fld4052Dim_RRRef,
    #V8TblAli1_RESULT._Fld4053Dim_TYPE,
    #V8TblAli1_RESULT._Fld4053Dim_RTRef,
    #V8TblAli1_RESULT._Fld4053Dim_RRRef,
    #V8TblAli1_RESULT._Fld4054Dim_TYPE,
    #V8TblAli1_RESULT._Fld4054Dim_RTRef,
    #V8TblAli1_RESULT._Fld4054Dim_RRRef,
    #V8TblAli1_RESULT._Fld4055DimRRef,
    #V8TblAli1_RESULT._Fld4056Dim_TYPE,
    #V8TblAli1_RESULT._Fld4056Dim_RTRef,
    #V8TblAli1_RESULT._Fld4056Dim_RRRef,
    #V8TblAli1_RESULT._Fld4057Dim_TYPE,
    #V8TblAli1_RESULT._Fld4057Dim_RTRef,
    #V8TblAli1_RESULT._Fld4057Dim_RRRef,
    #V8TblAli1_RESULT._Fld4058Dim_TYPE,
    #V8TblAli1_RESULT._Fld4058Dim_RTRef,
    #V8TblAli1_RESULT._Fld4058Dim_RRRef,
    #V8TblAli1_RESULT._Fld4059DimRRef,
    #V8TblAli1_RESULT._Fld4060Dim_TYPE,
    #V8TblAli1_RESULT._Fld4060Dim_RTRef,
    #V8TblAli1_RESULT._Fld4060Dim_RRRef,
    #V8TblAli1_RESULT._Fld4061Dim_TYPE,
    #V8TblAli1_RESULT._Fld4061Dim_RTRef,
    #V8TblAli1_RESULT._Fld4061Dim_RRRef,
    #V8TblAli1_RESULT._Fld4062Dim_TYPE,
    #V8TblAli1_RESULT._Fld4062Dim_RTRef,
    #V8TblAli1_RESULT._Fld4062Dim_RRRef,
    #V8TblAli1_RESULT._Fld4063DimRRef,
    #V8TblAli1_RESULT._Fld4064DimRRef,
    #V8TblAli1_RESULT._LineNo
    ) #V8TblAli1_Q_008_T_002
    LEFT OUTER JOIN _Document134 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x00000086 AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document134._IDRRef
    LEFT OUTER JOIN _Document155 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000009B AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document155._IDRRef
    LEFT OUTER JOIN _Document129 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x00000081 AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document129._IDRRef
    LEFT OUTER JOIN _Document123 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000007B AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document123._IDRRef
    LEFT OUTER JOIN _Document122 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000007A AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document122._IDRRef
    LEFT OUTER JOIN _Document157 WITH(NOLOCK)
    ON #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000009D AND #V8TblAli1_Q_008_T_002._RecorderRRef = _Document157._IDRRef
    ON #V8TblAli1_Q_008_T_002._Fld4142RRef = _CalcReg4113_Q_008_T_001._Fld4114RRef AND CASE
    WHEN #V8TblAli1_Q_008_T_002._Fld4144RRef = 0x00000000000000000000000000000000
    THEN #V8TblAli1_Q_008_T_002._Fld4144RRef
    WHEN #V8TblAli1_Q_008_T_002._Fld4153RRef = 0xa2c97ffbef28f4674f20824a80eab857
    THEN ISNULL(CASE
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000009D
    THEN _Document157._Fld2369RRef
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000007A
    THEN _Document122._Fld1456RRef
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000007B
    THEN _Document123._Fld1523RRef
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x00000081
    THEN _Document129._Fld1718RRef
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x0000009B
    THEN _Document155._Fld2308RRef
    WHEN #V8TblAli1_Q_008_T_002._RecorderTRef = 0x00000086
    THEN _Document134._Fld1844RRef
    ELSE CAST(NULL AS BINARY(16))
    END, #V8TblAli1_Q_008_T_002._Fld4144RRef)
    ELSE #V8TblAli1_Q_008_T_002._Fld4144RRef
    END = _CalcReg4113_Q_008_T_001._Fld4116RRef AND #V8TblAli1_Q_008_T_002._Fld4153RRef = _CalcKind282._Fld3973RRef AND
    _CalcReg4113_Q_008_T_001._Fld4131 = #V8TblAli1_Q_008_T_002._Fld4899 AND _CalcReg4113_Q_008_T_001._Fld4129 = #V8TblAli1_Q_008_T_002._Fld4151
    AND _CalcReg4113_Q_008_T_001._Fld4130 = #V8TblAli1_Q_008_T_002._Fld4152 AND _CalcReg4113_Q_008_T_001._Fld4115RRef =
    #V8TblAli1_Q_008_T_002._Fld4143RRef
    WHERE
    _CalcReg4113_Q_008_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_008_T_001._Period = @P2 AND _CalcKind282._Fld3973RRef IN
    (@P5,@P6,@P7,@P8,@P9,@P10,@P11)
    GROUP BY
    _CalcReg4113_Q_008_T_001._RecorderTRef,
    _CalcReg4113_Q_008_T_001._RecorderRRef,
    _CalcReg4113_Q_008_T_001._LineNo,
    #V8TblAli1_Q_008_T_002._Fld4047DimRRef,
    #V8TblAli1_Q_008_T_002._Fld4051DimRRef,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4048Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4049Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4050Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4052Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4053Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4054Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4055DimRRef,
    #V8TblAli1_Q_008_T_002._Fld4059DimRRef,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4056Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4057Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4058Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4060Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4061Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_TYPE,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_RTRef,
    #V8TblAli1_Q_008_T_002._Fld4062Dim_RRRef,
    #V8TblAli1_Q_008_T_002._Fld4063DimRRef,
    #V8TblAli1_Q_008_T_002._Fld4064DimRRef
    UNION ALL
    SELECT
    _CalcReg4113_Q_007_T_001._RecorderTRef _Q_008_F_000TRef,
    _CalcReg4113_Q_007_T_001._RecorderRRef _Q_008_F_000RRef,
    _CalcReg4113_Q_007_T_001._LineNo _Q_008_F_001,
    #V8TblAli1_Q_007_T_002._Fld4019DimRRef _Q_008_F_002RRef,
    #V8TblAli1_Q_007_T_002._Fld4023DimRRef _Q_008_F_003RRef,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_TYPE _Q_008_F_004_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_RTRef _Q_008_F_004_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_RRRef _Q_008_F_004_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_TYPE _Q_008_F_005_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_RTRef _Q_008_F_005_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_RRRef _Q_008_F_005_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_TYPE _Q_008_F_006_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_RTRef _Q_008_F_006_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_RRRef _Q_008_F_006_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_TYPE _Q_008_F_007_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_RTRef _Q_008_F_007_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_RRRef _Q_008_F_007_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_TYPE _Q_008_F_008_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_RTRef _Q_008_F_008_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_RRRef _Q_008_F_008_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_TYPE _Q_008_F_009_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_RTRef _Q_008_F_009_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_RRRef _Q_008_F_009_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4027DimRRef _Q_008_F_010RRef,
    #V8TblAli1_Q_007_T_002._Fld4032DimRRef _Q_008_F_011RRef,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_TYPE _Q_008_F_012_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_RTRef _Q_008_F_012_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_RRRef _Q_008_F_012_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_TYPE _Q_008_F_013_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_RTRef _Q_008_F_013_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_RRRef _Q_008_F_013_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_TYPE _Q_008_F_014_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_RTRef _Q_008_F_014_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_RRRef _Q_008_F_014_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_TYPE _Q_008_F_015_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_RTRef _Q_008_F_015_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_RRRef _Q_008_F_015_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_TYPE _Q_008_F_016_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_RTRef _Q_008_F_016_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_RRRef _Q_008_F_016_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_TYPE _Q_008_F_017_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_RTRef _Q_008_F_017_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_RRRef _Q_008_F_017_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4036DimRRef _Q_008_F_018RRef,
    #V8TblAli1_Q_007_T_002._Fld4037DimRRef _Q_008_F_019RRef,
    SUM(CASE
    WHEN #V8TblAli1_Q_007_T_002._CalcKindRRef IN
    (0x88cdb74bd2bb1e9f4788b89fd596dd0e,0xbf039c3c98dfd95e41cba12e60eb772a,0xa4ec600fb4dcf6b741c647ec4a647b41)
    THEN CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4018Base * #V8TblAli1_Q_007_T_002._Fld4150 AS NUMERIC(32,10)) AS NUMERIC(38,10))
    WHEN #V8TblAli1_Q_007_T_002._Fld4155 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(38,10))
    ELSE CASE
    WHEN #V8TblAli1_Q_007_T_002._CalcKindRRef IN
    (0xa47395c8bb72a48a4e6c2c8074a69af5,0x90b884177dcce0e9442968bc65e56b9c,0xa16c053588c052c840c194aa19aa1a08)
    THEN CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4018Base * #V8TblAli1_Q_007_T_002._Fld4150 AS NUMERIC(32,10)) * CASE
    WHEN #V8TblAli1_Q_007_T_002._Fld4147 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(17,10))
    ELSE CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4146 AS NUMERIC(11,6)) / #V8TblAli1_Q_007_T_002._Fld4147 AS NUMERIC(17,10))
    END AS NUMERIC(38,10))
    WHEN #V8TblAli1_Q_007_T_002._CalcKindRRef IN
    (0x90b0087d331cd4c34ecd808e7e900776,0xaa373e027ab619414f6f9de9813ff9ca,0xa4950d0ccfe795f642a25ad3ef6e1017)
    THEN CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4018Base * #V8TblAli1_Q_007_T_002._Fld4150 AS NUMERIC(32,10)) AS NUMERIC(38,10))
    WHEN #V8TblAli1_Q_007_T_002._CalcKindRRef IN
    (0xbef92f16763b138f435103137db8d638,0x8ca89454672308a347f44b949493337e,0x940e203368ac15654bd9e011bfe95b2f)
    THEN CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4018Base * CASE
    WHEN #V8TblAli1_Q_007_T_002._Fld4147 = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(17,10))
    ELSE CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4146 AS NUMERIC(11,6)) / #V8TblAli1_Q_007_T_002._Fld4147 AS NUMERIC(17,10))
    END AS NUMERIC(37,10)) AS NUMERIC(38,10))
    ELSE CAST(#V8TblAli1_Q_007_T_002._Fld4018Base AS NUMERIC(38,10))
    END * CASE
    WHEN #V8TblAli1_Q_007_T_002._Fld4155 > #V8TblAli1_Q_007_T_002._Fld4154
    THEN CAST(CAST(#V8TblAli1_Q_007_T_002._Fld4154 AS NUMERIC(10,8)) / #V8TblAli1_Q_007_T_002._Fld4155 AS NUMERIC(12,10))
    ELSE CAST(CAST(1 AS NUMERIC(1,0)) AS NUMERIC(12,10))
    END
    END) _Q_008_F_020
    FROM
    _CalcReg4113 _CalcReg4113_Q_007_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_Q_007_T_001._CalcKindRRef = _CalcKind282._IDRRef
    INNER JOIN (
    SELECT
    _CalcReg4141_MAIN._RecorderTRef _RecorderTRef,
    _CalcReg4141_MAIN._RecorderRRef _RecorderRRef,
    _CalcReg4141_MAIN._CalcKindRRef _CalcKindRRef,
    _CalcReg4141_MAIN._Fld4142RRef _Fld4142RRef,
    _CalcReg4141_MAIN._Fld4143RRef _Fld4143RRef,
    _CalcReg4141_MAIN._Fld4144RRef _Fld4144RRef,
    _CalcReg4141_MAIN._Fld4146 _Fld4146,
    _CalcReg4141_MAIN._Fld4147 _Fld4147,
    _CalcReg4141_MAIN._Fld4150 _Fld4150,
    _CalcReg4141_MAIN._Fld4151 _Fld4151,
    _CalcReg4141_MAIN._Fld4152 _Fld4152,
    _CalcReg4141_MAIN._Fld4153RRef _Fld4153RRef,
    _CalcReg4141_MAIN._Fld4154 _Fld4154,
    _CalcReg4141_MAIN._Fld4155 _Fld4155,
    _CalcReg4141_MAIN._Fld4899 _Fld4899,
    SUM(_CalcReg4014_SLAVE._Fld4018) _Fld4018Base,
    _CalcReg4014_SLAVE._Fld4019RRef _Fld4019DimRRef,
    _CalcReg4014_SLAVE._Fld4020_TYPE _Fld4020Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4020_RTRef _Fld4020Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4020_RRRef _Fld4020Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4021_TYPE _Fld4021Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4021_RTRef _Fld4021Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4021_RRRef _Fld4021Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4022_TYPE _Fld4022Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4022_RTRef _Fld4022Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4022_RRRef _Fld4022Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4023RRef _Fld4023DimRRef,
    _CalcReg4014_SLAVE._Fld4024_TYPE _Fld4024Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4024_RTRef _Fld4024Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4024_RRRef _Fld4024Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4025_TYPE _Fld4025Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4025_RTRef _Fld4025Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4025_RRRef _Fld4025Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4026_TYPE _Fld4026Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4026_RTRef _Fld4026Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4026_RRRef _Fld4026Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4027RRef _Fld4027DimRRef,
    _CalcReg4014_SLAVE._Fld4029_TYPE _Fld4029Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4029_RTRef _Fld4029Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4029_RRRef _Fld4029Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4030_TYPE _Fld4030Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4030_RTRef _Fld4030Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4030_RRRef _Fld4030Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4031_TYPE _Fld4031Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4031_RTRef _Fld4031Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4031_RRRef _Fld4031Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4032RRef _Fld4032DimRRef,
    _CalcReg4014_SLAVE._Fld4033_TYPE _Fld4033Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4033_RTRef _Fld4033Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4033_RRRef _Fld4033Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4034_TYPE _Fld4034Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4034_RTRef _Fld4034Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4034_RRRef _Fld4034Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4035_TYPE _Fld4035Dim_TYPE,
    _CalcReg4014_SLAVE._Fld4035_RTRef _Fld4035Dim_RTRef,
    _CalcReg4014_SLAVE._Fld4035_RRRef _Fld4035Dim_RRRef,
    _CalcReg4014_SLAVE._Fld4036RRef _Fld4036DimRRef,
    _CalcReg4014_SLAVE._Fld4037RRef _Fld4037DimRRef
    FROM
    _CalcReg4141 _CalcReg4141_MAIN WITH(NOLOCK)
    LEFT OUTER JOIN _CalcReg4014 _CalcReg4014_SLAVE WITH(NOLOCK)
    ON _CalcReg4141_MAIN._Fld4142RRef = _CalcReg4014_SLAVE._Fld4015RRef AND _CalcReg4141_MAIN._Fld4143RRef = _CalcReg4014_SLAVE._Fld4016RRef AND
    _CalcReg4141_MAIN._Fld4144RRef = _CalcReg4014_SLAVE._Fld4017RRef AND _CalcReg4014_SLAVE._Period <= _CalcReg4141_MAIN._BPDateTill AND CASE
    WHEN 0x01 = 0x01
    THEN _CalcReg4014_SLAVE._Period
    END >= DATEADD(DAY, 1 - 1, DATEADD(MONTH, DATEPART(MONTH, _CalcReg4141_MAIN._BPDateFrom) - 1, DATEADD(YEAR, DATEPART(YEAR,
    _CalcReg4141_MAIN._BPDateFrom) - 2000, {ts ''2000-01-01 00:00:00''})))
    INNER JOIN _CalcKind283_BaseCK _CalcKind283_BaseCK_BASECALCKIND WITH(NOLOCK)
    ON _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_TYPE = 0x08 AND _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_RTRef = 0x00000119 AND
    _CalcKind283_BaseCK_BASECALCKIND._BaseCKBaseCK_RRRef = _CalcReg4014_SLAVE._CalcKindRRef AND
    _CalcKind283_BaseCK_BASECALCKIND._CalcKind283_IDRRef = _CalcReg4141_MAIN._CalcKindRRef
    WHERE
    _CalcReg4141_MAIN._Fld4143RRef = @P12 AND _CalcReg4141_MAIN._Period = @P2
    GROUP BY
    _CalcReg4141_MAIN._RecorderTRef,
    _CalcReg4141_MAIN._RecorderRRef,
    _CalcReg4141_MAIN._CalcKindRRef,
    _CalcReg4141_MAIN._Fld4142RRef,
    _CalcReg4141_MAIN._Fld4143RRef,
    _CalcReg4141_MAIN._Fld4144RRef,
    _CalcReg4141_MAIN._Fld4146,
    _CalcReg4141_MAIN._Fld4147,
    _CalcReg4141_MAIN._Fld4150,
    _CalcReg4141_MAIN._Fld4151,
    _CalcReg4141_MAIN._Fld4152,
    _CalcReg4141_MAIN._Fld4153RRef,
    _CalcReg4141_MAIN._Fld4154,
    _CalcReg4141_MAIN._Fld4155,
    _CalcReg4141_MAIN._Fld4899,
    _CalcReg4014_SLAVE._Fld4019RRef,
    _CalcReg4014_SLAVE._Fld4020_TYPE,
    _CalcReg4014_SLAVE._Fld4020_RTRef,
    _CalcReg4014_SLAVE._Fld4020_RRRef,
    _CalcReg4014_SLAVE._Fld4021_TYPE,
    _CalcReg4014_SLAVE._Fld4021_RTRef,
    _CalcReg4014_SLAVE._Fld4021_RRRef,
    _CalcReg4014_SLAVE._Fld4022_TYPE,
    _CalcReg4014_SLAVE._Fld4022_RTRef,
    _CalcReg4014_SLAVE._Fld4022_RRRef,
    _CalcReg4014_SLAVE._Fld4023RRef,
    _CalcReg4014_SLAVE._Fld4024_TYPE,
    _CalcReg4014_SLAVE._Fld4024_RTRef,
    _CalcReg4014_SLAVE._Fld4024_RRRef,
    _CalcReg4014_SLAVE._Fld4025_TYPE,
    _CalcReg4014_SLAVE._Fld4025_RTRef,
    _CalcReg4014_SLAVE._Fld4025_RRRef,
    _CalcReg4014_SLAVE._Fld4026_TYPE,
    _CalcReg4014_SLAVE._Fld4026_RTRef,
    _CalcReg4014_SLAVE._Fld4026_RRRef,
    _CalcReg4014_SLAVE._Fld4027RRef,
    _CalcReg4014_SLAVE._Fld4029_TYPE,
    _CalcReg4014_SLAVE._Fld4029_RTRef,
    _CalcReg4014_SLAVE._Fld4029_RRRef,
    _CalcReg4014_SLAVE._Fld4030_TYPE,
    _CalcReg4014_SLAVE._Fld4030_RTRef,
    _CalcReg4014_SLAVE._Fld4030_RRRef,
    _CalcReg4014_SLAVE._Fld4031_TYPE,
    _CalcReg4014_SLAVE._Fld4031_RTRef,
    _CalcReg4014_SLAVE._Fld4031_RRRef,
    _CalcReg4014_SLAVE._Fld4032RRef,
    _CalcReg4014_SLAVE._Fld4033_TYPE,
    _CalcReg4014_SLAVE._Fld4033_RTRef,
    _CalcReg4014_SLAVE._Fld4033_RRRef,
    _CalcReg4014_SLAVE._Fld4034_TYPE,
    _CalcReg4014_SLAVE._Fld4034_RTRef,
    _CalcReg4014_SLAVE._Fld4034_RRRef,
    _CalcReg4014_SLAVE._Fld4035_TYPE,
    _CalcReg4014_SLAVE._Fld4035_RTRef,
    _CalcReg4014_SLAVE._Fld4035_RRRef,
    _CalcReg4014_SLAVE._Fld4036RRef,
    _CalcReg4014_SLAVE._Fld4037RRef,
    _CalcReg4141_MAIN._LineNo
    ) #V8TblAli1_Q_007_T_002
    LEFT OUTER JOIN _Document134 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x00000086 AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document134._IDRRef
    LEFT OUTER JOIN _Document155 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000009B AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document155._IDRRef
    LEFT OUTER JOIN _Document129 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x00000081 AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document129._IDRRef
    LEFT OUTER JOIN _Document123 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000007B AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document123._IDRRef
    LEFT OUTER JOIN _Document122 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000007A AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document122._IDRRef
    LEFT OUTER JOIN _Document157 WITH(NOLOCK)
    ON #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000009D AND #V8TblAli1_Q_007_T_002._RecorderRRef = _Document157._IDRRef
    ON #V8TblAli1_Q_007_T_002._Fld4142RRef = _CalcReg4113_Q_007_T_001._Fld4114RRef AND CASE
    WHEN #V8TblAli1_Q_007_T_002._Fld4144RRef = 0x00000000000000000000000000000000
    THEN #V8TblAli1_Q_007_T_002._Fld4144RRef
    WHEN #V8TblAli1_Q_007_T_002._Fld4153RRef = 0xa2c97ffbef28f4674f20824a80eab857
    THEN ISNULL(CASE
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000009D
    THEN _Document157._Fld2369RRef
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000007A
    THEN _Document122._Fld1456RRef
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000007B
    THEN _Document123._Fld1523RRef
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x00000081
    THEN _Document129._Fld1718RRef
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x0000009B
    THEN _Document155._Fld2308RRef
    WHEN #V8TblAli1_Q_007_T_002._RecorderTRef = 0x00000086
    THEN _Document134._Fld1844RRef
    ELSE CAST(NULL AS BINARY(16))
    END, #V8TblAli1_Q_007_T_002._Fld4144RRef)
    ELSE #V8TblAli1_Q_007_T_002._Fld4144RRef
    END = _CalcReg4113_Q_007_T_001._Fld4116RRef AND #V8TblAli1_Q_007_T_002._Fld4153RRef = _CalcKind282._Fld3973RRef AND
    _CalcReg4113_Q_007_T_001._Fld4131 = #V8TblAli1_Q_007_T_002._Fld4899 AND _CalcReg4113_Q_007_T_001._Fld4129 = #V8TblAli1_Q_007_T_002._Fld4151
    AND _CalcReg4113_Q_007_T_001._Fld4130 = #V8TblAli1_Q_007_T_002._Fld4152 AND _CalcReg4113_Q_007_T_001._Fld4115RRef =
    #V8TblAli1_Q_007_T_002._Fld4143RRef
    WHERE
    _CalcReg4113_Q_007_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_007_T_001._Period = @P2 AND _CalcKind282._Fld3973RRef IN
    (@P5,@P6,@P7,@P8,@P9,@P10,@P11)
    GROUP BY
    _CalcReg4113_Q_007_T_001._RecorderTRef,
    _CalcReg4113_Q_007_T_001._RecorderRRef,
    _CalcReg4113_Q_007_T_001._LineNo,
    #V8TblAli1_Q_007_T_002._Fld4019DimRRef,
    #V8TblAli1_Q_007_T_002._Fld4023DimRRef,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4020Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4021Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4022Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4024Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4025Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4026Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4027DimRRef,
    #V8TblAli1_Q_007_T_002._Fld4032DimRRef,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4029Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4030Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4031Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4033Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4034Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_TYPE,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_RTRef,
    #V8TblAli1_Q_007_T_002._Fld4035Dim_RRRef,
    #V8TblAli1_Q_007_T_002._Fld4036DimRRef,
    #V8TblAli1_Q_007_T_002._Fld4037DimRRef
    ) #V8TblAli3_Q_000_T_011
    ON #V8TblAli1_Q_000_T_001._Q_006_F_000TRef = #V8TblAli3_Q_000_T_011._Q_008_F_000TRef AND #V8TblAli1_Q_000_T_001._Q_006_F_000RRef =
    #V8TblAli3_Q_000_T_011._Q_008_F_000RRef AND #V8TblAli1_Q_000_T_001._Q_006_F_001 = #V8TblAli3_Q_000_T_011._Q_008_F_001 AND
    (#V8TblAli1_Q_000_T_001._Q_006_F_004RRef = 0x00000000000000000000000000000000 OR
    #V8TblAli1_Q_000_T_001._Q_006_F_005RRef = 0x00000000000000000000000000000000)
    LEFT OUTER JOIN _Acc2_ExtDim3953 _Acc2_ExtDim3953_Q_000_T_012 WITH(NOLOCK)
    ON ISNULL(#V8TblAli2_Q_000_T_010._Fld4059DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_011RRef) <> 0x00000000000000000000000000000000 AND
    ISNULL(#V8TblAli2_Q_000_T_010._Fld4059DimRRef, #V8TblAli3_Q_000_T_011._Q_008_F_011RRef) = _Acc2_ExtDim3953_Q_000_T_012._Acc2_IDRRef AND
    _Acc2_ExtDim3953_Q_000_T_012._DimKindRRef = 0x9a81c4f3e5a65569419526bd2cac1c61
    LEFT OUTER JOIN (
    SELECT
    #V8TblAli1_Q_010_T_001._Q_009_F_000TRef _Q_010_F_000TRef,
    #V8TblAli1_Q_010_T_001._Q_009_F_000RRef _Q_010_F_000RRef,
    #V8TblAli1_Q_010_T_001._Q_009_F_001 _Q_010_F_001,
    _InfoReg3179_Q_010_T_002._Fld3180 _Q_010_F_002
    FROM
    (
    SELECT
    _CalcReg4113_Q_009_T_001._RecorderTRef _Q_009_F_000TRef,
    _CalcReg4113_Q_009_T_001._RecorderRRef _Q_009_F_000RRef,
    _CalcReg4113_Q_009_T_001._LineNo _Q_009_F_001,
    MAX(_InfoReg3179_Q_009_T_002._Period) _Q_009_F_002
    FROM
    _CalcReg4113 _CalcReg4113_Q_009_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _InfoReg3179 _InfoReg3179_Q_009_T_002 WITH(NOLOCK)
    ON _InfoReg3179_Q_009_T_002._Period <= _CalcReg4113_Q_009_T_001._APDateFrom
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_Q_009_T_001._CalcKindRRef = _CalcKind282._IDRRef
    WHERE
    _CalcReg4113_Q_009_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_009_T_001._Period = @P2 AND _CalcKind282._Fld3973RRef = @P8
    GROUP BY
    _CalcReg4113_Q_009_T_001._LineNo,
    _CalcReg4113_Q_009_T_001._RecorderTRef,
    _CalcReg4113_Q_009_T_001._RecorderRRef
    ) #V8TblAli1_Q_010_T_001
    LEFT OUTER JOIN _InfoReg3179 _InfoReg3179_Q_010_T_002 WITH(NOLOCK)
    ON _InfoReg3179_Q_010_T_002._Period = #V8TblAli1_Q_010_T_001._Q_009_F_002
    ) #V8TblAli4_Q_000_T_013
    ON #V8TblAli1_Q_000_T_001._Q_006_F_000TRef = #V8TblAli4_Q_000_T_013._Q_010_F_000TRef AND #V8TblAli1_Q_000_T_001._Q_006_F_000RRef =
    #V8TblAli4_Q_000_T_013._Q_010_F_000RRef AND #V8TblAli1_Q_000_T_001._Q_006_F_001 = #V8TblAli4_Q_000_T_013._Q_010_F_001
    LEFT OUTER JOIN (
    SELECT
    #V8TblAli1_IRAP._RecorderTRef _RecorderTRef,
    #V8TblAli1_IRAP._RecorderRRef _RecorderRRef,
    #V8TblAli1_IRAP._LineNo _LineNo,
    #V8TblAli1_IRAP._Fld2994AP _Fld2994AP,
    #TMPb35290403b2d035a426a61602a65d4ec_IRAAP._Fld2994AAP _Fld2994AAP
    FROM
    (
    SELECT
    _CalcReg4113_MAIN._RecorderTRef _RecorderTRef,
    _CalcReg4113_MAIN._RecorderRRef _RecorderRRef,
    _CalcReg4113_MAIN._LineNo _LineNo,
    #TMPac553a601876028342622ef4622c35f6_IR._Fld2994AP _Fld2994AP
    FROM
    _CalcReg4113 _CalcReg4113_MAIN WITH(NOLOCK)
    LEFT OUTER JOIN #tt7 #TMPac553a601876028342622ef4622c35f6_IR WITH(NOLOCK)
    ON #TMPac553a601876028342622ef4622c35f6_IR._DATEFROM = _CalcReg4113_MAIN._ActionPeriod AND #TMPac553a601876028342622ef4622c35f6_IR._DATETILL
    = DATEADD(MONTH, 1, _CalcReg4113_MAIN._ActionPeriod) AND _CalcReg4113_MAIN._Fld4124RRef =
    #TMPac553a601876028342622ef4622c35f6_IR._Fld4124RRef AND _CalcReg4113_MAIN._Fld4125RRef = #TMPac553a601876028342622ef4622c35f6_IR._Fld4125RRef
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_MAIN._CalcKindRRef = _CalcKind282._IDRRef
    WHERE
    _CalcKind282._Fld3973RRef = @P8 AND _CalcReg4113_MAIN._Fld4132RRef = @P1 AND _CalcReg4113_MAIN._Period = @P2
    ) #V8TblAli1_IRAP
    LEFT OUTER JOIN #tt9 #TMPb35290403b2d035a426a61602a65d4ec_IRAAP WITH(NOLOCK)
    ON #V8TblAli1_IRAP._RecorderTRef = #TMPb35290403b2d035a426a61602a65d4ec_IRAAP._RecorderTRef AND #V8TblAli1_IRAP._RecorderRRef =
    #TMPb35290403b2d035a426a61602a65d4ec_IRAAP._RecorderRRef AND #V8TblAli1_IRAP._LineNo = #TMPb35290403b2d035a426a61602a65d4ec_IRAAP._LineNo
    ) #V8TblAli5_Q_000_T_014
    ON #V8TblAli1_Q_000_T_001._Q_006_F_000TRef = #V8TblAli5_Q_000_T_014._RecorderTRef AND #V8TblAli1_Q_000_T_001._Q_006_F_000RRef =
    #V8TblAli5_Q_000_T_014._RecorderRRef AND #V8TblAli1_Q_000_T_001._Q_006_F_001 = #V8TblAli5_Q_000_T_014._LineNo
    LEFT OUTER JOIN (
    SELECT
    #V8TblAli1_Q_012_T_001._Q_011_F_000TRef _Q_012_F_000TRef,
    #V8TblAli1_Q_012_T_001._Q_011_F_000RRef _Q_012_F_000RRef,
    #V8TblAli1_Q_012_T_001._Q_011_F_001 _Q_012_F_001,
    #V8TblAli1_Q_012_T_001._Q_011_F_007 _Q_012_F_002,
    CASE
    WHEN CASE
    WHEN #V8TblAli1_Q_012_T_001._Q_011_F_005RRef = 0x838caab601043bf9442b9053a4c11d6e
    THEN #V8TblAli1_Q_012_T_001._Q_011_F_006
    ELSE #V8TblAli1_Q_012_T_001._Q_011_F_008
    END = CAST(0 AS NUMERIC(1,0))
    THEN CAST(CAST(0 AS NUMERIC(1,0)) AS NUMERIC(22,10))
    ELSE CAST(CAST(SUM(_InfoReg2989_Q_012_T_002._Fld2994) AS NUMERIC(16,6)) / CASE
    WHEN #V8TblAli1_Q_012_T_001._Q_011_F_005RRef = 0x838caab601043bf9442b9053a4c11d6e
    THEN #V8TblAli1_Q_012_T_001._Q_011_F_006
    ELSE #V8TblAli1_Q_012_T_001._Q_011_F_008
    END AS NUMERIC(22,10))
    END _Q_012_F_003
    FROM
    (
    SELECT
    _CalcReg4113_Q_011_T_001._RecorderTRef _Q_011_F_000TRef,
    _CalcReg4113_Q_011_T_001._RecorderRRef _Q_011_F_000RRef,
    _CalcReg4113_Q_011_T_001._LineNo _Q_011_F_001,
    _CalcReg4113_Q_011_T_001._APDateFrom _Q_011_F_002,
    _CalcReg4113_Q_011_T_001._APDateTill _Q_011_F_003,
    _CalcReg4113_Q_011_T_001._Fld4124RRef _Q_011_F_004RRef,
    _CalcReg4113_Q_011_T_001._Fld4125RRef _Q_011_F_005RRef,
    _CalcReg4113_Q_011_T_001._Fld4121 _Q_011_F_006,
    _CalcReg4113_Q_011_T_001._Fld4131 _Q_011_F_007,
    _CalcReg4113_Q_011_T_001._Fld4122 _Q_011_F_008
    FROM
    _CalcReg4113 _CalcReg4113_Q_011_T_001 WITH(NOLOCK)
    LEFT OUTER JOIN _Document123 WITH(NOLOCK)
    ON _CalcReg4113_Q_011_T_001._RecorderTRef = 0x0000007B AND _CalcReg4113_Q_011_T_001._RecorderRRef = _Document123._IDRRef
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON _CalcReg4113_Q_011_T_001._CalcKindRRef = _CalcKind282._IDRRef
    WHERE
    _CalcReg4113_Q_011_T_001._Fld4132RRef = @P1 AND _CalcReg4113_Q_011_T_001._Period = @P2 AND _CalcKind282._Fld3973RRef = @P8 AND NOT
    (ISNULL(CASE
    WHEN CASE
    WHEN _CalcReg4113_Q_011_T_001._RecorderTRef = 0x0000007B
    THEN _Document123._Fld1524RRef
    ELSE CAST(NULL AS BINARY(16))
    END IS NOT NULL
    THEN 0x08
    END, CASE
    WHEN CAST(N'''' AS NVARCHAR(1)) IS NOT NULL
    THEN 0x05
    END) = @P13 AND ISNULL(CASE
    WHEN _CalcReg4113_Q_011_T_001._RecorderTRef = 0x0000007B
    THEN _Document123._Fld1524RRef
    ELSE CAST(NULL AS BINARY(16))
    END, CASE
    WHEN CAST(N'''' AS NVARCHAR(1)) IS NOT NULL
    THEN 0x00000000000000000000000000000000
    END) IN (@P14,@P15,@P16,@P17,@P18,@P19,@P20,@P21)) AND CAST(DATEDIFF(DAY, _CalcReg4113_Q_011_T_001._Fld4131,
    _CalcReg4113_Q_011_T_001._APDateFrom) AS NUMERIC(10,0)) < CAST(@P22 AS NUMERIC(1,0)) AND _CalcReg4113_Q_011_T_001._Fld4131 >= @P23
    ) #V8TblAli1_Q_012_T_001
    LEFT OUTER JOIN _InfoReg2989 _InfoReg2989_Q_012_T_002 WITH(NOLOCK)
    ON #V8TblAli1_Q_012_T_001._Q_011_F_004RRef = _InfoReg2989_Q_012_T_002._Fld2990RRef AND #V8TblAli1_Q_012_T_001._Q_011_F_005RRef =
    _InfoReg2989_Q_012_T_002._Fld2991RRef AND #V8TblAli1_Q_012_T_001._Q_011_F_002 <= _InfoReg2989_Q_012_T_002._Fld2992 AND DATEADD(DAY, 1,
    #V8TblAli1_Q_012_T_001._Q_011_F_007) >= _InfoReg2989_Q_012_T_002._Fld2992 AND #V8TblAli1_Q_012_T_001._Q_011_F_003 >=
    _InfoReg2989_Q_012_T_002._Fld2992
    GROUP BY
    #V8TblAli1_Q_012_T_001._Q_011_F_000TRef,
    #V8TblAli1_Q_012_T_001._Q_011_F_000RRef,
    #V8TblAli1_Q_012_T_001._Q_011_F_005RRef,
    #V8TblAli1_Q_012_T_001._Q_011_F_007,
    #V8TblAli1_Q_012_T_001._Q_011_F_008,
    #V8TblAli1_Q_012_T_001._Q_011_F_006,
    #V8TblAli1_Q_012_T_001._Q_011_F_001
    ) #V8TblAli6_Q_000_T_015
    ON #V8TblAli1_Q_000_T_001._Q_006_F_000TRef = #V8TblAli6_Q_000_T_015._Q_012_F_000TRef AND #V8TblAli1_Q_000_T_001._Q_006_F_000RRef =
    #V8TblAli6_Q_000_T_015._Q_012_F_000RRef AND #V8TblAli1_Q_000_T_001._Q_006_F_001 = #V8TblAli6_Q_000_T_015._Q_012_F_001
    LEFT OUTER JOIN _Reference84 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_002RRef = _Reference84._IDRRef
    LEFT OUTER JOIN _CalcKind282 WITH(NOLOCK)
    ON #V8TblAli1_Q_000_T_001._Q_006_F_025RRef = _CalcKind282._IDRRef
    LEFT OUTER JOIN _Reference60 _Reference60_2 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_006_RTRef = 0x0000003C AND
    #V8TblAli3_Q_000_T_011._Q_008_F_006_RRRef = _Reference60_2._IDRRef
    LEFT OUTER JOIN _Reference73 _Reference73_2 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_006_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_006_RTRef = 0x00000049 AND
    #V8TblAli3_Q_000_T_011._Q_008_F_006_RRRef = _Reference73_2._IDRRef
    LEFT OUTER JOIN _Reference60 _Reference60_1 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_005_RTRef = 0x0000003C AND
    #V8TblAli3_Q_000_T_011._Q_008_F_005_RRRef = _Reference60_1._IDRRef
    LEFT OUTER JOIN _Reference73 _Reference73_1 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_005_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_005_RTRef = 0x00000049 AND
    #V8TblAli3_Q_000_T_011._Q_008_F_005_RRRef = _Reference73_1._IDRRef
    LEFT OUTER JOIN _Reference60 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_004_RTRef = 0x0000003C AND
    #V8TblAli3_Q_000_T_011._Q_008_F_004_RRRef = _Reference60._IDRRef
    LEFT OUTER JOIN _Reference73 WITH(NOLOCK)
    ON #V8TblAli3_Q_000_T_011._Q_008_F_004_TYPE = 0x08 AND #V8TblAli3_Q_000_T_011._Q_008_F_004_RTRef = 0x00000049 AND
    #V8TblAli3_Q_000_T_011._Q_008_F_004_RRRef = _Reference73._IDRRef
    ORDER BY
    _Reference84._Description,
    #V8TblAli1_Q_000_T_001._Q_006_F_000TRef,
    #V8TblAli1_Q_000_T_001._Q_006_F_000RRef,
    #V8TblAli1_Q_000_T_001._Q_006_F_001
    SELECT @@TRANCOUNT', N'@P1 varbinary(16),@P2 datetime,@P3 varbinary(16),@P4 varbinary(16),@P5 varbinary(16),@P6 varbinary(16),@P7
    varbinary(16),@P8 varbinary(16),@P9 varbinary(16),@P10 varbinary(16),@P11 varbinary(16),@P12 varbinary(16),@P13 varbinary(1),@P14
    varbinary(16),@P15 varbinary(16),@P16 varbinary(16),@P17 varbinary(16),@P18 varbinary(16),@P19 varbinary(16),@P20 varbinary(16),@P21
    varbinary(16),@P22 numeric(1,0),@P23 datetime', 0xAEA400145E2349E411DBA5746E4AAA56, {ts '2007-03-01 00:00:00'},
    0xA89B63662BE8CE3C4241A8FE3F9DC478, 0x99585043D58201E94E45A6EECC9C3E1D, 0xA10632C580309AB445FE6E0673358E29,
    0xBC6653438D580F8B4893A5E5CDCBF3C0, 0x9C7F84C5AF1D6682486585064B23DAB3, 0xA2C97FFBEF28F4674F20824A80EAB857,
    0x9A38775FC0369F1C44E3224B3278F903, 0x8248C62572173FFF4F83672BC7FCB3F2, 0x87CEE7A0408B77714221EBDE6C803DA5,
    0xB5810011256EFA0A11DB26CE394D16B4, 0x08, 0x880E813BFC669D214B62C07EF5FB2EA7, 0x83418EB522B6ED1348C5A97A0A8C096A,
    0x897074E3861B72D845EF4F74F420537C, 0xBF24E9C1D08EC876440D19CCE58A38AF, 0xA4B0A0C0FD6BAC2C475DFCBF642C9472,
    0x8C1A8A4CEC517A9D4C2D74F00D0074DF, 0xA89A145B4313709E42CDC938CB2AF6E0, 0xBD980B798DDA9F1F47E4A5E7B4332E02, 2, {ts '2005-01-01 00:00:00'}
    12 апреля 2007 г. 23:27
  • как ни странно table scan-ов немного, хотя пару таблиц в tempdb они свопят
    статистику делаю fullscan
    12 апреля 2007 г. 23:47
  • Извиняюсь, но ваш план запроса меня просто испугал Smile

     

    Могу только посоветовать сравнить с планом запроса с другой машины.

    23 апреля 2007 г. 9:46
  • ничего страшного,

    вообщем то привык расчитывать только на себя

     

    план как план, читаемость плохая переменных конечно, но он автоматически генерируется 1С платформой, тут уж не попишешь Smile

     

    25 апреля 2007 г. 12:24
  • Как минимум не хватает двух вещей - второго плана, который работает быстро, и в идеале предварительного поиска той части, которая тормозит. Там явно большую часть  Loop-ов можно убрать, локализовав проблему.

     

    Но всё-таки пугающе. Я пока максимум за раз оптимизировал 15 таблиц с кучкой подзапросов.

    25 апреля 2007 г. 12:58
  • попробую в понедельник снять альтернативный трейс (это организационная задержка, думаю hint то давать можно,  но у меня еще задача будет не только разницу уловить, а понять влияние ресурсной среды, в том числе софта на принятие решений оптимизатором)

    может быть подскажите, есть толковое описание алгоритмов анализа, но не типа примитивного 444 экзамена (где рекомендуется счетчики ставить, или DTA  юзать), а что то более "логиное" и без "шаманства" Smile

    25 апреля 2007 г. 13:25
  •  Гилёв Вячеслав написано:

    попробую в понедельник снять альтернативный трейс (это организационная задержка, думаю hint то давать можно,  но у меня еще задача будет не только разницу уловить, а понять влияние ресурсной среды, в том числе софта на принятие решений оптимизатором)

    может быть подскажите, есть толковое описание алгоритмов анализа, но не типа примитивного 444 экзамена (где рекомендуется счетчики ставить, или DTA  юзать), а что то более "логичное" и без "шаманства"

    25 апреля 2007 г. 13:40
  • Тогда давайте всю информацию, включая число исполнений, ожидаемый размер и так далее. Если получиться, то и

    set statistics profile on.

    http://blogs.msdn.com/queryoptteam/archive/2006/08/29/730521.aspx

     

    Да, и на уровне идеи - попробуйте добавить хинт OPTION(LOOP JOIN)). 

     

    И оттуда же http://blogs.msdn.com/sqlqueryprocessing/archive/2007/02/01/hash-warning-sql-profiler-event.aspx

    26 апреля 2007 г. 6:11