"localhost:/firebird/data/ILICHEVSK2.FDB". Процедуры Previous topic Chapter index Next topic

ACN_DECLARATION_CROP

 

Входные параметры

Параметр

Тип

Описание

BEGINDATE

DATE

 

ENDDATE

DATE

 

STORAGEID

INTEGER

 

PRELIMINARYSHRINKAGE

INTEGER

 

YEARHARVESTING

INTEGER

 

STORINGID

INTEGER

 

ALLOCATEAGRARIANFUND

INTEGER

 

SUBTRACTQUANTITY

INTEGER

 

PASS

INTEGER

 

 

Выходные параметры

Параметр

Тип

Описание

CROPNAME

VARCHAR(50)

 

REMAIN

INTEGER

 

INCOME

INTEGER

 

OUTCOME

INTEGER

 

REST

INTEGER

 

BOLD

SMALLINT

 

 

Описание

(Нет описания для процедуры ACN_DECLARATION_CROP)

 

Определение

CREATE PROCEDURE ACN_DECLARATION_CROP(
    BEGINDATE DATE,
    ENDDATE DATE,
    STORAGEID INTEGER,
    PRELIMINARYSHRINKAGE INTEGER,
    YEARHARVESTING INTEGER,
    STORINGID INTEGER,
    ALLOCATEAGRARIANFUND INTEGER,
    SUBTRACTQUANTITY INTEGER,
    PASS INTEGER)
RETURNS (
    CROPNAME VARCHAR(50),
    REMAIN INTEGER,
    INCOME INTEGER,
    OUTCOME INTEGER,
    REST INTEGER,
    BOLD SMALLINT)
