Procedura-GroupedVATSummaryPos

Parametry:

NázevPopisDatový typ
AFirmSelIDChar(10)
ADivisionsSelIDChar(10)
ABusOrdersSelIDChar(10)
ABusTransactionsSelIDChar(10)
ABusProjectsSelIDChar(10)
AVATDateFromFloat(0, 0)
AVATDateToFloat(0, 0)
ADivisionsWithChildsChar(1)
ABusOrdersWithChildsChar(1)
ABusTransactionsWithChildsChar(1)
ABusProjectsWithChildsChar(1)
AVATCountry_IDChar(10)

Návratové hodnoty:

NázevPopisDatový typ
VATIndex_IDChar(10)
TAmountWithoutVATNumeric(15, 2)
TAmountNumeric(15, 2)
ForeignTAmountWithoutVATNumeric(15, 2)
ForeignTAmountNumeric(15, 2)

Tělo:

BEGIN
  /* prodej */
  FOR
    SELECT
      A.VATIndex_ID,
      SUM(A.TAmountWithoutVAT),
      SUM(A.TAmount),
      SUM(A.ForeignTAmountWithoutVAT),
      SUM(A.ForeignTAmount)
    FROM
      GroupedVATPosIncome(:AFirmSelID, :ADivisionsSelID, :ABusOrdersSelID,
        :ABusTransactionsSelID, :AVATDateFrom, :AVATDateTo, :ADivisionsWithChilds,
        :ABusOrdersWithChilds, :ABusTransactionsWithChilds, :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
  /* vracení (zde se nemusi otacet znamenko, protoze jsou zaporne castky v datech) */
  FOR
    SELECT
      A.VATIndex_ID,
      SUM(A.TAmountWithoutVAT),
      SUM(A.TAmount),
      SUM(A.ForeignTAmountWithoutVAT),
      SUM(A.ForeignTAmount)
    FROM
      GroupedVATPosRefund(:AFirmSelID, :ADivisionsSelID, :ABusOrdersSelID,
        :ABusTransactionsSelID, :AVATDateFrom, :AVATDateTo, :ADivisionsWithChilds,
        :ABusOrdersWithChilds, :ABusTransactionsWithChilds, :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;

Generated by ABRA Software a.s. 27.10.2021 16:34:31