BEGIN
/* radky OSTP */
FOR
SELECT
A.VATIndex_ID,
SUM(A.TAmountWithoutVAT),
SUM(A.TAmount),
SUM(A.ForeignTAmountWithoutVAT),
SUM(A.ForeignTAmount)
FROM
GroupedVATOtherIncomes(:AFirmSelID, :ADivisionsSelID, :ABusOrdersSelID,
:ABusTransactionsSelID, :ABusProjectsSelID, :AVATDateFrom, :AVATDateTo, :ADivisionsWithChilds,
:ABusOrdersWithChilds, :ABusTransactionsWithChilds, :ABusProjectsWithChilds, :AVATCountry_ID) A
WHERE
A.VATIndex_ID IS NOT NULL
GROUP BY
A.VATIndex_ID
INTO
:VATIndex_ID, :TAmountWithoutVAT, :TAmount, :ForeignTAmountWithoutVAT, :ForeignTAmount
DO BEGIN
SUSPEND;
END
/* radky OSTV */
FOR
SELECT
A.VATIndex_ID,
SUM(A.TAmountWithoutVAT),
SUM(A.TAmount),
SUM(A.ForeignTAmountWithoutVAT),
SUM(A.ForeignTAmount)
FROM
GroupedVATOtherExpenses(:AFirmSelID, :ADivisionsSelID, :ABusOrdersSelID,
:ABusTransactionsSelID, :ABusProjectsSelID, :AVATDateFrom, :AVATDateTo, :ADivisionsWithChilds,
:ABusOrdersWithChilds, :ABusTransactionsWithChilds, :ABusProjectsWithChilds, :AVATCountry_ID) A
WHERE
A.VATIndex_ID IS NOT NULL
GROUP BY
A.VATIndex_ID
INTO
:VATIndex_ID, :TAmountWithoutVAT, :TAmount, :ForeignTAmountWithoutVAT, :ForeignTAmount
DO BEGIN
SUSPEND;
END
END;