AS
declare variable CROPFULLNAME varchar(100);
declare variable AREMAIN integer;
declare variable AINCOME integer;
declare variable AOUTCOME integer;
declare variable AREST integer;
declare variable CROPGHI integer;
declare variable CLASSGHI integer;
declare variable REMAIN_11 numeric(15,3) = 0;
declare variable INCOME_11 numeric(15,3) = 0;
declare variable OUTCOME_11 numeric(15,3) = 0;
declare variable REST_11 numeric(15,3) = 0;
declare variable REMAIN_12 numeric(15,3) = 0;
declare variable INCOME_12 numeric(15,3) = 0;
declare variable OUTCOME_12 numeric(15,3) = 0;
declare variable REST_12 numeric(15,3) = 0;
declare variable REMAIN_13 numeric(15,3) = 0;
declare variable INCOME_13 numeric(15,3) = 0;
declare variable OUTCOME_13 numeric(15,3) = 0;
declare variable REST_13 numeric(15,3) = 0;
declare variable REMAIN_14 numeric(15,3) = 0;
declare variable INCOME_14 numeric(15,3) = 0;
declare variable OUTCOME_14 numeric(15,3) = 0;
declare variable REST_14 numeric(15,3) = 0;
declare variable REMAIN_15 numeric(15,3) = 0;
declare variable INCOME_15 numeric(15,3) = 0;
declare variable OUTCOME_15 numeric(15,3) = 0;
declare variable REST_15 numeric(15,3) = 0;
declare variable REMAIN_16 numeric(15,3) = 0;
declare variable INCOME_16 numeric(15,3) = 0;
declare variable OUTCOME_16 numeric(15,3) = 0;
declare variable REST_16 numeric(15,3) = 0;
declare variable REMAIN_17 numeric(15,3) = 0;
declare variable INCOME_17 numeric(15,3) = 0;
declare variable OUTCOME_17 numeric(15,3) = 0;
declare variable REST_17 numeric(15,3) = 0;
declare variable REMAIN_18 numeric(15,3) = 0;
declare variable INCOME_18 numeric(15,3) = 0;
declare variable OUTCOME_18 numeric(15,3) = 0;
declare variable REST_18 numeric(15,3) = 0;
declare variable REMAIN_21 numeric(15,3) = 0;
declare variable INCOME_21 numeric(15,3) = 0;
declare variable OUTCOME_21 numeric(15,3) = 0;
declare variable REST_21 numeric(15,3) = 0;
declare variable REMAIN_31 numeric(15,3) = 0;
declare variable INCOME_31 numeric(15,3) = 0;
declare variable OUTCOME_31 numeric(15,3) = 0;
declare variable REST_31 numeric(15,3) = 0;
declare variable REMAIN_32 numeric(15,3) = 0;
declare variable INCOME_32 numeric(15,3) = 0;
declare variable OUTCOME_32 numeric(15,3) = 0;
declare variable REST_32 numeric(15,3) = 0;
declare variable REMAIN_33 numeric(15,3) = 0;
declare variable INCOME_33 numeric(15,3) = 0;
declare variable OUTCOME_33 numeric(15,3) = 0;
declare variable REST_33 numeric(15,3) = 0;
declare variable REMAIN_34 numeric(15,3) = 0;
declare variable INCOME_34 numeric(15,3) = 0;
declare variable OUTCOME_34 numeric(15,3) = 0;
declare variable REST_34 numeric(15,3) = 0;
declare variable REMAIN_35 numeric(15,3) = 0;
declare variable INCOME_35 numeric(15,3) = 0;
declare variable OUTCOME_35 numeric(15,3) = 0;
declare variable REST_35 numeric(15,3) = 0;
declare variable REMAIN_41 numeric(15,3) = 0;
declare variable INCOME_41 numeric(15,3) = 0;
declare variable OUTCOME_41 numeric(15,3) = 0;
declare variable REST_41 numeric(15,3) = 0;
declare variable REMAIN_42 numeric(15,3) = 0;
declare variable INCOME_42 numeric(15,3) = 0;
declare variable OUTCOME_42 numeric(15,3) = 0;
declare variable REST_42 numeric(15,3) = 0;
declare variable REMAIN_51 numeric(15,3) = 0;
declare variable INCOME_51 numeric(15,3) = 0;
declare variable OUTCOME_51 numeric(15,3) = 0;
declare variable REST_51 numeric(15,3) = 0;
declare variable REMAIN_61 numeric(15,3) = 0;
declare variable INCOME_61 numeric(15,3) = 0;
declare variable OUTCOME_61 numeric(15,3) = 0;
declare variable REST_61 numeric(15,3) = 0;
declare variable REMAIN_71 numeric(15,3) = 0;
declare variable INCOME_71 numeric(15,3) = 0;
declare variable OUTCOME_71 numeric(15,3) = 0;
declare variable REST_71 numeric(15,3) = 0;
declare variable REMAIN_72 numeric(15,3) = 0;
declare variable INCOME_72 numeric(15,3) = 0;
declare variable OUTCOME_72 numeric(15,3) = 0;
declare variable REST_72 numeric(15,3) = 0;
declare variable REMAIN_81 numeric(15,3) = 0;
declare variable INCOME_81 numeric(15,3) = 0;
declare variable OUTCOME_81 numeric(15,3) = 0;
declare variable REST_81 numeric(15,3) = 0;
declare variable REMAIN_91 numeric(15,3) = 0;
declare variable INCOME_91 numeric(15,3) = 0;
declare variable OUTCOME_91 numeric(15,3) = 0;
declare variable REST_91 numeric(15,3) = 0;
declare variable REMAIN_101 numeric(15,3) = 0;
declare variable INCOME_101 numeric(15,3) = 0;
declare variable OUTCOME_101 numeric(15,3) = 0;
declare variable REST_101 numeric(15,3) = 0;
declare variable REMAIN_111 numeric(15,3) = 0;
declare variable INCOME_111 numeric(15,3) = 0;
declare variable OUTCOME_111 numeric(15,3) = 0;
declare variable REST_111 numeric(15,3) = 0;
declare variable REMAIN_121 numeric(15,3) = 0;
declare variable INCOME_121 numeric(15,3) = 0;
declare variable OUTCOME_121 numeric(15,3) = 0;
declare variable REST_121 numeric(15,3) = 0;
declare variable REMAIN_131 numeric(15,3) = 0;
declare variable INCOME_131 numeric(15,3) = 0;
declare variable OUTCOME_131 numeric(15,3) = 0;
declare variable REST_131 numeric(15,3) = 0;
declare variable REMAIN_132 numeric(15,3) = 0;
declare variable INCOME_132 numeric(15,3) = 0;
declare variable OUTCOME_132 numeric(15,3) = 0;
declare variable REST_132 numeric(15,3) = 0;
declare variable REMAIN_133 numeric(15,3) = 0;
declare variable INCOME_133 numeric(15,3) = 0;
declare variable OUTCOME_133 numeric(15,3) = 0;
declare variable REST_133 numeric(15,3) = 0;
declare variable REMAIN_134 numeric(15,3) = 0;
declare variable INCOME_134 numeric(15,3) = 0;
declare variable OUTCOME_134 numeric(15,3) = 0;
declare variable REST_134 numeric(15,3) = 0;
declare variable REMAIN_141 numeric(15,3) = 0;
declare variable INCOME_141 numeric(15,3) = 0;
declare variable OUTCOME_141 numeric(15,3) = 0;
declare variable REST_141 numeric(15,3) = 0;
declare variable REMAIN_151 numeric(15,3) = 0;
declare variable INCOME_151 numeric(15,3) = 0;
declare variable OUTCOME_151 numeric(15,3) = 0;
declare variable REST_151 numeric(15,3) = 0;
declare variable REMAIN_152 numeric(15,3) = 0;
declare variable INCOME_152 numeric(15,3) = 0;
declare variable OUTCOME_152 numeric(15,3) = 0;
declare variable REST_152 numeric(15,3) = 0;
declare variable REMAIN_153 numeric(15,3) = 0;
declare variable INCOME_153 numeric(15,3) = 0;
declare variable OUTCOME_153 numeric(15,3) = 0;
declare variable REST_153 numeric(15,3) = 0;
declare variable REMAIN_154 numeric(15,3) = 0;
declare variable INCOME_154 numeric(15,3) = 0;
declare variable OUTCOME_154 numeric(15,3) = 0;
declare variable REST_154 numeric(15,3) = 0;
declare variable REMAIN_155 numeric(15,3) = 0;
declare variable INCOME_155 numeric(15,3) = 0;
declare variable OUTCOME_155 numeric(15,3) = 0;
declare variable REST_155 numeric(15,3) = 0;
begin
  for
    select min(ACN_SVODKA_VALARS.CROPFULLNAME),
        sum(ACN_SVODKA_VALARS.REMAINDECLARATION), sum(ACN_SVODKA_VALARS.INCOMEDECLARATION),
        sum(ACN_SVODKA_VALARS.OUTCOMEDECLARATION), sum(ACN_SVODKA_VALARS.COMEAFTERDECLARATION),
        min(ACN_SVODKA_VALARS.CROPGHI), min(ACN_SVODKA_VALARS.CLASSGHI)
      from ACN_SVODKA_VALARS(:BEGINDATE, :ENDDATE, 0, -1, -1, :STORAGEID, :STORINGID,
                             0, 0, 0, null, :PRELIMINARYSHRINKAGE, 1, :YEARHARVESTING, 0)
      where (:ALLOCATEAGRARIANFUND = 0)
          or ((:ALLOCATEAGRARIANFUND = 1)
              and (((:PASS = 1) and (((:SUBTRACTQUANTITY = 1) and (ACN_SVODKA_VALARS.CLIENTTYPEID <> 4))
                                     or (:SUBTRACTQUANTITY = 0)))
                   or ((:PASS = 2) and (ACN_SVODKA_VALARS.CLIENTTYPEID = 4))))

