BEGIN
/* radky PP */
FOR
SELECT
A.VATIndex_ID,
SUM(A.TAmountWithoutVAT),
SUM(A.TAmount),
SUM(A.ForeignTAmountWithoutVAT),
SUM(A.ForeignTAmount)
FROM
GroupedVATCashReceived(: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 PV */
FOR
SELECT
A.VATIndex_ID,
SUM(A.TAmountWithoutVAT),
SUM(A.TAmount),
SUM(A.ForeignTAmountWithoutVAT),
SUM(A.ForeignTAmount)
FROM
GroupedVATCashPaid(: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 VP */
FOR
SELECT
A.VATIndex_ID,
SUM(-1 * A.TAmountWithoutVAT),
SUM(-1 * A.TAmount),
SUM(-1 * A.ForeignTAmountWithoutVAT),
SUM(-1 * A.ForeignTAmount)
FROM
GroupedVATRefCashReceived(: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 VV */
FOR
SELECT
A.VATIndex_ID,
SUM(-1 * A.TAmountWithoutVAT),
SUM(-1 * A.TAmount),
SUM(-1 * A.ForeignTAmountWithoutVAT),
SUM(-1 * A.ForeignTAmount)
FROM
GroupedVATRefCashPaid(: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;