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

ACC_AVALANDINCOMESTAT_MAIN

 

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

Параметр

Тип

Описание

REPORTDATE1

DATE

 

REPORTDATE2

DATE

 

PARTYID

INTEGER

 

PARTYDATE

DATE

 

REPORTTYPE

INTEGER

 

CROPTYPEID

INTEGER

 

 

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

Параметр

Тип

Описание

CROPCLASS

VARCHAR(250)

 

AVALIABLE

BIGINT

 

INCOME

BIGINT

 

INCOME4

BIGINT

 

INCOME5

BIGINT

 

LINECODE

VARCHAR(10)

 

 

Описание

Бухгалтерия - Формы 1-зерно (полугодовая и месячная)

 

Определение

CREATE PROCEDURE ACC_AVALANDINCOMESTAT_MAIN(
    REPORTDATE1 DATE,
    REPORTDATE2 DATE,
    PARTYID INTEGER,
    PARTYDATE DATE,
    REPORTTYPE INTEGER,
    CROPTYPEID INTEGER)
RETURNS (
    CROPCLASS VARCHAR(250),
    AVALIABLE BIGINT,
    INCOME BIGINT,
    INCOME4 BIGINT,
    INCOME5 BIGINT,
    LINECODE VARCHAR(10))
AS
declare variable AV57 numeric(15,3);
declare variable INC57 numeric(15,3);
declare variable INC57_4 numeric(15,3);
declare variable INC57_5 numeric(15,3);
declare variable AVALIABLE1 numeric(15,3);
declare variable INCOME1 numeric(15,3);
declare variable INCOME14 numeric(15,3);
declare variable INCOME15 numeric(15,3);
declare variable AVALIABLE2 numeric(15,3);
declare variable INCOME2 numeric(15,3);
declare variable INCOME24 numeric(15,3);
declare variable INCOME25 numeric(15,3);
begin
  if (:CROPTYPEID <> 5) then begin
    CROPCLASS = '  Пшениця - всього</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(сума кодів 02, 08)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE1, :INCOME1, :INCOME14, :INCOME15;

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE2, :INCOME2, :INCOME24, :INCOME25;

    AVALIABLE = :AVALIABLE1 + :AVALIABLE2;
    INCOME = :INCOME1 + :INCOME2;
    INCOME4 = :INCOME14 + :INCOME24;
    INCOME5 = :INCOME15 + :INCOME25;
    LINECODE = '01';
    AV57 = :AVALIABLE;
    INC57 = :INCOME;
    INC57_4 = :INCOME4;
    INC57_5 = :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '          в тому числі:' || ascii_char(13) || '<b>    тверда</b>' || ascii_char(13) || '    <i>(більше або дорівнює суми кодів 03-07)</i>';
      AVALIABLE = :AVALIABLE1;
      INCOME = :INCOME1;
      INCOME4 = :INCOME14;
      INCOME5 = :INCOME15;
      LINECODE = '02';
      suspend;

      CROPCLASS = '    з неї 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, 407, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '03';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, 408, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '04';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, 409, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '05';
      suspend;

      CROPCLASS = '                4 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, 410, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '06';
      suspend;

      CROPCLASS = '                5 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 399, 411, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '07';
      suspend;

      CROPCLASS = '<b>    м' || ascii_char(39) || 'яка</b>' || ascii_char(13) || '    <i>(більше або дорівнює суми кодів 09-14)</i>';
      AVALIABLE = :AVALIABLE2;
      INCOME = :INCOME2;
      INCOME4 = :INCOME24;
      INCOME5 = :INCOME25;
      LINECODE = '08';
      suspend;

      CROPCLASS = '    з неї 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 160, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '09';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 161, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '10';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 162, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '11';
      suspend;

      CROPCLASS = '                4 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 163, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '12';
      suspend;

      CROPCLASS = '                5 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 164, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '13';
      suspend;

      CROPCLASS = '                6 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 400, 165, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '14';
      suspend;
    end

    CROPCLASS = '  Жито - всього</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 16, 17, 62, 63)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 64, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '15';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 64, 183, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '16';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 64, 184, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '17';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 64, 185, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '62';
      suspend;

      CROPCLASS = '                4 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 64, 186, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '63';
      suspend;
    end

    CROPCLASS = '  Просо</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 19-21)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 53, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '18';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 53, 154, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '19';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 53, 155, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '20';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 53, 156, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '21';
      suspend;
    end

    CROPCLASS = '  Рис</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 23-26)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 40, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '22';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: вищого класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 40, 136, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '23';
      suspend;

      CROPCLASS = '                1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 40, 133, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '24';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 40, 134, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '25';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 40, 135, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '26';
      suspend;
    end

    CROPCLASS = '  Гречка</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 28-30)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 10, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '27';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 10, 123, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '28';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 10, 126, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '29';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 10, 127, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '30';
      suspend;
    end

    CROPCLASS = '  Кукурудза</b>' || ascii_char(13) || '  (в перерахунку на зерно)';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 32-34)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 44, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '31';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 44, 138, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '32';
      suspend;

      CROPCLASS = '                 2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 44, 139, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '33';
      suspend;

      CROPCLASS = '                 3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 44, 140, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '34';
      suspend;
    end

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>  Ячмінь - всього</b>' || ascii_char(13) || '  <i>(сума кодів 36, 39)</i>';
    else CROPCLASS = '  Ячмінь - всього</b>' || ascii_char(13) || '  <i>(більше або дорівнює коду 36)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 67, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE1, :INCOME1, :INCOME14, :INCOME15;

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 68, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE2, :INCOME2, :INCOME24, :INCOME25;

    AVALIABLE = :AVALIABLE1 + :AVALIABLE2;
    INCOME = :INCOME1 + :INCOME2;
    INCOME4 = :INCOME14 + :INCOME24;
    INCOME5 = :INCOME15 + :INCOME25;
    LINECODE = '35';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then
      CROPCLASS = '          в тому числі:' || ascii_char(13) || '<b>    пивоварний</b>' || ascii_char(13) || '    <i>(більше або дорівнює суми кодів 37, 38)</i>';
    else CROPCLASS = '          з нього пивоварний';

    AVALIABLE = :AVALIABLE2;
    INCOME = :INCOME2;
    INCOME4 = :INCOME24;
    INCOME5 = :INCOME25;
    LINECODE = '36';
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '                1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 68, 192, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '37';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 68, 193, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '38';
      suspend;

      CROPCLASS = '<b>    товарний</b>' || ascii_char(13) || '    <i>(більше або дорівнює суми кодів 40-42)</i>';
      AVALIABLE = :AVALIABLE2;
      INCOME = :INCOME2;
      INCOME4 = :INCOME24;
      INCOME5 = :INCOME25;
      LINECODE = '39';
      suspend;

      CROPCLASS = '                1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 67, 189, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '40';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 67, 190, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '41';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 67, 191, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '42';
      suspend;
    end

    CROPCLASS = '  Зернобобові</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює коду 44)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, -6, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '43';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі <b>горох:</b>' || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 45-47)</i>';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 38, -1, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '44';
      suspend;

      CROPCLASS = '                1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 38, 128, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '45';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 38, 129, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '46';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 38, 130, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '47';
      suspend;
    end

    CROPCLASS = '  Овес</b>';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 49-52)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 403, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '48';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;
  
    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 425, 61, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '49';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 426, 61, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '50';
      suspend;

      CROPCLASS = '                3 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 427, 61, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '51';
      suspend;

      CROPCLASS = '                4 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 428, 61, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '52';
      suspend;
    end

    CROPCLASS = '  Вика';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS;

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 11, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '53';
    AV57 =  :AV57 + :AVALIABLE;
    INC57 =  :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    CROPCLASS = '  Інші зернові';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || ' культури</b>' || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 55, 56)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 0, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '54';
    AV57 = :AV57 + :AVALIABLE;
    INC57 = :INC57 + :INCOME;
    INC57_4 = :INC57_4 + :INCOME4;
    INC57_5 = :INC57_5 + :INCOME5;
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  у тому числі: тритикале';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 63 , -1, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '55';
      suspend;

      CROPCLASS = '                зерносуміш';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 313 , -1, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '56';
      suspend;
    end

    CROPCLASS = '<b>  Всього зернових культур</b>' || ascii_char(13) || '  <i>(сума кодів 01, 15, 18, 22, 27, 31, 35, 43, 48, 53, 54';

    if (:REPORTTYPE = 1) then
      CROPCLASS = CROPCLASS || '; сума кодів 58-60';

    CROPCLASS = CROPCLASS || ')</i>';
    AVALIABLE = :AV57;
    INCOME = :INC57;
    INCOME4 = :INC57_4;
    INCOME5 = :INC57_5;
    LINECODE = '<b>57';
    suspend;
  end
  else begin
    CROPCLASS = '  Насіння соняшнику';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS;

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 404, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '64';
    suspend;

    CROPCLASS = '  Соя';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS;

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 402, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '65';
    suspend;

    CROPCLASS = '  Ріпак - всього';

    if (:REPORTTYPE = 1) then
      CROPCLASS = '<b>' || CROPCLASS || '</b>' || ascii_char(13) || '  <i>(більше або дорівнює суми кодів 67, 68)</i>';

    select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
        ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
      from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 401, -1, -1, :REPORTDATE1, :REPORTDATE2)
    into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

    LINECODE = '66';
    suspend;

    if (:REPORTTYPE = 1) then begin
      CROPCLASS = '  в тому числі: 1 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 402, 417, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '67';
      suspend;

      CROPCLASS = '                2 класу';

      select ACC_AVALANDINCOMESTAT_CALC.AVALIABLE, ACC_AVALANDINCOMESTAT_CALC.INCOME,
          ACC_AVALANDINCOMESTAT_CALC.INCOME4, ACC_AVALANDINCOMESTAT_CALC.INCOME5
        from ACC_AVALANDINCOMESTAT_CALC(:PARTYID, :PARTYDATE, 402, 418, -1, :REPORTDATE1, :REPORTDATE2)
      into :AVALIABLE, :INCOME, :INCOME4, :INCOME5;

      LINECODE = '68';
      suspend;
    end
  end
end

 

     Previous topic Chapter index Next topic