--      where (ACN_SVODKA_VALARS.CLIENTTYPEID <> 4)
--      where (ACN_SVODKA_VALARS.CLIENTTYPEID = 4)
    group by ACN_SVODKA_VALARS.CLASSGHI
    into :CROPFULLNAME, :AREMAIN, :AINCOME, :AOUTCOME, :AREST, :CROPGHI, :CLASSGHI

  do begin
    if (:CLASSGHI = 397) then begin                                 -- Пшеница группа А 1-го класса
      REMAIN_12 = :REMAIN_12 + :AREMAIN;
      INCOME_12 = :INCOME_12 + :AINCOME;
      OUTCOME_12 = :OUTCOME_12 + :AOUTCOME;
      REST_12 = :REST_12 + :AREST;
    end

    if (:CLASSGHI = 398) then begin                                 -- Пшеница группа А 2-го класса
      REMAIN_13 = :REMAIN_13 + :AREMAIN;
      INCOME_13 = :INCOME_13 + :AINCOME;
      OUTCOME_13 = :OUTCOME_13 + :AOUTCOME;
      REST_13 = :REST_13 + :AREST;
    end

    if (:CLASSGHI = 399) then begin                                 -- Пшеница группа А 3-го класса
      REMAIN_14 = :REMAIN_14 + :AREMAIN;
      INCOME_14 = :INCOME_14 + :AINCOME;
      OUTCOME_14 = :OUTCOME_14 + :AOUTCOME;
      REST_14 = :REST_14 + :AREST;
    end

    if (:CLASSGHI = 400) then begin                                 -- Пшеница группа Б 4-го класса
      REMAIN_15 = :REMAIN_15 + :AREMAIN;
      INCOME_15 = :INCOME_15 + :AINCOME;
      OUTCOME_15 = :OUTCOME_15 + :AOUTCOME;
      REST_15 = :REST_15 + :AREST;
    end

    if (:CLASSGHI = 401) then begin                                 -- Пшеница группа Б 5-го класса
      REMAIN_16 = :REMAIN_16 + :AREMAIN;
      INCOME_16 = :INCOME_16 + :AINCOME;
      OUTCOME_16 = :OUTCOME_16 + :AOUTCOME;
      REST_16 = :REST_16 + :AREST;
    end

    if (:CLASSGHI = 402) then begin                                 -- Пшеница 6-го класса
      REMAIN_17 = :REMAIN_17 + :AREMAIN;
      INCOME_17 = :INCOME_17 + :AINCOME;
      OUTCOME_17 = :OUTCOME_17 + :AOUTCOME;
      REST_17 = :REST_17 + :AREST;
    end

    if ((:CLASSGHI = 403) or (:CLASSGHI = 496)) then begin          -- Пшеница некласифицированная
      REMAIN_18 = :REMAIN_18 + :AREMAIN;
      INCOME_18 = :INCOME_18 + :AINCOME;
      OUTCOME_18 = :OUTCOME_18 + :AOUTCOME;
      REST_18 = :REST_18 + :AREST;
    end

    if (:CROPGHI = 399) then begin                                  -- Пшеница твердая
      REMAIN_21 = :REMAIN_21 + :AREMAIN;
      INCOME_21 = :INCOME_21 + :AINCOME;
      OUTCOME_21 = :OUTCOME_21 + :AOUTCOME;
      REST_21 = :REST_21 + :AREST;
    end

    if (:CLASSGHI = 183) then begin                                 -- Рожь 1-го класса
      REMAIN_32 = :REMAIN_32 + :AREMAIN;
      INCOME_32 = :INCOME_32 + :AINCOME;
      OUTCOME_32 = :OUTCOME_32 + :AOUTCOME;
      REST_32 = :REST_32 + :AREST;
    end

    if (:CLASSGHI = 184) then begin                                 -- Рожь 2-го класса
      REMAIN_33 = :REMAIN_33 + :AREMAIN;
      INCOME_33 = :INCOME_33 + :AINCOME;
      OUTCOME_33 = :OUTCOME_33 + :AOUTCOME;
      REST_33 = :REST_33 + :AREST;
    end

    if (:CLASSGHI = 185) then begin                                 -- Рожь 3-го класса
      REMAIN_34 = :REMAIN_34 + :AREMAIN;
      INCOME_34 = :INCOME_34 + :AINCOME;
      OUTCOME_34 = :OUTCOME_34 + :AOUTCOME;
      REST_34 = :REST_34 + :AREST;
    end

    if (:CLASSGHI = 186) then begin                                 -- Рожь 4-го класса
      REMAIN_35 = :REMAIN_35 + :AREMAIN;
      INCOME_35 = :INCOME_35 + :AINCOME;
      OUTCOME_35 = :OUTCOME_35 + :AOUTCOME;
      REST_35 = :REST_35 + :AREST;
    end

    if (:CROPGHI in (67,68)) then begin                             -- Ячмень, всего
      REMAIN_41 = :REMAIN_41 + :AREMAIN;
      INCOME_41 = :INCOME_41 + :AINCOME;
      OUTCOME_41 = :OUTCOME_41 + :AOUTCOME;
      REST_41 = :REST_41 + :AREST;

      if (:CROPGHI = 68) then begin                                 -- Ячмень пивоварный
        REMAIN_42 = :REMAIN_42 + :AREMAIN;
        INCOME_42 = :INCOME_42 + :AINCOME;
        OUTCOME_42 = :OUTCOME_42 + :AOUTCOME;
        REST_42 = :REST_42 + :AREST;
      end
    end

    if (:CROPGHI in (403)) then begin                               -- Овес
      REMAIN_51 = :REMAIN_51 + :AREMAIN;
      INCOME_51 = :INCOME_51 + :AINCOME;
      OUTCOME_51 = :OUTCOME_51 + :AOUTCOME;
      REST_51 = :REST_51 + :AREST;
    end

    if (:CROPGHI = 44) then begin                                   -- Кукуруза
      if (:CLASSGHI = 260) then begin                               -- Семена кукурузы
        REMAIN_134 = :REMAIN_134 + :AREMAIN;
        INCOME_134 = :INCOME_134 + :AINCOME;
        OUTCOME_134 = :OUTCOME_134 + :AOUTCOME;
        REST_134 = :REST_134 + :AREST;
      end
      else begin                                                    -- Кукуруза
        REMAIN_61 = :REMAIN_61 + :AREMAIN;
        INCOME_61 = :INCOME_61 + :AINCOME;
        OUTCOME_61 = :OUTCOME_61 + :AOUTCOME;
        REST_61 = :REST_61 + :AREST;
      end
    end

    if (:CROPGHI in (38)) then begin                                   -- Зернобобовые, всего
      REMAIN_71 = :REMAIN_71 + :AREMAIN;
      INCOME_71 = :INCOME_71 + :AINCOME;
      OUTCOME_71 = :OUTCOME_71 + :AOUTCOME;
      REST_71 = :REST_71 + :AREST;

      if (:CROPGHI = 38) then begin                               -- Горох
        REMAIN_72 = :REMAIN_72 + :AREMAIN;
        INCOME_72 = :INCOME_72 + :AINCOME;
        OUTCOME_72 = :OUTCOME_72 + :AOUTCOME;
        REST_72 = :REST_72 + :AREST;
      end
    end

    if (:CROPGHI in (406)) then begin                               -- Просо
      REMAIN_81 = :REMAIN_81 + :AREMAIN;
      INCOME_81 = :INCOME_81 + :AINCOME;
      OUTCOME_81 = :OUTCOME_81 + :AOUTCOME;
      REST_81 = :REST_81 + :AREST;
    end

    if (:CROPGHI in (10)) then begin                               -- Гречка
      REMAIN_91 = :REMAIN_91 + :AREMAIN;
      INCOME_91 = :INCOME_91 + :AINCOME;
      OUTCOME_91 = :OUTCOME_91 + :AOUTCOME;
      REST_91 = :REST_91 + :AREST;
    end

    if (:CROPGHI in (407)) then begin                               -- Рис
      REMAIN_101 = :REMAIN_101 + :AREMAIN;
      INCOME_101 = :INCOME_101 + :AINCOME;
      OUTCOME_101 = :OUTCOME_101 + :AOUTCOME;
      REST_101 = :REST_101 + :AREST;
    end

    if (:CROPGHI in (63)) then begin                               -- Тритикале
      REMAIN_111 = :REMAIN_111 + :AREMAIN;
      INCOME_111 = :INCOME_111 + :AINCOME;
      OUTCOME_111 = :OUTCOME_111 + :AOUTCOME;
      REST_111 = :REST_111 + :AREST;
    end

    if (:CROPGHI in (313)) then begin                               -- Зерносмесь
      REMAIN_121 = :REMAIN_121 + :AREMAIN;
      INCOME_121 = :INCOME_121 + :AINCOME;
      OUTCOME_121 = :OUTCOME_121 + :AOUTCOME;
      REST_121 = :REST_121 + :AREST;
    end

    if (:CROPGHI in (60,404)) then begin                            -- Подсолнечник
      REMAIN_152 = :REMAIN_152 + :AREMAIN;
      INCOME_152 = :INCOME_152 + :AINCOME;
      OUTCOME_152 = :OUTCOME_152 + :AOUTCOME;
      REST_152 = :REST_152 + :AREST;
    end
    if (:CROPGHI in (61,402)) then begin                            -- Соя
      REMAIN_153 = :REMAIN_153 + :AREMAIN;
      INCOME_153 = :INCOME_153 + :AINCOME;
      OUTCOME_153 = :OUTCOME_153 + :AOUTCOME;
      REST_153 = :REST_153 + :AREST;
    end
    if (:CROPGHI = 401) then begin                                   -- Рапс
      REMAIN_154 = :REMAIN_154 + :AREMAIN;
      INCOME_154 = :INCOME_154 + :AINCOME;
      OUTCOME_154 = :OUTCOME_154 + :AOUTCOME;
      REST_154 = :REST_154 + :AREST;
    end
/*
    if (:CROPGHI = 400) then begin                                  -- Прочее
      REMAIN_155 = :REMAIN_155 + :AREMAIN;
      INCOME_155 = :INCOME_155 + :AINCOME;
      OUTCOME_155 = :OUTCOME_155 + :AOUTCOME;
      REST_155 = :REST_155 + :AREST;
    end
*/
  end

  REMAIN_12 = round(:REMAIN_12 / 1000);
  INCOME_12 = round(:INCOME_12 / 1000);
  OUTCOME_12 = round(:OUTCOME_12 / 1000);
  REST_12 = round(:REST_12 / 1000);

  if ((REMAIN_12 + INCOME_12 - OUTCOME_12) <> REST_12) then
    if (OUTCOME_12 > 0) then
      OUTCOME_12 = REMAIN_12 + INCOME_12 - REST_12;
    else INCOME_12 = REST_12 - REMAIN_12;

  REMAIN_13 = round(:REMAIN_13 / 1000);
  INCOME_13 = round(:INCOME_13 / 1000);
  OUTCOME_13 = round(:OUTCOME_13 / 1000);
  REST_13 = round(:REST_13 / 1000);

  if ((REMAIN_13 + INCOME_13 - OUTCOME_13) <> REST_13) then
    if (OUTCOME_13 > 0) then
      OUTCOME_13 = REMAIN_13 + INCOME_13 - REST_13;
    else INCOME_13 = REST_13 - REMAIN_13;

  REMAIN_14 = round(:REMAIN_14 / 1000);
  INCOME_14 = round(:INCOME_14 / 1000);
  OUTCOME_14 = round(:OUTCOME_14 / 1000);
  REST_14 = round(:REST_14 / 1000);

  if ((REMAIN_14 + INCOME_14 - OUTCOME_14) <> REST_14) then
    if (OUTCOME_14 > 0) then
      OUTCOME_14 = REMAIN_14 + INCOME_14 - REST_14;
    else INCOME_14 = REST_14 - REMAIN_14;

  REMAIN_15 = round(:REMAIN_15 / 1000);
  INCOME_15 = round(:INCOME_15 / 1000);
  OUTCOME_15 = round(:OUTCOME_15 / 1000);
  REST_15 = round(:REST_15 / 1000);

  if ((REMAIN_15 + INCOME_15 - OUTCOME_15) <> REST_15) then
    if (OUTCOME_15 > 0) then
      OUTCOME_15 = REMAIN_15 + INCOME_15 - REST_15;
    else INCOME_15 = REST_15 - REMAIN_15;

  REMAIN_16 = round(:REMAIN_16 / 1000);
  INCOME_16 = round(:INCOME_16 / 1000);
  OUTCOME_16 = round(:OUTCOME_16 / 1000);
  REST_16 = round(:REST_16 / 1000);

  if ((REMAIN_16 + INCOME_16 - OUTCOME_16) <> REST_16) then
    if (OUTCOME_16 > 0) then
      OUTCOME_16 = REMAIN_16 + INCOME_16 - REST_16;
    else INCOME_16 = REST_16 - REMAIN_16;

  REMAIN_17 = round(:REMAIN_17 / 1000);
  INCOME_17 = round(:INCOME_17 / 1000);
  OUTCOME_17 = round(:OUTCOME_17 / 1000);
  REST_17 = round(:REST_17 / 1000);

  if ((REMAIN_17 + INCOME_17 - OUTCOME_17) <> REST_17) then
    if (OUTCOME_17 > 0) then
      OUTCOME_17 = REMAIN_17 + INCOME_17 - REST_17;
    else INCOME_17 = REST_17 - REMAIN_17;

  REMAIN_18 = round(:REMAIN_18 / 1000);
  INCOME_18 = round(:INCOME_18 / 1000);
  OUTCOME_18 = round(:OUTCOME_18 / 1000);
  REST_18 = round(:REST_18 / 1000);

  if ((REMAIN_18 + INCOME_18 - OUTCOME_18) <> REST_18) then
    if (OUTCOME_18 > 0) then
      OUTCOME_18 = REMAIN_18 + INCOME_18 - REST_18;
    else INCOME_18 = REST_18 - REMAIN_18;

  REMAIN_11 = REMAIN_12 + REMAIN_13 + REMAIN_14 + REMAIN_15 + REMAIN_16 + REMAIN_17 + REMAIN_18;
  INCOME_11 = INCOME_12 + INCOME_13 + INCOME_14 + INCOME_15 + INCOME_16 + INCOME_17 + INCOME_18;
  OUTCOME_11 = OUTCOME_12 + OUTCOME_13 + OUTCOME_14 + OUTCOME_15 + OUTCOME_16 + OUTCOME_17 + OUTCOME_18;
  REST_11 = REST_12 + REST_13 + REST_14 + REST_15 + REST_16 + REST_17 + REST_18;

  CROPNAME = '1. Пшеница м`яка, усього';
  REMAIN = :REMAIN_11;
  INCOME = :INCOME_11;
  OUTCOME = :OUTCOME_11;
  REST = :REST_11;
  BOLD = 1;
  suspend;


  CROPNAME = '   у т.ч. група А 1-го класу';
  REMAIN = :REMAIN_12;
  INCOME = :INCOME_12;
  OUTCOME = :OUTCOME_12;
  REST = :REST_12;
  BOLD = 0;
  suspend;


  CROPNAME = '                  2-го класу';
  REMAIN = :REMAIN_13;
  INCOME = :INCOME_13;
  OUTCOME = :OUTCOME_13;
  REST = :REST_13;
  BOLD = 0;
  suspend;


  CROPNAME = '                  3-го класу';
  REMAIN = :REMAIN_14;
  INCOME = :INCOME_14;
  OUTCOME = :OUTCOME_14;
  REST = :REST_14;
  BOLD = 0;
  suspend;


  CROPNAME = '          група Б 4-го класу';
  REMAIN = :REMAIN_15;
  INCOME = :INCOME_15;
  OUTCOME = :OUTCOME_15;
  REST = :REST_15;
  BOLD = 0;
  suspend;


  CROPNAME = '                  5-го класу';
  REMAIN = :REMAIN_16;
  INCOME = :INCOME_16;
  OUTCOME = :OUTCOME_16;
  REST = :REST_16;
  BOLD = 0;
  suspend;


  CROPNAME = '                  6-го класу';
  REMAIN = :REMAIN_17;
  INCOME = :INCOME_17;
  OUTCOME = :OUTCOME_17;
  REST = :REST_17;
  BOLD = 0;
  suspend;


  CROPNAME = '                  некласифікована';
  REMAIN = :REMAIN_18;
  INCOME = :INCOME_18;
  OUTCOME = :OUTCOME_18;
  REST = :REST_18;
  BOLD = 0;
  suspend;


  REMAIN_21 = round(:REMAIN_21 / 1000);
  INCOME_21 = round(:INCOME_21 / 1000);
  OUTCOME_21 = round(:OUTCOME_21 / 1000);
  REST_21 = round(:REST_21 / 1000);

  if ((REMAIN_21 + INCOME_21 - OUTCOME_21) <> REST_21) then
    if (OUTCOME_21 > 0) then
      OUTCOME_21 = REMAIN_21 + INCOME_21 - REST_21;
    else INCOME_21 = REST_21 - REMAIN_21;

  CROPNAME = '2. Пшеница тверда';
  REMAIN = :REMAIN_21;
  INCOME = :INCOME_21;
  OUTCOME = :OUTCOME_21;
  REST = :REST_21;
  BOLD = 1;
  suspend;


  REMAIN_32 = round(:REMAIN_32 / 1000);
  INCOME_32 = round(:INCOME_32 / 1000);
  OUTCOME_32 = round(:OUTCOME_32 / 1000);
  REST_32 = round(:REST_32 / 1000);

  if ((REMAIN_32 + INCOME_32 - OUTCOME_32) <> REST_32) then
    if (OUTCOME_32 > 0) then
      OUTCOME_32 = REMAIN_32 + INCOME_32 - REST_32;
    else INCOME_32 = REST_32 - REMAIN_32;

  REMAIN_33 = round(:REMAIN_33 / 1000);
  INCOME_33 = round(:INCOME_33 / 1000);
  OUTCOME_33 = round(:OUTCOME_33 / 1000);
  REST_33 = round(:REST_33 / 1000);

  if ((REMAIN_33 + INCOME_33 - OUTCOME_33) <> REST_33) then
    if (OUTCOME_33 > 0) then
      OUTCOME_33 = REMAIN_33 + INCOME_33 - REST_33;
    else INCOME_33 = REST_33 - REMAIN_33;

  REMAIN_34 = round(:REMAIN_34 / 1000);
  INCOME_34 = round(:INCOME_34 / 1000);
  OUTCOME_34 = round(:OUTCOME_34 / 1000);
  REST_34 = round(:REST_34 / 1000);

  if ((REMAIN_34 + INCOME_34 - OUTCOME_34) <> REST_34) then
    if (OUTCOME_34 > 0) then
      OUTCOME_34 = REMAIN_34 + INCOME_34 - REST_34;
    else INCOME_34 = REST_34 - REMAIN_34;

  REMAIN_35 = round(:REMAIN_31 / 1000);
  INCOME_35 = round(:INCOME_35 / 1000);
  OUTCOME_35 = round(:OUTCOME_35 / 1000);
  REST_35 = round(:REST_35 / 1000);

  if ((REMAIN_35 + INCOME_35 - OUTCOME_35) <> REST_35) then
    if (OUTCOME_35 > 0) then
      OUTCOME_35 = REMAIN_35 + INCOME_35 - REST_35;
    else INCOME_35 = REST_35 - REMAIN_35;

  REMAIN_31 = REMAIN_32 + REMAIN_33 + REMAIN_34 + REMAIN_35;
  INCOME_31 = INCOME_32 + INCOME_33 + INCOME_34 + INCOME_35;
  OUTCOME_31 = OUTCOME_32 + OUTCOME_33 + OUTCOME_34 + OUTCOME_35;
  REST_31 = REST_32 + REST_33 + REST_34 + REST_35;

  CROPNAME = '3. Жито, усього';
  REMAIN = REMAIN_31;
  INCOME = INCOME_31;
  OUTCOME = OUTCOME_31;
  REST = REST_31;
  BOLD = 1;
  suspend;


  CROPNAME = '   у т.ч. 1-го класу';
  REMAIN = REMAIN_32;
  INCOME = INCOME_32;
  OUTCOME = OUTCOME_32;
  REST = REST_32;
  BOLD = 0;
  suspend;


  CROPNAME = '          2-го класу';
  REMAIN = REMAIN_33;
  INCOME = INCOME_33;
  OUTCOME = OUTCOME_33;
  REST = REST_33;
  BOLD = 0;
  suspend;


  CROPNAME = '          3-го класу';
  REMAIN = REMAIN_34;
  INCOME = INCOME_34;
  OUTCOME = OUTCOME_34;
  REST = REST_34;
  BOLD = 0;
  suspend;


  CROPNAME = '          4-го класу';
  REMAIN = REMAIN_35;
  INCOME = INCOME_35;
  OUTCOME = OUTCOME_35;
  REST = REST_35;
  BOLD = 0;
  suspend;


  REMAIN_41 = round(:REMAIN_41 / 1000);
  INCOME_41 = round(:INCOME_41 / 1000);
  OUTCOME_41 = round(:OUTCOME_41 / 1000);
  REST_41 = round(:REST_41 / 1000);

  if ((REMAIN_41 + INCOME_41 - OUTCOME_41) <> REST_41) then
    if (OUTCOME_41 > 0) then
      OUTCOME_41 = REMAIN_41 + INCOME_41 - REST_41;
    else INCOME_41 = REST_41 - REMAIN_41;

  CROPNAME = '4. Ячмінь, усього';
  REMAIN = REMAIN_41;
  INCOME = INCOME_41;
  OUTCOME = OUTCOME_41;
  REST = REST_41;
  BOLD = 1;
  suspend;


  REMAIN_42 = round(:REMAIN_42 / 1000);
  INCOME_42 = round(:INCOME_42 / 1000);
  OUTCOME_42 = round(:OUTCOME_42 / 1000);
  REST_42 = round(:REST_42 / 1000);

  if ((REMAIN_42 + INCOME_42 - OUTCOME_42) <> REST_42) then
    if (OUTCOME_42 > 0) then
      OUTCOME_42 = REMAIN_42 + INCOME_42 - REST_42;
    else INCOME_42 = REST_42 - REMAIN_42;

  CROPNAME = '   у т.ч. пивоварний';
  REMAIN = REMAIN_42;
  INCOME = INCOME_42;
  OUTCOME = OUTCOME_42;
  REST = REST_42;
  BOLD = 0;
  suspend;


  REMAIN_51 = round(:REMAIN_51 / 1000);
  INCOME_51 = round(:INCOME_51 / 1000);
  OUTCOME_51 = round(:OUTCOME_51 / 1000);
  REST_51 = round(:REST_51 / 1000);

  if ((REMAIN_51 + INCOME_51 - OUTCOME_51) <> REST_51) then
    if (OUTCOME_51 > 0) then
      OUTCOME_51 = REMAIN_51 + INCOME_51 - REST_51;
    else INCOME_51 = REST_51 - REMAIN_51;

  CROPNAME = '5. Овес';
  REMAIN = REMAIN_51;
  INCOME = INCOME_51;
  OUTCOME = OUTCOME_51;
  REST = REST_51;
  BOLD = 1;
  suspend;


  REMAIN_61 = round(:REMAIN_61 / 1000);
  INCOME_61 = round(:INCOME_61 / 1000);
  OUTCOME_61 = round(:OUTCOME_61 / 1000);
  REST_61 = round(:REST_61 / 1000);

  if ((REMAIN_61 + INCOME_61 - OUTCOME_61) <> REST_61) then
    if (OUTCOME_61 > 0) then
      OUTCOME_61 = REMAIN_61 + INCOME_61 - REST_61;
    else INCOME_61 = REST_61 - REMAIN_61;

  CROPNAME = '6. Кукурудза';
  REMAIN = REMAIN_61;
  INCOME = INCOME_61;
  OUTCOME = OUTCOME_61;
  REST = REST_61;
  BOLD = 1;
  suspend;


  REMAIN_71 = round(:REMAIN_71 / 1000);
  INCOME_71 = round(:INCOME_71 / 1000);
  OUTCOME_71 = round(:OUTCOME_71 / 1000);
  REST_71 = round(:REST_71 / 1000);

  if ((REMAIN_71 + INCOME_71 - OUTCOME_71) <> REST_71) then
    if (OUTCOME_71 > 0) then
      OUTCOME_71 = REMAIN_71 + INCOME_71 - REST_71;
    else INCOME_71 = REST_71 - REMAIN_71;

  CROPNAME = '7. Зернобобові, всього';
  REMAIN = REMAIN_71;
  INCOME = INCOME_71;
  OUTCOME = OUTCOME_71;
  REST = REST_71;
  BOLD = 1;
  suspend;


  REMAIN_72 = round(:REMAIN_72 / 1000);
  INCOME_72 = round(:INCOME_72 / 1000);
  OUTCOME_72 = round(:OUTCOME_72 / 1000);
  REST_72 = round(:REST_72 / 1000);

  if ((REMAIN_72 + INCOME_72 - OUTCOME_72) <> REST_72) then
    if (OUTCOME_72 > 0) then
      OUTCOME_72 = REMAIN_72 + INCOME_72 - REST_72;
    else INCOME_72 = REST_72 - REMAIN_72;

  CROPNAME = '   у т.ч. горох';
  REMAIN = REMAIN_72;
  INCOME = INCOME_72;
  OUTCOME = OUTCOME_72;
  REST = REST_72;
  BOLD = 0;
  suspend;


  REMAIN_81 = round(:REMAIN_81 / 1000);
  INCOME_81 = round(:INCOME_81 / 1000);
  OUTCOME_81 = round(:OUTCOME_81 / 1000);
  REST_81 = round(:REST_81 / 1000);

  if ((REMAIN_81 + INCOME_81 - OUTCOME_81) <> REST_81) then
    if (OUTCOME_81 > 0) then
      OUTCOME_81 = REMAIN_81 + INCOME_81 - REST_81;
    else INCOME_81 = REST_81 - REMAIN_81;

  CROPNAME = '8. Просо';
  REMAIN = REMAIN_81;
  INCOME = INCOME_81;
  OUTCOME = OUTCOME_81;
  REST = REST_81;
  BOLD = 1;
  suspend;


  REMAIN_91 = round(:REMAIN_91 / 1000);
  INCOME_91 = round(:INCOME_91 / 1000);
  OUTCOME_91 = round(:OUTCOME_91 / 1000);
  REST_91 = round(:REST_91 / 1000);

  if ((REMAIN_91 + INCOME_91 - OUTCOME_91) <> REST_91) then
    if (OUTCOME_91 > 0) then
      OUTCOME_91 = REMAIN_91 + INCOME_91 - REST_91;
    else INCOME_91 = REST_91 - REMAIN_91;

  CROPNAME = '9. Гречка';
  REMAIN = REMAIN_91;
  INCOME = INCOME_91;
  OUTCOME = OUTCOME_91;
  REST = REST_91;
  BOLD = 1;
  suspend;


  REMAIN_101 = round(:REMAIN_101 / 1000);
  INCOME_101 = round(:INCOME_101 / 1000);
  OUTCOME_101 = round(:OUTCOME_101 / 1000);
  REST_101 = round(:REST_101 / 1000);
  if ((REMAIN_101 + INCOME_101 - OUTCOME_101) <> REST_101) then
    if (OUTCOME_101 > 0) then
      OUTCOME_101 = REMAIN_101 + INCOME_101 - REST_101;
    else INCOME_101 = REST_101 - REMAIN_101;

  CROPNAME = '10. Рис';
  REMAIN = REMAIN_101;
  INCOME = INCOME_101;
  OUTCOME = OUTCOME_101;
  REST = REST_101;
  BOLD = 1;
  suspend;


  REMAIN_111 = round(:REMAIN_111 / 1000);
  INCOME_111 = round(:INCOME_111 / 1000);
  OUTCOME_111 = round(:OUTCOME_111 / 1000);
  REST_111 = round(:REST_111 / 1000);

  if ((REMAIN_111 + INCOME_111 - OUTCOME_111) <> REST_111) then
    if (OUTCOME_111 > 0) then
      OUTCOME_111 = REMAIN_111 + INCOME_111 - REST_111;
    else INCOME_111 = REST_111 - REMAIN_111;

  CROPNAME = '11. Тритікале';
  REMAIN = REMAIN_111;
  INCOME = INCOME_111;
  OUTCOME = OUTCOME_111;
  REST = REST_111;
  BOLD = 1;
  suspend;


  REMAIN_121 = round(:REMAIN_121 / 1000);
  INCOME_121 = round(:INCOME_121 / 1000);
  OUTCOME_121 = round(:OUTCOME_121 / 1000);
  REST_121 = round(:REST_121 / 1000);

  if ((REMAIN_121 + INCOME_121 - OUTCOME_121) <> REST_121) then
    if (OUTCOME_121 > 0) then
      OUTCOME_121 = REMAIN_121 + INCOME_121 - REST_121;
    else INCOME_121 = REST_121 - REMAIN_121;

  CROPNAME = '12. Зерносуміш';
  REMAIN = REMAIN_121;
  INCOME = INCOME_121;
  OUTCOME = OUTCOME_121;
  REST = REST_121;
  BOLD = 1;
  suspend;


  REMAIN_132 = round(:REMAIN_132 / 1000);
  INCOME_132 = round(:INCOME_132 / 1000);
  OUTCOME_132 = round(:OUTCOME_132 / 1000);
  REST_132 = round(:REST_132 / 1000);

  if ((REMAIN_132 + INCOME_132 - OUTCOME_132) <> REST_132) then
    if (OUTCOME_132 > 0) then
      OUTCOME_132 = REMAIN_132 + INCOME_132 - REST_132;
    else INCOME_132 = REST_132 - REMAIN_132;

  REMAIN_133 = round(:REMAIN_133 / 1000);
  INCOME_133 = round(:INCOME_133 / 1000);
  OUTCOME_133 = round(:OUTCOME_133 / 1000);
  REST_133 = round(:REST_133 / 1000);

  if ((REMAIN_133 + INCOME_133 - OUTCOME_133) <> REST_133) then
    if (OUTCOME_133 > 0) then
      OUTCOME_133 = REMAIN_133 + INCOME_133 - REST_133;
    else INCOME_133 = REST_133 - REMAIN_133;

  REMAIN_134 = round(:REMAIN_134 / 1000);
  INCOME_134 = round(:INCOME_134 / 1000);
  OUTCOME_134 = round(:OUTCOME_134 / 1000);
  REST_134 = round(:REST_134 / 1000);

  if ((REMAIN_134 + INCOME_134 - OUTCOME_134) <> REST_134) then
    if (OUTCOME_134 > 0) then
      OUTCOME_134 = REMAIN_134 + INCOME_134 - REST_134;
    else INCOME_134 = REST_134 - REMAIN_134;

  REMAIN_131 = REMAIN_132 + REMAIN_133 + REMAIN_134;
  INCOME_131 = INCOME_132 + INCOME_133 + INCOME_134;
  OUTCOME_131 = OUTCOME_132 + OUTCOME_133 + OUTCOME_134;
  REST_131 = REST_132 + REST_133 + REST_134;


  CROPNAME = '13. Сортове та гібридне насіння, всього';
  REMAIN = REMAIN_131;
  INCOME = INCOME_131;
  OUTCOME = OUTCOME_131;
  REST = REST_131;
  BOLD = 1;
  suspend;


  CROPNAME = '   у т.ч. озимих зернових культур';
  REMAIN = REMAIN_132;
  INCOME = INCOME_132;
  OUTCOME = OUTCOME_132;
  REST = REST_132;
  BOLD = 0;
  suspend;


  CROPNAME = '          ярих зернових та зернобобових культур';
  REMAIN = REMAIN_133;
  INCOME = INCOME_133;
  OUTCOME = OUTCOME_133;
  REST = REST_133;
  BOLD = 0;
  suspend;


  CROPNAME = '          кукурудзи';
  REMAIN = REMAIN_134;
  INCOME = INCOME_134;
  OUTCOME = OUTCOME_134;
  REST = REST_134;
  BOLD = 0;
  suspend;


  CROPNAME = 'УСЬОГО ЗЕРНА';
  REMAIN = REMAIN_11 + REMAIN_21 + REMAIN_31 +  + REMAIN_41 +  + REMAIN_51 + REMAIN_61 +
      REMAIN_81 + REMAIN_91 + REMAIN_101 + REMAIN_111 + REMAIN_121 + REMAIN_131;
  INCOME = INCOME_11 + INCOME_21 + INCOME_31 + INCOME_41 + INCOME_51 + INCOME_61 +
      INCOME_81 + INCOME_91 + INCOME_101 + INCOME_111 + INCOME_121 + INCOME_131;
  OUTCOME = OUTCOME_11 + OUTCOME_21 + OUTCOME_31 + OUTCOME_41 + OUTCOME_51 + OUTCOME_61 +
      OUTCOME_81 + OUTCOME_91 + OUTCOME_101 + OUTCOME_111 + OUTCOME_121 + OUTCOME_131;
  REST = REST_11 + REST_21 + REST_31 + REST_41 + REST_51 + REST_61 +
      REST_81 + REST_91 + REST_101 + REST_111 + REST_121 + REST_131;
  BOLD = 1;
  suspend;


  REMAIN_152 = round(:REMAIN_152 / 1000);
  INCOME_152 = round(:INCOME_152 / 1000);
  OUTCOME_152 = round(:OUTCOME_152 / 1000);
  REST_152 = round(:REST_152 / 1000);

  if ((REMAIN_152 + INCOME_152 - OUTCOME_152) <> REST_152) then
    if (OUTCOME_152 > 0) then
      OUTCOME_152 = REMAIN_152 + INCOME_152 - REST_152;
    else INCOME_152 = REST_152 - REMAIN_152;

  REMAIN_153 = round(:REMAIN_153 / 1000);
  INCOME_153 = round(:INCOME_153 / 1000);
  OUTCOME_153 = round(:OUTCOME_153 / 1000);
  REST_153 = round(:REST_153 / 1000);

  if ((REMAIN_153 + INCOME_153 - OUTCOME_153) <> REST_153) then
    if (OUTCOME_153 > 0) then
      OUTCOME_153 = REMAIN_153 + INCOME_153 - REST_153;
    else INCOME_153 = REST_153 - REMAIN_153;

  REMAIN_154 = round(:REMAIN_154 / 1000);
  INCOME_154 = round(:INCOME_154 / 1000);
  OUTCOME_154 = round(:OUTCOME_154 / 1000);
  REST_154 = round(:REST_154 / 1000);

  if ((REMAIN_154 + INCOME_154 - OUTCOME_154) <> REST_154) then
    if (OUTCOME_154 > 0) then
      OUTCOME_154 = REMAIN_154 + INCOME_154 - REST_154;
    else INCOME_154 = REST_154 - REMAIN_154;

  REMAIN_155 = round(:REMAIN_155 / 1000);
  INCOME_155 = round(:INCOME_155 / 1000);
  OUTCOME_155 = round(:OUTCOME_155 / 1000);
  REST_155 = round(:REST_155 / 1000);

  if ((REMAIN_155 + INCOME_155 - OUTCOME_155) <> REST_155) then
    if (OUTCOME_155 > 0) then
      OUTCOME_155 = REMAIN_155 + INCOME_155 - REST_155;
    else INCOME_155 = REST_155 - REMAIN_155;

  REMAIN_151 = REMAIN_152 + REMAIN_153 + REMAIN_154 + REMAIN_155;
  INCOME_151 = INCOME_152 + INCOME_153 + INCOME_154 + INCOME_155;
  OUTCOME_151 = OUTCOME_152 + OUTCOME_153 + OUTCOME_154 + OUTCOME_155;
  REST_151 = REST_152 + REST_153 + REST_154 + REST_155;


  CROPNAME = 'Насіння олійних культур, усього';
  REMAIN = REMAIN_151;
  INCOME = INCOME_151;
  OUTCOME = OUTCOME_151;
  REST = REST_151;
  BOLD = 1;
  suspend;


  CROPNAME = '   у т.ч. соняшник';
  REMAIN = REMAIN_152;
  INCOME = INCOME_152;
  OUTCOME = OUTCOME_152;
  REST = REST_152;
  BOLD = 0;
  suspend;


  CROPNAME = '          соя';
  REMAIN = REMAIN_153;
  INCOME = INCOME_153;
  OUTCOME = OUTCOME_153;
  REST = REST_153;
  BOLD = 0;
  suspend;


  CROPNAME = '          ріпак';
  REMAIN = REMAIN_154;
  INCOME = INCOME_154;
  OUTCOME = OUTCOME_154;
  REST = REST_154;
  BOLD = 0;
  suspend;


  CROPNAME = '          інше';
  REMAIN = REMAIN_155;
  INCOME = INCOME_155;
  OUTCOME = OUTCOME_155;
  REST = REST_155;
  BOLD = 0;
  suspend;

end

 

     Previous topic Chapter index Next topic